From cef06123f64d0296940711da9a70a30e7d9b8cbd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 16 Feb 2022 14:09:48 +0100 Subject: [PATCH 1/3] Load collections of different resources on change Signed-off-by: Joas Schilling --- src/components/CollectionList.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/components/CollectionList.vue b/src/components/CollectionList.vue index e720290c..eea666ba 100644 --- a/src/components/CollectionList.vue +++ b/src/components/CollectionList.vue @@ -163,12 +163,29 @@ export default { return options } }, + mounted() { actions.fetchCollectionsByResource({ resourceType: this.type, resourceId: this.id }) }, + + watch: { + type() { + actions.fetchCollectionsByResource({ + resourceType: this.type, + resourceId: this.id + }) + }, + id() { + actions.fetchCollectionsByResource({ + resourceType: this.type, + resourceId: this.id + }) + } + }, + methods: { select(selectedOption, id) { if (selectedOption.method === METHOD_CREATE_COLLECTION) { From b0d1b5a61f9f90243006af94238255ae878d3e88 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 4 Mar 2022 10:21:41 +0100 Subject: [PATCH 2/3] Also add a prop for if the tab is visible Signed-off-by: Joas Schilling --- src/components/CollectionList.vue | 32 +++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/components/CollectionList.vue b/src/components/CollectionList.vue index eea666ba..329f1229 100644 --- a/src/components/CollectionList.vue +++ b/src/components/CollectionList.vue @@ -111,6 +111,10 @@ export default { name: { type: String, default: '' + }, + isActive: { + type: Boolean, + default: true } }, data() { @@ -173,16 +177,28 @@ export default { watch: { type() { - actions.fetchCollectionsByResource({ - resourceType: this.type, - resourceId: this.id - }) + if (this.isActive) { + actions.fetchCollectionsByResource({ + resourceType: this.type, + resourceId: this.id + }) + } }, id() { - actions.fetchCollectionsByResource({ - resourceType: this.type, - resourceId: this.id - }) + if (this.isActive) { + actions.fetchCollectionsByResource({ + resourceType: this.type, + resourceId: this.id + }) + } + }, + isActive(isActive) { + if (isActive) { + actions.fetchCollectionsByResource({ + resourceType: this.type, + resourceId: this.id + }) + } } }, From c3aaca822da004e0a41466498cf1099f8c8075e6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 12 Apr 2022 12:48:48 +0200 Subject: [PATCH 3/3] Change order Signed-off-by: Joas Schilling --- src/components/CollectionList.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/CollectionList.vue b/src/components/CollectionList.vue index 329f1229..8cc74032 100644 --- a/src/components/CollectionList.vue +++ b/src/components/CollectionList.vue @@ -168,13 +168,6 @@ export default { } }, - mounted() { - actions.fetchCollectionsByResource({ - resourceType: this.type, - resourceId: this.id - }) - }, - watch: { type() { if (this.isActive) { @@ -202,6 +195,13 @@ export default { } }, + mounted() { + actions.fetchCollectionsByResource({ + resourceType: this.type, + resourceId: this.id + }) + }, + methods: { select(selectedOption, id) { if (selectedOption.method === METHOD_CREATE_COLLECTION) {