Fix custom component loading

This commit is contained in:
Vincent Fiduccia 2020-03-13 15:29:47 -07:00
parent e67c77dcc6
commit ebed7576d8
No known key found for this signature in database
GPG Key ID: 2B29AD6BB2BB2582
4 changed files with 26 additions and 18 deletions

View File

@ -128,7 +128,11 @@ export default {
}, },
data() { data() {
return { currentValue: this.value }; return {
currentValue: this.value,
detailComponent: this.$store.getters['type-map/importDetail'](this.resource),
editComponent: this.$store.getters['type-map/importEdit'](this.resource),
};
}, },
computed: { computed: {
@ -164,9 +168,9 @@ export default {
showComponent() { showComponent() {
if ( this.isView && this.hasCustomDetail ) { if ( this.isView && this.hasCustomDetail ) {
return this.$store.getters['type-map/importDetail'](this.resource); return this.detailComponent;
} else if ( !this.isView && this.hasCustomEdit ) { } else if ( !this.isView && this.hasCustomEdit ) {
return this.$store.getters['type-map/importEdit'](this.resource); return this.editComponent;
} }
return null; return null;

View File

@ -228,11 +228,13 @@ export default {
availableActions() { availableActions() {
return this.$store.getters[`${ this.storeName }/forTable`]; return this.$store.getters[`${ this.storeName }/forTable`];
}, },
...mapState({ ...mapState({
tableSelected(state) { tableSelected(state) {
return state[this.storeName].tableSelected; return state[this.storeName].tableSelected;
} }
}), }),
classObject() { classObject() {
return { return {
'top-divider': this.topDivider, 'emphasized-body': this.emphasizedBody, 'body-dividers': this.bodyDividers 'top-divider': this.topDivider, 'emphasized-body': this.emphasizedBody, 'body-dividers': this.bodyDividers

View File

@ -81,16 +81,17 @@ export default {
<hr /> <hr />
</li> </li>
<li v-else-if="child[childrenKey]" :key="child.name"> <li v-else-if="child[childrenKey]" :key="child.name">
<Group <ul class="list-unstyled m-0">
:key="child.name" <Group
:depth="depth + 1" :key="child.name"
:is-expanded="isExpanded" :depth="depth + 1"
:toggle-group="toggleGroup" :is-expanded="isExpanded"
:children-key="childrenKey" :children-key="childrenKey"
:can-collapse="canCollapse" :can-collapse="canCollapse"
:id-prefix="id+'_'" :id-prefix="id+'_'"
:group="child" :group="child"
/> />
</ul>
</li> </li>
<Type <Type
v-else v-else

View File

@ -3,6 +3,11 @@ import ResourceTable from '@/components/ResourceTable';
export default { export default {
components: { ResourceTable }, components: { ResourceTable },
data() {
return { listComponent: this.$store.getters['type-map/importList'](this.resource) };
},
computed: { computed: {
schema() { schema() {
return this.$store.getters['cluster/schemaFor'](this.resource); return this.$store.getters['cluster/schemaFor'](this.resource);
@ -16,10 +21,6 @@ export default {
return this.$store.getters['type-map/hasCustomList'](this.resource); return this.$store.getters['type-map/hasCustomList'](this.resource);
}, },
showComponent() {
return this.$store.getters['type-map/importList'](this.resource);
},
typeDisplay() { typeDisplay() {
return this.$store.getters['type-map/pluralLabelFor'](this.schema); return this.$store.getters['type-map/pluralLabelFor'](this.schema);
}, },
@ -53,7 +54,7 @@ export default {
</header> </header>
<div v-if="hasComponent"> <div v-if="hasComponent">
<component <component
:is="showComponent" :is="listComponent"
:schema="schema" :schema="schema"
:rows="rows" :rows="rows"
:headers="headers" :headers="headers"