diff --git a/mindinsight/ui/src/components/header.vue b/mindinsight/ui/src/components/header.vue
index fab5125f..681e6d9e 100644
--- a/mindinsight/ui/src/components/header.vue
+++ b/mindinsight/ui/src/components/header.vue
@@ -29,7 +29,7 @@ limitations under the License.
class="el-menu-demo"
mode="horizontal">
{{$t("summaryManage.summaryList")}}
- {{$t("debugger.debugger")}}
+ {{$t("debugger.debugger")}}
{{$t("explain.explain")}}
@@ -107,6 +107,7 @@ export default {
isLanguage: true,
timeReloadValue: this.$store.state.timeReloadValue,
newReloadValue: this.$store.state.timeReloadValue,
+ showDebugger: window.enableDebugger,
};
},
computed: {
diff --git a/mindinsight/ui/src/main.js b/mindinsight/ui/src/main.js
index 37f5a14e..7fd0b1fb 100644
--- a/mindinsight/ui/src/main.js
+++ b/mindinsight/ui/src/main.js
@@ -25,6 +25,7 @@ import i18n from './i18n';
import $ from 'jquery';
import locale from 'element-ui/lib/locale/lang/en';
import localezh from 'element-ui/lib/locale/lang/zh-CN';
+import {basePath} from '@/services/fetcher';
let language = window.localStorage.getItem('milang');
const languageList = ['zh-cn', 'en-us'];
@@ -44,6 +45,10 @@ Vue.prototype.$bus = new Vue();
// Route interception
router.beforeEach((to, from, next) => {
+ if (!window.enableDebugger && to.path === '/debugger') {
+ next('/');
+ return;
+ }
// cancel request
if (from.path !== '/') {
store.commit('clearToken');
@@ -83,12 +88,10 @@ function isBrowserSupport() {
return false;
}
}
-
-window.onload = function(e) {
- if (isBrowserSupport()) {
- Vue.prototype.$warmBrowser = true;
- }
- // Instantiation
+/**
+ * Instantiate App
+ */
+function appInstantiation() {
setTimeout(() => {
new Vue({
router,
@@ -97,4 +100,25 @@ window.onload = function(e) {
render: (h) => h(App),
}).$mount('#app');
}, 100);
+}
+
+window.enableDebugger = true;
+window.onload = function(e) {
+ if (isBrowserSupport()) {
+ Vue.prototype.$warmBrowser = true;
+ }
+ $.ajax({
+ url: `${basePath}v1/mindinsight/ui-config`,
+ type: 'GET',
+ dataType: 'json',
+ success: (data) => {
+ if (data) {
+ window.enableDebugger = data.enable_debugger;
+ }
+ appInstantiation();
+ },
+ error: ()=> {
+ appInstantiation();
+ },
+ });
};