mirror of https://github.com/rancher/ui.git
Remove route action to load all MC App template versions
only load the versions we need rancher/rancher#17790
This commit is contained in:
parent
03a280a7fc
commit
75f2a5f274
|
|
@ -1,20 +1,26 @@
|
|||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { hash } from 'rsvp';
|
||||
import { all } from 'rsvp';
|
||||
import { get } from '@ember/object';
|
||||
|
||||
export default Route.extend({
|
||||
globalStore: service(),
|
||||
catalog: service(),
|
||||
|
||||
beforeModel() {
|
||||
return hash({
|
||||
templateversions: this.globalStore.find('templateversion'),
|
||||
templates: this.catalog.fetchTemplates(),
|
||||
});
|
||||
},
|
||||
|
||||
model() {
|
||||
return this.globalStore.findAll('multiclusterapp').then( (resp) => ({ apps: resp }));
|
||||
},
|
||||
|
||||
afterModel(model/* , transition */) {
|
||||
let promises = [];
|
||||
|
||||
get(model, 'apps').forEach((app) => {
|
||||
promises.push(this.catalog.fetchTemplate(get(app, 'templateVersionId'), true));
|
||||
});
|
||||
|
||||
return all(promises).then(() => {
|
||||
return this.catalog.fetchMultiClusterAppTemplates(get(model, 'apps'));
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -102,6 +102,20 @@ export default Service.extend({
|
|||
return allSettled(deps);
|
||||
},
|
||||
|
||||
fetchMultiClusterAppTemplates(apps) {
|
||||
let deps = [];
|
||||
|
||||
apps.forEach((app) => {
|
||||
let extInfo = get(app, 'externalIdInfo');
|
||||
|
||||
if ( extInfo && extInfo.templateId ) {
|
||||
deps.push(this.fetchTemplate(extInfo.templateId, false));
|
||||
}
|
||||
});
|
||||
|
||||
return allSettled(deps);
|
||||
},
|
||||
|
||||
fetchUnScopedCatalogs() {
|
||||
return hash({
|
||||
projectCatalogs: this.fetchCatalogs('projectCatalog'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue