From 9b7e0b74fc7555df6501201c7b51abd219bb9b42 Mon Sep 17 00:00:00 2001 From: Neil MacDougall Date: Sun, 23 May 2021 20:22:17 +0100 Subject: [PATCH] Tidy ups --- config/product/legacy.js | 16 ++++++++-------- config/product/settings.js | 9 +++++++-- pages/c/_cluster/explorer/tools/index.vue | 21 +-------------------- store/type-map.js | 6 ++++-- 4 files changed, 20 insertions(+), 32 deletions(-) diff --git a/config/product/legacy.js b/config/product/legacy.js index 3b19647012..fe95a58aa4 100644 --- a/config/product/legacy.js +++ b/config/product/legacy.js @@ -1,5 +1,5 @@ import { LEGACY } from '@/store/features'; -import { DSL } from '@/store/type-map'; +import { DSL, IF_HAVE } from '@/store/type-map'; export const NAME = 'legacy'; @@ -50,7 +50,7 @@ export function init(store) { }); virtualType({ - ifHave: 'project', + ifHave: IF_HAVE.PROJECT, label: 'Project', namespaced: true, name: 'v1-project', @@ -62,7 +62,7 @@ export function init(store) { }); virtualType({ - ifHave: 'no-project', + ifHave: IF_HAVE.NO_PROJECT, label: 'Project', namespaced: true, name: 'v1-project-overview', @@ -83,7 +83,7 @@ export function init(store) { // Project Pages virtualType({ - ifHave: 'project', + ifHave: IF_HAVE.PROJECT, label: 'Alerts', namespaced: true, name: 'project-alerts', @@ -94,7 +94,7 @@ export function init(store) { }); virtualType({ - ifHave: 'project', + ifHave: IF_HAVE.PROJECT, label: 'Apps', namespaced: true, name: 'project-apps', @@ -105,7 +105,7 @@ export function init(store) { }); virtualType({ - ifHave: 'project', + ifHave: IF_HAVE.PROJECT, label: 'Catalogs', namespaced: true, name: 'project-catalogs', @@ -116,7 +116,7 @@ export function init(store) { }); virtualType({ - ifHave: 'project', + ifHave: IF_HAVE.PROJECT, label: 'Logging', namespaced: true, name: 'project-logging', @@ -127,7 +127,7 @@ export function init(store) { }); virtualType({ - ifHave: 'project', + ifHave: IF_HAVE.PROJECT, label: 'Monitoring', namespaced: true, name: 'project-monitoring', diff --git a/config/product/settings.js b/config/product/settings.js index 4269ed72fc..9858bc6406 100644 --- a/config/product/settings.js +++ b/config/product/settings.js @@ -1,6 +1,11 @@ -import { FEATURE_DESCRIPTION, RESTART, SIMPLE_NAME, STATE } from '@/config/table-headers'; -import { MANAGEMENT } from '@/config/types'; import { DSL } from '@/store/type-map'; +import { MANAGEMENT } from '@/config/types'; +import { + STATE, + SIMPLE_NAME, + FEATURE_DESCRIPTION, + RESTART, +} from '@/config/table-headers'; export const NAME = 'settings'; diff --git a/pages/c/_cluster/explorer/tools/index.vue b/pages/c/_cluster/explorer/tools/index.vue index 51557c6002..e20f1de03f 100644 --- a/pages/c/_cluster/explorer/tools/index.vue +++ b/pages/c/_cluster/explorer/tools/index.vue @@ -22,8 +22,7 @@ export default { this.showDeprecated = query[DEPRECATED] === _FLAGGED; this.showHidden = query[HIDDEN] === _FLAGGED; - this.allInstalled = await this.$store.dispatch('cluster/findAll', { type: CATALOG.APP, opt: { force: true } }); - // this.allInstalled = await this.$store.dispatch('cluster/findAll', { type: CATALOG.APP }); + this.allInstalled = await this.$store.dispatch('cluster/findAll', { type: CATALOG.APP }); // If legacy feature flag enabled if (this.legacyEnabled) { @@ -114,33 +113,15 @@ export default { return [ this._legacyChart('monitoring'), this._legacyChart('logging'), - // this._legacyChart('istio'), ]; } }, mounted() { window.c = this; - - // start a timer - // this._checkMonitoring(); }, methods: { - // _checkMonitoring() { - // setTimeout(() => { - // console.log('>> V1 Monitoring >>>>>>>>>>>>>>>>>>'); - // const s = this.currentCluster?.status; - // if (s) { - // console.log(JSON.parse(JSON.stringify(s))); - // } else { - // console.log('Monitoring not installed'); - // } - // console.log(this.installedApps); - // this._checkMonitoring(); - // }, 5000); - // }, - _legacyChart(id) { return { certifiedSort: 1, diff --git a/store/type-map.js b/store/type-map.js index 35e794820e..d58de0707d 100644 --- a/store/type-map.js +++ b/store/type-map.js @@ -140,6 +140,8 @@ const instanceMethods = {}; export const IF_HAVE = { V1_MONITORING: 'v1-monitoring', V2_MONITORING: 'v2-monitoring', + PROJECT: 'project', + NO_PROJECT: 'no-project', }; export function DSL(store, product, module = 'type-map') { @@ -1466,10 +1468,10 @@ function ifHave(getters, option) { case IF_HAVE.V1_MONITORING: { return haveV1Monitoring(getters); } - case 'project': { + case IF_HAVE.PROJECT: { return !!project(getters); } - case 'no-project': { + case IF_HAVE.NO_PROJECT: { return !project(getters); } default: