From c97a1e8e5c1754d5e6bef62745a540c46485673e Mon Sep 17 00:00:00 2001 From: "Marco A. Nina Mena" Date: Mon, 5 Feb 2024 17:34:12 -0500 Subject: [PATCH 1/3] Add parameter to updateQuery --- resources/js/components/shared/PmqlInput.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/js/components/shared/PmqlInput.vue b/resources/js/components/shared/PmqlInput.vue index 27da5985c6..e6452c9ab1 100755 --- a/resources/js/components/shared/PmqlInput.vue +++ b/resources/js/components/shared/PmqlInput.vue @@ -203,6 +203,7 @@ export default { "paramProjectCategories", "paramName", "permission", + "updateQuery", ], data() { return { @@ -260,8 +261,14 @@ export default { this.calcInputHeight(); }, value() { - if (this.query !== this.value) { - this.query = this.value || ""; + if (this.updateQuery) { + if (this.query !== this.value) { + this.query = this.value || ""; + } + } else { + if (!this.query || this.query === "") { + this.query = this.value; + } } }, }, From 8548af537004c1b42ccf62be947277600f398e58 Mon Sep 17 00:00:00 2001 From: "Marco A. Nina Mena" Date: Mon, 5 Feb 2024 17:45:53 -0500 Subject: [PATCH 2/3] Fix sonaQube --- resources/js/components/shared/PmqlInput.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/js/components/shared/PmqlInput.vue b/resources/js/components/shared/PmqlInput.vue index e6452c9ab1..8aa98f6f22 100755 --- a/resources/js/components/shared/PmqlInput.vue +++ b/resources/js/components/shared/PmqlInput.vue @@ -265,10 +265,8 @@ export default { if (this.query !== this.value) { this.query = this.value || ""; } - } else { - if (!this.query || this.query === "") { - this.query = this.value; - } + } else if (!this.query || this.query === "") { + this.query = this.value; } }, }, From d4bfacb57608b0ae02151777b6126874f2676297 Mon Sep 17 00:00:00 2001 From: "Marco A. Nina Mena" Date: Tue, 6 Feb 2024 09:23:15 -0500 Subject: [PATCH 3/3] simplify nested if --- resources/js/components/shared/PmqlInput.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/js/components/shared/PmqlInput.vue b/resources/js/components/shared/PmqlInput.vue index 8aa98f6f22..f0ccae8ac7 100755 --- a/resources/js/components/shared/PmqlInput.vue +++ b/resources/js/components/shared/PmqlInput.vue @@ -261,10 +261,8 @@ export default { this.calcInputHeight(); }, value() { - if (this.updateQuery) { - if (this.query !== this.value) { - this.query = this.value || ""; - } + if (this.updateQuery && this.query !== this.value) { + this.query = this.value || ""; } else if (!this.query || this.query === "") { this.query = this.value; }