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 /moon_dashboard/moon/static/moon/pdp/pdp.controller.js | |
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 'moon_dashboard/moon/static/moon/pdp/pdp.controller.js')
-rw-r--r-- | moon_dashboard/moon/static/moon/pdp/pdp.controller.js | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/moon_dashboard/moon/static/moon/pdp/pdp.controller.js b/moon_dashboard/moon/static/moon/pdp/pdp.controller.js deleted file mode 100644 index 1859b1f8..00000000 --- a/moon_dashboard/moon/static/moon/pdp/pdp.controller.js +++ /dev/null @@ -1,125 +0,0 @@ -(function () { - 'use strict'; - - angular - .module('moon') - .controller('moon.pdp.controller', - controller); - - controller.$inject = ['moon.util.service', 'moon.pdp.service', 'horizon.framework.widgets.form.ModalFormService']; - - function controller(util, pdpService, ModalFormService) { - var self = this; - self.model = pdpService; - pdpService.initialize(); - - self.createPdp = function createPdp() { - var schema = { - type: "object", - properties: { - name: { type: "string", minLength: 2, title: gettext("Name") }, - description: { type: "string", minLength: 2, title: gettext("Description") } - }, - required: ['name', 'description'] - }; - var pdp = { name: '', description: '' }; - var config = { - title: gettext('Create PDP'), - schema: schema, - form: ['name', { key: 'description', type: 'textarea' }], - model: pdp - }; - ModalFormService.open(config).then(submit); - - function submit(form) { - pdpService.createPdp(form.model); - } - } - - self.updatePdp = function updatePdp(pdp) { - var schema = { - type: "object", - properties: { - name: { type: "string", minLength: 2, title: gettext("Name") }, - description: { type: "string", minLength: 2, title: gettext("Description") } - }, - required: ['name', 'description'] - }; - var config = { - title: gettext('Update PDP'), - schema: schema, - form: ['name', { key: 'description', type: 'textarea' }], - model: angular.copy(pdp) - }; - ModalFormService.open(config).then(submit); - - function submit(form) { - pdpService.updatePdp(form.model); - } - } - - self.removePdp = function removePdp(pdp) { - if (confirm(gettext('Are you sure to delete this PDP?'))) - pdpService.removePdp(pdp); - } - - self.addPolicy = function addPolicy(pdp) { - var schema = { - type: "object", - properties: { - id: { type: "string", title: gettext("Select a Policy:") } - }, - required: ['id'] - }; - var titleMap = util.arrayToTitleMap(pdpService.policies) - var config = { - title: gettext('Add Policy'), - schema: schema, - form: [{ key: 'id', type: 'select', titleMap: titleMap }], - model: {} - }; - ModalFormService.open(config).then(submit); - - function submit(form) { - var pdpCopy = angular.copy(pdp); - pdpCopy.security_pipeline.push(pdpService.getPolicy(form.model.id)); - pdpService.updatePdp(pdpCopy); - } - } - - self.removePolicyFromPdp = function removePolicyFromPdp(pdp, policy) { - if (confirm(gettext('Are you sure to remove this Policy from PDP?'))) { - var pdpCopy = angular.copy(pdp); - pdpCopy.security_pipeline.splice(pdp.security_pipeline.indexOf(policy), 1); - pdpService.updatePdp(pdpCopy); - } - } - - self.changeProject = function changeProject(pdp) { - var schema = { - type: "object", - properties: { - id: { type: "string", title: gettext("Select a Project:") } - }, - required: ['id'] - }; - var model = {id : pdp.keystone_project_id}; - - var titleMap = util.arrayToTitleMap(pdpService.projects) - var config = { - title: gettext('Change Project'), - schema: schema, - form: [{ key: 'id', type: 'select', titleMap: titleMap }], - model: model - }; - ModalFormService.open(config).then(submit); - - function submit(form) { - var pdpCopy = angular.copy(pdp); - pdpCopy.project = pdpService.getProject(form.model.id); - pdpService.updatePdp(pdpCopy); - } - } - - } -})();
\ No newline at end of file |