diff --git a/pkg/harvester/config/harvester-cluster.js b/pkg/harvester/config/harvester-cluster.js index 9accb466..b873cc01 100644 --- a/pkg/harvester/config/harvester-cluster.js +++ b/pkg/harvester/config/harvester-cluster.js @@ -65,6 +65,27 @@ export function init($plugin, store) { weightType, } = $plugin.DSL(store, PRODUCT_NAME); + const isSingleVirtualCluster = process.env.rancherEnv === PRODUCT_NAME; + + if (isSingleVirtualCluster) { + const home = { + name: `${PRODUCT_NAME}-c-cluster-resource`, + params: { + product: PRODUCT_NAME, + resource: HCI.DASHBOARD + } + }; + + store.dispatch('setIsSingleProduct', { + logo: require(`@shell/assets/images/providers/harvester.svg`), + productNameKey: 'harvester.productLabel', + getVersionInfo: (store) => store.getters[`${PRODUCT_NAME}/byId`]?.(HCI.SETTING, 'server-version')?.value || 'unknown', + afterLoginRoute: home, + logoRoute: home, + supportCustomLogo: true + }); + } + product({ inStore: 'harvester', removable: false, diff --git a/pkg/harvester/index.ts b/pkg/harvester/index.ts index 04859a29..84ae5d0a 100644 --- a/pkg/harvester/index.ts +++ b/pkg/harvester/index.ts @@ -5,6 +5,7 @@ import extensionRoutes from './routing/harvester-routing'; import harvesterCommonStore from './store/harvester-common'; import harvesterStore from './store/harvester-store'; import customValidators from './validators'; +import { PRODUCT_NAME } from './config/harvester'; // Init the package export default function (plugin: IPlugin) { @@ -17,7 +18,12 @@ export default function (plugin: IPlugin) { // Built-in icon plugin.metadata.icon = require('./icon.svg'); - plugin.addProduct(require('./config/harvester-manager')); + const isSingleVirtualCluster = process.env.rancherEnv === PRODUCT_NAME; + + if (!isSingleVirtualCluster) { + plugin.addProduct(require('./config/harvester-manager')); + } + plugin.addProduct(require('./config/harvester-cluster')); plugin.addDashboardStore(harvesterCommonStore.config.namespace, harvesterCommonStore.specifics, harvesterCommonStore.config); diff --git a/pkg/harvester/pages/c/_cluster/index.vue b/pkg/harvester/pages/c/_cluster/index.vue index ef2a1d4c..4bd8a78a 100644 --- a/pkg/harvester/pages/c/_cluster/index.vue +++ b/pkg/harvester/pages/c/_cluster/index.vue @@ -3,11 +3,11 @@ import { PRODUCT_NAME } from '../../../config/harvester'; import { HCI } from '../../../types'; export default { - middleware({ redirect, route }) { - return redirect({ + beforeCreate() { + this.$router.replace({ name: `${ PRODUCT_NAME }-c-cluster-resource`, params: { - ...route.params, + ...this.$router.currentRoute.params, product: PRODUCT_NAME, resource: HCI.DASHBOARD } diff --git a/pkg/harvester/pages/c/_cluster/projectsnamespaces.vue b/pkg/harvester/pages/c/_cluster/projectsnamespaces.vue index ab1ffab3..14047abb 100644 --- a/pkg/harvester/pages/c/_cluster/projectsnamespaces.vue +++ b/pkg/harvester/pages/c/_cluster/projectsnamespaces.vue @@ -1,6 +1,36 @@ - \ No newline at end of file +