From 1100c66ce03a059ebe7ece9734e799b49b3a5a9e Mon Sep 17 00:00:00 2001 From: WuKong Date: Sat, 23 Dec 2017 21:49:35 +0100 Subject: moonv4 cleanup Change-Id: Icef927f3236d985ac13ff7376f6ce6314b2b39b0 Signed-off-by: WuKong --- .../app/policy/action/mapping/policy-map.tpl.html | 64 ------------ .../policy/action/mapping/policy-unmap.tpl.html | 33 ------ .../policy/action/mapping/policy.controller.map.js | 106 ------------------- .../action/mapping/policy.controller.unmap.js | 74 -------------- .../static/app/policy/action/policy-add.tpl.html | 113 --------------------- .../app/policy/action/policy-delete.tpl.html | 40 -------- .../app/policy/action/policy.controller.add.js | 113 --------------------- .../app/policy/action/policy.controller.delete.js | 69 ------------- 8 files changed, 612 deletions(-) delete mode 100755 moonv4/moon_gui/static/app/policy/action/mapping/policy-map.tpl.html delete mode 100755 moonv4/moon_gui/static/app/policy/action/mapping/policy-unmap.tpl.html delete mode 100755 moonv4/moon_gui/static/app/policy/action/mapping/policy.controller.map.js delete mode 100755 moonv4/moon_gui/static/app/policy/action/mapping/policy.controller.unmap.js delete mode 100755 moonv4/moon_gui/static/app/policy/action/policy-add.tpl.html delete mode 100755 moonv4/moon_gui/static/app/policy/action/policy-delete.tpl.html delete mode 100755 moonv4/moon_gui/static/app/policy/action/policy.controller.add.js delete mode 100755 moonv4/moon_gui/static/app/policy/action/policy.controller.delete.js (limited to 'moonv4/moon_gui/static/app/policy/action') diff --git a/moonv4/moon_gui/static/app/policy/action/mapping/policy-map.tpl.html b/moonv4/moon_gui/static/app/policy/action/mapping/policy-map.tpl.html deleted file mode 100755 index 8b787f14..00000000 --- a/moonv4/moon_gui/static/app/policy/action/mapping/policy-map.tpl.html +++ /dev/null @@ -1,64 +0,0 @@ - diff --git a/moonv4/moon_gui/static/app/policy/action/mapping/policy-unmap.tpl.html b/moonv4/moon_gui/static/app/policy/action/mapping/policy-unmap.tpl.html deleted file mode 100755 index a2cda52a..00000000 --- a/moonv4/moon_gui/static/app/policy/action/mapping/policy-unmap.tpl.html +++ /dev/null @@ -1,33 +0,0 @@ - \ No newline at end of file diff --git a/moonv4/moon_gui/static/app/policy/action/mapping/policy.controller.map.js b/moonv4/moon_gui/static/app/policy/action/mapping/policy.controller.map.js deleted file mode 100755 index 6ad8caa7..00000000 --- a/moonv4/moon_gui/static/app/policy/action/mapping/policy.controller.map.js +++ /dev/null @@ -1,106 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('PolicyMapController', PolicyMapController); - - PolicyMapController.$inject = ['$scope', 'alertService', '$translate', 'formService', 'policyService', 'pdpService', 'utilService']; - - function PolicyMapController($scope, alertService, $translate, formService, policyService, pdpService, utilService ) { - - var map = this; - - /* - * - */ - - map.pdps = []; - - map.pdp = $scope.pdp; - - map.addPolicyToList = false; - - map.map = mapToPdp; - - activate(); - - function activate() { - - resolvePolicies(); - - } - - function resolvePolicies() { - - map.policiesLoading = true; - - policyService.findAllWithCallback(function(policies){ - map.policies = policies; - map.policiesLoading = false; - } - ); - - } - - function mapToPdp() { - - if (formService.isInvalid(map.form)) { - - formService.checkFieldsValidity(map.form); - - } else { - - map.mappingLoading = true; - - var pdpToSend = angular.copy(map.pdp); - - pdpToSend.security_pipeline.push(map.selectedPolicy.id); - - pdpService.update(pdpToSend, mapSuccess, mapError); - - } - - function mapSuccess(data) { - - var pdpReceived = utilService.transformOne(data, 'pdps'); - - - $translate('moon.policy.map.success', {pdpName: pdpReceived.name, policyName: map.selectedPolicy.name}).then(function (translatedValue) { - - alertService.alertSuccess(translatedValue); - - }); - - map.mappingLoading = false; - - $scope.$emit('event:policyMapToPdpSuccess', pdpReceived); - - } - - function mapError(response) { - - $translate('moon.policy.map.error', { - - pdpName: map.pdp.name, - policyName: map.selectedPolicy.name - - }).then(function (translatedValue) { - - alertService.alertError(translatedValue); - - }); - - map.mappingLoading = false; - - $scope.$emit('event:policyMapToPdpError'); - - } - } - - - - } - -})(); \ No newline at end of file diff --git a/moonv4/moon_gui/static/app/policy/action/mapping/policy.controller.unmap.js b/moonv4/moon_gui/static/app/policy/action/mapping/policy.controller.unmap.js deleted file mode 100755 index d309ec0f..00000000 --- a/moonv4/moon_gui/static/app/policy/action/mapping/policy.controller.unmap.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @author arnaud marhin - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('PolicyUnMapController', PolicyUnMapController); - - PolicyUnMapController.$inject = ['$scope', '$translate', 'alertService', 'pdpService', 'utilService']; - - function PolicyUnMapController($scope, $translate, alertService, pdpService, utilService) { - - var unmap = this; - - /* - * - */ - - unmap.pdp = $scope.pdp; - unmap.policy = $scope.policy; - - unmap.unMappingLoading = false; - - unmap.unmap = unMapPolicyToPdp; - - /* - * - */ - - function unMapPolicyToPdp() { - - unmap.unMappingLoading = true; - - var pdpToUpdate = angular.copy(unmap.pdp); - - pdpToUpdate.security_pipeline = _.without(pdpToUpdate.security_pipeline, unmap.policy.id); - - pdpService.update(pdpToUpdate, unMapSuccess, unMapError); - - function unMapSuccess(data) { - - $translate('moon.policy.unmap.success', { pdpName: unmap.pdp.name, policyName: unmap.policy.name }) - .then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - unmap.unMappingLoading = false; - - $scope.$emit('event:policyUnMappedToPdpSuccess', utilService.transformOne(data, 'pdps')); - - } - - function unMapError(reason) { - - $translate('moon.policy.unmap.error', { pdpName: unmap.pdp.name, policyName: unmap.policy.name }) - .then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - unmap.unMappingLoading = false; - - $scope.$emit('event:policyUnMappedToPdpError'); - - } - - } - - } - -})(); diff --git a/moonv4/moon_gui/static/app/policy/action/policy-add.tpl.html b/moonv4/moon_gui/static/app/policy/action/policy-add.tpl.html deleted file mode 100755 index d20c41be..00000000 --- a/moonv4/moon_gui/static/app/policy/action/policy-add.tpl.html +++ /dev/null @@ -1,113 +0,0 @@ - diff --git a/moonv4/moon_gui/static/app/policy/action/policy-delete.tpl.html b/moonv4/moon_gui/static/app/policy/action/policy-delete.tpl.html deleted file mode 100755 index 3b5df88b..00000000 --- a/moonv4/moon_gui/static/app/policy/action/policy-delete.tpl.html +++ /dev/null @@ -1,40 +0,0 @@ - \ No newline at end of file diff --git a/moonv4/moon_gui/static/app/policy/action/policy.controller.add.js b/moonv4/moon_gui/static/app/policy/action/policy.controller.add.js deleted file mode 100755 index 0320c2e9..00000000 --- a/moonv4/moon_gui/static/app/policy/action/policy.controller.add.js +++ /dev/null @@ -1,113 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('PolicyAddController', PolicyAddController); - - PolicyAddController.$inject = ['$scope', '$translate', 'alertService', 'formService', 'policyService', 'utilService', 'modelService']; - - function PolicyAddController($scope, $translate, alertService, formService, policyService, utilService, modelService) { - - var add = this; - - /* - * - */ - - add.loading = false; - - add.form = {}; - - add.policy = {name: null, genre: null, description: null, model_id: null}; - - add.genres = ['admin', 'authz']; - - add.models = []; - - add.modelsLoading = true; - - add.create = createPolicy; - - - activate(); - - function activate(){ - - resolveModels(); - - } - - /* - * - */ - - function resolveModels() { - - modelService.findAllWithCallBack(resolveModelsCallback); - - } - - function resolveModelsCallback(models) { - - add.models = models; - - add.modelsLoading = false; - - } - - - function createPolicy() { - - if(formService.isInvalid(add.form)) { - - formService.checkFieldsValidity(add.form); - - } else { - - - add.loading = true; - - policyService.data.policy.create({}, { - - name: add.policy.name, - description: add.policy.description, - genre: [add.selectedGenre], - model_id: add.selectedModel.id - - }, createSuccess, createError); - - } - - function createSuccess(data) { - - var createdPolicy = utilService.transformOne(data, 'policies'); - - $translate('moon.policy.add.success', { policyName: createdPolicy.name }).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - add.loading = false; - - $scope.$emit('event:policyCreatedSuccess', createdPolicy); - - } - - function createError(reason) { - - $translate('moon.policy.add.error', { policyName: add.model.name }).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - add.loading = false; - - $scope.$emit('event:policyCreatedError', add.project); - - } - - } - - } - -})(); diff --git a/moonv4/moon_gui/static/app/policy/action/policy.controller.delete.js b/moonv4/moon_gui/static/app/policy/action/policy.controller.delete.js deleted file mode 100755 index 9a718ddc..00000000 --- a/moonv4/moon_gui/static/app/policy/action/policy.controller.delete.js +++ /dev/null @@ -1,69 +0,0 @@ - -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('PolicyDeleteController', PolicyDeleteController); - - PolicyDeleteController.$inject = ['$scope', '$translate', 'alertService', 'policyService']; - - function PolicyDeleteController($scope, $translate, alertService, policyService) { - - var del = this; - - /* - * - */ - - del.policy = $scope.policy; - del.loading = false; - - del.remove = deletePolicy; - - activate(); - - /** - * - */ - - function activate(){ - - } - - - function deletePolicy(){ - - del.loading = true; - - policyService.delete(del.policy, deleteSuccess, deleteError); - - function deleteSuccess(data) { - - $translate('moon.policy.remove.success', { policyName: del.policy.name }).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - del.loading = false; - - $scope.$emit('event:policyDeletedSuccess', del.policy); - - } - - function deleteError(reason) { - - $translate('moon.policy.remove.error', { policyName: del.policy.name, errorCode: reason.data.error.code, message : reason.data.error.message } ).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - del.loading = false; - - $scope.$emit('event:policyDeletedError', del.policy); - - } - - } - } - -})(); -- cgit 1.2.3-korg