mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
We no longer need to load the plugin separately when nevigating to a harvester cluster
Because it's all one extension/plugin we don't need to do this separately anymore. This was causing conflicts with dev load.
This commit is contained in:
parent
2d2615128c
commit
30682dc638
@ -168,42 +168,8 @@ export default class HciCluster extends ProvCluster {
|
|||||||
return uiInfo ? this._supportedClusterPkgDetails(uiInfo, clusterId) : this._legacyClusterPkgDetails();
|
return uiInfo ? this._supportedClusterPkgDetails(uiInfo, clusterId) : this._legacyClusterPkgDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadClusterPlugin() {
|
|
||||||
// Skip loading if it's built in
|
|
||||||
const plugins = this.$rootState.$plugin.getPlugins();
|
|
||||||
const loadedPkgs = Object.keys(plugins);
|
|
||||||
|
|
||||||
if (loadedPkgs.find((pkg) => pkg === HARVESTER_NAME)) {
|
|
||||||
console.info('Harvester plugin built is built in, skipping load from external sources'); // eslint-disable-line no-console
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the plugin name and the url it can be fetched from
|
|
||||||
const { pkgUrl, pkgName } = await this._pkgDetails();
|
|
||||||
|
|
||||||
console.info('Harvester plugin details: ', pkgName, pkgUrl); // eslint-disable-line no-console
|
|
||||||
|
|
||||||
// Skip loading if we've previously loaded the correct one
|
|
||||||
if (!!plugins[pkgName]) {
|
|
||||||
console.info('Harvester plugin already loaded, no need to load', pkgName); // eslint-disable-line no-console
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.info('Attempting to load Harvester plugin', pkgName); // eslint-disable-line no-console
|
|
||||||
|
|
||||||
const res = await this.$rootState.$plugin.loadAsync(pkgName, pkgUrl);
|
|
||||||
|
|
||||||
console.info('Loaded Harvester plugin', pkgName); // eslint-disable-line no-console
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
async goToCluster() {
|
async goToCluster() {
|
||||||
await this.loadClusterPlugin()
|
this.currentRouter().push({
|
||||||
.then(() => {
|
|
||||||
this.currentRouter().push({
|
|
||||||
name: `${ VIRTUAL }-c-cluster-resource`,
|
name: `${ VIRTUAL }-c-cluster-resource`,
|
||||||
params: {
|
params: {
|
||||||
cluster: this.status.clusterName,
|
cluster: this.status.clusterName,
|
||||||
@ -211,17 +177,5 @@ export default class HciCluster extends ProvCluster {
|
|||||||
resource: HCI.DASHBOARD // Go directly to dashboard to avoid blip of components on screen
|
resource: HCI.DASHBOARD // Go directly to dashboard to avoid blip of components on screen
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
const message = typeof error === 'object' ? JSON.stringify(err) : err;
|
|
||||||
|
|
||||||
console.error('Failed to load harvester package: ', message); // eslint-disable-line no-console
|
|
||||||
|
|
||||||
this.$dispatch('growl/error', {
|
|
||||||
title: this.t('harvesterManager.plugins.loadError'),
|
|
||||||
message,
|
|
||||||
timeout: 5000
|
|
||||||
}, { root: true });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user