From 7769fa9c3ff453600236990f47e63a4e103b5fa6 Mon Sep 17 00:00:00 2001 From: Ross Murphy Date: Wed, 9 Oct 2024 23:13:32 +0100 Subject: [PATCH 1/2] Update PolicyCondition to allow NOT_PRESENT for CPE and PURL Signed-off-by: Ross Murphy --- src/i18n/locales/en.json | 3 +- src/views/policy/PolicyCondition.vue | 45 ++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 76dc3b0bf..e82fe8944 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -876,7 +876,8 @@ "is": "is", "is_not": "is not", "matches": "matches", - "no_match": "does not match" + "no_match": "does not match", + "not_present": "not present" }, "policy_violation": { "fails": "Violation Failures", diff --git a/src/views/policy/PolicyCondition.vue b/src/views/policy/PolicyCondition.vue index 559c5e046..bff42b9cc 100644 --- a/src/views/policy/PolicyCondition.vue +++ b/src/views/policy/PolicyCondition.vue @@ -39,6 +39,8 @@ v-else-if=" subject !== 'COORDINATES' && subject !== 'VERSION_DISTANCE' && + subject !== 'CPE' && + subject !== 'PACKAGE_URL' && !isSubjectSelectable " id="input-value" @@ -51,6 +53,32 @@ :debounce-events="'keyup'" /> + + + + { this.uuid = response.data.uuid; @@ -446,7 +484,8 @@ export default { .put(url, { subject: this.subject, operator: this.subject === 'COMPONENT_HASH' ? 'IS' : this.operator, - value: dynamicValue, + value: + this.operator === 'NOT_PRESENT' ? 'NOT_PRESENT' : dynamicValue, }) .then((response) => { this.uuid = response.data.uuid; From 0d833b19cf08df396db0fddbd3f2a11ae1df2835 Mon Sep 17 00:00:00 2001 From: Ross Murphy Date: Wed, 9 Oct 2024 23:59:57 +0100 Subject: [PATCH 2/2] seperate operators for CPE and PURL Signed-off-by: Ross Murphy --- src/views/policy/PolicyCondition.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/views/policy/PolicyCondition.vue b/src/views/policy/PolicyCondition.vue index bff42b9cc..ecb99019c 100644 --- a/src/views/policy/PolicyCondition.vue +++ b/src/views/policy/PolicyCondition.vue @@ -248,6 +248,10 @@ export default { { value: 'IS_NOT', text: this.$t('operator.is_not') }, ], regexOperators: [ + { value: 'MATCHES', text: this.$t('operator.matches') }, + { value: 'NO_MATCH', text: this.$t('operator.no_match') }, + ], + regexOperatorsCpePurl: [ { value: 'MATCHES', text: this.$t('operator.matches') }, { value: 'NOT_PRESENT', text: this.$t('operator.not_present') }, { value: 'NO_MATCH', text: this.$t('operator.no_match') }, @@ -365,10 +369,10 @@ export default { this.retrieveLicenseGroups(); break; case 'PACKAGE_URL': - this.operators = this.regexOperators; + this.operators = this.regexOperatorsCpePurl; break; case 'CPE': - this.operators = this.regexOperators; + this.operators = this.regexOperatorsCpePurl; break; case 'SWID_TAGID': this.operators = this.regexOperators;