diff --git a/bcs-services/bcs-bscp/ui/src/api/record.ts b/bcs-services/bcs-bscp/ui/src/api/record.ts new file mode 100644 index 0000000000..efc4b9ade6 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/api/record.ts @@ -0,0 +1,29 @@ +import http from '../request'; +import { IRecordQuery } from '../../types/record'; + +/** + * 获取操作记录列表 + * @param biz_id 空间ID + * @param params 查询参数 + * @returns + */ +export const getRecordList = (biz_id: string, params: IRecordQuery) => + http.get(`/config/biz_id/${biz_id}/audits`, { params }).then((res) => res.data); + +/** + * 审批操作:撤销/驳回/通过/手动上线 + * @param biz_id 空间ID + * @param app_id 服务ID + * @param release_id 版本ID + * @param params 参数 + * @returns + */ +export const approve = ( + biz_id: string, + app_id: number, + release_id: number, + params: { publish_status: string; reason?: string }, +) => + http + .post(`/config/biz_id/${biz_id}/app_id/${app_id}/release_id/${release_id}/approve`, { ...params }) + .then((res) => res.data); diff --git a/bcs-services/bcs-bscp/ui/src/components/head.vue b/bcs-services/bcs-bscp/ui/src/components/head.vue index e2114d78f1..69d06a033d 100644 --- a/bcs-services/bcs-bscp/ui/src/components/head.vue +++ b/bcs-services/bcs-bscp/ui/src/components/head.vue @@ -179,6 +179,7 @@ { id: 'configuration-example', module: 'example', name: t('配置示例') }, ], }, + { id: 'records-all', module: 'records', name: t('操作记录') }, ]); const optionList = ref([]); diff --git a/bcs-services/bcs-bscp/ui/src/constants/config.ts b/bcs-services/bcs-bscp/ui/src/constants/config.ts index 097a70b641..4f13899d98 100644 --- a/bcs-services/bcs-bscp/ui/src/constants/config.ts +++ b/bcs-services/bcs-bscp/ui/src/constants/config.ts @@ -75,19 +75,19 @@ export enum APPROVE_TYPE { Rejected, // 2 驳回/撤销 } -// 版本上线状态 -export const ONLINE_TYPE = { - Manually: 'Manually', // 手动上线 - Automatically: 'Automatically', // 审批通过后自动上线 - Periodically: 'Periodically', // 定时上线 - Immediately: 'Immediately', // 立即上线 -}; - // 版本上线方式 -export const APPROVE_STATUS = { - PendApproval: 'PendApproval', // 待审批 - PendPublish: 'PendPublish', // 待上线 - RevokedPublish: 'RevokedPublish', // 撤销上线 - RejectedApproval: 'RejectedApproval', // 上线驳回 - AlreadyPublish: 'AlreadyPublish', // 已上线 -}; +export enum ONLINE_TYPE { + Manually = 'Manually', // 手动上线 + Automatically = 'Automatically', // 审批通过后自动上线 + Periodically = 'Periodically', // 定时上线 + Immediately = 'Immediately', // 立即上线 +} + +// 版本状态 +export enum APPROVE_STATUS { + PendApproval = 'PendApproval', // 待审批 + PendPublish = 'PendPublish', // 待上线 + RevokedPublish = 'RevokedPublish', // 撤销上线 + RejectedApproval = 'RejectedApproval', // 审批驳回 + AlreadyPublish = 'AlreadyPublish', // 已上线 +} diff --git a/bcs-services/bcs-bscp/ui/src/constants/record.ts b/bcs-services/bcs-bscp/ui/src/constants/record.ts new file mode 100644 index 0000000000..05d081ee37 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/constants/record.ts @@ -0,0 +1,43 @@ +import { localT } from '../i18n'; + +// 资源类型 +export const RECORD_RES_TYPE = { + app_config: localT('服务配置'), // 2024.9 第一版只有这个字段 +}; + +// 操作行为 +export const ACTION = { + Create: localT('创建服务'), + Publish: localT('上线服务'), + Update: localT('更新服务'), + Delete: localT('删除服务'), + PublishVersionConfig: localT('上线版本配置'), // 2024.9 第一版只有这个字段 +}; + +// 资源实例 +export const INSTANCE = { + releases_name: localT('配置版本名称'), + group: localT('配置上线范围'), +}; + +// 状态 +export const STATUS = { + PendApproval: localT('待审批'), + PendPublish: localT('待上线'), + RevokedPublish: localT('撤销上线'), + RejectedApproval: localT('审批驳回'), + AlreadyPublish: localT('已上线'), + Failure: localT('失败'), // 脚本相关的才会有 + Success: localT('成功'), // 脚本相关的才会有 +}; + +// 版本状态 +export enum APPROVE_STATUS { + PendApproval = 'PendApproval', // 待审批 + PendPublish = 'PendPublish', // 待上线 + RevokedPublish = 'RevokedPublish', // 撤销上线 + RejectedApproval = 'RejectedApproval', // 审批驳回 + AlreadyPublish = 'AlreadyPublish', // 已上线 + Failure = 'Failure', + Success = 'Success', +} diff --git a/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts b/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts index a23d1db5ee..db5aa4b299 100644 --- a/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts +++ b/bcs-services/bcs-bscp/ui/src/i18n/en-us.ts @@ -475,6 +475,7 @@ export default { '文件上传准备中,请稍候…': 'File upload is in preparation, please wait...', '( 后台已存在此文件,上传快速完成 )': '( The background already has this file, the upload is completed quickly )', '立即上线:点击“确认上线”后,配置版本将立即上线,适用于紧急更新等立即生效的场景定时上线:点击“确认上线”后,配置版本不会立即生效,可设定具体时间点,使版本在该时间自动上线,适用于非紧急更新场景,避免高峰时段上线,降低用户影响': '立即上线:点击“确认上线”后,配置版本将立即上线,适用于紧急更新等立即生效的场景\n定时上线:点击“确认上线”后,配置版本不会立即生效,可设定具体时间点,使版本在该时间自动上线,适用于非紧急更新场景,避免高峰时段上线,降低用户影响', + 审批开启的文案: '此服务版本上线已启用审批流程,请选择审批通过后的上线方式\n手动上线:适用于需人工干预和确认的场景,常用于重要业务或正式环\n境中的模块配置上线\n审批通过后立即上线:适用于高度自动化的场景,常用于非正式环境的\n配置上线,以提升部署效率\n定时上线:适用于需在特定时间上线的场景;若在指定时间前审批流程\n未完成,则将自动切换为手动上线', // 分组管理 新增分组: 'New group', diff --git a/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts b/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts index f6c3fab7c8..7fb7707748 100644 --- a/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts +++ b/bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts @@ -98,6 +98,7 @@ export default { 配置示例: '配置示例', 业务名: '业务名', 业务: '业务', + 操作记录: '操作记录', // 配置管理 @@ -494,9 +495,34 @@ export default { 版本已上线: '版本已上线', 等待定时上线: '等待定时上线', 待审批: '待审批', - 上线驳回: '上线驳回', + 审批驳回: '审批驳回', 撤销上线: '撤销上线', 审批通过: '审批通过', + 待上线: '待上线', + 操作时间: '操作时间', + 所属服务: '所属服务', + 资源类型: '资源类型', + 操作行为: '操作行为', + 资源实例: '资源实例', + 操作人: '操作人', + 操作途径: '操作途径', + // 状态: '状态', + // 操作: '操作', + 服务配置: '服务配置', + 创建服务: '创建服务', + // 上线服务: '上线服务', + 更新服务: '更新服务', + 删除服务: '删除服务', + 上线版本配置: '上线版本配置', + '提示-已上线文案': '上线操作人:{reviser}\n上线时间:{time}', + '提示-审批驳回': '审批已驳回\n审批人:{reviser}\n上线时间:{time}\n驳回原因:{reason}', + '提示-已撤销': '已撤销\n撤销人:{reviser}\n撤销时间:{time}', + '提示-失败': '此脚本版本正在被服务使用,删除失败', + 配置版本名称: '配置版本名称', + 配置上线范围: '配置上线范围', + 去审批: '去审批', + 审批: '审批', + 再次提交: '再次提交', // 分组管理 新增分组: '新增分组', diff --git a/bcs-services/bcs-bscp/ui/src/router.ts b/bcs-services/bcs-bscp/ui/src/router.ts index 7029384ebd..aa6314dd17 100644 --- a/bcs-services/bcs-bscp/ui/src/router.ts +++ b/bcs-services/bcs-bscp/ui/src/router.ts @@ -166,6 +166,27 @@ const routes = [ }, component: () => import('./views/space/client/example/index.vue'), }, + { + path: 'records', + children: [ + { + path: 'all/:queryTime?', + name: 'records-all', + component: () => import('./views/space/records/index.vue'), + meta: { + navModule: 'records', + }, + }, + { + path: ':appId(\\d+)/:queryTime?', + name: 'records-appId', + component: () => import('./views/space/records/index.vue'), + meta: { + navModule: 'records', + }, + }, + ], + }, ], }, { diff --git a/bcs-services/bcs-bscp/ui/src/views/space/records/components/date-picker.vue b/bcs-services/bcs-bscp/ui/src/views/space/records/components/date-picker.vue new file mode 100644 index 0000000000..614de03290 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/records/components/date-picker.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/bcs-services/bcs-bscp/ui/src/views/space/records/components/dialog-confirm.vue b/bcs-services/bcs-bscp/ui/src/views/space/records/components/dialog-confirm.vue new file mode 100644 index 0000000000..539c0bcf2a --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/records/components/dialog-confirm.vue @@ -0,0 +1,155 @@ + + + + + diff --git a/bcs-services/bcs-bscp/ui/src/views/space/records/components/more-actions.vue b/bcs-services/bcs-bscp/ui/src/views/space/records/components/more-actions.vue new file mode 100644 index 0000000000..dc31fab4b0 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/records/components/more-actions.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/bcs-services/bcs-bscp/ui/src/views/space/records/components/record-table.vue b/bcs-services/bcs-bscp/ui/src/views/space/records/components/record-table.vue new file mode 100644 index 0000000000..632791920f --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/records/components/record-table.vue @@ -0,0 +1,518 @@ + + + + + diff --git a/bcs-services/bcs-bscp/ui/src/views/space/records/components/search-option.vue b/bcs-services/bcs-bscp/ui/src/views/space/records/components/search-option.vue new file mode 100644 index 0000000000..d6977f7219 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/records/components/search-option.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/bcs-services/bcs-bscp/ui/src/views/space/records/components/service-selector.vue b/bcs-services/bcs-bscp/ui/src/views/space/records/components/service-selector.vue new file mode 100644 index 0000000000..34059eed93 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/records/components/service-selector.vue @@ -0,0 +1,206 @@ + + + + + diff --git a/bcs-services/bcs-bscp/ui/src/views/space/records/components/version-diff.vue b/bcs-services/bcs-bscp/ui/src/views/space/records/components/version-diff.vue new file mode 100644 index 0000000000..8ecb20d353 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/records/components/version-diff.vue @@ -0,0 +1,177 @@ + + + + + diff --git a/bcs-services/bcs-bscp/ui/src/views/space/records/index.vue b/bcs-services/bcs-bscp/ui/src/views/space/records/index.vue new file mode 100644 index 0000000000..fa585f9a6b --- /dev/null +++ b/bcs-services/bcs-bscp/ui/src/views/space/records/index.vue @@ -0,0 +1,41 @@ + + + diff --git a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/detail-header.vue b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/detail-header.vue index 2f31229fd8..e1edcfb95d 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/detail-header.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/detail-header.vue @@ -40,7 +40,7 @@ - + - + @@ -99,6 +99,7 @@ create: false, publish: false, }); + const verAppStatus = ref(); const props = defineProps<{ bkBizId: string; diff --git a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/header-more-options.vue b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/header-more-options.vue index 17e5aa4168..14a96884e5 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/header-more-options.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/header-more-options.vue @@ -3,16 +3,26 @@
  • 服务上线记录
  • -
  • - 撤销 -
  • + +
  • + 撤销 +
  • +
diff --git a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/modify-group-publish.vue b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/modify-group-publish.vue index f60426577a..19f8dcde8f 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/modify-group-publish.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/modify-group-publish.vue @@ -2,7 +2,8 @@
{ - handleConfirm(true); + const handlePublishClick = async () => { + const { bkBizId: biz_id, appId: app_id } = props; + const resp = await approve(biz_id, app_id, publishedVersionId.value, { publish_status: 'AlreadyPublish' }); + handleConfirm(resp.haveCredentials); }; // 打开上线版本确认弹窗 diff --git a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/publish-version/index.vue b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/publish-version/index.vue index a14c88b339..32e0a69975 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/publish-version/index.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/publish-version/index.vue @@ -3,7 +3,7 @@ { - handleConfirm(true); + const handlePublishClick = async () => { + const { bkBizId: biz_id, appId: app_id } = props; + const resp = await approve(biz_id, app_id, publishedVersionId.value, { publish_status: 'AlreadyPublish' }); + handleConfirm(resp.haveCredentials); }; const handleOpenPublishDialog = () => { diff --git a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/version-approve-status.vue b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/version-approve-status.vue index c274a3ef84..a31af321c4 100644 --- a/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/version-approve-status.vue +++ b/bcs-services/bcs-bscp/ui/src/views/space/service/detail/components/version-approve-status.vue @@ -1,8 +1,9 @@ - + {{ t('或签') }} {{ t('会签') }} diff --git a/bcs-services/bcs-bscp/ui/types/record.ts b/bcs-services/bcs-bscp/ui/types/record.ts new file mode 100644 index 0000000000..807e849e60 --- /dev/null +++ b/bcs-services/bcs-bscp/ui/types/record.ts @@ -0,0 +1,119 @@ +// 操作记录列表参数 +export interface IRecordQuery { + start?: number; + limit?: number; + app_id?: number; + all?: boolean; + start_time?: string; + end_time?: string; + search_value?: string; + operate?: string; +} + +// 审批操作:撤销/驳回/通过/手动上线 +export interface IDialogData { + service?: string; + version?: string; + group?: string; +} + +// 列表每行的数据 +export interface IRowData { + audit: { + id: number; + spec: { + res_type: string; + action: string; + rid?: string; + app_code?: string; + detail?: string; + operator: string; + res_instance: string; + operate_way: string; + status: string; + }; + attachment: { + biz_id: number; + app_id: number; + res_id: number; + }; + revision: { + created_at: string; + }; + }; + strategy: { + publish_type: string; + publish_time: string; + publish_status: string; + reject_reason: string; + approver: string; + approver_progress: string; + updated_at: string; + reviser: string; + release_id: number; + scope: { + groups: [ + { + id: number; + spec: { + name: string; + public: boolean; + bind_apps: []; + mode: string; + selector: { + labels_and: [ + { + key: string; + op: string; + value: string; + }, + ]; + }; + uid: string; + }; + attachment: { + biz_id: number; + }; + revision: { + creator: string; + reviser: string; + create_at: string; + update_at: string; + }; + }, + { + id: 2; + spec: { + name: string; + public: true; + bind_apps: []; + mode: string; + selector: { + labels_and: [ + { + key: string; + op: string; + value: string; + }, + ]; + }; + uid: string; + }; + attachment: { + biz_id: number; + }; + revision: { + creator: string; + reviser: string; + create_at: string; + update_at: string; + }; + }, + ]; + }; + }; + app: { + name: string; + creator: string; + }; +}