mirror of https://github.com/rancher/ui.git
Merge pull request #4795 from catherineluse/fix-mcapp-upgrade
This commit is contained in:
commit
e30d79f1ae
|
|
@ -19,17 +19,40 @@ export default Route.extend({
|
|||
var store = get(this, 'globalStore');
|
||||
|
||||
var dependencies = {
|
||||
tpl: get(this, 'catalog').fetchTemplate(params.template),
|
||||
projects: this.scope.getAllProjects(),
|
||||
clusters: this.scope.getAllClusters(),
|
||||
};
|
||||
|
||||
if ( params.upgrade ) {
|
||||
dependencies.upgrade = get(this, 'catalog').fetchTemplate(`${ params.template }-${ params.upgrade }`, true);
|
||||
}
|
||||
|
||||
|
||||
if (params.appId) {
|
||||
dependencies.app = store.find('multiclusterapp', params.appId);
|
||||
dependencies.app.then((appData) => {
|
||||
const getCurrentVersion = (app) => {
|
||||
const templateVersionId = app.templateVersionId;
|
||||
const splitId = templateVersionId.split('-');
|
||||
const currentVersion = splitId[splitId.length - 1];
|
||||
|
||||
return currentVersion;
|
||||
}
|
||||
const currentVersion = getCurrentVersion(appData);
|
||||
|
||||
// If an app ID is given, the current app version will be used in the
|
||||
// multi-cluster app launch route.
|
||||
dependencies.upgrade = get(this, 'catalog').fetchTemplate(`${ params.template }-${ params.upgrade }`, true, currentVersion);
|
||||
|
||||
dependencies.tpl = get(this, 'catalog').fetchTemplate(params.template, false, currentVersion);
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new Error(err);
|
||||
})
|
||||
} else {
|
||||
// If an app ID is not given, the current app version will not be used
|
||||
// in the multi-cluster app launch route.
|
||||
if ( params.upgrade ) {
|
||||
dependencies.upgrade = get(this, 'catalog').fetchTemplate(`${ params.template }-${ params.upgrade }`, true);
|
||||
}
|
||||
dependencies.tpl = get(this, 'catalog').fetchTemplate(params.template)
|
||||
}
|
||||
|
||||
return hash(dependencies, 'Load dependencies').then((results) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue