mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
Enable standalone mode for harvester cluster routing
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
parent
cb76589e95
commit
bd2d8b1878
@ -65,6 +65,27 @@ export function init($plugin, store) {
|
|||||||
weightType,
|
weightType,
|
||||||
} = $plugin.DSL(store, PRODUCT_NAME);
|
} = $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({
|
product({
|
||||||
inStore: 'harvester',
|
inStore: 'harvester',
|
||||||
removable: false,
|
removable: false,
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import extensionRoutes from './routing/harvester-routing';
|
|||||||
import harvesterCommonStore from './store/harvester-common';
|
import harvesterCommonStore from './store/harvester-common';
|
||||||
import harvesterStore from './store/harvester-store';
|
import harvesterStore from './store/harvester-store';
|
||||||
import customValidators from './validators';
|
import customValidators from './validators';
|
||||||
|
import { PRODUCT_NAME } from './config/harvester';
|
||||||
|
|
||||||
// Init the package
|
// Init the package
|
||||||
export default function (plugin: IPlugin) {
|
export default function (plugin: IPlugin) {
|
||||||
@ -17,7 +18,12 @@ export default function (plugin: IPlugin) {
|
|||||||
// Built-in icon
|
// Built-in icon
|
||||||
plugin.metadata.icon = require('./icon.svg');
|
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.addProduct(require('./config/harvester-cluster'));
|
||||||
|
|
||||||
plugin.addDashboardStore(harvesterCommonStore.config.namespace, harvesterCommonStore.specifics, harvesterCommonStore.config);
|
plugin.addDashboardStore(harvesterCommonStore.config.namespace, harvesterCommonStore.specifics, harvesterCommonStore.config);
|
||||||
|
|||||||
@ -3,11 +3,11 @@ import { PRODUCT_NAME } from '../../../config/harvester';
|
|||||||
import { HCI } from '../../../types';
|
import { HCI } from '../../../types';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
middleware({ redirect, route }) {
|
beforeCreate() {
|
||||||
return redirect({
|
this.$router.replace({
|
||||||
name: `${ PRODUCT_NAME }-c-cluster-resource`,
|
name: `${ PRODUCT_NAME }-c-cluster-resource`,
|
||||||
params: {
|
params: {
|
||||||
...route.params,
|
...this.$router.currentRoute.params,
|
||||||
product: PRODUCT_NAME,
|
product: PRODUCT_NAME,
|
||||||
resource: HCI.DASHBOARD
|
resource: HCI.DASHBOARD
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,36 @@
|
|||||||
<script>
|
<script>
|
||||||
import ExplorerProjectsNamespaces from '@shell/components/ExplorerProjectsNamespaces';
|
import ExplorerProjectsNamespaces from '@shell/components/ExplorerProjectsNamespaces.vue';
|
||||||
export default { components: { ExplorerProjectsNamespaces } };
|
import { PRODUCT_NAME as HARVESTER_PRODUCT } from '../../../config/harvester';
|
||||||
|
import { MANAGEMENT, NAMESPACE } from '@shell/config/types';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { ExplorerProjectsNamespaces },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
createProjectLocation: {
|
||||||
|
name: `${ HARVESTER_PRODUCT }-c-cluster-resource-create`,
|
||||||
|
params: {
|
||||||
|
product: HARVESTER_PRODUCT,
|
||||||
|
cluster: this.$store.getters['currentCluster']?.id,
|
||||||
|
resource: MANAGEMENT.PROJECT
|
||||||
|
},
|
||||||
|
},
|
||||||
|
createNamespaceLocation: {
|
||||||
|
name: `${ HARVESTER_PRODUCT }-c-cluster-resource-create`,
|
||||||
|
params: {
|
||||||
|
product: HARVESTER_PRODUCT,
|
||||||
|
resource: NAMESPACE
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template><ExplorerProjectsNamespaces v-bind="$attrs" /></template>
|
<template>
|
||||||
|
<ExplorerProjectsNamespaces
|
||||||
|
v-bind="$attrs"
|
||||||
|
:create-project-location-override="createProjectLocation"
|
||||||
|
:create-namespace-location-override="createNamespaceLocation"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user