diff options
author | Thomas Duval <thomas.duval@orange.com> | 2020-06-03 10:06:52 +0200 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2020-06-03 10:06:52 +0200 |
commit | 7bb53c64da2dcf88894bfd31503accdd81498f3d (patch) | |
tree | 4310e12366818af27947b5e2c80cb162da93a4b5 /dashboard/src/components/pdp/CreatePdp.vue | |
parent | cbea4e360e9bfaa9698cf7c61c83c96a1ba89b8c (diff) |
Update to new version 5.4HEADstable/jermamaster
Signed-off-by: Thomas Duval <thomas.duval@orange.com>
Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea
Diffstat (limited to 'dashboard/src/components/pdp/CreatePdp.vue')
-rw-r--r-- | dashboard/src/components/pdp/CreatePdp.vue | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/dashboard/src/components/pdp/CreatePdp.vue b/dashboard/src/components/pdp/CreatePdp.vue new file mode 100644 index 00000000..aca46413 --- /dev/null +++ b/dashboard/src/components/pdp/CreatePdp.vue @@ -0,0 +1,83 @@ +<template> + <div class="list-group-item row"> + <form> + <div class="form-group"> + <label for="modelName">Name</label> + <input + type="text" + name="name" + v-model="pdpCreate.name" + v-validate.initial="'alpha_dash|required|min:3'" + class="form-control" + id="modelName" + > + </div> + <div class="form-group"> + <label for="modelDescription">Description</label> + <textarea + name="description" + v-model="pdpCreate.description" + v-validate.initial="'required|min:3'" + class="form-control" + ></textarea> + </div> + <div class="form-group"> + <label for="pdpVpi">Vim project id</label> + <input + type="text" + name="vim_project_id" + v-model="pdpCreate.vim_project_id" + class="form-control" + id="pdpVpi" + > + </div> + <div class="form-group"> + <label for="pdpPolicy">Policy</label> + <select v-model="selectedPolicy" class="form-control" id="pdpPolicy" v-validate.initial="'required'" name="policy"> + <option v-for="policy in policies" :key="policy.id" :value="policy.id">{{ policy.name }}</option> + </select> + </div> + <ul> + <li v-for="error in errors.all()" :key="error.id">{{ error }}</li> + </ul> + <button type="button" class="btn btn-secondary" @click="close()">Cancel</button> + <span> </span> + <button type="button" :disabled="errors.any()" class="btn btn-primary" @click="createModel()">Create</button> + </form> + </div> +</template> + +<script> +import PdpService from "./../../services/Pdp.service.js"; +import PolicyService from "../../services/Policy.service"; +import util from "../../services/Util.service"; + +export default { + data: function() { + return { + selectedPolicy: null, + pdpCreate: { + name: "", + description: "", + security_pipeline: [], + vim_project_id: "" + } + }; + }, + computed:{ + policies() { + return util.sortByName(PolicyService.policies); + } + }, + methods: { + createModel() { + this.pdpCreate.security_pipeline.push(this.selectedPolicy); + PdpService.createPdp(this.pdpCreate); + this.close(); + }, + close() { + this.$emit("close") + } + } +}; +</script> |