From e9f4d61b8dae866446fceef36cc7ee84fdda8893 Mon Sep 17 00:00:00 2001 From: WangQianliang Date: Wed, 11 Sep 2019 19:44:10 +0800 Subject: [PATCH] fix(code/frontend): should show updating instead of cloning when updating (#45238) (#45336) --- x-pack/legacy/plugins/code/model/repository.ts | 1 + .../code/public/components/admin_page/project_item.tsx | 7 +++++++ x-pack/legacy/plugins/code/public/reducers/status.ts | 3 +++ x-pack/plugins/translations/translations/zh-CN.json | 1 + 4 files changed, 12 insertions(+) diff --git a/x-pack/legacy/plugins/code/model/repository.ts b/x-pack/legacy/plugins/code/model/repository.ts index ec2777caf8584e..c4469a7d593d72 100644 --- a/x-pack/legacy/plugins/code/model/repository.ts +++ b/x-pack/legacy/plugins/code/model/repository.ts @@ -171,6 +171,7 @@ export interface IndexWorkerProgress extends WorkerProgress { export enum RepoState { CLONING, + UPDATING, DELETING, INDEXING, READY, diff --git a/x-pack/legacy/plugins/code/public/components/admin_page/project_item.tsx b/x-pack/legacy/plugins/code/public/components/admin_page/project_item.tsx index 48a6407b911c04..b3a2c49c08f516 100644 --- a/x-pack/legacy/plugins/code/public/components/admin_page/project_item.tsx +++ b/x-pack/legacy/plugins/code/public/components/admin_page/project_item.tsx @@ -30,6 +30,7 @@ import { RepoStatus } from '../../actions/status'; const stateColor = { [RepoState.CLONING]: 'secondary', + [RepoState.UPDATING]: 'secondary', [RepoState.DELETING]: 'accent', [RepoState.INDEXING]: 'primary', }; @@ -126,6 +127,12 @@ class CodeProjectItem extends React.PureComponent< ); + } else if (status.state === RepoState.UPDATING) { + footer = ( +
+ +
+ ); } else if (status.state === RepoState.DELETE_ERROR) { footer = (
diff --git a/x-pack/legacy/plugins/code/public/reducers/status.ts b/x-pack/legacy/plugins/code/public/reducers/status.ts index fe9e58ffcc488c..4e57d5e7e7565c 100644 --- a/x-pack/legacy/plugins/code/public/reducers/status.ts +++ b/x-pack/legacy/plugins/code/public/reducers/status.ts @@ -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; diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 90a4ae1345bb81..557febe5ac765c 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -4326,6 +4326,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": "确认删除仓库?",