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:
Cody Jackson 2024-09-17 08:55:21 -07:00 committed by Francesco Torchia
parent 2d2615128c
commit 30682dc638
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393

View File

@ -168,41 +168,7 @@ export default class HciCluster extends ProvCluster {
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() {
await this.loadClusterPlugin()
.then(() => {
this.currentRouter().push({
name: `${ VIRTUAL }-c-cluster-resource`,
params: {
@ -211,17 +177,5 @@ export default class HciCluster extends ProvCluster {
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 });
});
}
}