aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/moon_gui/static/app/pdp/action/pdp.controller.add.js
diff options
context:
space:
mode:
Diffstat (limited to 'moonv4/moon_gui/static/app/pdp/action/pdp.controller.add.js')
-rwxr-xr-xmoonv4/moon_gui/static/app/pdp/action/pdp.controller.add.js108
1 files changed, 0 insertions, 108 deletions
diff --git a/moonv4/moon_gui/static/app/pdp/action/pdp.controller.add.js b/moonv4/moon_gui/static/app/pdp/action/pdp.controller.add.js
deleted file mode 100755
index d1c34c79..00000000
--- a/moonv4/moon_gui/static/app/pdp/action/pdp.controller.add.js
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * @author arnaud marhin<arnaud.marhin@orange.com>
- */
-
-(function() {
-
- 'use strict';
-
- angular
- .module('moon')
- .controller('PDPAddController', PDPAddController);
-
- PDPAddController.$inject = ['$scope', '$translate', 'alertService', 'formService', 'pdpService', 'policyService', 'utilService'];
-
- function PDPAddController($scope, $translate, alertService, formService, pdpService, policyService, utilService) {
-
- var add = this;
-
- /*
- *
- */
-
- add.form = {};
-
- add.pdp = {};
-
- add.policies = [];
-
- add.selectedPolicy = null;
-
- add.loading = false;
- add.loadingPolicies = true;
-
- add.create = createPDP;
-
- resolvePolicies();
-
- /*
- *
- */
-
- /**
- * This function return an array of all policies/template ids
- */
- function resolvePolicies() {
-
- policyService.findAllWithCallback(function(policies){
-
- add.policies = policies;
- add.loadingPolicies = false;
- });
-
- }
-
- function createPDP(pdp) {
-
- if(formService.isInvalid(add.form)) {
-
- formService.checkFieldsValidity(add.form);
-
- } else {
-
- add.loading = true;
-
- pdpService.data.pdp.create({}, {
-
- name: add.pdp.name,
- description: add.pdp.description,
- security_pipeline: [add.selectedPolicy.id],
- keystone_project_id: null
-
- }, createSuccess, createError);
-
- }
-
- function createSuccess(data) {
-
- $translate('moon.pdp.add.success', { pdpName: pdp.name })
- .then(function (translatedValue) {
- alertService.alertSuccess(translatedValue);
- });
-
- var createdPdp = utilService.transformOne(data, 'pdps');
-
- add.loading = false;
-
- $scope.$emit('event:pdpCreatedSuccess', createdPdp);
-
- }
-
- function createError(reason) {
-
- $translate('moon.pdp.add.error', { pdpName: pdp.name })
- .then(function (translatedValue) {
- alertService.alertError(translatedValue);
- });
-
- add.loading = false;
-
- $scope.$emit('event:pdpCreatedError');
-
- }
-
- }
-
- }
-
-})();