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 --- .../static/app/model/action/model-add.tpl.html | 66 --- .../static/app/model/action/model-delete.tpl.html | 39 -- .../static/app/model/action/model-view.tpl.html | 41 -- .../app/model/action/model.controller.add.js | 71 --- .../app/model/action/model.controller.delete.js | 72 --- .../app/model/action/model.controller.view.js | 53 --- .../app/model/edit/metadata/metadata-edit.tpl.html | 99 ----- .../app/model/edit/metadata/metadata-list.tpl.html | 491 --------------------- .../app/model/edit/metadata/metadata.edit.dir.js | 332 -------------- .../app/model/edit/metadata/metadata.list.dir.js | 372 ---------------- .../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 ---- .../metarules/action/metarules-edit-basic.tpl.html | 67 --- .../edit/metarules/action/metarules-edit.tpl.html | 62 --- .../metarules/action/metarules.controller.edit.js | 49 -- .../metarules/action/metarules.edit.basic.dir.js | 98 ---- .../model/edit/metarules/metarules-list.tpl.html | 138 ------ .../app/model/edit/metarules/metarules.list.dir.js | 240 ---------- .../app/model/edit/model-edit-basic.tpl.html | 65 --- .../static/app/model/edit/model-edit.tpl.html | 70 --- .../static/app/model/edit/model.controller.edit.js | 61 --- .../static/app/model/edit/model.edit.basic.dir.js | 97 ---- .../moon_gui/static/app/model/model-list.tpl.html | 123 ------ .../static/app/model/model.controller.list.js | 195 -------- 28 files changed, 3474 deletions(-) delete mode 100755 moonv4/moon_gui/static/app/model/action/model-add.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/action/model-delete.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/action/model-view.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/action/model.controller.add.js delete mode 100755 moonv4/moon_gui/static/app/model/action/model.controller.delete.js delete mode 100755 moonv4/moon_gui/static/app/model/action/model.controller.view.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/metadata/metadata-edit.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/metadata/metadata-list.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/metadata/metadata.edit.dir.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/metadata/metadata.list.dir.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-add.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-map.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-unmap.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.controller.add.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.map.controller.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.unmap.controller.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/metarules-edit-basic.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/metarules-edit.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/metarules.controller.edit.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/action/metarules.edit.basic.dir.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/metarules-list.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/metarules/metarules.list.dir.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/model-edit-basic.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/model-edit.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/edit/model.controller.edit.js delete mode 100755 moonv4/moon_gui/static/app/model/edit/model.edit.basic.dir.js delete mode 100755 moonv4/moon_gui/static/app/model/model-list.tpl.html delete mode 100755 moonv4/moon_gui/static/app/model/model.controller.list.js (limited to 'moonv4/moon_gui/static/app/model') diff --git a/moonv4/moon_gui/static/app/model/action/model-add.tpl.html b/moonv4/moon_gui/static/app/model/action/model-add.tpl.html deleted file mode 100755 index dee53a97..00000000 --- a/moonv4/moon_gui/static/app/model/action/model-add.tpl.html +++ /dev/null @@ -1,66 +0,0 @@ - diff --git a/moonv4/moon_gui/static/app/model/action/model-delete.tpl.html b/moonv4/moon_gui/static/app/model/action/model-delete.tpl.html deleted file mode 100755 index cde16d0e..00000000 --- a/moonv4/moon_gui/static/app/model/action/model-delete.tpl.html +++ /dev/null @@ -1,39 +0,0 @@ - \ No newline at end of file diff --git a/moonv4/moon_gui/static/app/model/action/model-view.tpl.html b/moonv4/moon_gui/static/app/model/action/model-view.tpl.html deleted file mode 100755 index 46c295c7..00000000 --- a/moonv4/moon_gui/static/app/model/action/model-view.tpl.html +++ /dev/null @@ -1,41 +0,0 @@ - diff --git a/moonv4/moon_gui/static/app/model/action/model.controller.add.js b/moonv4/moon_gui/static/app/model/action/model.controller.add.js deleted file mode 100755 index 11d3abf4..00000000 --- a/moonv4/moon_gui/static/app/model/action/model.controller.add.js +++ /dev/null @@ -1,71 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('ModelAddController', ModelAddController); - - ModelAddController.$inject = ['$scope', 'modelService', 'alertService', '$translate', 'formService', 'utilService']; - - function ModelAddController($scope, modelService, alertService, $translate, formService, utilService) { - - var add = this; - - /* - * - */ - - add.form = {}; - - add.loading = false; - - add.model = { name: null, description: null, meta_rules : [] }; - - add.create = createModel; - - function createModel() { - - if(formService.isInvalid(add.form)) { - - formService.checkFieldsValidity(add.form); - - } else { - - add.loading = true; - - modelService.data.create({}, add.model, createSuccess, createError); - - } - - function createSuccess(data) { - - var createdModel = utilService.transformOne(data, 'models'); - - $translate('moon.model.add.success', { modelName: createdModel.name }).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - add.loading = false; - - $scope.$emit('event:modelCreatedSuccess', createdModel); - - } - - function createError(reason) { - - $translate('moon.model.add.error', { modelName: add.model.name }).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - add.loading = false; - - $scope.$emit('event:modelCreatedError', add.project); - - } - - } - - } - -})(); diff --git a/moonv4/moon_gui/static/app/model/action/model.controller.delete.js b/moonv4/moon_gui/static/app/model/action/model.controller.delete.js deleted file mode 100755 index 5d9dae1a..00000000 --- a/moonv4/moon_gui/static/app/model/action/model.controller.delete.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @author arnaud marhin - */ - -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('ModelDeleteController', ModelDeleteController); - - ModelDeleteController.$inject = ['$scope', '$translate', 'alertService', 'modelService']; - - function ModelDeleteController($scope, $translate, alertService, modelService) { - - var del = this; - - /* - * - */ - - del.model = $scope.model; - del.loading = false; - - del.remove = deleteModel; - - activate(); - - /** - * - */ - - function activate(){ - - } - - - function deleteModel(){ - - del.loading = true; - - modelService.delete(del.model, deleteSuccess, deleteError); - - function deleteSuccess(data) { - - $translate('moon.model.remove.success', { modelName: del.model.name }).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - del.loading = false; - - $scope.$emit('event:modelDeletedSuccess', del.model); - - } - - function deleteError(reason) { - - $translate('moon.model.remove.error', { modelName: del.model.name, errorCode: reason.data.error.code, message : reason.data.error.message } ).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - del.loading = false; - - $scope.$emit('event:modelDeletedError', del.model); - - } - - } - } - -})(); diff --git a/moonv4/moon_gui/static/app/model/action/model.controller.view.js b/moonv4/moon_gui/static/app/model/action/model.controller.view.js deleted file mode 100755 index 7605eecf..00000000 --- a/moonv4/moon_gui/static/app/model/action/model.controller.view.js +++ /dev/null @@ -1,53 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('ModelViewController', ModelViewController); - - ModelViewController.$inject = ['$scope', 'metaRuleService']; - - function ModelViewController($scope, metaRuleService) { - - var view = this; - - /* - * - */ - - view.model = $scope.model; - - view.meta_rules_values = false; - - activate(); - - function activate(){ - - if(view.model.meta_rules.length > 0 ){ - - findMetaRules(); - - }else{ - - view.meta_rules_values = []; - - } - - } - - function findMetaRules(){ - - metaRuleService.findSomeWithMetaData(view.model.meta_rules).then(function(metaRules){ - - view.meta_rules_values = metaRules; - - view.model.meta_rules_values = metaRules; - - }); - - } - - } - -})(); diff --git a/moonv4/moon_gui/static/app/model/edit/metadata/metadata-edit.tpl.html b/moonv4/moon_gui/static/app/model/edit/metadata/metadata-edit.tpl.html deleted file mode 100755 index 2616be1c..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metadata/metadata-edit.tpl.html +++ /dev/null @@ -1,99 +0,0 @@ -
- - - -
- -
- -
- - - - - -
-
- -
- -
- - - - - -
- -
- -
- - - -
- - - -
- Name is required -
- -
- -
- -
- - -
- -
- -
- -
- -
- - - - Create - - - - -
- -
- -
- -
- -
\ No newline at end of file diff --git a/moonv4/moon_gui/static/app/model/edit/metadata/metadata-list.tpl.html b/moonv4/moon_gui/static/app/model/edit/metadata/metadata-list.tpl.html deleted file mode 100755 index 30a42dbc..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metadata/metadata-list.tpl.html +++ /dev/null @@ -1,491 +0,0 @@ -
- -
- -
- -
- -

List of associated Subject Categories

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IdNameDescription
- - - - Remove - - - - -
- - - -
- -
There is no Subjects
- -
- -
- -
- -
- -
- -

Add a Subject Category

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

List associated of Object Categories

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IdNameDescription
- - - - Remove - - - - - -
- - - -
- -
There is no Objects
- -
- -
- -
- -
- -
- -

Add an Object Category

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

List associated of Action Categories

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IdNameDescription
- - - - Remove - - - - -
- - - -
- -
There is no Actions
- -
- -
- -
- -
- -
- -

Add an Action Category

- -
- -
. - - - -
- -
- -
- - -
- -
- -
- -
- -
- -

List of associated Subject Categories

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
Name
There is no Subjects
- -
- -
- -
- -
- -
- -
- -
- -

List associated of Object Categories

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Name
There is no Objects
- -
- -
- -
- -
- -
- -
- -
- -

List associated of Action Categories

- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - -
Name
There is no Actions
- -
- -
- -
- -
- -
-
-
\ No newline at end of file diff --git a/moonv4/moon_gui/static/app/model/edit/metadata/metadata.edit.dir.js b/moonv4/moon_gui/static/app/model/edit/metadata/metadata.edit.dir.js deleted file mode 100755 index 10df83b0..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metadata/metadata.edit.dir.js +++ /dev/null @@ -1,332 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .directive('moonMetaDataEdit', moonMetaDataEdit); - - moonMetaDataEdit.$inject = []; - - function moonMetaDataEdit() { - - return { - templateUrl : 'html/model/edit/metadata/metadata-edit.tpl.html', - bindToController : true, - controller : moonMetaDataEditController, - controllerAs : 'edit', - scope : { - //Type can be 'ACTION', 'OBJECT', 'SUBJECT' - metaDataType: '=', - metaRule : '=' - }, - restrict : 'E', - replace : true - }; - } - - angular - .module('moon') - .controller('moonMetaDataEditController', moonMetaDataEditController); - - moonMetaDataEditController.$inject = ['$scope', 'metaDataService', 'META_DATA_CST', 'alertService', - '$translate', 'formService', 'metaRuleService', 'utilService']; - - function moonMetaDataEditController($scope, metaDataService, META_DATA_CST, alertService, - $translate, formService, metaRuleService, utilService) { - - var edit = this; - - edit.metaDataType = $scope.edit.metaDataType; - edit.metaRule = $scope.edit.metaRule; - - edit.fromList = true; - - edit.laoading = false; - - edit.form = {}; - - edit.metaData = { name: null, description: null}; - - edit.list = []; - - edit.create = createMetaData; - edit.addToMetaRule = addToMetaRule; - edit.deleteMetaData = deleteMetaData; - - activate(); - - /* - * - */ - - function activate(){ - - switch(edit.metaDataType){ - - case META_DATA_CST.TYPE.SUBJECT: - - metaDataService.subject.findAllWithCallback(callBackList); - break; - - case META_DATA_CST.TYPE.OBJECT: - - metaDataService.object.findAllWithCallback(callBackList); - break; - - case META_DATA_CST.TYPE.ACTION: - - metaDataService.action.findAllWithCallback(callBackList); - break; - - default : - - edit.list = []; - break; - - } - - function callBackList(list){ - - edit.list = list; - - } - - } - - /** - * Add - */ - - function addToMetaRule(){ - - if(!edit.selectedMetaData){ - - return; - - } - - var metaRuleToSend = edit.metaRule; - - switch(edit.metaDataType){ - - case META_DATA_CST.TYPE.SUBJECT: - - metaRuleToSend.subject_categories.push(edit.selectedMetaData.id); - break; - - case META_DATA_CST.TYPE.OBJECT: - - metaRuleToSend.object_categories.push(edit.selectedMetaData.id); - break; - - case META_DATA_CST.TYPE.ACTION: - - metaRuleToSend.action_categories.push(edit.selectedMetaData.id); - break; - } - - metaRuleService.update(metaRuleToSend, updateMetaRuleSuccess, updateMetaRuleError); - - function updateMetaRuleSuccess(data){ - - $translate('moon.model.metarules.update.success', { metaRuleName: metaRuleToSend.name }).then( function(translatedValue) { - - alertService.alertSuccess(translatedValue); - - }); - - metaRuleToSend = utilService.transformOne(data, 'meta_rules'); - - $scope.$emit('event:updateMetaRuleFromMetaDataAddSuccess', metaRuleToSend); - - stopLoading(); - - } - - function updateMetaRuleError(reason){ - - $translate('moon.model.metarules.update.error', { metaRuleName: metaRuleToSend.name, reason: reason.message}).then( function(translatedValue) { - - alertService.alertError(translatedValue); - - }); - - stopLoading(); - - } - - } - - /** - * Create - */ - - function createMetaData() { - - if(formService.isInvalid(edit.form)) { - - formService.checkFieldsValidity(edit.form); - - } else { - - startLoading(); - - var metaDataToSend = angular.copy(edit.metaData); - - switch(edit.metaDataType){ - - case META_DATA_CST.TYPE.SUBJECT: - - metaDataService.subject.add(metaDataToSend, createSuccess, createError); - break; - - case META_DATA_CST.TYPE.OBJECT: - - metaDataService.object.add(metaDataToSend, createSuccess, createError); - break; - - case META_DATA_CST.TYPE.ACTION: - - metaDataService.action.add(metaDataToSend, createSuccess, createError); - break; - } - - } - - function createSuccess(data) { - - var created = {}; - - switch(edit.metaDataType){ - - case META_DATA_CST.TYPE.SUBJECT: - - created = utilService.transformOne(data, 'subject_categories'); - break; - - case META_DATA_CST.TYPE.OBJECT: - - created = utilService.transformOne(data, 'object_categories'); - break; - - case META_DATA_CST.TYPE.ACTION: - - created = utilService.transformOne(data, 'action_categories'); - break; - } - - $translate('moon.model.metadata.edit.create.success', { name: created.name }).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - stopLoading(); - - edit.list.push(created); - - displayList(); - - } - - function createError(reason) { - - $translate('moon.model.metadata.edit.create.error', { name: metaDataToSend.name }).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - stopLoading(); - - } - - } - - function deleteMetaData(){ - - if(!edit.selectedMetaData){ - - return; - - } - - startLoading(); - - var metaDataToDelete = angular.copy(edit.selectedMetaData); - - switch(edit.metaDataType){ - case META_DATA_CST.TYPE.SUBJECT: - - metaDataService.subject.delete(metaDataToDelete, deleteSuccess, deleteError); - break; - - case META_DATA_CST.TYPE.OBJECT: - - metaDataService.object.delete(metaDataToDelete, deleteSuccess, deleteError); - break; - - case META_DATA_CST.TYPE.ACTION: - - metaDataService.action.delete(metaDataToDelete, deleteSuccess, deleteError); - break; - } - - - function deleteSuccess(data) { - - $translate('moon.model.metadata.edit.delete.success', { name: metaDataToDelete.name }).then(function (translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - metaRuleService.findOneWithMetaData(edit.metaRule.id).then( function(metaRule){ - - edit.metaRule = metaRule; - - cleanSelectedValue(); - - activate(); - - stopLoading(); - - $scope.$emit('event:deleteMetaDataFromMetaDataAddSuccess', edit.metaRule); - - }); - - } - - function deleteError(reason) { - - $translate('moon.model.metadata.edit.delete.error', { name: metaDataToDelete.name }).then(function (translatedValue) { - alertService.alertError(translatedValue); - }); - - stopLoading(); - - } - } - - function cleanSelectedValue(){ - - delete edit.selectedMetaData; - - } - - function startLoading(){ - - edit.loading = true; - - } - - function stopLoading(){ - - edit.loading = false; - - } - - function displayList(){ - - edit.fromList = true; - - } - - } - -})(); \ No newline at end of file diff --git a/moonv4/moon_gui/static/app/model/edit/metadata/metadata.list.dir.js b/moonv4/moon_gui/static/app/model/edit/metadata/metadata.list.dir.js deleted file mode 100755 index beb2ed86..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metadata/metadata.list.dir.js +++ /dev/null @@ -1,372 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .directive('moonMetaDataList', moonMetaDataList); - - moonMetaDataList.$inject = []; - - function moonMetaDataList() { - - return { - templateUrl : 'html/model/edit/metadata/metadata-list.tpl.html', - bindToController : true, - controller : moonMetaDataListController, - controllerAs : 'list', - scope : { - metaRule: '=', - editMode: '=', - // shortDisplay : boolean value - shortDisplay: '=' - }, - restrict : 'E', - replace : true - }; - } - - angular - .module('moon') - .controller('moonMetaDataListController', moonMetaDataListController); - - moonMetaDataListController.$inject = ['$scope', '$rootScope', 'metaDataService', '$translate', 'alertService', 'metaRuleService', 'META_DATA_CST', 'utilService']; - - function moonMetaDataListController($scope, $rootScope, metaDataService, $translate, alertService, metaRuleService, META_DATA_CST, utilService){ - - var list = this; - - list.metaRule = $scope.list.metaRule; - list.editMode = $scope.list.editMode; - list.shortDisplay = $scope.list.shortDisplay; - - list.typeOfSubject = META_DATA_CST.TYPE.SUBJECT; - list.typeOfObject = META_DATA_CST.TYPE.OBJECT; - list.typeOfAction = META_DATA_CST.TYPE.ACTION; - - list.unMapSub = unMapSub; - list.unMapObj = unMapObj; - list.unMapAct = unMapAct; - - // list.deleteSub = deleteSub; - // list.deleteObj = deleteObj; - // list.deleteAct = deleteAct; - - list.getSubjectCategories = getSubjectCategories; - list.getObjectCategories = getObjectCategories; - list.getActionCategories = getActionCategories; - - activate(); - - function activate(){ - - manageSubjectCategories(); - - manageObjectCategories(); - - manageActionCategories(); - - } - - var rootListeners = { - - 'event:updateMetaRuleFromMetaDataAddSuccess': $rootScope.$on('event:updateMetaRuleFromMetaDataAddSuccess', updateMetaRuleCategories), - - 'event:deleteMetaDataFromMetaDataAddSuccess': $rootScope.$on('event:deleteMetaDataFromMetaDataAddSuccess', deleteMetaRuleCategories) - - }; - - for (var unbind in rootListeners) { - $scope.$on('$destroy', rootListeners[unbind]); - } - - - function manageSubjectCategories(){ - - list.loadingCatSub = true; - - metaDataService.subject.findSomeWithCallback(list.metaRule.subject_categories, function(categories){ - - list.catSub = categories; - list.loadingCatSub = false; - - }); - } - - function manageObjectCategories(){ - - list.loadingCatObj = true; - - metaDataService.object.findSomeWithCallback(list.metaRule.object_categories, function(categories){ - - list.catObj = categories; - list.loadingCatObj = false; - - }); - - } - - function manageActionCategories(){ - - list.loadingCatAct = true; - - metaDataService.action.findSomeWithCallback(list.metaRule.action_categories, function(categories){ - - list.catAct = categories; - list.loadingCatAct = false; - - }); - - } - - - /** - * UnMap - */ - - function unMapSub(subject){ - - subject.loader = true; - - var metaRuleToSend = angular.copy(list.metaRule); - - metaRuleToSend.subject_categories = _.without(metaRuleToSend.subject_categories, subject.id); - - metaRuleService.update(metaRuleToSend, updateMetaRuleSuccess, updateMetaRuleError); - - function updateMetaRuleSuccess(data){ - - $translate('moon.model.metarules.update.success', { metaRuleName: list.metaRule.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - list.metaRule = metaRuleService.findMetaDataFromMetaRule(utilService.transformOne(data, 'meta_rules')); - - activate(); - - subject.loader = false; - - } - - function updateMetaRuleError(reason){ - - $translate('moon.model.metarules.update.error', { metaRuleName: list.metaRule.name, reason: reason.message}).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - subject.loader = false; - - } - - } - - function unMapObj(object){ - - object.loader = true; - - var metaRuleToSend = angular.copy(list.metaRule); - - metaRuleToSend.object_categories = _.without(metaRuleToSend.object_categories, object.id); - - metaRuleService.update(metaRuleToSend, updateMetaRuleSuccess, updateMetaRuleError); - - function updateMetaRuleSuccess(data){ - - $translate('moon.model.metarules.update.success', { metaRuleName: list.metaRule.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - list.metaRule = metaRuleService.findMetaDataFromMetaRule(utilService.transformOne(data, 'meta_rules')); - - activate(); - - object.loader = false; - - } - - function updateMetaRuleError(reason){ - - $translate('moon.model.metarules.update.error', { metaRuleName: list.metaRule.name, reason: reason.message}).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - object.loader = false; - - } - - } - - function unMapAct(action){ - - action.loader = true; - - var metaRuleToSend = angular.copy(list.metaRule); - - metaRuleToSend.action_categories = _.without(metaRuleToSend.action_categories, action.id); - - metaRuleService.update(metaRuleToSend, updateMetaRuleSuccess, updateMetaRuleError); - - function updateMetaRuleSuccess(data){ - - $translate('moon.model.metarules.update.success', { metaRuleName: list.metaRule.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - list.metaRule = metaRuleService.findMetaDataFromMetaRule(utilService.transformOne(data, 'meta_rules')); - - activate(); - - action.loader = false; - - } - - function updateMetaRuleError(reason){ - - $translate('moon.model.metarules.update.error', { metaRuleName: list.metaRule.name, reason: reason.message}).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - action.loader = false; - - } - - } - - // /** - // * Delete - // */ - // - // function deleteSub(subject){ - // - // subject.loader = true; - // - // metaDataService.subject.delete(subject, deleteSubSuccess, deleteSubError); - // - // function deleteSubSuccess(data){ - // - // $translate('moon.model.metadata.subject.delete.success', { subjectName: subject.name }).then( function(translatedValue) { - // alertService.alertSuccess(translatedValue); - // }); - // - // removeSubFromSubList(subject); - // - // subject.loader = false; - // - // } - // - // function deleteSubError(reason){ - // - // $translate('moon.model.metadata.subject.delete.error', - // { subjectName: subject.name, reason: reason.message}).then( function(translatedValue) { - // alertService.alertError(translatedValue); - // }); - // - // subject.loader = false; - // - // } - // } - // - // function deleteObj(object){ - // - // object.loader = true; - // - // metaDataService.object.delete(object, deleteObjSuccess, deleteObjError); - // - // function deleteObjSuccess(data){ - // - // $translate('moon.model.metadata.object.delete.success', { objectName: object.name }).then( function(translatedValue) { - // alertService.alertSuccess(translatedValue); - // }); - // - // removeObjFromObjList(object); - // /*list.catSub = metaDataService.subject.findSome(list.metaRule.subject_categories); - // list.catObj = metaDataService.object.findSome(list.metaRule.object_categories); - // list.catAct = metaDataService.action.findSome(list.metaRule.action_categories);*/ - // - // object.loader = false; - // - // } - // - // function deleteObjError(reason){ - // - // $translate('moon.model.metadata.object.delete.error', { objectName: object.name, reason: reason.message}).then( function(translatedValue) { - // alertService.alertError(translatedValue); - // }); - // - // object.loader = false; - // } - // } - // - // function deleteAct(action){ - // - // action.loader = true; - // - // metaDataService.action.delete(action, deleteActSuccess, deleteActError); - // - // function deleteActSuccess(data){ - // - // $translate('moon.model.metadata.action.delete.success', { actionName: action.name }).then( function(translatedValue) { - // alertService.alertSuccess(translatedValue); - // }); - // - // removeActFromActList(action); - // - // action.loader = false; - // - // } - // - // function deleteActError(reason){ - // - // $translate('moon.model.metadata.action.delete.error', { actionName: action.name, reason: reason.message}).then( function(translatedValue) { - // alertService.alertError(translatedValue); - // }); - // - // action.loader = false; - // - // } - // } - - function getSubjectCategories(){ - return list.catSub ? list.catSub : []; - } - - function getObjectCategories(){ - return list.catObj ? list.catObj : []; - } - - function getActionCategories(){ - return list.catAct ? list.catAct : []; - } - - // function removeSubFromSubList(subject){ - // list.catSub = _.without(list.catSub, subject); - // } - // - // function removeObjFromObjList(object){ - // list.catObj = _.without(list.catObj, object); - // } - // - // function removeActFromActList(action){ - // list.catAct = _.without(list.catAct, action); - // } - - function updateMetaRuleCategories( event, metaRule){ - - list.metaRule = metaRule; - - activate(); - - } - - - function deleteMetaRuleCategories( event, metaRule){ - - list.metaRule = metaRule; - - activate(); - - } - - } - -})(); \ No newline at end of file diff --git a/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-add.tpl.html b/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-add.tpl.html deleted file mode 100755 index a721e6d0..00000000 --- a/moonv4/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/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-map.tpl.html b/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-map.tpl.html deleted file mode 100755 index 1830204b..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-map.tpl.html +++ /dev/null @@ -1,102 +0,0 @@ - diff --git a/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-unmap.tpl.html b/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules-unmap.tpl.html deleted file mode 100755 index bb02aba2..00000000 --- a/moonv4/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/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.controller.add.js b/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.controller.add.js deleted file mode 100755 index a95951fa..00000000 --- a/moonv4/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/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.map.controller.js b/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.map.controller.js deleted file mode 100755 index cf9ba06c..00000000 --- a/moonv4/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/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.unmap.controller.js b/moonv4/moon_gui/static/app/model/edit/metarules/action/mapping/metarules.unmap.controller.js deleted file mode 100755 index 30f32d51..00000000 --- a/moonv4/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'); - - } - - } - - } - -})(); diff --git a/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules-edit-basic.tpl.html b/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules-edit-basic.tpl.html deleted file mode 100755 index b6136195..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules-edit-basic.tpl.html +++ /dev/null @@ -1,67 +0,0 @@ -
- -
- -
- - - -
- - - -
- -
- -
- - - -
- - - -
- Name is required -
- -
- -
- -
- - -
- -
- -
- -
- -
- - - Init - - -
- -
- - - - Update - - - - -
- -
- -
- -
\ No newline at end of file diff --git a/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules-edit.tpl.html b/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules-edit.tpl.html deleted file mode 100755 index 7b074448..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules-edit.tpl.html +++ /dev/null @@ -1,62 +0,0 @@ - diff --git a/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules.controller.edit.js b/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules.controller.edit.js deleted file mode 100755 index b2ebc45d..00000000 --- a/moonv4/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){ - - edit.metaRule = metaRule; - - } - - } - -})(); diff --git a/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules.edit.basic.dir.js b/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules.edit.basic.dir.js deleted file mode 100755 index 603e7a33..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metarules/action/metarules.edit.basic.dir.js +++ /dev/null @@ -1,98 +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'); - - $translate('moon.model.metarules.edit.basic.success', { metaRuleName: updatedMetaRule.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - edit.loading = false; - - $scope.$emit('event:metaRuleBasicUpdatedSuccess', updatedMetaRule); - - } - - 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); - - } - } - -})(); diff --git a/moonv4/moon_gui/static/app/model/edit/metarules/metarules-list.tpl.html b/moonv4/moon_gui/static/app/model/edit/metarules/metarules-list.tpl.html deleted file mode 100755 index ebe307c3..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metarules/metarules-list.tpl.html +++ /dev/null @@ -1,138 +0,0 @@ -
- - -

List of Meta Rules

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Name
-
-
Description
-
-
Number of Subjects
-
-
Number of Subjects
-
-
Number of Actions
-
-
Actions
-
There is no Meta Rules
- -
- - - -
- - - -
- -
- -
- -
- - - -
diff --git a/moonv4/moon_gui/static/app/model/edit/metarules/metarules.list.dir.js b/moonv4/moon_gui/static/app/model/edit/metarules/metarules.list.dir.js deleted file mode 100755 index 120b6a8b..00000000 --- a/moonv4/moon_gui/static/app/model/edit/metarules/metarules.list.dir.js +++ /dev/null @@ -1,240 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .directive('moonMetaRulesList', moonMetaRulesList); - - moonMetaRulesList.$inject = []; - - function moonMetaRulesList() { - - return { - templateUrl : 'html/model/edit/metarules/metarules-list.tpl.html', - bindToController : true, - controller : moonMetaRulesListController, - controllerAs : 'list', - scope : { - // if edit and delete possibilities are displayed - // Value are True or False - editMode : '=', - mappedModel : '=' - }, - restrict : 'E', - replace : true - }; - } - - angular - .module('moon') - .controller('moonMetaRulesListController', moonMetaRulesListController); - - moonMetaRulesListController.$inject = ['$scope', '$rootScope', 'NgTableParams', '$filter', '$modal', 'metaRuleService']; - - function moonMetaRulesListController($scope, $rootScope, NgTableParams, $filter, $modal, metaRuleService ){ - - var list = this; - - list.table = {}; - - list.editMode = $scope.list.editMode; - list.model = $scope.list.mappedModel; - list.metaRules = list.model.meta_rules_values; - - list.getMetaRules = getMetaRules; - list.hasMetaRules = hasMetaRules; - list.showDetail = showDetail; - list.getSubjectList = getSubjectList; - list.getObjectList = getObjectList; - list.getActionlist = getActionlist; - list.getShowDetailValue = getShowDetailValue; - - list.showDetailValue = false; - - list.subject_list = []; - list.object_list = []; - list.action_list = []; - - list.edit = { modal: $modal({ template: 'html/model/edit/metarules/action/metarules-edit.tpl.html', show: false }), - showModal: showEditModal }; - - /*list.edit.modal.result.finally(function(){ - console.log('CATCHING'); - });*/ - - - list.map = { modal: $modal({ template: 'html/model/edit/metarules/action/mapping/metarules-map.tpl.html', show: false }), - showModal: showMapModal }; - - list.unmap = { modal: $modal({ template: 'html/model/edit/metarules/action/mapping/metarules-unmap.tpl.html', show: false }), - showModal: showUnmapModal }; - - activate(); - - function activate(){ - - newMetaRulesTable(); - - } - - /* - * ---- events - */ - var rootListeners = { - - 'event:metaRuleMapToModelSuccess': $rootScope.$on('event:metaRuleMapToModelSuccess', updateModelFromMapSuccess), - - 'event:metaRuleUnMappedToModelSuccess': $rootScope.$on('event:metaRuleUnMappedToModelSuccess', modelUnmappedSuccess), - 'event:metaRuleUnMappedToModelError': $rootScope.$on('event:metaRuleUnMappedToModelError', modelUnmappedError) - - }; - - for (var unbind in rootListeners) { - $scope.$on('$destroy', rootListeners[unbind]); - } - - - - function newMetaRulesTable() { - - list.table = new NgTableParams({ - - page: 1, // show first page - count: 10, // count per page - sorting: { - name: 'asc' // initial sorting - } - - }, { - - total: function () { return list.getMetaRules().length; }, // length of data - getData: function($defer, params) { - - var orderedData = params.sorting() ? $filter('orderBy')(list.getMetaRules(), params.orderBy()) : list.getMetaRules(); - $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count())); - - }, - $scope: { $data: {} } - - }); - - return list.table; - - } - - /** - * If the directive is not in editMode and displaying MetaData Content, if the editMode change to true, MetaData Content need to be hidden - */ - $scope.$watch('list.editMode', function(newValue, oldValue){ - list.showDetailValue = false; - }); - - function getMetaRules() { - return (list.metaRules) ? list.metaRules : []; - } - - function hasMetaRules() { - return list.getMetaRules().length > 0; - } - - function showDetail(aMetaRule){ - - if(aMetaRule.id === getShowDetailValue().id){ - - list.showDetailValue = false; - list.subject_list = []; - list.object_list = []; - list.action_list = []; - - }else{ - - list.subject_list = aMetaRule.subject_categories_values; - list.object_list = aMetaRule.object_categories_values; - list.action_list = aMetaRule.action_categories_values; - list.showDetailValue = aMetaRule; - - } - - } - - function showEditModal(aMetaRule) { - list.edit.modal.$scope.metaRule = aMetaRule; - list.edit.modal.$promise.then(list.edit.modal.show); - } - - function getShowDetailValue(){ - return list.showDetailValue; - } - - function getSubjectList(){ - return list.subject_list; - } - - function getObjectList(){ - return list.object_list; - } - - function getActionlist(){ - return list.action_list; - } - - /* - * ---- add - */ - function showMapModal() { - list.map.modal.$scope.model = list.model; - list.map.modal.$promise.then(list.map.modal.show); - } - - function refreshRules(){ - - list.metaRules = list.model.meta_rules_values; - list.table.total(list.getMetaRules().length); - list.table.reload(); - - } - - function updateModelFromMapSuccess(event, model){ - - list.model = model; - - refreshRules(); - - list.map.modal.hide(); - - } - - /* - * ---- unmap - */ - - function showUnmapModal(metaRule) { - - list.unmap.modal.$scope.model = list.model; - list.unmap.modal.$scope.metaRule = metaRule; - list.unmap.modal.$promise.then(list.unmap.modal.show); - - } - - function modelUnmappedSuccess(event, model) { - - list.model = model; - - metaRuleService.findSomeWithCallback(list.model.meta_rules, function(meta_rules){ - - list.model.meta_rules_values = meta_rules; - refreshRules(); - list.unmap.modal.hide(); - - }); - - } - - function modelUnmappedError(event) { - list.unmap.modal.hide(); - } - - } - -})(); diff --git a/moonv4/moon_gui/static/app/model/edit/model-edit-basic.tpl.html b/moonv4/moon_gui/static/app/model/edit/model-edit-basic.tpl.html deleted file mode 100755 index bd73b4ef..00000000 --- a/moonv4/moon_gui/static/app/model/edit/model-edit-basic.tpl.html +++ /dev/null @@ -1,65 +0,0 @@ -
- -
- -
- - - -
- - - -
- -
- -
- - - -
- - - -
- Name is required -
- -
- -
- -
- - -
- -
- -
- -
- - - -
- - - - Update - - - -
- -
- -
- -
\ No newline at end of file diff --git a/moonv4/moon_gui/static/app/model/edit/model-edit.tpl.html b/moonv4/moon_gui/static/app/model/edit/model-edit.tpl.html deleted file mode 100755 index 4955f441..00000000 --- a/moonv4/moon_gui/static/app/model/edit/model-edit.tpl.html +++ /dev/null @@ -1,70 +0,0 @@ -
- -
-

Edit

-
- -
- -
- - Basic Information - - Update - - - -
- -
- -
- -
- -
-
- -
Id
-
- -
Name
-
- -
Description
-
- -
-
-
- -
- -
- -
- - Meta Rule - - -
- -
-
- - - -
-
- -
- -
- -
- - -
diff --git a/moonv4/moon_gui/static/app/model/edit/model.controller.edit.js b/moonv4/moon_gui/static/app/model/edit/model.controller.edit.js deleted file mode 100755 index 3e10a533..00000000 --- a/moonv4/moon_gui/static/app/model/edit/model.controller.edit.js +++ /dev/null @@ -1,61 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('ModelEditController', ModelEditController); - - ModelEditController.$inject = ['$scope', '$rootScope', 'model', 'metaRuleService']; - - function ModelEditController($scope, $rootScope, model, metaRuleService) { - - var edit = this; - - edit.model = model; - - edit.editBasic = false; - - edit.editMetaRules = true; - - activate(); - - function activate(){ - - } - - /* - * ---- events - */ - var rootListeners = { - - 'event:modelUpdatedSuccess': $rootScope.$on('event:modelUpdatedSuccess', modelUpdatedSuccess), - - 'event:updateModelFromMetaRuleAddSuccess': $rootScope.$on('event:updateModelFromMetaRuleAddSuccess', modelUpdatedSuccess) - - }; - - for (var unbind in rootListeners) { - $scope.$on('$destroy', rootListeners[unbind]); - } - - /** - * When the model is updated, this function refresh the current model with the new changes - * @param event - * @param model - */ - function modelUpdatedSuccess(event, model){ - - edit.model = model; - - metaRuleService.findSomeWithCallback(model.meta_rules, function(metaRules){ - - edit.model.meta_rules_values = metaRules; - - }); - - } - - } - -})(); diff --git a/moonv4/moon_gui/static/app/model/edit/model.edit.basic.dir.js b/moonv4/moon_gui/static/app/model/edit/model.edit.basic.dir.js deleted file mode 100755 index 54bb7071..00000000 --- a/moonv4/moon_gui/static/app/model/edit/model.edit.basic.dir.js +++ /dev/null @@ -1,97 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .directive('moonModelEditBasic', moonModelEditBasic); - - moonModelEditBasic.$inject = []; - - function moonModelEditBasic() { - - return { - templateUrl : 'html/model/edit/model-edit-basic.tpl.html', - bindToController : true, - controller : moonModelEditBasicController, - controllerAs : 'edit', - scope : { - model : '=' - }, - restrict : 'E', - replace : true - }; - } - - angular - .module('moon') - .controller('moonModelEditBasicController', moonModelEditBasicController); - - moonModelEditBasicController.$inject = ['$scope', 'modelService', 'formService', 'alertService', '$translate', 'utilService']; - - function moonModelEditBasicController($scope, modelService, formService, alertService, $translate, utilService){ - - var edit = this; - - edit.editModel = editModel; - edit.init = init; - - edit.form = {}; - - activate(); - - function activate(){ - - edit.model = $scope.edit.model; - - edit.modelToEdit = angular.copy(edit.model); - - } - - function editModel(){ - - if(formService.isInvalid(edit.form)) { - - formService.checkFieldsValidity(edit.form); - - }else{ - - edit.loading = true; - - modelService.update(edit.modelToEdit, updateSuccess, updateError); - - } - - function updateSuccess(data) { - - var updatedModel = utilService.transformOne(data, 'models'); - - $translate('moon.model.edit.basic.success', { modelName: updatedModel.name }).then( function(translatedValue) { - alertService.alertSuccess(translatedValue); - }); - - edit.loading = false; - - $scope.$emit('event:modelUpdatedSuccess', updatedModel); - - } - - function updateError(reason) { - - $translate('moon.model.edit.basic.error', { modelName: edit.model.name }).then( function(translatedValue) { - alertService.alertError(translatedValue); - }); - - edit.loading = false; - - } - } - - function init(){ - - edit.modelToEdit = angular.copy(edit.model); - - } - } - -})(); diff --git a/moonv4/moon_gui/static/app/model/model-list.tpl.html b/moonv4/moon_gui/static/app/model/model-list.tpl.html deleted file mode 100755 index 89c682cc..00000000 --- a/moonv4/moon_gui/static/app/model/model-list.tpl.html +++ /dev/null @@ -1,123 +0,0 @@ -
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
 
-
 
-
 
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
Name
-
-
Description
-
-
Number of Meta Rules
-
-
Actions
-
There is no Models
- -
- -
- -
- - - -
- -
- -
\ No newline at end of file diff --git a/moonv4/moon_gui/static/app/model/model.controller.list.js b/moonv4/moon_gui/static/app/model/model.controller.list.js deleted file mode 100755 index 5021a57e..00000000 --- a/moonv4/moon_gui/static/app/model/model.controller.list.js +++ /dev/null @@ -1,195 +0,0 @@ -(function() { - - 'use strict'; - - angular - .module('moon') - .controller('ModelListController', ModelListController); - - ModelListController.$inject = ['$scope', '$rootScope', 'models', 'NgTableParams', '$filter', '$modal']; - - function ModelListController($scope, $rootScope, models, NgTableParams, $filter, $modal) { - - var list = this; - - list.models = models; - - list.table = {}; - - list.search = { query: '', - find: searchModel, - reset: searchReset }; - - list.getModels = getModels; - list.hasModels = hasModels; - list.deleteModel = deleteModel; - list.refreshModels = refreshModels; - - list.add = { modal: $modal({ template: 'html/model/action/model-add.tpl.html', show: false }), - showModal: showAddModal }; - - list.view = { modal: $modal({ template: 'html/model/action/model-view.tpl.html', show: false }), - showModal: showViewModal }; - - list.del = { modal: $modal({ template: 'html/model/action/model-delete.tpl.html', show: false }), - showModal: showDeleteModal }; - - activate(); - - function activate(){ - newModelsTable(); - } - - - /* - * ---- events - */ - var rootListeners = { - - 'event:modelCreatedSuccess': $rootScope.$on('event:modelCreatedSuccess', modelCreatedSuccess), - 'event:modelCreatedError': $rootScope.$on('event:modelCreatedError', modelCreatedError), - - 'event:modelDeletedSuccess': $rootScope.$on('event:modelDeletedSuccess', modelDeletedSuccess), - 'event:modelDeletedError': $rootScope.$on('event:modelDeletedError', modelDeletedError) - - - }; - - for (var unbind in rootListeners) { - $scope.$on('$destroy', rootListeners[unbind]); - } - - - function newModelsTable() { - - list.table = new NgTableParams({ - - page: 1, // show first page - count: 10, // count per page - sorting: { - name: 'asc' // initial sorting - } - - }, { - - total: function () { return list.getModels().length; }, // length of data - getData: function($defer, params) { - - var orderedData = params.sorting() ? $filter('orderBy')(list.getModels(), params.orderBy()) : list.getModels(); - $defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count())); - - }, - $scope: { $data: {} } - - }); - - return list.table; - - } - - function getModels() { - return (list.models) ? list.models : []; - } - - function hasModels() { - return list.getModels().length > 0; - } - - /** - * Blank the search field - */ - function searchReset() { - list.search.query = ''; - } - - /* - * ---- search - */ - - function searchModel(model){ - return (model.name.indexOf(list.search.query) !== -1 || model.description.indexOf(list.search.query) !== -1); - } - - /* - * ---- add - */ - function showAddModal() { - list.add.modal.$promise.then(list.add.modal.show); - } - - function addModel(model) { - list.models.push(model); - } - - /** - * Refresh the table - */ - function refreshModels(){ - list.table.total(list.models.length); - list.table.reload(); - } - - /** - * This function will add a model to the current list of models and refresh the table - * @param event - * @param model - */ - function modelCreatedSuccess(event, model) { - addModel(model); - refreshModels(); - list.add.modal.hide(); - } - - /** - * This function hide the add modal - * @param event - */ - function modelCreatedError(event) { - list.add.modal.hide(); - } - - /* - * ---- view - */ - - function showViewModal(model) { - - list.view.modal.$scope.model = model; - list.view.modal.$promise.then(list.view.modal.show); - - } - - - /* - * ---- delete - */ - - function showDeleteModal(model) { - - list.del.modal.$scope.model = model; - list.del.modal.$promise.then(list.del.modal.show); - - } - - function deleteModel(model) { - list.models = _.chain(list.models).reject({id: model.id}).value(); - } - - - function modelDeletedSuccess(event, model) { - - list.deleteModel(model); - list.refreshModels(); - - list.del.modal.hide(); - - } - - function modelDeletedError(event, model) { - list.del.modal.hide(); - } - - - } - -})(); -- cgit 1.2.3-korg