mirror of https://github.com/rancher/dashboard.git
Plugin updates for custom charts within pkg (#7077)
* Plugin updates for custom charts within pkg * Remove unnecessary valuesComponent set
This commit is contained in:
parent
9b5241fc8a
commit
7297b8553f
|
|
@ -85,7 +85,11 @@ export default {
|
|||
showConditions() {
|
||||
const inStore = this.$store.getters['currentStore'](this.value.type);
|
||||
|
||||
return this.isView && this.needConditions && this.value?.type && this.$store.getters[`${ inStore }/pathExistsInSchema`](this.value.type, 'status.conditions');
|
||||
if ( this.$store.getters[`${ inStore }/schemaFor`](this.value.type) ) {
|
||||
return this.isView && this.needConditions && this.value?.type && this.$store.getters[`${ inStore }/pathExistsInSchema`](this.value.type, 'status.conditions');
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
showEvents() {
|
||||
return this.isView && this.needEvents && this.hasEvents && (this.events.length || this.alwaysShowEvents);
|
||||
|
|
|
|||
|
|
@ -758,8 +758,10 @@ export default {
|
|||
|
||||
// Load a values component for the UI if it is named in the Helm chart.
|
||||
if ( component ) {
|
||||
if ( this.$store.getters['catalog/haveComponent'](component) ) {
|
||||
this.valuesComponent = this.$store.getters['catalog/importComponent'](component);
|
||||
const hasChartComponent = this.$store.getters['type-map/hasCustomChart'](component);
|
||||
|
||||
if ( hasChartComponent ) {
|
||||
this.valuesComponent = this.$store.getters['type-map/importChart'](component);
|
||||
const loaded = await this.valuesComponent();
|
||||
|
||||
this.showValuesComponent = true;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ export function resolveList(key) {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
export function resolveChart(key) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function resolveEdit(key) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,19 +255,13 @@ export const getters = {
|
|||
|
||||
haveComponent() {
|
||||
return (name) => {
|
||||
try {
|
||||
require.resolve(`@shell/chart/${ name }`);
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return getters['type-map/hasCustomChart'](name);
|
||||
};
|
||||
},
|
||||
|
||||
importComponent(state, getters) {
|
||||
return (name) => {
|
||||
return importChart(name);
|
||||
return getters['type-map/importChart'](name);
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ import {
|
|||
ensureRegex, escapeHtml, escapeRegex, ucFirst, pluralize
|
||||
} from '@shell/utils/string';
|
||||
import {
|
||||
importList, importDetail, importEdit, listProducts, loadProduct, importCustomPromptRemove, resolveList, resolveEdit, resolveWindowComponent, importWindowComponent, resolveDetail, importDialog
|
||||
importChart, importList, importDetail, importEdit, listProducts, loadProduct, importCustomPromptRemove, resolveList, resolveEdit, resolveWindowComponent, importWindowComponent, resolveChart, resolveDetail, importDialog
|
||||
} from '@shell/utils/dynamic-importer';
|
||||
|
||||
import { NAME as EXPLORER } from '@shell/config/product/explorer';
|
||||
|
|
@ -361,6 +361,7 @@ export const state = function() {
|
|||
groupLabel: {},
|
||||
ignore: {},
|
||||
list: {},
|
||||
chart: {},
|
||||
detail: {},
|
||||
edit: {},
|
||||
componentFor: {},
|
||||
|
|
@ -1056,6 +1057,14 @@ export const getters = {
|
|||
};
|
||||
},
|
||||
|
||||
hasCustomChart(state, getters, rootState) {
|
||||
return (rawType) => {
|
||||
const key = getters.componentFor(rawType);
|
||||
|
||||
return hasCustom(state, rootState, 'chart', key, key => resolveChart(key));
|
||||
};
|
||||
},
|
||||
|
||||
hasCustomDetail(state, getters, rootState) {
|
||||
return (rawType, subType) => {
|
||||
const key = getters.componentFor(rawType, subType);
|
||||
|
|
@ -1124,6 +1133,12 @@ export const getters = {
|
|||
};
|
||||
},
|
||||
|
||||
importChart(state, getters, rootState) {
|
||||
return (rawType) => {
|
||||
return loadExtension(rootState, 'chart', getters.componentFor(rawType), importChart);
|
||||
};
|
||||
},
|
||||
|
||||
importDetail(state, getters, rootState) {
|
||||
return (rawType, subType) => {
|
||||
return loadExtension(rootState, 'detail', getters.componentFor(rawType, subType), importDetail);
|
||||
|
|
|
|||
|
|
@ -107,6 +107,10 @@ export function resolveList(key) {
|
|||
return require.resolve(`@shell/list/${ key }`);
|
||||
}
|
||||
|
||||
export function resolveChart(key) {
|
||||
return require.resolve(`@shell/chart/${ key }`);
|
||||
}
|
||||
|
||||
export function resolveEdit(key) {
|
||||
return require.resolve(`@shell/edit/${ key }`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue