Skip to content

Commit

Permalink
fix(code/frontend): should show updating instead of cloning when upda…
Browse files Browse the repository at this point in the history
…ting (#45238)
  • Loading branch information
WangQianliang authored Sep 11, 2019
1 parent 6e4916f commit 4d4a5b3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/code/model/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export interface IndexWorkerProgress extends WorkerProgress {

export enum RepoState {
CLONING,
UPDATING,
DELETING,
INDEXING,
READY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { RepoStatus } from '../../actions/status';

const stateColor = {
[RepoState.CLONING]: 'secondary',
[RepoState.UPDATING]: 'secondary',
[RepoState.DELETING]: 'accent',
[RepoState.INDEXING]: 'primary',
};
Expand Down Expand Up @@ -126,6 +127,12 @@ class CodeProjectItem extends React.PureComponent<
<FormattedMessage id="xpack.code.repoItem.cloningText" defaultMessage="CLONING..." />
</div>
);
} else if (status.state === RepoState.UPDATING) {
footer = (
<div className="codeFooter">
<FormattedMessage id="xpack.code.repoItem.updatingText" defaultMessage="UPDATING..." />
</div>
);
} else if (status.state === RepoState.DELETE_ERROR) {
footer = (
<div className="codeFooter codeFooter--error">
Expand Down
3 changes: 3 additions & 0 deletions x-pack/legacy/plugins/code/public/reducers/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ const getGitState = (gitStatus: CloneWorkerProgress) => {
) {
return RepoState.CLONE_ERROR;
} else if (progress < WorkerReservedProgress.COMPLETED) {
if (gitStatus.cloneProgress && gitStatus.cloneProgress.isCloned) {
return RepoState.UPDATING;
}
return RepoState.CLONING;
} else if (progress === WorkerReservedProgress.COMPLETED) {
return RepoState.READY;
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -4306,6 +4306,7 @@
"xpack.code.repoItem.cancelButtonText": "否,取消",
"xpack.code.repoItem.cloneErrorText": "克隆错误",
"xpack.code.repoItem.cloningText": "克隆中...",
"xpack.code.repoItem.updatingText": "更新中...",
"xpack.code.repoItem.confirmButtonText": "是,继续",
"xpack.code.repoItem.deleteButtonLabel": "删除",
"xpack.code.repoItem.deleteConfirmTitle": "确认删除仓库?",
Expand Down

0 comments on commit 4d4a5b3

Please sign in to comment.