From 7bb53c64da2dcf88894bfd31503accdd81498f3d Mon Sep 17 00:00:00 2001 From: Thomas Duval Date: Wed, 3 Jun 2020 10:06:52 +0200 Subject: Update to new version 5.4 Signed-off-by: Thomas Duval Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea --- .../policy/edit/parameter/data/data-edit.tpl.html | 83 ----- .../policy/edit/parameter/data/data-list.tpl.html | 390 --------------------- .../policy/edit/parameter/data/data.edit.dir.js | 258 -------------- .../policy/edit/parameter/data/data.list.dir.js | 293 ---------------- 4 files changed, 1024 deletions(-) delete mode 100755 moon_gui/static/app/policy/edit/parameter/data/data-edit.tpl.html delete mode 100755 moon_gui/static/app/policy/edit/parameter/data/data-list.tpl.html delete mode 100755 moon_gui/static/app/policy/edit/parameter/data/data.edit.dir.js delete mode 100755 moon_gui/static/app/policy/edit/parameter/data/data.list.dir.js (limited to 'moon_gui/static/app/policy/edit/parameter/data') diff --git a/moon_gui/static/app/policy/edit/parameter/data/data-edit.tpl.html b/moon_gui/static/app/policy/edit/parameter/data/data-edit.tpl.html deleted file mode 100755 index fae647e3..00000000 --- a/moon_gui/static/app/policy/edit/parameter/data/data-edit.tpl.html +++ /dev/null @@ -1,83 +0,0 @@ -
- -
- -
- -
- - - -
- - - -
- Name is required - -
- -
- -
- -
- - -
- -
- -
- -
- - - -
- - - - - -
-
- -
- -
- Category is required - -
- -
-
- -
- -
- - - - Create - - - - -
- -
- -
- -
- -
\ No newline at end of file diff --git a/moon_gui/static/app/policy/edit/parameter/data/data-list.tpl.html b/moon_gui/static/app/policy/edit/parameter/data/data-list.tpl.html deleted file mode 100755 index b69a4eed..00000000 --- a/moon_gui/static/app/policy/edit/parameter/data/data-list.tpl.html +++ /dev/null @@ -1,390 +0,0 @@ -
-
- -
- -

List of associated Subjects

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionCategory
- -
- - Loading -
- -
- -
- -
- - - - Delete - - -
- - - -
- -
There is no Subjects
- -
- -
- -
- -
- -
- -

Add a Subject Category

- -
- -
- - - -
- -
- -
- -
- -

List associated of Objects

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionCategoryActions
- -
- - Loading -
- -
- -
- -
- - - - Delete - - -
- - - -
- -
There is no Objects
- -
- -
- -
- -
- -
- -

Add an Object Category

- -
- -
- - - -
- -
- -
- -
- -

List associated of Actions

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionCategoryActions
- -
- - Loading -
- -
- -
- -
- - - - Delete - - -
- - - -
- -
There is no Actions
- -
- - -
- -
- -
- -
- -

Add an Action Category

- -
- -
. - - - -
- -
- -
\ No newline at end of file diff --git a/moon_gui/static/app/policy/edit/parameter/data/data.edit.dir.js b/moon_gui/static/app/policy/edit/parameter/data/data.edit.dir.js deleted file mode 100755 index 2ae08177..00000000 --- a/moon_gui/static/app/policy/edit/parameter/data/data.edit.dir.js +++ /dev/null @@ -1,258 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .directive('moonDataEdit', moonDataEdit); - - moonDataEdit.$inject = []; - - function moonDataEdit() { - - return { - templateUrl : 'html/policy/edit/parameter/data/data-edit.tpl.html', - bindToController : true, - controller : moonDataEditController, - controllerAs : 'edit', - scope : { - //Type can be 'ACTION', 'OBJECT', 'SUBJECT' - mnDataType: '=', - policy : '=' - }, - restrict : 'E', - replace : true - }; - - } - - angular - .module('moon') - .controller('moonDataEditController', moonDataEditController); - - moonDataEditController.$inject = ['$scope', 'dataService', 'DATA_CST', 'alertService', '$translate', - 'formService', 'policyService', 'utilService', 'metaDataService', 'modelService', 'metaRuleService']; - - function moonDataEditController($scope, dataService, DATA_CST, alertService, $translate, - formService, policyService, utilService, metaDataService, modelService, metaRuleService) { - - var edit = this; - - edit.dataType = $scope.edit.mnDataType; - edit.policy = $scope.edit.policy; - - edit.fromList = false; - - edit.loading = false; - - edit.form = {}; - - edit.data = { name: null, description: null}; - - edit.list = []; - edit.categoriesToBeSelected = []; - - edit.create = createData; - - activate(); - - /* - * - */ - - function activate(){ - - loadAllCategories(); - - switch(edit.dataType){ - - case DATA_CST.TYPE.SUBJECT: - - dataService.subject.findAllFromPolicyWithCallback(edit.policy.id, callBackList); - break; - - case DATA_CST.TYPE.OBJECT: - - dataService.object.findAllFromPolicyWithCallback(edit.policy.id, callBackList); - break; - - case DATA_CST.TYPE.ACTION: - - dataService.action.findAllFromPolicyWithCallback(edit.policy.id, callBackList); - break; - - default : - - edit.list = []; - break; - - } - - function callBackList(list){ - - // For each Data, there is a check about the mapping between the Data and the policy - _.each(list, function (element) { - if (element.policy_id !== edit.policy.id) { - - edit.list.push(element); - - } - }); - - } - - } - - - function loadAllCategories(){ - - modelService.findOneWithCallback(edit.policy.model_id, function(model){ - - metaRuleService.findSomeWithCallback(model.meta_rules, function(metaRules){ - - switch(edit.dataType){ - - case DATA_CST.TYPE.SUBJECT: - var subjectCategoryList = _.reduce(metaRules, function(result, metaRule) { - return result.concat(metaRule.subject_categories); - }, []) - metaDataService.subject.findSomeWithCallback(subjectCategoryList, callBackList); - break; - - case DATA_CST.TYPE.OBJECT: - var objectCategoryList = _.reduce(metaRules, function(result, metaRule) { - return result.concat(metaRule.object_categories); - }, []) - metaDataService.object.findSomeWithCallback(objectCategoryList, callBackList); - break; - - case DATA_CST.TYPE.ACTION: - var actionCategoryList = _.reduce(metaRules, function(result, metaRule) { - return result.concat(metaRule.action_categories); - }, []) - metaDataService.action.findSomeWithCallback(actionCategoryList, callBackList); - break; - - default : - - edit.categoriesToBeSelected = []; - break; - - } - - function callBackList(list){ - - edit.categoriesToBeSelected = list; - - } - }); - - }); - - - } - - /** - * Create - */ - - function createData() { - - if(formService.isInvalid(edit.form)) { - - formService.checkFieldsValidity(edit.form); - - } else { - - startLoading(); - - var dataToSend = angular.copy(edit.data); - - switch(edit.dataType){ - - case DATA_CST.TYPE.SUBJECT: - - dataService.subject.add(dataToSend, edit.policy.id, edit.selectedCategory.id, createSuccess, createError); - break; - - case DATA_CST.TYPE.OBJECT: - - dataService.object.add(dataToSend, edit.policy.id, edit.selectedCategory.id, createSuccess, createError); - break; - - case DATA_CST.TYPE.ACTION: - - dataService.action.add(dataToSend, edit.policy.id, edit.selectedCategory.id, createSuccess, createError); - break; - } - - } - - /** - * @param data - */ - function createSuccess(data) { - - var created = {}; - var name = ''; - - switch(edit.dataType){ - - case DATA_CST.TYPE.SUBJECT: - - created = utilService.transformOne(data['subject_data'], 'data'); - name = created.name; - break; - - case DATA_CST.TYPE.OBJECT: - - created = utilService.transformOne(data['object_data'], 'data'); - name = created.value.name; - break; - - case DATA_CST.TYPE.ACTION: - - created = utilService.transformOne(data['action_data'], 'data'); - name = created.value.name; - break; - } - - $translate('moon.policy.data.edit.create.success', { name: name }).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - $scope.$emit('event:createDataFromDataEditSuccess', created, edit.dataType); - - stopLoading(); - - edit.list.push(created); - - } - - function createError(reason) { - - $translate('moon.policy.data.edit.create.error', { name: dataToSend.name }).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - stopLoading(); - - } - - } - - function startLoading(){ - - edit.loading = true; - - } - - function stopLoading(){ - - edit.loading = false; - - } - - } - -})(); \ No newline at end of file diff --git a/moon_gui/static/app/policy/edit/parameter/data/data.list.dir.js b/moon_gui/static/app/policy/edit/parameter/data/data.list.dir.js deleted file mode 100755 index 23a7e535..00000000 --- a/moon_gui/static/app/policy/edit/parameter/data/data.list.dir.js +++ /dev/null @@ -1,293 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .directive('moonDataList', moonDataList); - - moonDataList.$inject = []; - - function moonDataList() { - - return { - templateUrl : 'html/policy/edit/parameter/data/data-list.tpl.html', - bindToController : true, - controller : moonDataListController, - controllerAs : 'list', - scope : { - policy: '=', - editMode : '=' - }, - restrict : 'E', - replace : true - }; - } - - angular - .module('moon') - .controller('moonDataListController', moonDataListController); - - moonDataListController.$inject = ['$scope', '$rootScope', 'dataService', '$translate', 'alertService', 'DATA_CST', 'metaDataService']; - - function moonDataListController($scope, $rootScope, dataService, $translate, alertService, DATA_CST, metaDataService){ - - var list = this; - - list.policy = $scope.list.policy; - list.editMode = $scope.list.editMode; - - list.typeOfSubject = DATA_CST.TYPE.SUBJECT; - list.typeOfObject = DATA_CST.TYPE.OBJECT; - list.typeOfAction = DATA_CST.TYPE.ACTION; - - list.deleteSub = deleteSub; - list.deleteObj = deleteObj; - list.deleteAct = deleteAct; - - list.getSubjects = getSubjects; - list.getObjects = getObjects; - list.getActions = getActions; - - list.getCategoryFromData = getCategoryFromData; - - activate(); - - function activate(){ - - manageSubjects(); - - manageObjects(); - - manageActions(); - - } - - var rootListeners = { - - 'event:createDataFromDataEditSuccess': $rootScope.$on('event:createDataFromDataEditSuccess', addDataToList) - - }; - - _.each(rootListeners, function(unbind){ - $scope.$on('$destroy', rootListeners[unbind]); - }); - - - function manageSubjects(){ - - list.loadingSub = true; - - dataService.subject.findAllFromPolicyWithCallback(list.policy.id, function(data){ - - list.subjects = data; - list.loadingSub = false; - - }); - } - - function manageObjects(){ - - list.loadingObj = true; - - dataService.object.findAllFromPolicyWithCallback(list.policy.id, function(data){ - - list.objects = data; - list.loadingObj = false; - - }); - - } - - function manageActions(){ - - list.loadingAct = true; - - dataService.action.findAllFromPolicyWithCallback(list.policy.id, function(data){ - - list.actions = data; - list.loadingAct = false; - - }); - - } - - function getCategoryFromData(data, type) { - - if(_.has(data, 'category')){ - return data.category; - } - - // if the call has not been made - if(!_.has(data, 'callCategoryInProgress')){ - - data.callCategoryInProgress = true; - - switch(type){ - - case DATA_CST.TYPE.SUBJECT: - metaDataService.subject.findOne(data.category_id, setCategoryToData); - break; - - case DATA_CST.TYPE.OBJECT: - metaDataService.object.findOne(data.category_id, setCategoryToData); - break; - - case DATA_CST.TYPE.ACTION: - metaDataService.action.findOne(data.category_id, setCategoryToData); - break; - - } - - } - - // if the call is in progress return false - return false; - - function setCategoryToData(category){ - - data.callCategoryInProgress = false; - data.category = category; - - } - } - - /** - * Delete - */ - - function deleteSub(subject){ - - subject.loader = true; - - dataService.subject.delete(subject, list.policy.id, subject.category_id, deleteSubSuccess, deleteSubError); - - function deleteSubSuccess(data){ - - $translate('moon.policy.data.subject.delete.success', { subjectName: subject.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - removeSubFromSubList(subject); - - subject.loader = false; - - } - - function deleteSubError(reason){ - - $translate('moon.policy.data.subject.delete.error', { subjectName: subject.name, reason: reason.message}).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - subject.loader = false; - - } - } - - function deleteObj(object){ - - object.loader = true; - - dataService.object.delete(object, list.policy.id, object.category_id, deleteObjSuccess, deleteObjError); - - function deleteObjSuccess(data){ - - $translate('moon.policy.data.object.delete.success', { objectName: object.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - removeObjFromObjList(object); - - object.loader = false; - - } - - function deleteObjError(reason){ - - $translate('moon.policy.data.object.delete.error', { objectName: object.name, reason: reason.message}).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - object.loader = false; - } - } - - function deleteAct(action){ - - action.loader = true; - - dataService.action.delete(action, list.policy.id, action.category_id, deleteActSuccess, deleteActError); - - function deleteActSuccess(data){ - - $translate('moon.policy.data.action.delete.success', { actionName: action.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - removeActFromActList(action); - - action.loader = false; - - } - - function deleteActError(reason){ - - $translate('moon.policy.data.action.delete.error', { actionName: action.name, reason: reason.message}).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - action.loader = false; - - } - } - - function getSubjects(){ - return list.subjects ? list.subjects : []; - } - - function getObjects(){ - return list.objects ? list.objects : []; - } - - function getActions(){ - return list.actions ? list.actions : []; - } - - function removeSubFromSubList(subject){ - list.subjects = _.without(list.subjects, subject); - } - - function removeObjFromObjList(object){ - list.objects = _.without(list.objects, object); - } - - function removeActFromActList(action){ - list.actions = _.without(list.actions, action); - } - - function addDataToList( event, data, typeOfData){ - - switch(typeOfData){ - - case DATA_CST.TYPE.SUBJECT: - - list.subjects.push(data); - break; - - case DATA_CST.TYPE.OBJECT: - - list.objects.push(data); - break; - - case DATA_CST.TYPE.ACTION: - - list.actions.push(data); - break; - } - - } - - } - -})(); \ No newline at end of file -- cgit 1.2.3-korg