Add policy rule multi select for when the number of items is constant
What does this MR do and why?
Add policy rule multi select for when the number of items is constant and items have only a key and value being the identifier and the text respectively.
I suspect that this is going to be a common pattern for the features CI or YAML based like policy orchestration.
Related work to #351166 (closed)
Example of usage:
data(){
return {
severityLevelsToAdd: this.rule.severity_levels,
};
},
//...
watch:{
severityLevelsToAdd(values){
this.rule.severity_levels = values;
},
},
//...
<policy-rule-multi-select
class="gl-mr-3 gl-ml-3"
:item-type-name="$options.APPROVAL_DIALOG_I18N.form.severityLevels"
:items="$options.SEVERITY_LEVELS"
v-model="severityLevelsToAdd"
/>
Screenshots or screen recordings
Live behavior:
How to set up and validate locally
- This example can be used:
import PolicyRuleMultiSelect from 'ee/threat_monitoring/components/policy_rule_multi_select.vue';
// Include PolicyRuleMultiSelect as part of the components list if rendering from another vue class
data(){
return {
selected: ['first_value'],
};
},
//...
watch:{
selected(values){
this.demoValues = values;
},
},
//...
<policy-rule-multi-select
class="gl-mr-3 gl-ml-3"
item-type-name="demo values"
:items="{first_value: 'First Value!', second_value: 'Second Value!!', third_value: 'Third Value!!!'}"
v-model="selected"
/>
- The output should be similar to the following:
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Zamir Martins