Skip to content

Commit

Permalink
Merge pull request #1894 from lhzzforever/dev/ft_ci
Browse files Browse the repository at this point in the history
Dev/ft ci
  • Loading branch information
huangpeng0428 authored Apr 3, 2023
2 parents 7431cd6 + 2e84a00 commit 27a2b49
Show file tree
Hide file tree
Showing 22 changed files with 211 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
import IamSearchSelect from '@/components/iam-search-select';
import { fuzzyRtxSearch } from '@/common/rtx';
import { formatCodeData } from '@/common/util';
import { mapGetters } from 'vuex';
export default {
name: '',
Expand Down Expand Up @@ -253,6 +254,7 @@
};
},
computed: {
...mapGetters(['externalSystemId']),
isLoading () {
return this.requestQueue.length > 0 && this.isShowDialog;
},
Expand Down Expand Up @@ -439,7 +441,11 @@
},
handleRemoteSystem (value) {
return this.$store.dispatch('system/getSystems')
const params = {};
if (this.externalSystemId) {
params.hidden = false;
}
return this.$store.dispatch('system/getSystems', params)
.then(({ data }) => {
return data.map(({ id, name }) => ({ id, name })).filter(item => item.name.indexOf(value) > -1);
});
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/render-user-group-dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
<script>
import IamSearchSelect from '@/components/iam-search-select';
import { formatCodeData } from '@/common/util';
import { mapGetters } from 'vuex';
export default {
name: '',
Expand Down Expand Up @@ -202,6 +203,7 @@
};
},
computed: {
...mapGetters(['externalSystemId']),
isLoading () {
return this.requestQueue.length > 0 && this.isShowDialog;
},
Expand Down Expand Up @@ -331,7 +333,11 @@
},
handleRemoteSystem (value) {
return this.$store.dispatch('system/getSystems')
const params = {};
if (this.externalSystemId) {
params.hidden = false;
}
return this.$store.dispatch('system/getSystems', params)
.then(({ data }) => {
return data.map(({ id, name }) => ({ id, name })).filter(item => item.name.indexOf(value) > -1);
});
Expand Down
24 changes: 16 additions & 8 deletions frontend/src/language/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ export const m = {
'申请自定义权限标题': 'If the previous permission package does not meet your needs, please apply for the permission through customization',
'申请自定义权限场景1': 'Certain permissions for a single system',
'申请自定义权限场景2': 'More flexible permission requirements',
'申请加入用户组搜索提示': 'Enter group name, description, belonging system, hierarchical administrator, etc. to search',
'申请加入用户组搜索提示': 'Enter group name, description, belonging system,,rating management space, etc. to search',
'超级管理员申请加入用户组搜索提示': 'Search Tips for Super Administrators Applying to Join User Groups',
'请输入条件搜索用户组': 'Please enter criteria to search for user groups'
},
Expand Down Expand Up @@ -704,7 +704,7 @@ export const m = {
'选择可授权人员范围': 'Select scope of authorized personnel',
'被授权范围': 'Authorized scope',
'添加系统和操作': 'Add systems and actions',
'修改一级管理空间授权范围': 'Modify the authorization scope of hierarchical administrator',
'修改一级管理空间授权范围': 'Modify the authorization scope of,rating management space',
'刷新列表': 'Refresh List',
'如需编辑一级管理空间的内容请点击': 'Click to edit',
'操作和资源范围': 'Actions and resources',
Expand Down Expand Up @@ -873,13 +873,14 @@ export const m = {
'权限模板成员更新': 'Permission template update members',
'权限模板预更新创建': 'Permission template pre-update creation',
'权限模板预更新删除': 'Permission template pre-update delete',
'创建一级管理空间': 'Create hierarchical administrator',
'一级管理空间增加成员': 'Hierarchical administrator add members',
'一级管理空间删除成员': 'Hierarchical administrator delete members',
'一级管理空间修改成员': 'Hierarchical administrator update members',
'创建一级管理空间': 'Create rating management space',
'管理员创建': 'Administrator Create',
'一级管理空间增加成员': 'rating management space add members',
'一级管理空间删除成员': 'rating management space delete members',
'一级管理空间修改成员': 'rating management space update members',
'成员创建默认权限': 'Members create default permissions',
'成员删除默认权限': 'Members delete default permissions',
'更新一级管理空间': 'Update hierarchical manager',
'更新一级管理空间': 'Update the primary management space',
'管理员成员增加': 'Admin member increase',
'管理员成员删除': 'Admin member delete',
'管理员成员修改': 'Admin member modification',
Expand All @@ -890,8 +891,14 @@ export const m = {
'管理员常用操作新建': 'Common operations for administrators',
'管理员常用操作删除': 'Admin common operations delete',
'组织架构同步': 'Organizational structure synchronization',
'ADMIN-API白名单创建': 'ADMIN-API whitelist create',
'ADMIN-API白名单删除': 'ADMIN-API whitelist delete',
'授权类API白名单创建': 'Author class API whitelist create',
'授权类API白名单删除': 'Author class API whitelist delete',
'管理类API白名单创建': 'Management class API whitelist create',
'管理类API白名单删除': 'Management class API whitelist delete',
'回滚事件': 'Rollback event',
'一级管理空间用户组成员续期': 'Hierarchical administrator group members renew',
'一级管理空间用户组成员续期': 'rating management space group members renew',
'用户组成员续期': 'Group members renew',
'页面': 'Page',
'权限模板版本全量同步': 'Permission template version is fully synchronized',
Expand All @@ -901,6 +908,7 @@ export const m = {
'新建常用操作': 'Create common actions',
'删除常用操作': 'Delete common actions',
'权限模板更新同步': 'Permission template update synchronization',
'权限模板更新提交': 'Perm template update submit',
'修改用户组审批流程': 'Modify the group approval process',
'修改默认审批流程': 'Modify the default approval process',
'修改操作审批流程': 'Modify the operation approval process',
Expand Down
24 changes: 17 additions & 7 deletions frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import './common/bkmagic';
// 全量引入自定义图标
import './assets/iconfont/style.css';

import { lang, locale } from 'bk-magic-vue';
import magicbox from 'bk-magic-vue';

import '@icon-cool/bk-icon-bk-iam';

Expand All @@ -73,13 +73,18 @@ Vue.prototype.scrollToLocation = function ($ref) {
};

Vue.use(VueI18n);
Vue.use(magicbox, {
i18n: (key, args) => i18n.t(key, args)
});

console.log('start');

const cn = require('./language/lang/zh');

const en = require('./language/lang/en');

const { lang, locale } = magicbox;

const messages = {
'zh-cn': Object.assign(lang.zhCN, cn),
en: Object.assign(lang.enUS, en)
Expand All @@ -93,14 +98,19 @@ const i18n = new VueI18n({
locale: language,
fallbackLocale: 'zh-cn',
// this.$i18n.locale 通过切换locale的值来实现语言切换
messages: messages
messages: messages,
missing (locale, path) {
const parsedPath = i18n._path.parsePath(path);
return parsedPath[parsedPath.length - 1];
}
});

if (language === 'zh-cn') {
locale.use(lang.zhCN);
} else {
locale.use(lang.enUS);
}
// if (language === 'zh-cn') {
// locale.use(lang.zhCN);
// } else {
// console.log(lang.enUS, 6555);
// }
locale.use(language === 'zh-cn' ? lang.zhCN : lang.enUS);

locale.i18n((key, value) => i18n.t(key, value));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
import editProcessDialog from './edit-process-dialog';
import { buildURLParams } from '@/common/url';
import { formatCodeData } from '@/common/util';
import { mapGetters } from 'vuex';
export default {
name: '',
components: {
Expand Down Expand Up @@ -155,6 +156,7 @@
};
},
computed: {
...mapGetters(['externalSystemId']),
isCanBatchDelete () {
return this.currentSelectList.length > 0 && this.tableList.length > 0;
},
Expand Down Expand Up @@ -222,7 +224,11 @@
methods: {
async fetchSystemList () {
try {
const res = await this.$store.dispatch('system/getSystems');
const params = {};
if (this.externalSystemId) {
params.hidden = false;
}
const res = await this.$store.dispatch('system/getSystems', params);
this.systemList = res.data;
setTimeout(() => {
if (this.cacheSystemId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
import { leaveConfirm } from '@/common/leave-confirm';
import { guid, formatCodeData } from '@/common/util';
import RenderActionTag from '@/components/common-action';
import { mapGetters } from 'vuex';
export default {
name: '',
Expand Down Expand Up @@ -240,6 +241,7 @@
};
},
computed: {
...mapGetters(['externalSystemId']),
isLoading () {
return this.initRequestQueue.length > 0;
},
Expand Down Expand Up @@ -501,6 +503,10 @@
async fetchSystems () {
this.systemListIsLoading = true;
try {
const params = {};
if (this.externalSystemId) {
params.hidden = false;
}
const { code, data } = await this.$store.dispatch('system/getSystems');
this.systemList = _.cloneDeep(data);
this.curSystemList = _.cloneDeep(data);
Expand Down
92 changes: 48 additions & 44 deletions frontend/src/views/group/components/add-action-sideslider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
</div>
</div>
<div class="right-wrapper" v-bkloading="{ isLoading: isRightLoading, opacity: 1, color: '#f5f6fa' }">
<template v-if="systemData[curSystem].list.length > 0 && !isRightLoading">
<template v-if="systemData[curSystem] && systemData[curSystem].list.length > 0 && !isRightLoading">
<render-action-tag
style="margin: 0;"
:system-id="curSystem"
Expand Down Expand Up @@ -155,7 +155,7 @@
</section>
</div>
</template>
<template v-if="systemData[curSystem].list.length < 1 && !isRightLoading">
<template v-if="systemData[curSystem] && !systemData[curSystem].list.length && !isRightLoading">
<div class="empty-wrapper">
<ExceptionEmpty
:type="emptyData.type"
Expand Down Expand Up @@ -497,13 +497,15 @@
async fetchSystems () {
this.systemListIsLoading = true;
try {
const { code, data } = await this.$store.dispatch('system/getSystems');
this.systemList = _.cloneDeep(data);
this.curSystemList = _.cloneDeep(data);
this.curSystem = this.defaultSystem;
const params = {};
if (this.externalSystemId) {
params.hidden = false;
this.curSystem = this.externalSystemId;
}
const { code, data } = await this.$store.dispatch('system/getSystems', params);
this.systemList = _.cloneDeep(data);
this.curSystemList = _.cloneDeep(data);
this.emptyData = formatCodeData(code, this.emptyData, data.length === 0);
if (this.systemList.length) {
if (!this.curSystem) {
Expand Down Expand Up @@ -608,56 +610,58 @@
},
handleDefaultData (payload, data) {
this.systemData[payload].list = _.cloneDeep(data);
this.systemData[payload].list.forEach(item => {
if (!item.actions) {
item.actions = [];
}
if (!item.sub_groups) {
item.sub_groups = [];
}
let allChecked = true;
let allDisabled = true;
item.actions.forEach(act => {
act.$id = `${payload}&${act.id}`;
act.related_resource_types.forEach(v => {
v.type = v.id;
});
this.$set(act, 'checked', this.defaultValue.includes(act.$id) || this.curSelectValue.includes(act.$id) || (act.tag === 'readonly' && !!this.groupId));
if (!act.checked) {
allChecked = false;
if (this.systemData[payload]) {
this.systemData[payload].list = _.cloneDeep(data);
this.systemData[payload].list.forEach(item => {
if (!item.actions) {
item.actions = [];
}
if (act.tag === 'readonly' && !!this.groupId) {
this.$set(act, 'disabled', true);
++this.systemData[payload].count;
} else {
allDisabled = false;
if (!item.sub_groups) {
item.sub_groups = [];
}
this.linearAction.push(act);
});
item.sub_groups.forEach(act => {
(act.actions || []).forEach(v => {
v.$id = `${payload}&${v.id}`;
v.related_resource_types.forEach(subItem => {
subItem.type = subItem.id;
let allChecked = true;
let allDisabled = true;
item.actions.forEach(act => {
act.$id = `${payload}&${act.id}`;
act.related_resource_types.forEach(v => {
v.type = v.id;
});
this.$set(v, 'checked', this.defaultValue.includes(v.$id) || this.curSelectValue.includes(v.$id) || (v.tag === 'readonly' && !!this.groupId));
if (!v.checked) {
this.$set(act, 'checked', this.defaultValue.includes(act.$id) || this.curSelectValue.includes(act.$id) || (act.tag === 'readonly' && !!this.groupId));
if (!act.checked) {
allChecked = false;
}
if (v.tag === 'readonly' && !!this.groupId) {
this.$set(v, 'disabled', true);
if (act.tag === 'readonly' && !!this.groupId) {
this.$set(act, 'disabled', true);
++this.systemData[payload].count;
} else {
allDisabled = false;
}
this.linearAction.push(v);
this.linearAction.push(act);
});
item.sub_groups.forEach(act => {
(act.actions || []).forEach(v => {
v.$id = `${payload}&${v.id}`;
v.related_resource_types.forEach(subItem => {
subItem.type = subItem.id;
});
this.$set(v, 'checked', this.defaultValue.includes(v.$id) || this.curSelectValue.includes(v.$id) || (v.tag === 'readonly' && !!this.groupId));
if (!v.checked) {
allChecked = false;
}
if (v.tag === 'readonly' && !!this.groupId) {
this.$set(v, 'disabled', true);
++this.systemData[payload].count;
} else {
allDisabled = false;
}
this.linearAction.push(v);
});
});
this.$set(item, 'text', allChecked ? this.$t(`m.common['取消全选']`) : this.$t(`m.common['全选']`));
this.$set(item, 'allDisabled', allDisabled);
});
this.$set(item, 'text', allChecked ? this.$t(`m.common['取消全选']`) : this.$t(`m.common['全选']`));
this.$set(item, 'allDisabled', allDisabled);
});
this.systemData[payload].system_name = this.systemList.find(item => item.id === payload).name;
this.systemData[payload].system_name = this.systemList.find(item => item.id === payload).name;
}
if (this.defaultValue.length > 0) {
const curAllActionIds = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
};
},
computed: {
...mapGetters(['user']),
...mapGetters(['user', 'externalSystemId']),
isSubset () {
return this.user.role.type === 'subset_manager';
},
Expand Down Expand Up @@ -426,7 +426,11 @@
},
handleRemoteSystem (value) {
return this.$store.dispatch('system/getSystems')
const params = {};
if (this.externalSystemId) {
params.hidden = false;
}
return this.$store.dispatch('system/getSystems', params)
.then(({ data }) => {
return data.map(({ id, name }) => ({ id, name })).filter(item => item.name.indexOf(value) > -1);
});
Expand Down
Loading

0 comments on commit 27a2b49

Please sign in to comment.