From d9c0998a8a655d2710a56471d82b23ad60b372e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E4=BF=8A=E5=B4=8E=5Bjunqigu=5D?= Date: Wed, 24 Jan 2024 15:23:58 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E5=88=9B=E5=BB=BA=E5=8F=8A?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=88=86=E5=8F=91=E8=AE=A1=E5=88=92=E6=97=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=B0=E5=BD=95=E5=88=86=E5=8F=91=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE=20#1675?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/planManage/createPlan/index.vue | 48 +++++++++++++++++-- .../src/views/planManage/planLog.vue | 32 +++++++++---- src/frontend/locale/repository/en-US.json | 8 +++- src/frontend/locale/repository/zh-CN.json | 8 +++- 4 files changed, 78 insertions(+), 18 deletions(-) diff --git a/src/frontend/devops-repository/src/views/planManage/createPlan/index.vue b/src/frontend/devops-repository/src/views/planManage/createPlan/index.vue index 7decf1060a..7c541360a2 100644 --- a/src/frontend/devops-repository/src/views/planManage/createPlan/index.vue +++ b/src/frontend/devops-repository/src/views/planManage/createPlan/index.vue @@ -119,6 +119,21 @@ :disabled="disabled"> + + {{ $t('planRecordAllLog') }} + + + {{ $t('planLogReserveDays') }} + + + {{$t('cancel')}} {{$t('confirm')}} @@ -168,7 +183,9 @@ remoteClusterIds: [], creator: '', created_time: '', - description: '' + description: '', + record: true, + recordReserveDays: 30 }, rules: { name: [ @@ -218,6 +235,23 @@ message: this.$t('pleaseSelect') + this.$t('space') + this.$t('targetNode'), trigger: 'blur' } + ], + recordReserveDays: [ + { + required: true, + message: this.$t('planRecordReserveDaysInfo'), + trigger: 'blur' + }, + { + validator: (value) => { + if (!Number(value) && isNaN(value)) { + this.planForm.recordReserveDays = '' + } + return !isNaN(value) + }, + message: this.$t('planRecordReserveDaysInfo'), + trigger: 'blur' + } ] }, replicaTaskObjects: [] @@ -289,7 +323,9 @@ conflictStrategy, executionStrategy, executionPlan: { executeTime, cronExpression } - } + }, + record, + recordReserveDays }, objects }) => { @@ -312,7 +348,9 @@ remoteClusterIds: this.checkClusterExist(remoteClusters.map(v => v.id)), description, createdBy, - createdDate + createdDate, + record, + recordReserveDays } this.replicaTaskObjects = objects }).finally(() => { @@ -376,7 +414,9 @@ }, remoteClusterIds: this.planForm.remoteClusterIds, enabled: true, - description: this.planForm.description + description: this.planForm.description, + record: this.planForm.record, + recordReserveDays: Number(this.planForm.recordReserveDays) } const request = this.routeName === 'createPlan' ? this.createPlan({ body }) diff --git a/src/frontend/devops-repository/src/views/planManage/planLog.vue b/src/frontend/devops-repository/src/views/planManage/planLog.vue index 482516f144..9e00567ec0 100644 --- a/src/frontend/devops-repository/src/views/planManage/planLog.vue +++ b/src/frontend/devops-repository/src/views/planManage/planLog.vue @@ -122,16 +122,28 @@ }) }, showLogDetailHandler ({ id }) { - this.$router.push({ - name: 'logDetail', - params: { - ...this.$route.params, - logId: id - }, - query: { - planName: this.planData.name - } - }) + // 历史的分发计划,后端接口返回的record字段为null,后端开发原话:record为true与null表示同一个意思,都是记录所有的分发日志 + if (this.planData?.record || this.planData.record === null) { + this.$router.push({ + name: 'logDetail', + params: { + ...this.$route.params, + logId: id + }, + query: { + planName: this.planData.name + } + }) + } else { + // 不记录日志详情,此时直接弹窗警告 + const name = this.planData.name + this.$bkMessage({ + message: this.$t('planTaskLogInfo', { name }), + theme: 'warning', + limit: 1, + offsetY: 50 + }) + } } } } diff --git a/src/frontend/locale/repository/en-US.json b/src/frontend/locale/repository/en-US.json index 4bf2fd56b4..532bbfaa01 100644 --- a/src/frontend/locale/repository/en-US.json +++ b/src/frontend/locale/repository/en-US.json @@ -651,7 +651,7 @@ "runningStatus":"Running status", "startExecutionTime":"Starting time", "endExecutionTime":"End Time", - "planLogTitle":"{name} execution log", + "planLogTitle":"{name} execution task record", "usedQuotaCapacity":"Quota capacity used by the repository", "nodeTypeEnum": { "CENTER": "center", @@ -829,5 +829,9 @@ "roleName":"Name", "addUserGroupTitle":"Create UserGroup", "editUserGroupTitle": "Edit UserGroup", - "associatedUseGroup": "UserGroup" + "associatedUseGroup": "UserGroup", + "planRecordAllLog":"Record all distribution logs", + "planLogReserveDays":"Log retention days (within 60 days)", + "planRecordReserveDaysInfo":"Please enter a number between 1-60", + "planTaskLogInfo":"[{name}] distribution plan does not select to record all distribution logs, and task log details cannot be viewed." } diff --git a/src/frontend/locale/repository/zh-CN.json b/src/frontend/locale/repository/zh-CN.json index 33776fedef..85ec5fbf7b 100644 --- a/src/frontend/locale/repository/zh-CN.json +++ b/src/frontend/locale/repository/zh-CN.json @@ -657,7 +657,7 @@ "runningStatus":"运行状态", "startExecutionTime":"开始执行时间", "endExecutionTime":"结束执行时间", - "planLogTitle":"{name} 执行日志", + "planLogTitle":"{name} 执行任务记录", "nodeTypeEnum": { "CENTER": "中心节点", "EDGE": "边缘节点", @@ -830,5 +830,9 @@ "roleName":"用户组名称", "addUserGroupTitle":"创建用户组", "editUserGroupTitle": "编辑用户组", - "associatedUseGroup": "关联用户组" + "associatedUseGroup": "关联用户组", + "planRecordAllLog":"记录所有分发日志", + "planLogReserveDays":"日志保留天数(60天内)", + "planRecordReserveDaysInfo":"请输入 1-60 之间的数字", + "planTaskLogInfo":"[{name}] 分发计划未选择记录所有分发日志,无法查看任务日志详情" } From 0283c29ecd6703f73c1dfcfdd037f1a62045b7eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E4=BF=8A=E5=B4=8E=5Bjunqigu=5D?= Date: Thu, 25 Jan 2024 15:04:14 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E5=88=B6=E5=93=81=E5=88=86?= =?UTF-8?q?=E5=8F=91=E7=9A=84=E6=97=A5=E5=BF=97=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=90=8C=E6=AD=A5=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E7=9A=84=E5=B1=95=E7=A4=BA=E5=B9=B6=E4=BF=AE=E6=94=B9=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=20#1675?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/store/actions/nodeManage.js | 13 ++- .../devops-repository/src/store/publicEnum.js | 15 ++++ .../src/views/planManage/logDetail.vue | 87 +++++++++++++++---- src/frontend/locale/repository/en-US.json | 13 ++- src/frontend/locale/repository/zh-CN.json | 13 ++- 5 files changed, 119 insertions(+), 22 deletions(-) diff --git a/src/frontend/devops-repository/src/store/actions/nodeManage.js b/src/frontend/devops-repository/src/store/actions/nodeManage.js index 3930d64727..3d2196ac91 100644 --- a/src/frontend/devops-repository/src/store/actions/nodeManage.js +++ b/src/frontend/devops-repository/src/store/actions/nodeManage.js @@ -129,7 +129,7 @@ export default { ) }, // 计划执行日志制品详情 - getPlanLogPackageList (_, { id, status, packageName, repoName, clusterName, path, current = 1, limit = 10 }) { + getPlanLogPackageList (_, { id, status, artifactName, repoName, clusterName, current = 1, limit = 10 }) { return Vue.prototype.$ajax.get( `${prefix}/task/record/detail/page/${id}`, { @@ -137,12 +137,17 @@ export default { pageNumber: current, pageSize: limit, status: status || undefined, - packageName: packageName || undefined, + artifactName: artifactName || undefined, repoName: repoName || undefined, - clusterName: clusterName || undefined, - path: path || undefined + clusterName: clusterName || undefined } } ) + }, + // 计划执行任务总览 + getPlanLogDetailOverview (_, { id }) { + return Vue.prototype.$ajax.get( + `${prefix}/task/record/overview/${id}` + ) } } diff --git a/src/frontend/devops-repository/src/store/publicEnum.js b/src/frontend/devops-repository/src/store/publicEnum.js index c576bc722e..bafa7a59f3 100644 --- a/src/frontend/devops-repository/src/store/publicEnum.js +++ b/src/frontend/devops-repository/src/store/publicEnum.js @@ -153,3 +153,18 @@ export const specialRepoEnum = [ 'report', 'custom' ] + +// 分发计划的任务日志详情页数量显示 +export const planLogEnum = { + total: '同步总数量', + success: '成功数量', + failed: '失败数量', + conflict: '冲突数量' +} + +// 分发计划冲突策略 +export const conflictStrategyEnum = { + SKIP: '跳过冲突', + OVERWRITE: '替换制品', + FAST_FAIL: '终止同步' +} diff --git a/src/frontend/devops-repository/src/views/planManage/logDetail.vue b/src/frontend/devops-repository/src/views/planManage/logDetail.vue index e53a15edce..362f114928 100644 --- a/src/frontend/devops-repository/src/views/planManage/logDetail.vue +++ b/src/frontend/devops-repository/src/views/planManage/logDetail.vue @@ -1,6 +1,22 @@ + + + + + + - + + + - - - + + @@ -83,12 +105,13 @@