Skip to content

Commit

Permalink
Revert "[🍒][CDAP-20917] Sync status UI changes"
Browse files Browse the repository at this point in the history
  • Loading branch information
GnsP authored May 8, 2024
1 parent d15b558 commit ffc39df
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import React, { useEffect } from 'react';
import { connect, Provider } from 'react-redux';
import T from 'i18n-react';
import styled from 'styled-components';
import { green, orange } from '@material-ui/core/colors';
import { green, red } from '@material-ui/core/colors';
import CheckCircleIcon from '@material-ui/icons/CheckCircle';
import ErrorIcon from '@material-ui/icons/Error';

Expand All @@ -30,7 +30,6 @@ import { GLOBALS } from 'services/global-constants';
import { Chip } from '@material-ui/core';
import { useFeatureFlagDefaultFalse } from 'services/react/customHooks/useFeatureFlag';
import { getScmSyncStatus } from '../store/ActionCreator';
import moment from 'moment';

const PREFIX = 'features.PipelineDetails.TopPanel';
const SCM_PREFIX = 'features.SourceControlManagement';
Expand Down Expand Up @@ -81,7 +80,7 @@ interface IPipelineDetailsMetadata {
};
scmSyncStatus?: {
isSynced?: boolean;
lastSyncedAt?: number;
lastModified?: number;
};
}

Expand Down Expand Up @@ -137,33 +136,19 @@ const PipelineDetailsMetadata = ({
</Popover>
</StyledSpan>
)}
{scmMultiSyncEnabled && scmSyncStatus && (
{scmMultiSyncEnabled && (
<StyledSpan>
{scmSyncStatus.isSynced ? (
<StyledChip
variant="outlined"
label={T.translate(`${SCM_PREFIX}.table.gitSyncStatusSynced`)}
icon={<CheckCircleIcon style={{ color: green[500] }} fontSize="small" />}
title={
scmSyncStatus.lastSyncedAt
? T.translate(`${SCM_PREFIX}.table.lastSyncedAtRelative`, {
diff: moment(scmSyncStatus.lastSyncedAt).fromNow(true),
})
: undefined
}
/>
) : (
<StyledChip
variant="outlined"
label={T.translate(`${SCM_PREFIX}.table.gitSyncStatusUnsynced`)}
icon={<ErrorIcon style={{ color: orange[300] }} fontSize="small" />}
title={
scmSyncStatus.lastSyncedAt
? T.translate(`${SCM_PREFIX}.table.lastSyncedAtRelative`, {
diff: moment(scmSyncStatus.lastSyncedAt).fromNow(true),
})
: undefined
}
icon={<ErrorIcon style={{ color: red[500] }} fontSize="small" />}
/>
)}
<Popover
Expand Down
21 changes: 6 additions & 15 deletions app/cdap/components/PipelineDetails/store/ActionCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,21 +494,12 @@ const getScmSyncStatus = (appId) => {
MyPipelineApi.getScmSyncStatus({
namespace,
appId,
}).subscribe(
(res) => {
PipelineDetailStore.dispatch({
type: ACTIONS.SET_SCM_SYNC_STATUS,
payload: res,
});
},
// eslint-disable-next-line no-unused-vars
(err) => {
PipelineDetailStore.dispatch({
type: ACTIONS.SET_SCM_SYNC_STATUS,
payload: null,
});
}
);
}).subscribe((res) => {
PipelineDetailStore.dispatch({
type: ACTIONS.SET_SCM_SYNC_STATUS,
payload: res,
});
});
};

const reset = () => {
Expand Down
6 changes: 2 additions & 4 deletions app/cdap/components/PipelineDetails/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ const DEFAULT_PIPELINE_DETAILS = {
sourceControlMeta: null,
pullLoading: false,
pullStatus: null,
scmSyncStatus: null,
scmSyncStatusRefreshTime: null,
scmSyncStatus: {},
};

const pipelineDetails = (state = DEFAULT_PIPELINE_DETAILS, action = defaultAction) => {
Expand Down Expand Up @@ -290,8 +289,7 @@ const pipelineDetails = (state = DEFAULT_PIPELINE_DETAILS, action = defaultActio
case ACTIONS.SET_SCM_SYNC_STATUS:
return {
...state,
scmSyncStatus: action.payload ? action.payload.app : null,
scmSyncStatusRefreshTime: action.payload ? action.payload.lastRefreshTime : null,
scmSyncStatus: action.payload,
};
case ACTIONS.RESET:
return DEFAULT_PIPELINE_DETAILS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
TableSortLabel,
} from '@material-ui/core';
import InfoIcon from '@material-ui/icons/Info';
import { green, orange } from '@material-ui/core/colors';
import { green, red } from '@material-ui/core/colors';
import CheckCircleIcon from '@material-ui/icons/CheckCircle';
import ErrorIcon from '@material-ui/icons/Error';

Expand Down Expand Up @@ -267,7 +267,7 @@ export const LocalPipelineTable = ({
</SyncStatusWrapper>
) : (
<SyncStatusWrapper>
<ErrorIcon style={{ color: orange[300] }} />
<ErrorIcon style={{ color: red[500] }} />
{T.translate(`${PREFIX}.gitSyncStatusUnsynced`)}
</SyncStatusWrapper>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
TableRow,
} from '@material-ui/core';
import TableSortLabel from '@material-ui/core/TableSortLabel';
import { green, orange } from '@material-ui/core/colors';
import { green, red } from '@material-ui/core/colors';
import CheckCircleIcon from '@material-ui/icons/CheckCircle';
import ErrorIcon from '@material-ui/icons/Error';
import StatusButton from 'components/StatusButton';
Expand Down Expand Up @@ -255,7 +255,7 @@ export const RemotePipelineTable = ({
</SyncStatusWrapper>
) : (
<SyncStatusWrapper>
<ErrorIcon style={{ color: orange[300] }} />
<ErrorIcon style={{ color: red[500] }} />
{T.translate(`${PREFIX}.gitSyncStatusUnsynced`)}
</SyncStatusWrapper>
)}
Expand Down
3 changes: 1 addition & 2 deletions app/cdap/text/text-en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3288,7 +3288,7 @@ features:
gitStatus: Connected to Git
syncStatus: Sync status
gitStatusHelperText: This status indicates that the pipeline has been pushed to or pulled from the git repository in the past. It does not necessarily mean the content is up to date.
syncStatusHelperText: Indicates the sync status with linked remote repository
syncStatusHelperText: This status indicates whether the pipeline is in sync with the linked remote repository.
pullFail: Failed to pull this pipeline from remote.
pushFail: Failed to push this pipeline to remote.
synced: Synced
Expand All @@ -3298,7 +3298,6 @@ features:
gitSyncStatusUnsynced: Unsynced
serverSidePaginationLabel: "Results {from} - {to}"
lastRefreshedAtLabel: Last refreshed at {datetime}
lastSyncedAtRelative: Last synced {diff} ago
syncButton: Sync Pipelines
title: Source Control Management
unlinkButton: Unlink Repository
Expand Down

0 comments on commit ffc39df

Please sign in to comment.