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

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

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