From eb023fdd4bc6eaf0ffb14b007d6ad873cf7431f6 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 21 Aug 2019 00:07:35 +0530 Subject: [PATCH] fix infinite component loop Signed-off-by: Rohit Yadav --- ui/src/components/CloudMonkey/Resource.vue | 28 +++++++++++----------- ui/src/components/tools/HeaderNotice.vue | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ui/src/components/CloudMonkey/Resource.vue b/ui/src/components/CloudMonkey/Resource.vue index a5b936bd481..cbab517d4b0 100644 --- a/ui/src/components/CloudMonkey/Resource.vue +++ b/ui/src/components/CloudMonkey/Resource.vue @@ -130,7 +130,7 @@ -
+
@@ -144,7 +144,7 @@ - +

{{ key }}

@@ -236,6 +236,7 @@ export default { selectedRowKeys: [], currentAction: {}, showAction: false, + showDetails: false, actions: [] } }, @@ -249,7 +250,7 @@ export default { }, watch: { '$route' (to, from) { - if (to.path === this.$route.path) { + if (to.fullPath !== from.fullPath) { this.fetchData() } } @@ -276,6 +277,11 @@ export default { if (search !== '') { params['keyword'] = search } + if (this.$route && this.$route.params && this.$route.params.id) { + this.showDetails = true + } else { + this.showDetails = false + } if (this.$route && this.$route.meta && this.$route.meta.permission) { this.apiName = this.$route.meta.permission[0] if (this.$route.meta.columns) { @@ -341,18 +347,12 @@ export default { for (let idx = 0; idx < this.items.length; idx++) { this.items[idx]['key'] = idx } - }) - }, - getResource (id) { - var res = {} - for (const item of this.items) { - if (item.id === id) { - res = item - break + if (this.items.length > 0) { + this.resource = this.items[0] + } else { + this.resource = {} } - } - this.resource = res - return this.resource + }) }, onSearch (value) { this.fetchData(value) diff --git a/ui/src/components/tools/HeaderNotice.vue b/ui/src/components/tools/HeaderNotice.vue index b22c356c156..67d3a9c0eee 100644 --- a/ui/src/components/tools/HeaderNotice.vue +++ b/ui/src/components/tools/HeaderNotice.vue @@ -11,7 +11,7 @@ - + Clear All