Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 操作记录与审批功能--story=115998324 #3463

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
4dc8ffe
feat: 提交审批70%进度 --story=115998324
q15971095971 Aug 23, 2024
35a5ad5
feat: api/config.ts文件冲突问题 --story=115998324
q15971095971 Aug 23, 2024
5316fb2
feat: 审批功能细节问题处理。去除无用代码--story=115998324
q15971095971 Aug 28, 2024
3b89876
feat: 1.提交审批部分接口更新;2.添加操作记录列表,部分功能暂未联调(总体80%进度)--story=115998324
q15971095971 Sep 14, 2024
b156375
feat: 操作记录列表过滤、审批驳回弹窗--story=115998324
q15971095971 Sep 16, 2024
0e6f4d7
feat: 搜索和过滤调整(待后端更新接口联调)--story=115998324
q15971095971 Sep 18, 2024
7e6c7f5
feat: 操作记录联调+bug优化--story=115998324
q15971095971 Sep 20, 2024
b4516ea
feat: 提交审批/操作记录联调done--story=115998324
q15971095971 Sep 23, 2024
7ca51ca
feat: 合并冲突--story=115998324
q15971095971 Sep 23, 2024
4fb8272
feat: 去除无用代码--story=115998324
q15971095971 Sep 23, 2024
3cd4a0d
feat: 去除无用代码--story=115998324
q15971095971 Sep 23, 2024
f94247b
feat: 1.根据url自动打开审批弹窗逻辑优化;2.国际化和部分英文样式微调--story=115998324
q15971095971 Sep 24, 2024
7be694f
feat: 适配后端逻辑变化的调整--story=115998324
q15971095971 Sep 29, 2024
06251ee
feat: 适配后端人员地址注入变量更新--story=115998324
q15971095971 Sep 30, 2024
2e06aeb
feat: 版本状态增加撤销人文案;操作列表部分情况样式异常问题--sgory=115998324
q15971095971 Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bcs-services/bcs-bscp/ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
var GRPC_ADDR = '{{ .GRPC_ADDR }}';
var HTTP_ADDR = '{{ .HTTP_ADDR }}';
var BK_NODE_HOST = '{{ .BK_NODE_HOST }}';
var User_Man_Host = '{{ .User_Man_Host }}';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个变量名称是怎么定的?建议和其他变量格式保持大写字母加下划线的格式。

window.BSCP_CONFIG = JSON.parse('{{ .BK_BSCP_CONFIG }}');
</script>
</head>
Expand Down
3 changes: 3 additions & 0 deletions bcs-services/bcs-bscp/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"@blueking/login-modal": "^1.0.1",
"@blueking/notice-component": "^2.0.1",
"@blueking/platform-config": "^1.0.3",
"@icon-cool/bk-icon-bk-biz-components": "^0.0.4",
"@types/js-cookie": "^3.0.2",
"@types/lodash.clonedeep": "^4.5.7",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"axios": "^1.6.0",
"bkui-vue": "1.0.3-beta.32",
"crypto-js": "^4.2.0",
Expand All @@ -30,6 +32,7 @@
"node-forge": "^1.3.1",
"pinia": "^2.0.33",
"sass": "^1.54.8",
"tippy.js": "^6.3.7",
"vue": "^3.4.21",
"vue-i18n": "9",
"vue-router": "^4.1.5",
Expand Down
53 changes: 53 additions & 0 deletions bcs-services/bcs-bscp/ui/src/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,30 @@ export const publishVersion = (
},
) => http.post(`/config/update/strategy/publish/publish/release_id/${releaseId}/app_id/${appId}/biz_id/${bizId}`, data);

/**
* 发布版本(增加审批)
* @param bizId 业务ID
* @param appId 应用ID
* @param data 参数
* @param publish_type 上线方式
* @param publish_time 定时上线时间
* @param allFirstPublish 所有待上线的分组是否为首次上线
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个参数没有用到

* @returns
*/
export const publishVerSubmit = (
bizId: string,
appId: number,
releaseId: number,
data: {
groups: Array<number>;
all: boolean;
memo: string;
publishType: 'Manually' | 'Automatically' | 'Periodically' | 'Immediately' | '';
publishTime: Date | string;
is_compare: boolean;
},
) => http.post(`/config/biz_id/${bizId}/app_id/${appId}/release_id/${releaseId}/submit`, data);

/**
* 获取服务下初始化脚本引用配置
* @param bizId 业务ID
Expand Down Expand Up @@ -675,3 +699,32 @@ export const createVersionNameCheck = (bizId: string, appId: number, name: strin
*/
export const importConfigFromTemplate = (bizId: string, appId: number, query: any) =>
http.post(`/config/biz/${bizId}/apps/${appId}/template_bindings/import_template_set`, query);

/**
* 上次上线方式查询
* @param bizId 业务ID
* @param appId 应用ID
* @returns
*/
export const publishType = (bizId: string, appId: number) =>
http.get(`/config/biz_id/${bizId}/app_id/${appId}/last/select`);

/**
* 当前版本状态查询
* @param bizId 业务ID
* @param appId 应用ID
* @param releaseId 版本ID
* @returns
*/
export const versionStatusQuery = (bizId: string, appId: number, releaseId: number) =>
http.get(`/config/biz_id/${bizId}/app_id/${appId}/release_id/${releaseId}/status`);

/**
* 当前服务下 所有版本上线状态检查
* @param bizId 业务ID
* @param appId 应用ID
* @param releaseId 版本ID
* @returns
*/
export const versionStatusCheck = (bizId: string, appId: number) =>
http.get(`/config/biz_id/${bizId}/app_id/${appId}/last/publish`);
8 changes: 8 additions & 0 deletions bcs-services/bcs-bscp/ui/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,11 @@ export const loginOut = () =>
http.get('/logout').then((resp) => {
window.location.href = `${resp.data.login_url}${encodeURIComponent(window.location.href)}&is_from_logout=1`;
});

/**
* 审批人员名单
* @returns
*/
export const approverListApi = () =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方法是返回一个api的地址,方法名称改一下,建议用get开头

`${(window as any).User_Man_Host}/api/c/compapi/v2/usermanage/fs_list_users/?app_code=bk-magicbox&page_size=1000&page=1`;
// /api/c/compapi/v2/usermanage/fs_list_users/?app_code=bk-magicbox&page_size=1000&page=1"
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 @@ -177,6 +177,7 @@
{ id: 'configuration-example', module: 'example', name: t('配置示例') },
],
},
{ id: 'records-all', module: 'records', name: t('操作记录') },
]);

const optionList = ref<ISpaceDetail[]>([]);
Expand Down
27 changes: 27 additions & 0 deletions bcs-services/bcs-bscp/ui/src/components/user-selector/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<BkMemberSelector v-bind="$attrs" :class="{ 'input-error': isError }">
<template v-for="(obj, name) in $slots" #[name]="data">
<slot :name="name" v-bind="data" />
</template>
</BkMemberSelector>
</template>
<script setup lang="ts">
import BkMemberSelector from './user-selector-origin/index';

withDefaults(
defineProps<{
isError: boolean;
}>(),
{},
);
</script>
<style lang="scss" scoped>
.input-error {
:deep(.user-selector-layout) {
.user-selector-container {
transition: all 0.3s;
border-color: #ea3636;
}
}
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// @ts-nocheck
import { computed, defineComponent, toRefs, withModifiers } from 'vue';

import RenderAvatar from './render-avatar';
import RenderList from './render-list';
import tooltips from './tooltips';

export default defineComponent({
name: 'AlternateItem',
directives: {
tooltips,
},
// props: ['selector', 'user', 'keyword', 'index'],
props: {
selector: {
type: Object,
},
user: {
type: Object,
},
keyword: {
type: String,
},
index: {
type: Number,
},
},
setup(props) {
const { selector, user, keyword } = toRefs(props);
const disabled = computed(() => selector.value.disabledUsers.includes(user.value.username));
const getItemContent = () => {
const [nameWithoutDomain, domain] = user.value.username.split('@');
let displayText = nameWithoutDomain;
if (keyword.value) {
displayText = displayText.replace(
new RegExp(keyword.value, 'g'),
`<span>${keyword.value}</span>`,
);
}
const displayUsername = selector.value.displayDomain && domain
? `${displayText}@${domain}`
: displayText;

const displayName = user.value.display_name;
if (displayName) {
return `${displayUsername}(${displayName})`;
}

return displayUsername;
};
const getTitle = () => selector.value.getDisplayText(user.value);

return {
disabled,
getItemContent,
getTitle,
};
},
render() {
return (
<li
class={[
'alternate-item',
this.index === this.selector.highlightIndex ? 'highlight' : '',
this.disabled && !this.selector.renderList ? 'disabled' : '',
]}
onClick={(e) => e.stopPropagation()}
onMousedown={withModifiers(() => this.selector.handleUserMousedown(this.user, this.disabled), ['left', 'stop'])}
onMouseup={withModifiers(() => this.selector.handleUserMouseup(this.user, this.disabled), ['left', 'stop'])}>
{
this.selector.renderList
? <>
<RenderList
selector={this.selector}
keyword={this.keyword}
user={this.user}
disabled={this.disabled}
>
</RenderList>
</>
: <>
{
this.selector.tagType === 'avatar'
? <>
<RenderAvatar
class="item-avatar"
user={this.user}
urlMethod={this.selector.avatarUrl}>
</RenderAvatar>
</>
: null
}
{
this.selector.displayListTips && this.user.category_name
? <>
<span
class="item-folder"
v-tooltips={{
placement: 'right',
interactive: true,
theme: 'light list-item-tips',
content: this.user.category_name,
offset: [0, 18],
}}>
{ this.user.category_name }
</span>
</>
: null
}
<span
class="item-name"
title={this.getTitle()}
v-html={this.getItemContent()}
></span>
</>
}
</li>
);
},
});
Loading
Loading