diff --git a/pages/c/_cluster/apps/install.vue b/pages/c/_cluster/apps/install.vue index 14478bdb8a6..2aac6e63c21 100644 --- a/pages/c/_cluster/apps/install.vue +++ b/pages/c/_cluster/apps/install.vue @@ -174,14 +174,14 @@ export default { }); } catch (e) { console.error(e); // eslint-disable-line no-console - throw e; + this.versionInfo = null; } if ( this.version && process.client ) { await this.loadValuesComponent(); } - const required = (this.version.annotations?.[CATALOG_ANNOTATIONS.REQUIRES_GVK] || '').split(/\s*,\s*/).filter(x => !!x).reverse(); + const required = (this.version?.annotations?.[CATALOG_ANNOTATIONS.REQUIRES_GVK] || '').split(/\s*,\s*/).filter(x => !!x).reverse(); if ( required.length ) { for ( const gvr of required ) { @@ -242,7 +242,7 @@ export default { } this.removeGlobalValuesFrom(userValues); - this.chartValues = merge(merge({}, this.versionInfo.values), userValues); + this.chartValues = merge(merge({}, this.versionInfo?.values || {}), userValues); this.valuesYaml = jsyaml.safeDump(this.chartValues || {}); if ( this.valuesYaml === '{}\n' ) { @@ -254,8 +254,8 @@ export default { this.originalYamlValues = this.valuesYaml; } - this.loadedVersionValues = this.versionInfo.values; - this.loadedVersion = this.version.key; + this.loadedVersionValues = this.versionInfo?.values || {}; + this.loadedVersion = this.version?.key; } }, @@ -437,9 +437,9 @@ export default { const { currentCluster, catalogOSAnnotation, - chart: { versions = [] }, - version: { version: selectedVersion }, } = this; + const versions = this.chart?.versions || []; + const selectedVersion = this.version?.version; const clusterProvider = currentCluster.status.provider || 'other'; const out = []; diff --git a/store/catalog.js b/store/catalog.js index 93e3a7c1e66..c1925e78c77 100644 --- a/store/catalog.js +++ b/store/catalog.js @@ -324,24 +324,29 @@ export const actions = { const key = `${ repoType }/${ repoName }/${ chartName }/${ versionName }`; let info = state.versionInfos[key]; - if ( !info ) { - const repo = getters['repo']({ repoType, repoName }); + try { + if ( !info ) { + const repo = getters['repo']({ repoType, repoName }); - if ( !repo ) { - throw new Error('Repo not found'); - } + if ( !repo ) { + throw new Error('Repo not found'); + } - info = await repo.followLink('info', { - url: addParams(repo.links.info, { - chartName, - version: versionName - }) - }); + info = await repo.followLink('info', { + url: addParams(repo.links.info, { + chartName, + version: versionName + }) + }); - commit('cacheVersion', { key, info }); - } + commit('cacheVersion', { key, info }); + } - return info; + return info; + } catch (e) { + console.log(e); + debugger; + } }, }; diff --git a/store/index.js b/store/index.js index 21bd473316e..01cf4df48ed 100644 --- a/store/index.js +++ b/store/index.js @@ -571,8 +571,10 @@ export const actions = { dispatch('prefs/loadTheme'); }, - loadingError({ commit, redirect }, err) { + loadingError({ commit, state }, err) { commit('setError', err); - redirect('/fail-whale'); + const router = state.$router; + + router.replace('/fail-whale'); } };