aboutsummaryrefslogtreecommitdiffstats
path: root/moon_gui/static/app/model/edit/metadata
diff options
context:
space:
mode:
Diffstat (limited to 'moon_gui/static/app/model/edit/metadata')
-rwxr-xr-xmoon_gui/static/app/model/edit/metadata/metadata-edit.tpl.html99
-rwxr-xr-xmoon_gui/static/app/model/edit/metadata/metadata-list.tpl.html491
-rwxr-xr-xmoon_gui/static/app/model/edit/metadata/metadata.edit.dir.js332
-rwxr-xr-xmoon_gui/static/app/model/edit/metadata/metadata.list.dir.js374
4 files changed, 0 insertions, 1296 deletions
diff --git a/moon_gui/static/app/model/edit/metadata/metadata-edit.tpl.html b/moon_gui/static/app/model/edit/metadata/metadata-edit.tpl.html
deleted file mode 100755
index 2616be1c..00000000
--- a/moon_gui/static/app/model/edit/metadata/metadata-edit.tpl.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<div>
-
- <div class="col-md-4 col-sm-4 col-xs-4">
- <a class="btn btn-primary" type="button" style="white-space: normal;" ng-click="edit.fromList = !edit.fromList">
- <span ng-if="!edit.fromList" data-translate="moon.model.metadata.edit.action.list">Add from the list</span>
- <span ng-if="edit.fromList" data-translate="moon.model.metadata.edit.action.new">Add a new Category</span>
- </a>
- </div>
-
- <div class="col-md-8 col-sm-8 col-xs-8">
-
- <form name="selectMetaData" ng-if="edit.fromList" class="form-horizontal" role="form" >
-
- <div class="form-group" >
-
- <ui-select ng-model="edit.selectedMetaData" name="object">
-
- <ui-select-match placeholder="(None)" ng-bind="$select.selected.name"></ui-select-match>
- <ui-select-choices repeat="ametaData in edit.list">
- <div ng-value="ametaData" ng-bind="ametaData.name"></div>
- </ui-select-choices>
-
- </ui-select>
-
- </div>
-
- <div class="form-group">
-
- <div class="pull-left col-md-4 col-sm-4 col-xs-4">
-
- <a href="" ng-disabled="edit.loading || !edit.selectedMetaData" ng-click="edit.deleteMetaData()" class="btn btn-warning">
- <span class="glyphicon glyphicon-trash"></span>
- <span data-translate="moon.model.metadata.edit.action.delete">Delete</span>
- </a>
-
- </div>
-
- <div class="pull-right col-md-7 col-md-offset-1 col-sm-7 col-sm-offset-1 col-xs-7 col-xs-offset-1 ">
-
- <a href="" ng-disabled="edit.loading || !edit.selectedMetaData" ng-click="edit.addToMetaRule()" class="btn btn-warning" style="white-space: normal;">
- <span class="glyphicon glyphicon-link"></span>
- <span data-translate="moon.model.metadata.edit.action.add">Add the selected Category</span>
- </a>
-
- </div>
-
- </div>
-
- <moon-loader ng-if="edit.loading"></moon-loader>
-
- </form>
-
- <form ng-if="!edit.fromList" class="form-horizontal" role="form" name="edit.form">
-
- <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.metadata.edit.name">Name</label>
-
- <div class="col-sm-6">
-
- <input name="name" id="name" class="form-control" type="text" data-ng-model="edit.metaData.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.metadata.edit.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.metadata.edit.description">Description</label>
- <div class="col-sm-6">
- <textarea id="description" name="description" class="form-control" data-ng-model="edit.metaData.description"></textarea>
- </div>
-
- </div>
-
- <div class="form-group">
-
- <div class="pull-right">
-
- <a href="" ng-disabled="edit.loading" ng-click="edit.create()" class="btn btn-warning">
- <span class="glyphicon glyphicon-save"></span>
- <span data-translate="moon.model.metadata.edit.action.create">Create</span>
- </a>
-
- <moon-loader ng-if="edit.loading"></moon-loader>
-
- </div>
-
- </div>
-
- </form>
-
- </div>
-
-</div> \ No newline at end of file
diff --git a/moon_gui/static/app/model/edit/metadata/metadata-list.tpl.html b/moon_gui/static/app/model/edit/metadata/metadata-list.tpl.html
deleted file mode 100755
index 30a42dbc..00000000
--- a/moon_gui/static/app/model/edit/metadata/metadata-list.tpl.html
+++ /dev/null
@@ -1,491 +0,0 @@
-<div>
- <!--
- !shortDisplay allow to display more details than shortDisplay.
- It will display panels row by row and each panels list have a table with more columns
- -->
- <div ng-if="!list.shortDisplay">
-
- <div class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4 data-translate="moon.model.metadata.subject.title">List of associated Subject Categories</h4>
-
- </div>
-
- <div class="panel-body">
-
- <div class="table-responsive">
-
- <table class="table table-striped">
-
- <thead>
- <tr>
- <th data-translate="moon.model.metadata.table.id">Id</th>
- <th data-translate="moon.model.metadata.table.name">Name</th>
- <th data-translate="moon.model.metadata.table.description">Description</th>
- <th ng-if="list.editMode" data-translate="moon.model.metadata.table.action.title"></th>
- </tr>
- </thead>
-
- <moon-loader ng-if="list.loadingCatSub"></moon-loader>
-
- <tbody ng-if="!list.loadingCatSub && list.getSubjectCategories().length > 0">
- <tr ng-repeat="(key, value) in list.catSub">
- <td ng-bind="value.id"></td>
- <td ng-bind="value.name"></td>
- <td ng-bind="value.description"></td>
- <td ng-if="list.editMode">
-
- <a href="" ng-if="!value.loader" ng-click="list.unMapSub(value)">
- <span class="glyphicon glyphicon-transfer"></span>
- <span class="control-label" data-translate="moon.model.metadata.action.remove">Remove</span>
- </a>
-
- <!--<div ng-if="!value.loader" class="dropdown">
-
- <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
- <span data-translate="moon.model.metadata.table.action.title">Actions</span>
- <span class="caret"></span>
- </button>
-
- <ul class="dropdown-menu">
-
- <li>
- <a href="" ng-click="list.unMapSub(value)" >
- <span class="glyphicon glyphicon-transfer"></span>
- <span class="control-label" data-translate="moon.model.metadata.action.remove">Remove</span>
- </a>
- </li>
-
- <li class="divider"></li>
-
- <li>
- <a href="" ng-click="list.deleteSub(value)">
- <span class="glyphicon glyphicon-trash"></span>
- <span class="control-label" data-translate="moon.model.metadata.table.action.delete">Delete</span>
- </a>
- </li>
-
- </ul>
-
- </div>-->
-
- <div ng-if="value.loader">
-
- <moon-loader></moon-loader>
-
- </div>
-
- </td>
-
- </tr>
- </tbody>
-
-
- <tbody ng-if="!list.loadingCatSub && list.catSub.length === 0">
- <tr>
- <td data-translate="moon.model.metadata.subject.notFound">There is no Subjects</td>
- <td></td>
- <td></td>
- <td ng-if="list.editMode"></td>
- </tr>
- </tbody>
-
- </table>
-
- </div>
-
- </div>
-
- </div>
-
- <div ng-if="list.editMode" class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4 data-translate="moon.model.metadata.subject.add.title">Add a Subject Category</h4>
-
- </div>
-
- <div class="panel-body">
-
- <moon-meta-data-edit meta-rule="list.metaRule"
- meta-data-type="list.typeOfSubject"></moon-meta-data-edit>
-
- </div>
-
- </div>
-
- <div class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4 data-translate="moon.model.metadata.object.title">List associated of Object Categories</h4>
-
- </div>
-
- <div class="panel-body">
-
- <div class="table-responsive">
-
- <table class="table table-striped">
-
- <thead>
- <tr>
- <th data-translate="moon.model.metadata.table.id">Id</th>
- <th data-translate="moon.model.metadata.table.name">Name</th>
- <th data-translate="moon.model.metadata.table.description">Description</th>
- <th ng-if="list.editMode" data-translate="moon.model.metadata.table.action.title"></th>
-
- </tr>
- </thead>
-
- <moon-loader ng-if="list.loadingCatObj"></moon-loader>
-
- <tbody ng-if="!list.loadingCatObj && list.catObj.length > 0">
- <tr ng-repeat="(key, value) in list.catObj">
- <td ng-bind="value.id"></td>
- <td ng-bind="value.name"></td>
- <td ng-bind="value.description"></td>
- <td ng-if="list.editMode">
-
- <a href="" ng-if="!value.loader" ng-click="list.unMapObj(value)">
- <span class="glyphicon glyphicon-transfer"></span>
- <span class="control-label" data-translate="moon.model.metadata.action.remove">Remove</span>
- </a>
-
-
- <!--<div ng-if="!value.loader" class="dropdown">
-
- <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
- <span data-translate="moon.model.metadata.table.action.title">Actions</span>
- <span class="caret"></span>
- </button>
-
- <ul class="dropdown-menu">
-
- <li>
- <a href="" ng-click="list.unMapObj(value)" >
- <span class="glyphicon glyphicon-transfer"></span>
- <span class="control-label" data-translate="moon.model.metadata.action.remove">Remove</span>
- </a>
- </li>
-
- <li class="divider"></li>
-
- <li>
- <a href="" ng-click="list.deleteObj(value)">
- <span class="glyphicon glyphicon-trash"></span>
- <span class="control-label" data-translate="moon.model.metadata.table.action.delete">Delete</span>
- </a>
- </li>
-
- </ul>
-
- </div>-->
-
- <div ng-if="value.loader">
-
- <moon-loader></moon-loader>
-
- </div>
-
- </td>
- </tr>
- </tbody>
-
- <tbody ng-if="!list.loadingCatObj && list.catObj.length === 0">
- <tr>
- <td data-translate="moon.model.metadata.object.notFound">There is no Objects</td>
- <td></td>
- <td></td>
- <td ng-if="list.editMode"></td>
- </tr>
- </tbody>
-
- </table>
-
- </div>
-
- </div>
-
- </div>
-
- <div ng-if="list.editMode" class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4 data-translate="moon.model.metadata.object.add.title">Add an Object Category</h4>
-
- </div>
-
- <div class="panel-body">
-
- <moon-meta-data-edit meta-rule="list.metaRule" meta-data-type="list.typeOfObject"></moon-meta-data-edit>
-
- </div>
-
- </div>
-
- <div class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4 data-translate="moon.model.metadata.action.title">List associated of Action Categories</h4>
-
- </div>
-
- <div class="panel-body">
-
- <div class="table-responsive">
-
- <table class="table table-striped">
-
- <thead>
- <tr>
- <th data-translate="moon.model.metadata.table.id">Id</th>
- <th data-translate="moon.model.metadata.table.name">Name</th>
- <th data-translate="moon.model.metadata.table.description">Description</th>
- <th ng-if="list.editMode" data-translate="moon.model.metadata.table.action.title"></th>
- </tr>
- </thead>
-
- <moon-loader ng-if="list.loadingCatAct"></moon-loader>
-
- <tbody ng-if="!list.loadingCatAct && list.catAct.length > 0">
- <tr ng-repeat="(key, value) in list.catAct">
- <td ng-bind="value.id"></td>
- <td ng-bind="value.name"></td>
- <td ng-bind="value.description"></td>
- <td ng-if="list.editMode">
-
- <a href="" ng-if="!value.loader" ng-click="list.unMapAct(value)">
- <span class="glyphicon glyphicon-transfer"></span>
- <span class="control-label" data-translate="moon.model.metadata.action.remove">Remove</span>
- </a>
-
- <!--<div ng-if="!value.loader" class="dropdown">
-
- <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
- <span data-translate="moon.model.metadata.table.action.title">Actions</span>
- <span class="caret"></span>
- </button>
-
- <ul class="dropdown-menu">
-
- <li>
- <a href="" ng-click="list.unMapAct(value)" >
- <span class="glyphicon glyphicon-transfer"></span>
- <span class="control-label" data-translate="moon.model.metadata.action.remove">Remove</span>
- </a>
- </li>
-
- <li class="divider"></li>
-
- <li>
- <a href="" ng-click="list.deleteAct(value)">
- <span class="glyphicon glyphicon-trash"></span>
- <span class="control-label" data-translate="moon.model.metadata.table.action.delete">Delete</span>
- </a>
- </li>
-
- </ul>
-
- </div>-->
-
- <div ng-if="value.loader">
-
- <moon-loader></moon-loader>
-
- </div>
-
- </td>
- </tr>
- </tbody>
-
- <tbody ng-if="!list.loadingCatAct && list.catAct.length === 0">
- <tr>
- <td data-translate="moon.model.metadata.action.notFound">There is no Actions</td>
- <td></td>
- <td></td>
- <td ng-if="list.editMode"></td>
- </tr>
- </tbody>
-
- </table>
-
- </div>
-
- </div>
-
- </div>
-
- <div ng-if="list.editMode" class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4 data-translate="moon.model.metadata.action.add.title">Add an Action Category</h4>
-
- </div>
-
- <div class="panel-body">.
-
- <moon-meta-data-edit meta-rule="list.metaRule" meta-data-type="list.typeOfAction"></moon-meta-data-edit>
-
- </div>
-
- </div>
-
- </div>
-
- <!--
- !shortDisplay allow to display less details than shortDisplay.
- It will display 3 panels on the same row, each panels have a table with on columns (name)
- -->
- <div ng-if="list.shortDisplay">
-
- <div class="row">
-
- <div class="col-md-4">
-
- <div class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4 data-translate="moon.model.metadata.subject.title">List of associated Subject Categories</h4>
-
- </div>
-
- <div class="panel-body">
-
- <div class="table-responsive">
-
- <table class="table table-striped">
-
- <thead>
- <tr>
- <th data-translate="moon.model.metadata.table.name">Name</th>
- </tr>
- </thead>
-
- <moon-loader ng-if="list.loadingCatSub"></moon-loader>
-
- <tbody ng-if="!list.loadingCatSub && list.getSubjectCategories().length > 0">
- <tr ng-repeat="(key, value) in list.catSub">
- <td ng-bind="value.name"></td>
- </tr>
- </tbody>
-
-
- <tbody ng-if="!list.loadingCatSub && list.catSub.length === 0">
- <tr>
- <td data-translate="moon.model.metadata.subject.notFound">There is no Subjects</td>
- </tr>
- </tbody>
-
- </table>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- <div class="col-md-4">
-
- <div class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4 data-translate="moon.model.metadata.object.title">List associated of Object Categories</h4>
-
- </div>
-
- <div class="panel-body">
-
- <div class="table-responsive">
-
- <table class="table table-striped">
-
- <thead>
- <tr>
- <th data-translate="moon.model.metadata.table.name">Name</th>
- </tr>
- </thead>
-
- <moon-loader ng-if="list.loadingCatObj"></moon-loader>
-
- <tbody ng-if="!list.loadingCatObj && list.catObj.length > 0">
- <tr ng-repeat="(key, value) in list.catObj">
- <td ng-bind="value.name"></td>
- </tr>
- </tbody>
-
- <tbody ng-if="!list.loadingCatObj && list.catObj.length === 0">
- <tr>
- <td data-translate="moon.model.metadata.object.notFound">There is no Objects</td>
- </tr>
- </tbody>
-
- </table>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- <div class="col-md-4">
-
- <div class="panel panel-default">
-
- <div class="panel-heading">
-
- <h4 data-translate="moon.model.metadata.action.title">List associated of Action Categories</h4>
-
- </div>
-
- <div class="panel-body">
-
- <div class="table-responsive">
-
- <table class="table table-striped">
-
- <thead>
- <tr>
- <th data-translate="moon.model.metadata.table.name">Name</th>
- </tr>
- </thead>
-
- <moon-loader ng-if="list.loadingCatAct"></moon-loader>
-
- <tbody ng-if="!list.loadingCatAct && list.catAct.length > 0">
- <tr ng-repeat="(key, value) in list.catAct">
- <td ng-bind="value.name"></td>
- </tr>
- </tbody>
-
- <tbody ng-if="!list.loadingCatAct && list.catAct.length === 0">
- <tr>
- <td data-translate="moon.model.metadata.action.notFound">There is no Actions</td>
- </tr>
- </tbody>
-
- </table>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
-
- </div>
- </div>
-</div> \ No newline at end of file
diff --git a/moon_gui/static/app/model/edit/metadata/metadata.edit.dir.js b/moon_gui/static/app/model/edit/metadata/metadata.edit.dir.js
deleted file mode 100755
index ab79b5db..00000000
--- a/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.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 = angular.copy(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');
-
- angular.copy(metaRuleToSend, edit.metaRule)
-
- $scope.$emit('event:updateMetaRuleFromMetaDataAddSuccess', edit.metaRule);
-
- 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){
-
- angular.copy(metaRule, edit.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/moon_gui/static/app/model/edit/metadata/metadata.list.dir.js b/moon_gui/static/app/model/edit/metadata/metadata.list.dir.js
deleted file mode 100755
index 305192b6..00000000
--- a/moon_gui/static/app/model/edit/metadata/metadata.list.dir.js
+++ /dev/null
@@ -1,374 +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);
- });
-
- metaRuleToSend = metaRuleService.findMetaDataFromMetaRule(utilService.transformOne(data, 'meta_rules'));
- angular.copy(metaRuleToSend, list.metaRule);
-
- 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);
- });
-
- metaRuleToSend = metaRuleService.findMetaDataFromMetaRule(utilService.transformOne(data, 'meta_rules'));
- angular.copy(metaRuleToSend, list.metaRule);
-
- 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);
- });
-
- metaRuleToSend = metaRuleService.findMetaDataFromMetaRule(utilService.transformOne(data, 'meta_rules'));
- angular.copy(metaRuleToSend, list.metaRule);
-
- 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