From 647aaeceb2026aa2d7e70ab19021c2a99a1d8132 Mon Sep 17 00:00:00 2001 From: Sahiba Mittal Date: Fri, 16 Sep 2022 15:08:51 +0100 Subject: [PATCH] fix osv ecosystem toggle handling Signed-off-by: Sahiba Mittal --- .../vuln-sources/VulnSourceOSVAdvisories.vue | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/views/administration/vuln-sources/VulnSourceOSVAdvisories.vue b/src/views/administration/vuln-sources/VulnSourceOSVAdvisories.vue index 5be1daaae..437b390a5 100644 --- a/src/views/administration/vuln-sources/VulnSourceOSVAdvisories.vue +++ b/src/views/administration/vuln-sources/VulnSourceOSVAdvisories.vue @@ -9,7 +9,6 @@ label v-bind="labelIcon" v-model="vulnsourceEnabled" - @change="handleVulnsourceEnabled" :disabled="enabledEcosystems.length === 0" /> {{$t('admin.vulnsource_osv_advisories_enable')}} @@ -58,6 +57,16 @@ export default { }, } }, + watch: { + vulnsourceEnabled(toggleChange) { + if(toggleChange === false) { + this.enabledEcosystems = []; + this.updateConfigProperties([ + {groupName: 'vuln-source', propertyName: 'google.osv.enabled', propertyValue: null} + ]); + } + } + }, methods: { removeEcosystem: function(ecosystem) { this.enabledEcosystems = this.enabledEcosystems.filter(e => e !== ecosystem); @@ -76,14 +85,6 @@ export default { this.updateConfigProperties([ {groupName: 'vuln-source', propertyName: 'google.osv.enabled', propertyValue: this.enabledEcosystems.join(";")} ]); - }, - handleVulnsourceEnabled: function(vulnsourceEnabled) { - if (vulnsourceEnabled === false) { - this.enabledEcosystems = []; - this.updateConfigProperties([ - {groupName: 'vuln-source', propertyName: 'google.osv.enabled', propertyValue: null} - ]); - } } }, created () {