mirror of https://github.com/rancher/dashboard.git
Merge pull request #3986 from richard-cox/master-fix-cluster-template-catalog-store
[master] Ensure we use the correct store when checking for catalog operation
This commit is contained in:
commit
a88ad64ce1
|
|
@ -696,13 +696,16 @@ export default {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await this.repo.doAction((isUpgrade ? 'upgrade' : 'install'), input);
|
const res = await this.repo.doAction((isUpgrade ? 'upgrade' : 'install'), input);
|
||||||
const operationId = `${ res.operationNamespace }/${ res.operationName }`;
|
const operationId = `${ res.operationNamespace }/${ res.operationName }`;
|
||||||
|
|
||||||
// Non-admins without a cluster won't be able to fetch operations immediately
|
// Non-admins without a cluster won't be able to fetch operations immediately
|
||||||
await this.repo.waitForOperation(operationId);
|
await this.repo.waitForOperation(operationId);
|
||||||
|
// Dynamically use store decided when loading catalog (covers standard user case when there's not cluster)
|
||||||
|
const inStore = this.$store.getters['catalog/inStore'];
|
||||||
|
|
||||||
this.operation = await this.$store.dispatch('cluster/find', {
|
this.operation = await this.$store.dispatch(`${ inStore }/find`, {
|
||||||
type: CATALOG.OPERATION,
|
type: CATALOG.OPERATION,
|
||||||
id: operationId
|
id: operationId
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,8 @@ export const state = function() {
|
||||||
namespacedRepos: [],
|
namespacedRepos: [],
|
||||||
charts: {},
|
charts: {},
|
||||||
versionInfos: {},
|
versionInfos: {},
|
||||||
config: { namespace: 'catalog' }
|
config: { namespace: 'catalog' },
|
||||||
|
inStore: undefined,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -283,6 +284,10 @@ export const getters = {
|
||||||
|
|
||||||
return steps;
|
return steps;
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
inStore(state) {
|
||||||
|
return state.inStore;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -293,6 +298,10 @@ export const mutations = {
|
||||||
Object.assign(currentState, newState);
|
Object.assign(currentState, newState);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setInStore(state, inStore) {
|
||||||
|
state.inStore = inStore;
|
||||||
|
},
|
||||||
|
|
||||||
setRepos(state, { cluster, namespaced }) {
|
setRepos(state, { cluster, namespaced }) {
|
||||||
state.clusterRepos = cluster;
|
state.clusterRepos = cluster;
|
||||||
state.namespacedRepos = namespaced;
|
state.namespacedRepos = namespaced;
|
||||||
|
|
@ -321,7 +330,7 @@ export const actions = {
|
||||||
let promises = {};
|
let promises = {};
|
||||||
// Installing an app? This is fine (in cluster store)
|
// Installing an app? This is fine (in cluster store)
|
||||||
// Fetching list of cluster templates? This is fine (in management store)
|
// Fetching list of cluster templates? This is fine (in management store)
|
||||||
// Installing a cluster template? This isn't fine (in cluster store as per insalling app, but if there is no cluster we need to default to management)
|
// Installing a cluster template? This isn't fine (in cluster store as per installing app, but if there is no cluster we need to default to management)
|
||||||
const inStore = rootGetters['currentCluster'] ? rootGetters['currentProduct'].inStore : 'management';
|
const inStore = rootGetters['currentCluster'] ? rootGetters['currentProduct'].inStore : 'management';
|
||||||
|
|
||||||
if ( rootGetters[`${ inStore }/schemaFor`](CATALOG.CLUSTER_REPO) ) {
|
if ( rootGetters[`${ inStore }/schemaFor`](CATALOG.CLUSTER_REPO) ) {
|
||||||
|
|
@ -334,6 +343,9 @@ export const actions = {
|
||||||
|
|
||||||
const hash = await allHash(promises);
|
const hash = await allHash(promises);
|
||||||
|
|
||||||
|
// As per comment above, when there are no clusters this will be management. Store it such that it can be used for those cases
|
||||||
|
commit('setInStore', inStore);
|
||||||
|
|
||||||
commit('setRepos', hash);
|
commit('setRepos', hash);
|
||||||
|
|
||||||
const repos = getters['repos'];
|
const repos = getters['repos'];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue