From f93a9470577969925c84101aa5de306d6e986950 Mon Sep 17 00:00:00 2001 From: ph Date: Fri, 15 Jan 2021 09:49:08 +0800 Subject: [PATCH] ui hide debugger sheet if debugger is not enabled --- mindinsight/ui/src/components/header.vue | 3 ++- mindinsight/ui/src/main.js | 32 +++++++++++++++++++----- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/mindinsight/ui/src/components/header.vue b/mindinsight/ui/src/components/header.vue index c14ad48c..af84c3ab 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 ef7a0b8d..f45d61d8 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']; @@ -83,12 +84,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 +96,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(); + }, + }); };