提交 36f2bb32 编写于 作者: C Captain.B 提交者: 刘瑞斌

feat(系统设置): 功能模块支持启用、禁用(X-Pack)

上级 63e9e0d5
Subproject commit 493663be7c000ceef5913783788def1f43b15b2f
Subproject commit 5f113d50f0d1d3c410b8ccd94cb5c9c944f2272c
......@@ -8,17 +8,20 @@
@select="handleSelect"
router>
<el-menu-item index="/track" v-permission="['test_manager','test_user','test_viewer']">
<el-menu-item index="/track" v-if="check('testTrack')" v-permission="['test_manager','test_user','test_viewer']">
{{ $t('test_track.test_track') }}
</el-menu-item>
<el-menu-item index="/api" @click="active()" v-permission="['test_manager','test_user','test_viewer']">
<el-menu-item index="/api" @click="active()" v-if="check('api')"
v-permission="['test_manager','test_user','test_viewer']">
{{ $t('commons.api') }}
</el-menu-item>
<el-menu-item index="/performance" onselectstart="return false"
<el-menu-item index="/performance" v-if="check('performance')"
onselectstart="return false"
v-permission="['test_manager','test_user','test_viewer']">
{{ $t('commons.performance') }}
</el-menu-item>
<el-menu-item index="/report" v-permission="['test_manager','test_user','test_viewer']" v-if="isReport">
<el-menu-item index="/report" v-permission="['test_manager','test_user','test_viewer']"
v-if="isReport && check('reportStat')">
{{ $t('commons.report_statistics.title') }}
</el-menu-item>
......@@ -29,67 +32,82 @@
</template>
<script>
import {LicenseKey} from '@/common/js/constants';
import {mapGetters} from "vuex";
import {LicenseKey} from '@/common/js/constants';
import {mapGetters} from "vuex";
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/);
const report = requireContext.keys().map(key => requireContext(key).report);
const isReport = report && report != null && report.length > 0 && report[0] != undefined ? true : false;
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/)
const report = requireContext.keys().map(key => requireContext(key).report);
const isReport = report && report != null && report.length > 0 && report[0] != undefined ? true : false;
export default {
name: "MsTopMenus",
data() {
return {
activeIndex: '/',
isReport: isReport
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const module = requireComponent.keys().length > 0 ? requireComponent("./module/Module.vue") : {};
export default {
name: "MsTopMenus",
data() {
return {
activeIndex: '/',
isReport: isReport,
modules: {}
};
},
props: {
color: String
},
watch: {
'$route'(to) {
if (to.matched.length > 0) {
this.activeIndex = to.matched[0].path;
}
},
props: {
color: String
},
watch: {
'$route'(to) {
if (to.matched.length > 0) {
this.activeIndex = to.matched[0].path;
}
this.handleSelect(this.activeIndex);
this.handleSelect(this.activeIndex);
}
},
mounted() {
if (this.$route.matched.length > 0) {
this.activeIndex = this.$route.matched[0].path;
}
let license = localStorage.getItem(LicenseKey);
if (license != "valid") {
this.isReport = false;
} else {
if (module.default) {
module.default.listModules(this);
}
}
},
computed: {
...mapGetters([
'isNewVersion',
'isOldVersion',
])
},
methods: {
handleSelect(index) {
this.activeIndex = index;
},
mounted() {
if (this.$route.matched.length > 0) {
this.activeIndex = this.$route.matched[0].path;
}
let license = localStorage.getItem(LicenseKey);
if (license != "valid") {
this.isReport = false;
active() {
if (this.activeIndex === '/api') {
if (this.isNewVersion) {
window.location.href = "/#/api/home";
} else if (this.isOldVersion) {
window.location.href = "/#/api/home_obsolete";
}
}
},
computed: {
...mapGetters([
'isNewVersion',
'isOldVersion',
])
},
methods: {
handleSelect(index) {
this.activeIndex = index
},
active() {
if (this.activeIndex === '/api') {
if (this.isNewVersion) {
window.location.href = "/#/api/home";
} else if (this.isOldVersion) {
window.location.href = "/#/api/home_obsolete";
}
}
check(key) {
if (module.default !== undefined) {
return true;
}
return this.modules[key] === 'ENABLE';
}
}
};
</script>
<style scoped>
.el-menu >>> .el-menu-item {
box-sizing: border-box;
height: 40px;
}
.el-menu >>> .el-menu-item {
box-sizing: border-box;
height: 40px;
}
</style>
......@@ -17,6 +17,9 @@
<el-tab-pane v-if="hasLicense()" :label="$t('auth_source.title')" name="auth">
<ms-auth/>
</el-tab-pane>
<el-tab-pane v-if="hasLicense()" :label="$t('module.title')" name="module">
<ms-module/>
</el-tab-pane>
</el-tabs>
</el-card>
</template>
......@@ -30,6 +33,7 @@ import {hasLicense} from '@/common/js/utils';
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {};
const auth = requireComponent.keys().length > 0 ? requireComponent("./auth/Auth.vue") : {};
const module = requireComponent.keys().length > 0 ? requireComponent("./module/Module.vue") : {};
export default {
name: "SystemParameterSetting",
......@@ -39,16 +43,17 @@ export default {
LdapSetting,
"MsDisplay": display.default,
"MsAuth": auth.default,
"MsModule": module.default,
},
data() {
return {
activeName: 'base',
}
};
},
methods: {
hasLicense,
}
}
};
</script>
<style scoped>
......
Subproject commit a37e6bb56ffaa7ecc4ee128640e9415304ad41b6
Subproject commit 449b55084bd1721b2ebf25bfc82d255354092c3b
......@@ -991,7 +991,7 @@ export default {
unit_of_measurement: "",
unit_of_count: "",
unit_of_times: "times",
formula:{
formula: {
completion: "finished api / all api * 100%",
coverage: "apis whitch have test case / all apis * 100%",
pass: "scenarios whitch final execute is sucess / all scenarios * 100%",
......@@ -1678,6 +1678,9 @@ export default {
title: 'Auth Source',
auth_name_valid: 'Name does not support special characters',
},
module: {
title: 'Module Management'
},
table: {
header_display_field: 'Header display field',
fields_to_be_selected: 'Fields to be selected',
......
......@@ -995,7 +995,7 @@ export default {
unit_of_measurement: "",
unit_of_count: "",
unit_of_times: "",
formula:{
formula: {
completion: "已完成的接口/接口总数*100%",
coverage: "有案例的接口/接口总数*100%",
pass: "最后一次执行成功的场景/场景总数*100%",
......@@ -1681,6 +1681,9 @@ export default {
title: '认证设置',
auth_name_valid: '名称不支持特殊字符',
},
module: {
title: '模块管理'
},
table: {
header_display_field: '表头显示字段',
fields_to_be_selected: '待选字段',
......
......@@ -1679,6 +1679,9 @@ export default {
title: '認證設置',
auth_name_valid: '名稱不支持特殊字符',
},
module: {
title: '模塊管理'
},
table: {
header_display_field: '表頭顯示欄位',
fields_to_be_selected: '待選欄位',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册