Skip to content

Commit

Permalink
feat: 1.提交审批部分接口更新;2.添加操作记录列表,部分功能暂未联调(总体80%进度)--story=115998324
Browse files Browse the repository at this point in the history
  • Loading branch information
q15971095971 committed Sep 14, 2024
1 parent 5316fb2 commit 3b89876
Show file tree
Hide file tree
Showing 22 changed files with 1,614 additions and 36 deletions.
29 changes: 29 additions & 0 deletions bcs-services/bcs-bscp/ui/src/api/record.ts
Original file line number Diff line number Diff line change
@@ -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);
1 change: 1 addition & 0 deletions bcs-services/bcs-bscp/ui/src/components/head.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
{ id: 'configuration-example', module: 'example', name: t('配置示例') },
],
},
{ id: 'records-all', module: 'records', name: t('操作记录') },
]);
const optionList = ref<ISpaceDetail[]>([]);
Expand Down
30 changes: 15 additions & 15 deletions bcs-services/bcs-bscp/ui/src/constants/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', // 已上线
}
43 changes: 43 additions & 0 deletions bcs-services/bcs-bscp/ui/src/constants/record.ts
Original file line number Diff line number Diff line change
@@ -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',
}
1 change: 1 addition & 0 deletions bcs-services/bcs-bscp/ui/src/i18n/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
28 changes: 27 additions & 1 deletion bcs-services/bcs-bscp/ui/src/i18n/zh-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default {
配置示例: '配置示例',
业务名: '业务名',
业务: '业务',
操作记录: '操作记录',


// 配置管理
Expand Down Expand Up @@ -494,9 +495,34 @@ export default {
版本已上线: '版本已上线',
等待定时上线: '等待定时上线',
待审批: '待审批',
上线驳回: '上线驳回',
审批驳回: '审批驳回',
撤销上线: '撤销上线',
审批通过: '审批通过',
待上线: '待上线',
操作时间: '操作时间',
所属服务: '所属服务',
资源类型: '资源类型',
操作行为: '操作行为',
资源实例: '资源实例',
操作人: '操作人',
操作途径: '操作途径',
// 状态: '状态',
// 操作: '操作',
服务配置: '服务配置',
创建服务: '创建服务',
// 上线服务: '上线服务',
更新服务: '更新服务',
删除服务: '删除服务',
上线版本配置: '上线版本配置',
'提示-已上线文案': '上线操作人:{reviser}\n上线时间:{time}',
'提示-审批驳回': '审批已驳回\n审批人:{reviser}\n上线时间:{time}\n驳回原因:{reason}',
'提示-已撤销': '已撤销\n撤销人:{reviser}\n撤销时间:{time}',
'提示-失败': '此脚本版本正在被服务使用,删除失败',
配置版本名称: '配置版本名称',
配置上线范围: '配置上线范围',
去审批: '去审批',
审批: '审批',
再次提交: '再次提交',

// 分组管理
新增分组: '新增分组',
Expand Down
21 changes: 21 additions & 0 deletions bcs-services/bcs-bscp/ui/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
],
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<template>
<div>
<bk-date-picker
v-click-outside="() => (open = false)"
ref="datePickerRef"
style="width: 300"
:disabled-date="disabledDate"
:model-value="defaultValue"
:shortcuts="shortcutsRange"
:editable="false"
:clearable="false"
:open="open"
type="datetimerange"
append-to-body
clear
@change="handleChange"
@click="open = !open">
<template #confirm>
<div>
<bk-button theme="primary" @click="open = false" style="margin-right: 8px; height: 26px"> 确定 </bk-button>
</div>
</template>
</bk-date-picker>
</div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
const shortcutsRange = ref([
// {
// text: '今天',
// value() {
// const end = new Date();
// const start = new Date(end.getFullYear(), end.getMonth(), end.getDate());
// return [start, end];
// },
// onClick: (picker) => {
// console.log(picker);
// },
// },
{
text: '近7天',
value() {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
return [start, end];
},
onClick: (picker) => {
console.log(picker);
},
},
{
text: '近15天',
value() {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 15);
return [start, end];
},
onClick: (picker) => {
console.log(picker);
},
},
{
text: '近30天',
value() {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
return [start, end];
},
onClick: (picker) => {
console.log(picker);
},
},
]);
const open = ref(false);
const datePickerRef = ref(null);
const defaultValue = ref([new Date(Date.now() - 7 * 24 * 60 * 60 * 1000), new Date()]);
const handleChange = (date: []) => {
defaultValue.value = date;
};
const disabledDate = (date: Date) => date && date.valueOf() > Date.now() - 86400;
</script>

<style scoped></style>
Loading

0 comments on commit 3b89876

Please sign in to comment.