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 --- .../action/mapping/metarules-add.tpl.html | 50 ----- .../action/mapping/metarules-map.tpl.html | 102 ---------- .../action/mapping/metarules-unmap.tpl.html | 35 ---- .../action/mapping/metarules.controller.add.js | 99 ---------- .../action/mapping/metarules.map.controller.js | 213 --------------------- .../action/mapping/metarules.unmap.controller.js | 74 ------- 6 files changed, 573 deletions(-) delete mode 100755 moon_gui/static/app/model/edit/metarules/action/mapping/metarules-add.tpl.html delete mode 100755 moon_gui/static/app/model/edit/metarules/action/mapping/metarules-map.tpl.html delete mode 100755 moon_gui/static/app/model/edit/metarules/action/mapping/metarules-unmap.tpl.html delete mode 100755 moon_gui/static/app/model/edit/metarules/action/mapping/metarules.controller.add.js delete mode 100755 moon_gui/static/app/model/edit/metarules/action/mapping/metarules.map.controller.js delete mode 100755 moon_gui/static/app/model/edit/metarules/action/mapping/metarules.unmap.controller.js (limited to 'moon_gui/static/app/model/edit/metarules/action/mapping') diff --git a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-add.tpl.html b/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-add.tpl.html deleted file mode 100755 index a721e6d0..00000000 --- a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-add.tpl.html +++ /dev/null @@ -1,50 +0,0 @@ -
- -
- -
- - - -
- - - -
- Name is required -
- -
-
- -
- - -
- -
- -
- - -
- -
- -
- - - - Create - - - - -
- -
- -
-
- -
diff --git a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-map.tpl.html b/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-map.tpl.html deleted file mode 100755 index 1830204b..00000000 --- a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-map.tpl.html +++ /dev/null @@ -1,102 +0,0 @@ - diff --git a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-unmap.tpl.html b/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-unmap.tpl.html deleted file mode 100755 index bb02aba2..00000000 --- a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-unmap.tpl.html +++ /dev/null @@ -1,35 +0,0 @@ - \ No newline at end of file diff --git a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.controller.add.js b/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.controller.add.js deleted file mode 100755 index a95951fa..00000000 --- a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.controller.add.js +++ /dev/null @@ -1,99 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .directive('moonMetaRulesAdd', moonMetaRulesAdd); - - moonMetaRulesAdd.$inject = []; - - function moonMetaRulesAdd() { - - return { - templateUrl : 'html/model/edit/metarules/action/mapping/metarules-add.tpl.html', - bindToController : true, - controller : moonMetaRulesAddController, - controllerAs : 'add', - scope : { - metaRules : '=' - }, - restrict : 'E', - replace : true - }; - } - - - angular - .module('moon') - .controller('moonMetaRulesAddController', moonMetaRulesAddController); - - moonMetaRulesAddController.$inject = ['$scope', 'metaRuleService', 'alertService', '$translate', 'formService', 'utilService']; - - function moonMetaRulesAddController($scope, metaRuleService, alertService, $translate, formService, utilService) { - - var add = this; - - /* - * - */ - - add.laoading = false; - - add.form = {}; - - add.metaRule = { name: null, description: null, subject_categories : [], object_categories : [], action_categories : [] }; - - add.create = createMetaRule; - - activate(); - - function activate(){ - - } - - function createMetaRule() { - - if(formService.isInvalid(add.form)) { - - formService.checkFieldsValidity(add.form); - - } else { - - add.loading = true; - - metaRuleService.data.create({}, add.metaRule, createSuccess, createError); - - } - - function createSuccess(data) { - - var createdMetaRule = utilService.transformOne(data, 'meta_rules'); - - $translate('moon.model.metarules.add.success', { metaRuleName: createdMetaRule.name }).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - add.loading = false; - - $scope.$emit('event:metaRuleCreatedSuccess', createdMetaRule); - - } - - function createError(reason) { - - $translate('moon.model.metarules.add.error', { metaRuleName: add.metaRule.name }).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - add.loading = false; - - $scope.$emit('event:metaRuleCreatedError', add.project); - - } - - } - - } - -})(); diff --git a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.map.controller.js b/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.map.controller.js deleted file mode 100755 index cf9ba06c..00000000 --- a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.map.controller.js +++ /dev/null @@ -1,213 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('moonMetaRulesMapController', moonMetaRulesMapController); - - moonMetaRulesMapController.$inject = ['$scope', '$rootScope', 'alertService', '$translate', 'formService', 'metaRuleService', 'modelService', 'utilService']; - - function moonMetaRulesMapController($scope, $rootScope, alertService, $translate, formService, metaRuleService, modelService, utilService ) { - - var map = this; - - /* - * - */ - - map.metaRules = []; - - map.model = $scope.model; - - map.addMetaRuleToList = false; - - map.mapToModel = mapToModel; - - map.deleteMetaRule = deleteMetaRule; - - activate(); - - function activate() { - - resolveMetaRules(); - - } - - /* - * ---- events - */ - var rootListeners = { - - 'event:metaRuleCreatedSuccess': $rootScope.$on('event:metaRuleCreatedSuccess', metaRuleCreatedSuccess), - 'event:metaRuleCreatedError': $rootScope.$on('event:metaRuleCreatedError', metaRuleCreatedError) - - }; - - for (var unbind in rootListeners) { - $scope.$on('$destroy', rootListeners[unbind]); - } - - - /* - * - */ - - function resolveMetaRules() { - - map.metaRulesLoading = true; - - metaRuleService.findAllWithCallback( - function(metaRules){ - map.metaRules = metaRules; - map.metaRulesLoading = false; - } - ); - - } - - function mapToModel() { - - if (formService.isInvalid(map.form)) { - - formService.checkFieldsValidity(map.form); - - } else { - - map.mappingLoading = true; - - var modelToSend = angular.copy(map.model); - - modelToSend.meta_rules.push(map.selectedMetaRule.id); - - modelService.update(modelToSend, mapSuccess, mapError); - - } - - function mapSuccess(data) { - - var modelReceived = utilService.transformOne(data, 'models'); - - metaRuleService.findSomeWithMetaData(modelReceived.meta_rules).then(function(metaRules){ - - modelReceived.meta_rules_values = metaRules; - - $translate('moon.model.metarules.map.success', { - - modelName: modelReceived.name, - metaRuleName: map.selectedMetaRule.name - - }).then(function (translatedValue) { - - alertService.alertSuccess(translatedValue); - - }); - - map.mappingLoading = false; - - $scope.$emit('event:metaRuleMapToModelSuccess', modelReceived); - - }); - - } - - function mapError(response) { - - $translate('moon.model.metarules.map.error', { - - modelName: map.model.name, - metaRuleName: map.selectedMetaRule.name - - }).then(function (translatedValue) { - - alertService.alertError(translatedValue); - - }); - - map.mappingLoading = false; - - } - } - - function cleanSelectedValue(){ - - delete map.selectedMetaRule; - - } - - - function deleteMetaRule(){ - - if(!map.selectedMetaRule){ - - return; - - } - - map.mappingLoading = true; - - var metaRuleTodelete = angular.copy(map.selectedMetaRule); - - metaRuleService.delete(metaRuleTodelete, deleteSuccess, deleteError); - - function deleteSuccess(data) { - - $translate('moon.model.metarules.delete.success', { metaRuleName: metaRuleTodelete.name }).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - cleanSelectedValue(); - - map.mappingLoading = false; - - resolveMetaRules(); - - // later this event will have to be catch, because the model can use the deleted MetaRule - $scope.$emit('event:deleteMetaRule', metaRuleTodelete); - - } - - function deleteError(reason) { - - $translate('moon.model.metarules.delete.error', { metaRuleName: metaRuleTodelete.name }).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - map.mappingLoading = false; - - } - } - - - - - - - /** - * This function will add a metaRule to the current list of metaRules - * @param event - * @param metaRule {...} metaRule to add - */ - function metaRuleCreatedSuccess(event, metaRule) { - - map.metaRules.push(metaRule); - showList(); - - } - - /** - * This function hide the add MetaRule Modal - * @param event - */ - function metaRuleCreatedError(event) { - - } - - function showList(){ - map.addMetaRuleToList = false; - } - - } - - -})(); \ No newline at end of file diff --git a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.unmap.controller.js b/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.unmap.controller.js deleted file mode 100755 index 30f32d51..00000000 --- a/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.unmap.controller.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @author arnaud marhin - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('MetaRulesUnMapController', MetaRulesUnMapController); - - MetaRulesUnMapController.$inject = ['$scope', '$translate', 'alertService', 'modelService']; - - function MetaRulesUnMapController($scope, $translate, alertService, modelService) { - - var unmap = this; - - /* - * - */ - - unmap.model = $scope.model; - unmap.metaRule = $scope.metaRule; - - unmap.unMappingLoading = false; - - unmap.unmap = unMapModelToMetaRule; - - /* - * - */ - - function unMapModelToMetaRule() { - - unmap.unMappingLoading = true; - - var modelToUpdate = angular.copy(unmap.model); - - modelToUpdate.meta_rules = _.without(modelToUpdate.meta_rules, unmap.metaRule.id); - - modelService.update(modelToUpdate, unMapSuccess, unMapError); - - function unMapSuccess(data) { - - $translate('moon.model.metarules.unmap.success', { modelName: unmap.model.name, metaRuleName: unmap.metaRule.name }) - .then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - unmap.unMappingLoading = false; - - $scope.$emit('event:metaRuleUnMappedToModelSuccess', modelToUpdate); - - } - - function unMapError(reason) { - - $translate('moon.model.metarules.unmap.error', { modelName: unmap.model.name, metaRuleName: unmap.metaRule.name }) - .then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - unmap.unMappingLoading = false; - - $scope.$emit('event:metaRuleUnMappedToModelError'); - - } - - } - - } - -})(); -- cgit 1.2.3-korg