aboutsummaryrefslogtreecommitdiffstats
path: root/moon_gui/static/app/model/edit/metarules/action
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2020-06-03 10:06:52 +0200
committerThomas Duval <thomas.duval@orange.com>2020-06-03 10:06:52 +0200
commit7bb53c64da2dcf88894bfd31503accdd81498f3d (patch)
tree4310e12366818af27947b5e2c80cb162da93a4b5 /moon_gui/static/app/model/edit/metarules/action
parentcbea4e360e9bfaa9698cf7c61c83c96a1ba89b8c (diff)
Update to new version 5.4HEADstable/jermamaster
Signed-off-by: Thomas Duval <thomas.duval@orange.com> Change-Id: Idcd868133d75928a1ffd74d749ce98503e0555ea
Diffstat (limited to 'moon_gui/static/app/model/edit/metarules/action')
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/mapping/metarules-add.tpl.html50
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/mapping/metarules-map.tpl.html102
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/mapping/metarules-unmap.tpl.html35
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/mapping/metarules.controller.add.js99
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/mapping/metarules.map.controller.js213
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/mapping/metarules.unmap.controller.js74
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/metarules-edit-basic.tpl.html67
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/metarules-edit.tpl.html62
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/metarules.controller.edit.js49
-rwxr-xr-xmoon_gui/static/app/model/edit/metarules/action/metarules.edit.basic.dir.js100
10 files changed, 0 insertions, 851 deletions
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 @@
-<div class="row">
-
- <form class="form-horizontal" role="form" name="add.form">
-
- <div class="form-group" ng-class="{'has-error': add.form.name.$invalid && add.form.name.$dirty}">
-
- <label for="name" class="col-sm-3 control-label" data-translate="moon.model.metarules.add.form.name">Name</label>
-
- <div class="col-sm-6">
-
- <input name="name" id="name" class="form-control" type="text" data-ng-model="add.metaRule.name" required />
-
- <div class="help-block" ng-show="add.form.name.$dirty && add.form.name.$invalid">
- <small class="error" ng-show="add.form.name.$error.required" data-translate="moon.model.metarules.add.check.name.required">Name is required</small>
- </div>
-
- </div>
- </div>
-
- <div class="form-group">
-
- <label for="description" class="col-sm-3 control-label" data-translate="moon.model.metarules.add.form.description">Description</label>
- <div class="col-sm-6">
- <textarea id="description" name="description" class="form-control" data-ng-model="add.metaRule.description"></textarea>
- </div>
-
- </div>
-
-
- <div class="form-group">
-
- <div class="col-sm-8">
-
- <div class="pull-right">
-
- <a href="" ng-disabled="add.loading" ng-click="add.create()" class="btn btn-warning">
- <span class="glyphicon glyphicon-save"></span>
- <span data-translate="moon.model.metarules.add.action.create">Create</span>
- </a>
-
- <moon-loader ng-if="add.loading"></moon-loader>
-
- </div>
-
- </div>
-
- </div>
- </form>
-
-</div>
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 @@
-<div ng-controller="moonMetaRulesMapController as map" class="modal" tabindex="-1" data-role="MapMetaRules">
-
- <div class="modal-dialog">
-
- <div class="modal-content">
-
- <div class="modal-header">
-
- <button type="button" class="close" ng-click="$hide()">&times;</button>
- <h4 class="modal-title" data-translate="moon.model.metarules.map.title"></h4>
-
- </div>
-
- <div class="modal-body">
-
- <div class="row">
-
- <div class="col-sm-3">
-
- <button class="btn btn-primary" style="white-space: normal;" ng-click="map.addMetaRuleToList = !map.addMetaRuleToList">
-
- <span ng-if="!map.addMetaRuleToList" data-translate="moon.model.metarules.map.action.new">Add a new Meta Rule</span>
- <span ng-if="map.addMetaRuleToList" data-translate="moon.model.metarules.map.action.list">List of Meta Rules</span>
-
- </button>
-
- </div>
-
- <div class="col-sm-9">
-
- <form class="form-horizontal" role="form" name="map.form">
-
- <div class="form-group" ng-if="!map.addMetaRuleToList">
-
- <label class="col-sm-3 control-label" data-translate="moon.model.metarules.map.form.list">List of Meta Rule</label>
-
- <div class="col-sm-9">
-
- <ui-select ng-model="map.selectedMetaRule" name="object">
-
- <ui-select-match placeholder="(None)" ng-bind="$select.selected.name"></ui-select-match>
- <ui-select-choices repeat="ametaRule in map.metaRules">
- <div ng-value="ametaRule" ng-bind="ametaRule.name"></div>
- </ui-select-choices>
-
- </ui-select>
-
- </div>
-
- </div>
-
- <div class="form-group" ng-if="!map.addMetaRuleToList">
-
- <moon-loader ng-if="map.metaRulesLoading || map.mappingLoading" ></moon-loader>
-
- <div class="col-sm-5">
- <a href="" ng-disabled="map.metaRulesLoading || map.mappingLoading || !map.selectedMetaRule" ng-click="map.deleteMetaRule()" class="btn btn-warning" style="white-space: normal;">
- <span class="glyphicon glyphicon-trash"></span>
- <span data-translate="moon.model.metarules.map.action.delete">Delete the selected Meta Rule</span>
- </a>
- </div>
-
- <div class="col-sm-5 col-sm-offset-2">
- <a href="" ng-disabled="map.metaRulesLoading || map.mappingLoading || !map.selectedMetaRule" ng-click="map.mapToModel()" class="btn btn-warning" style="white-space: normal;">
- <span class="glyphicon glyphicon-link"></span>
- <span data-translate="moon.model.metarules.map.action.add">Add the selected Meta Rule</span>
- </a>
- </div>
-
- </div>
-
- <div class="form-group" ng-if="map.addMetaRuleToList">
-
- <moon-meta-rules-add></moon-meta-rules-add>
-
- </div>
-
- </form>
-
- </div>
-
- </div>
-
- </div>
-
- <div class="modal-footer">
-
- <div class="btn-toolbar" style="float: right;">
-
- <a href="" ng-click="$hide()" class="btn btn-default">
- <span data-translate="moon.model.metarules.add.action.cancel">Cancel</span>
- </a>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
-</div>
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 @@
-<div ng-controller="MetaRulesUnMapController as unmap" class="modal" tabindex="-1" data-role="modalUnMapMetaRule">
-
- <div class="modal-dialog">
-
- <div class="modal-content">
-
- <div class="modal-header">
- <button type="button" class="close" ng-click="$hide()">&times;</button>
- <h4 class="modal-title" data-translate="moon.model.metarules.unmap.title"></h4>
- </div>
-
- <div class="modal-body">
- <span data-translate="moon.model.metarules.unmap.content" data-translate-values="{ modelName: unmap.model.name, metaRuleName: unmap.metaRule.name }"></span>
- </div>
-
- <div class="modal-footer">
-
- <div class="btn-toolbar" style="float: right;">
- <a href="" ng-click="$hide()" class="btn btn-default">
- <span data-translate="moon.model.metarules.unmap.action.cancel">Cancel</span>
- </a>
- <a href="" ng-disabled="unmap.unMappingLoading" ng-click="unmap.unmap()" class="btn btn-warning">
- <span class="glyphicon glyphicon-transfer"></span>
- <span data-translate="moon.model.metarules.unmap.action.unmap">Unmap</span>
- </a>
- <moon-loader ng-if="unmap.unMappingLoading" ></moon-loader>
- </div>
-
- </div>
-
- </div>
-
- </div>
-
-</div> \ 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<arnaud.marhin@orange.com>
- */
-
-(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');
-
- }
-
- }
-
- }
-
-})();
diff --git a/moon_gui/static/app/model/edit/metarules/action/metarules-edit-basic.tpl.html b/moon_gui/static/app/model/edit/metarules/action/metarules-edit-basic.tpl.html
deleted file mode 100755
index b6136195..00000000
--- a/moon_gui/static/app/model/edit/metarules/action/metarules-edit-basic.tpl.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<div class="row">
-
- <form class="form-horizontal" role="form" name="edit.form">
-
- <div class="form-group">
-
- <label for="id" class="col-sm-3 control-label" data-translate="moon.model.metarules.edit.basic.form.id">Id</label>
-
- <div class="col-sm-6">
-
- <input name="id" id="id" disabled class="form-control" type="text" data-ng-model="edit.metaRuleToEdit.id" required />
-
- </div>
-
- </div>
-
- <div class="form-group" ng-class="{'has-error': edit.form.name.$invalid && edit.form.name.$dirty}">
-
- <label for="name" class="col-sm-3 control-label" data-translate="moon.model.metarules.edit.basic.form.name">Name</label>
-
- <div class="col-sm-6">
-
- <input name="name" id="name" class="form-control" type="text" data-ng-model="edit.metaRuleToEdit.name" required />
-
- <div class="help-block" ng-show="edit.form.name.$dirty && edit.form.name.$invalid">
- <small class="error" ng-show="edit.form.name.$error.required" data-translate="moon.model.metarules.edit.basic.check.name.required">Name is required</small>
- </div>
-
- </div>
-
- </div>
-
- <div class="form-group">
-
- <label for="description" class="col-sm-3 control-label" data-translate="moon.model.metarules.edit.basic.form.description">Description</label>
- <div class="col-sm-6">
- <textarea id="description" name="description" class="form-control" data-ng-model="edit.metaRuleToEdit.description"></textarea>
- </div>
-
- </div>
-
- <div class="form-group">
-
- <div class="col-sm-2 col-sm-offset-3">
-
- <a href="" ng-disabled="edit.loading" ng-click="edit.init()" class="btn btn-default">
- <span data-translate="moon.model.metarules.edit.basic.action.init">Init</span>
- </a>
-
- </div>
-
- <div class="col-sm-4 col-sm-offset-2">
-
- <a href="" ng-disabled="edit.loading" ng-click="edit.editMetaRule()" class="btn btn-warning">
- <span class="glyphicon glyphicon-save"></span>
- <span data-translate="moon.model.metarules.edit.basic.action.update">Update</span>
- </a>
-
- <moon-loader ng-if="edit.loading"></moon-loader>
-
- </div>
-
- </div>
-
- </form>
-
-</div> \ No newline at end of file
diff --git a/moon_gui/static/app/model/edit/metarules/action/metarules-edit.tpl.html b/moon_gui/static/app/model/edit/metarules/action/metarules-edit.tpl.html
deleted file mode 100755
index 7b074448..00000000
--- a/moon_gui/static/app/model/edit/metarules/action/metarules-edit.tpl.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<div ng-controller="MetaRulesEditController as edit" class="modal" tabindex="-1" data-role="modalViewProject">
-
- <div class="modal-dialog">
-
- <div class="modal-content">
-
- <div class="modal-header">
- <button type="button" class="close" ng-click="$hide()">&times;</button>
- <h4 class="modal-title" data-translate="moon.model.metarules.edit.title" data-translate-values="{metaRuleName: edit.metaRule.name}"></h4>
- </div>
-
- <div class="modal-body">
-
- <div class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4>
- <span data-translate="moon.model.edit.basic.title" >Basic Information</span>
- <a href="" ng-click="edit.editBasic = !edit.editBasic">
- <span data-translate="moon.model.metarules.edit.update">Update</span>
- <span class="glyphicon glyphicon-cog"></span>
- </a>
- </h4>
-
- </div>
-
- <div class="panel-body">
-
- <div ng-if="edit.editBasic">
- <moon-meta-rules-edit-basic meta-rule="edit.metaRule"></moon-meta-rules-edit-basic>
- </div>
-
- <div ng-if="!edit.editBasic">
- <dl class="dl-horizontal">
- <dt>Id</dt>
- <dd ng-bind="edit.metaRule.id"></dd>
- <dt>Name</dt>
- <dd ng-bind="edit.metaRule.name"></dd>
- <dt>Description</dt>
- <dd ng-bind="edit.metaRule.description"></dd>
- </dl>
- </div>
- </div>
-
- </div>
-
- <moon-meta-data-list edit-mode="true" meta-rule="edit.metaRule"></moon-meta-data-list>
-
- </div>
-
- <div class="modal-footer top10">
- <div class="btn-toolbar" style="float: right;">
- <button ng-click="$hide()" class="btn btn-default" data-translate="moon.model.view.action.close">Close</button>
- </div>
- </div>
-
- </div>
-
- </div>
-
-</div>
diff --git a/moon_gui/static/app/model/edit/metarules/action/metarules.controller.edit.js b/moon_gui/static/app/model/edit/metarules/action/metarules.controller.edit.js
deleted file mode 100755
index de6965d0..00000000
--- a/moon_gui/static/app/model/edit/metarules/action/metarules.controller.edit.js
+++ /dev/null
@@ -1,49 +0,0 @@
-(function() {
-
- 'use strict';
-
- angular
- .module('moon')
- .controller('MetaRulesEditController', MetaRulesEditController);
-
- MetaRulesEditController.$inject = ['$scope', '$rootScope'];
-
- function MetaRulesEditController($scope, $rootScope) {
-
- var edit = this;
-
- edit.metaRule = $scope.metaRule;
-
- activate();
-
- function activate(){
- }
-
-
- /*
- * ---- events
- */
- var rootListeners = {
-
- 'event:metaRuleBasicUpdatedSuccess': $rootScope.$on('event:metaRuleBasicUpdatedSuccess', metaRuleUpdatedSuccess)
-
- };
-
- for (var unbind in rootListeners) {
- $scope.$on('$destroy', rootListeners[unbind]);
- }
-
- /**
- * When the MetaRule is updated, this function refresh the current metaRule with the new changes
- * @param event
- * @param metaRule
- */
- function metaRuleUpdatedSuccess(event, metaRule){
-
- angular.copy(metaRule, edit.metaRule);
-
- }
-
- }
-
-})();
diff --git a/moon_gui/static/app/model/edit/metarules/action/metarules.edit.basic.dir.js b/moon_gui/static/app/model/edit/metarules/action/metarules.edit.basic.dir.js
deleted file mode 100755
index b9dcd19c..00000000
--- a/moon_gui/static/app/model/edit/metarules/action/metarules.edit.basic.dir.js
+++ /dev/null
@@ -1,100 +0,0 @@
-(function() {
-
- 'use strict';
-
- angular
- .module('moon')
- .directive('moonMetaRulesEditBasic', moonMetaRulesEditBasic);
-
- moonMetaRulesEditBasic.$inject = [];
-
- function moonMetaRulesEditBasic() {
-
- return {
- templateUrl : 'html/model/edit/metarules/action/metarules-edit-basic.tpl.html',
- bindToController : true,
- controller : moonMetaRulesEditBasicController,
- controllerAs : 'edit',
- scope : {
- metaRule : '='
- },
- restrict : 'E',
- replace : true
- };
-
- }
-
- angular
- .module('moon')
- .controller('moonMetaRulesEditBasicController', moonMetaRulesEditBasicController);
-
- moonMetaRulesEditBasicController.$inject = ['$scope', 'metaRuleService', 'formService', 'alertService', '$translate', 'utilService'];
-
- function moonMetaRulesEditBasicController($scope, metaRuleService, formService, alertService, $translate, utilService){
-
- var edit = this;
-
- edit.editMetaRule = editMetaRule;
- edit.init = init;
-
- edit.form = {};
-
- activate();
-
- function activate(){
-
- edit.metaRule = $scope.edit.metaRule;
-
- edit.metaRuleToEdit = angular.copy(edit.metaRule);
-
- }
-
- function editMetaRule(){
-
- if(formService.isInvalid(edit.form)) {
-
- formService.checkFieldsValidity(edit.form);
-
- }else{
-
- edit.loading = true;
-
- metaRuleService.update(edit.metaRuleToEdit, updateSuccess, updateError);
-
- }
-
- function updateSuccess(data) {
-
- var updatedMetaRule = utilService.transformOne(data, 'meta_rules');
-
- angular.copy(updatedMetaRule, edit.metaRule);
-
- $translate('moon.model.metarules.edit.basic.success', { metaRuleName: updatedMetaRule.name }).then( function(translatedValue) {
- alertService.alertSuccess(translatedValue);
- });
-
- edit.loading = false;
-
- $scope.$emit('event:metaRuleBasicUpdatedSuccess', edit.metaRule);
-
- }
-
- function updateError(reason) {
-
- $translate('moon.model.edit.basic.error', { metaRuleName: edit.metaRule.name }).then( function(translatedValue) {
- alertService.alertError(translatedValue);
- });
-
- edit.loading = false;
-
- }
- }
-
- function init(){
-
- edit.metaRuleToEdit = angular.copy(edit.metaRule);
-
- }
- }
-
-})();