blob: 82ad07e28ce1e2933345c20d8b6888730bbf0005 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<template>
<div>
<hr>
<h4>Select policy:</h4>
<form data-vv-scope="select">
<div class="form-group">
<select v-model="selectedPolicyId" v-validate.initial="'required'">
<option disabled value>Please select one</option>
<option
v-for="policy in policies"
:value="policy.id"
:key="policy.id"
>{{policy.name}}</option>
</select>
</div>
<button type="button" class="btn btn-secondary" @click="close()">Cancel</button>
<span> </span>
<button
type="button"
:disabled="errors.any('select')"
class="btn btn-primary"
@click="addPolicy()"
>Add</button>
</form>
<br>
<br>
</div>
</template>
<script>
import PdpService from "./../../services/Pdp.service.js";
import util from "./../../services/Util.service.js";
export default {
name: "addPolicy",
data: function() {
return {
selectedPolicyId: null,
};
},
props: {
pdp: Object
},
methods: {
addPolicy() {
var policy = PdpService.getPolicy(this.selectedPolicyId);
var pdpCopy = util.clone(this.pdp);
pdpCopy.security_pipeline.push(policy);
PdpService.updatePdp(pdpCopy);
this.close();
},
close() {
this.$emit("close");
}
},
computed: {
policies() {
return PdpService.policies.filter(
el => !this.pdp.security_pipeline.includes(el)
);
}
}
};
</script>
|