diff options
author | asteroide <thomas.duval@orange.com> | 2017-06-09 16:18:59 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-06-09 16:18:59 +0200 |
commit | 60bb98696ee93f979914d8e88ed4708f59fcff9c (patch) | |
tree | a404880ec261f95c69fa4a6a1edd50ef9a66d160 /moonv4/moon_gui/static/app/model | |
parent | 8039214d0caedfec5456bd8ee0898a1b9a55629a (diff) |
Stable version
Change-Id: I70001bedbdf1823cb9e8dccd545800387777201b
Diffstat (limited to 'moonv4/moon_gui/static/app/model')
8 files changed, 553 insertions, 386 deletions
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 index fde6cdb0..2616be1c 100644 --- 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 @@ -70,7 +70,7 @@ <div class="form-group"> - <label for="description" class="col-sm-3 control-label"data-translate="moon.model.metadata.edit.description">Description</label> + <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> 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 index 35b61f57..30a42dbc 100644 --- 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 @@ -1,149 +1,156 @@ <div> - <div class="panel panel-default"> + <!-- + !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-heading"> + <div class="panel panel-default"> - <h4 data-translate="moon.model.metadata.subject.title">List of associated Subject Categories</h4> + <div class="panel-heading"> - </div> + <h4 data-translate="moon.model.metadata.subject.title">List of associated Subject Categories</h4> - <div class="panel-body"> + </div> - <div class="table-responsive"> + <div class="panel-body"> - <table class="table table-striped"> + <div class="table-responsive"> - <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> + <table class="table table-striped"> - <moon-loader ng-if="list.loadingCatSub"></moon-loader> + <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> - <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"> + <moon-loader ng-if="list.loadingCatSub"></moon-loader> - <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> + <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"> - <!--<div ng-if="!value.loader" class="dropdown"> + <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> - <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> + <!--<div ng-if="!value.loader" class="dropdown"> - <ul class="dropdown-menu"> + <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> - <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> + <ul class="dropdown-menu"> - <li class="divider"></li> + <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> - <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> + <li class="divider"></li> - </ul> + <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> - </div>--> + </ul> - <div ng-if="value.loader"> + </div>--> - <moon-loader></moon-loader> + <div ng-if="value.loader"> - </div> + <moon-loader></moon-loader> - </td> + </div> - </tr> - </tbody> + </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> + <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> + <div ng-if="list.editMode" class="panel panel-default"> - <div ng-if="list.editMode" class="panel panel-default"> + <div class="panel-heading"> - <div class="panel-heading"> + <h4 data-translate="moon.model.metadata.subject.add.title">Add a Subject Category</h4> - <h4 data-translate="moon.model.metadata.subject.add.title">Add a Subject Category</h4> + </div> - </div> + <div class="panel-body"> - <div class="panel-body"> + <moon-meta-data-edit meta-rule="list.metaRule" + meta-data-type="list.typeOfSubject"></moon-meta-data-edit> - <moon-meta-data-edit meta-rule="list.metaRule" meta-data-type="list.typeOfSubject"></moon-meta-data-edit> + </div> </div> - </div> - - <div class="panel panel-default"> + <div class="panel panel-default"> - <div class="panel-heading"> + <div class="panel-heading"> - <h4 data-translate="moon.model.metadata.object.title">List associated of Object Categories</h4> + <h4 data-translate="moon.model.metadata.object.title">List associated of Object Categories</h4> - </div> + </div> - <div class="panel-body"> + <div class="panel-body"> - <div class="table-responsive"> + <div class="table-responsive"> - <table class="table table-striped"> + <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> + <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> + </tr> + </thead> - <moon-loader ng-if="list.loadingCatObj"></moon-loader> + <moon-loader ng-if="list.loadingCatObj"></moon-loader> - <tbody ng-if="!list.loadingCatObj && list.catObj.length > 0"> + <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)" > + <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> @@ -186,148 +193,299 @@ </td> </tr> - </tbody> + </tbody> - <tbody ng-if="!list.loadingCatObj && list.catObj.length === 0"> + <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> + </tbody> + + </table> - </table> + </div> </div> </div> - </div> + <div ng-if="list.editMode" class="panel panel-default"> - <div ng-if="list.editMode" class="panel panel-default"> + <div class="panel-heading"> - <div class="panel-heading"> + <h4 data-translate="moon.model.metadata.object.add.title">Add an Object Category</h4> - <h4 data-translate="moon.model.metadata.object.add.title">Add an Object Category</h4> + </div> - </div> + <div class="panel-body"> - <div class="panel-body"> + <moon-meta-data-edit meta-rule="list.metaRule" meta-data-type="list.typeOfObject"></moon-meta-data-edit> - <moon-meta-data-edit meta-rule="list.metaRule" meta-data-type="list.typeOfObject"></moon-meta-data-edit> + </div> </div> - </div> + <div class="panel panel-default"> - <div class="panel panel-default"> + <div class="panel-heading"> - <div class="panel-heading"> + <h4 data-translate="moon.model.metadata.action.title">List associated of Action Categories</h4> - <h4 data-translate="moon.model.metadata.action.title">List associated of Action Categories</h4> - - </div> + </div> - <div class="panel-body"> + <div class="panel-body"> - <div class="table-responsive"> + <div class="table-responsive"> - <table class="table table-striped"> + <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> + <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> + <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"> + <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> + <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"> + <!--<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> + <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"> + <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> + <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 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> + <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> + </ul> - </div>--> + </div>--> - <div ng-if="value.loader"> + <div ng-if="value.loader"> - <moon-loader></moon-loader> + <moon-loader></moon-loader> - </div> + </div> - </td> - </tr> - </tbody> + </td> + </tr> + </tbody> - <tbody ng-if="!list.loadingCatAct && list.catAct.length === 0"> + <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> + </tbody> - </table> + </table> + + </div> </div> </div> - </div> + <div ng-if="list.editMode" class="panel panel-default"> - <div ng-if="list.editMode" class="panel panel-default"> + <div class="panel-heading"> - <div class="panel-heading"> + <h4 data-translate="moon.model.metadata.action.add.title">Add an Action Category</h4> - <h4 data-translate="moon.model.metadata.action.add.title">Add an Action Category</h4> + </div> - </div> + <div class="panel-body">. - <div class="panel-body">. + <moon-meta-data-edit meta-rule="list.metaRule" meta-data-type="list.typeOfAction"></moon-meta-data-edit> - <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/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 index 2e927c44..10df83b0 100644 --- 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 @@ -29,9 +29,11 @@ .module('moon') .controller('moonMetaDataEditController', moonMetaDataEditController); - moonMetaDataEditController.$inject = ['$scope', 'metaDataService', 'META_DATA_CST', 'alertService', '$translate', 'formService', 'metaRuleService', 'utilService']; + moonMetaDataEditController.$inject = ['$scope', 'metaDataService', 'META_DATA_CST', 'alertService', + '$translate', 'formService', 'metaRuleService', 'utilService']; - function moonMetaDataEditController($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; @@ -86,7 +88,7 @@ function callBackList(list){ - edit.list = list + edit.list = list; } 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 index c4654be1..beb2ed86 100644 --- 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 @@ -17,7 +17,9 @@ controllerAs : 'list', scope : { metaRule: '=', - editMode : '=' + editMode: '=', + // shortDisplay : boolean value + shortDisplay: '=' }, restrict : 'E', replace : true @@ -36,6 +38,7 @@ 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; @@ -45,9 +48,9 @@ list.unMapObj = unMapObj; list.unMapAct = unMapAct; - list.deleteSub = deleteSub; - list.deleteObj = deleteObj; - list.deleteAct = deleteAct; + // list.deleteSub = deleteSub; + // list.deleteObj = deleteObj; + // list.deleteAct = deleteAct; list.getSubjectCategories = getSubjectCategories; list.getObjectCategories = getObjectCategories; @@ -82,7 +85,7 @@ list.loadingCatSub = true; - metaDataService.subject.findSomeWithCallback(list.metaRule.subject_categories, function(categories){ + metaDataService.subject.findSomeWithCallback(list.metaRule.subject_categories, function(categories){ list.catSub = categories; list.loadingCatSub = false; @@ -229,97 +232,99 @@ } - /** - * 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(metaRule.subject_categories); - list.catObj = metaDataService.object.findSome(metaRule.object_categories); - list.catAct = metaDataService.action.findSome(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; - - } - } + // /** + // * 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 : []; @@ -333,17 +338,17 @@ 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 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){ 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 index c36700ff..ebe307c3 100644 --- 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 @@ -1,149 +1,138 @@ <div> - <div class="row"> - <div><h4 data-translate="moon.model.metarules.title">List of Meta Rules</h4></div> + <div><h4 data-translate="moon.model.metarules.title">List of Meta Rules</h4></div> - </div> - - <div class="row"> - - <div class="table-responsive" data-role="table"> - <table class="table table-striped table-hover" ng-table="list.table"> - - <colgroup> - <col class="col-md-2" /> - <col class="col-md-2" /> - <col class="col-md-1" /> - <col class="col-md-1" /> - <col class="col-md-1" /> - <col class="col-md-2" /> - </colgroup> + <div class="table-responsive" data-role="table"> + <table class="table table-striped table-hover" ng-table="list.table"> - <thead> + <colgroup> + <col class="col-md-2" /> + <col class="col-md-2" /> + <col class="col-md-1" /> + <col class="col-md-1" /> + <col class="col-md-1" /> + <col class="col-md-2" /> + </colgroup> - <tr> + <thead> - <th class="customTables sortable" - ng-class="{ 'sort-asc': list.table.isSortBy('name', 'asc'), 'sort-desc': list.table.isSortBy('name', 'desc') }" - ng-click="list.table.sorting('name', list.table.isSortBy('name', 'asc') ? 'desc' : 'asc')"> - <div data-translate="moon.model.metarules.table.name">Name</div> - </th> + <tr> - <th class="customTables sortable" - ng-class="{ 'sort-asc': list.table.isSortBy('description', 'asc'), 'sort-desc': list.table.isSortBy('description', 'desc') }" - ng-click="list.table.sorting('description', list.table.isSortBy('description', 'asc') ? 'desc' : 'asc')"> - <div data-translate="moon.model.metarules.table.description">Description</div> - </th> + <th class="customTables sortable" + ng-class="{ 'sort-asc': list.table.isSortBy('name', 'asc'), 'sort-desc': list.table.isSortBy('name', 'desc') }" + ng-click="list.table.sorting('name', list.table.isSortBy('name', 'asc') ? 'desc' : 'asc')"> + <div data-translate="moon.model.metarules.table.name">Name</div> + </th> - <th class="customTables sortable"> - <div data-translate="moon.model.metarules.table.metadata.subject.number">Number of Subjects</div> - </th> + <th class="customTables sortable" + ng-class="{ 'sort-asc': list.table.isSortBy('description', 'asc'), 'sort-desc': list.table.isSortBy('description', 'desc') }" + ng-click="list.table.sorting('description', list.table.isSortBy('description', 'asc') ? 'desc' : 'asc')"> + <div data-translate="moon.model.metarules.table.description">Description</div> + </th> - <th class="customTables sortable"> - <div data-translate="moon.model.metarules.table.metadata.object.number">Number of Subjects</div> - </th> + <th class="customTables sortable"> + <div data-translate="moon.model.metarules.table.metadata.subject.number">Number of Subjects</div> + </th> - <th class="customTables sortable"> - <div data-translate="moon.model.metarules.table.metadata.action.number">Number of Actions</div> - </th> + <th class="customTables sortable"> + <div data-translate="moon.model.metarules.table.metadata.object.number">Number of Subjects</div> + </th> - <th class="customTables"> - <div data-translate="moon.model.metarules.action.title">Actions</div> - </th> - </tr> + <th class="customTables sortable"> + <div data-translate="moon.model.metarules.table.metadata.action.number">Number of Actions</div> + </th> - </thead> + <th class="customTables"> + <div data-translate="moon.model.metarules.action.title">Actions</div> + </th> + </tr> - <tbody ng-if="!list.hasMetaRules()"> - <tr> - <td colspan="2"><span data-translate="moon.model.metarules.table.notFound">There is no Meta Rules</span></td> - </tr> - </tbody> + </thead> - <tbody ng-if="list.hasMetaRules()"> + <tbody ng-if="!list.hasMetaRules()"> + <tr> + <td colspan="2"><span data-translate="moon.model.metarules.table.notFound">There is no Meta Rules</span></td> + </tr> + </tbody> - <tr ng-repeat="aMetaRules in $data | filter:list.search.find | orderBy:sort:reverse"> - <td ng-bind="aMetaRules.name"></td> - <td ng-bind="aMetaRules.description"></td> - <td ng-bind="aMetaRules.subject_categories.length"></td> - <td ng-bind="aMetaRules.object_categories.length"></td> - <td ng-bind="aMetaRules.action_categories.length"></td> - <td> + <tbody ng-if="list.hasMetaRules()"> - <div ng-if="list.editMode"> + <tr ng-repeat="aMetaRules in $data | filter:list.search.find | orderBy:sort:reverse"> + <td ng-bind="aMetaRules.name"></td> + <td ng-bind="aMetaRules.description"></td> + <td ng-bind="aMetaRules.subject_categories.length"></td> + <td ng-bind="aMetaRules.object_categories.length"></td> + <td ng-bind="aMetaRules.action_categories.length"></td> + <td> - <div ng-if="!value.loader" class="dropdown"> + <div ng-if="list.editMode"> - <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> + <div ng-if="!value.loader" class="dropdown"> - <ul class="dropdown-menu"> + <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> - <li> - <a href="" ng-click="list.unmap.showModal(aMetaRules)" > - <span class="glyphicon glyphicon-transfer"></span> - <span class="control-label" data-translate="moon.model.metarules.action.remove">Remove</span> - </a> - </li> + <ul class="dropdown-menu"> - <li> - <a href="" ng-click="list.edit.showModal(aMetaRules)"> - <span class="glyphicon glyphicon-cog"></span> - <span class="control-label" data-translate="moon.model.metarules.action.edit">Edit</span> - </a> - </li> + <li> + <a href="" ng-click="list.unmap.showModal(aMetaRules)" > + <span class="glyphicon glyphicon-transfer"></span> + <span class="control-label" data-translate="moon.model.metarules.action.remove">Remove</span> + </a> + </li> - </ul> + <li> + <a href="" ng-click="list.edit.showModal(aMetaRules)"> + <span class="glyphicon glyphicon-cog"></span> + <span class="control-label" data-translate="moon.model.metarules.action.edit">Edit</span> + </a> + </li> - </div> + </ul> </div> - <div ng-if="!list.editMode"> + </div> - <a href="" ng-click="list.showDetail(aMetaRules)"> + <div ng-if="!list.editMode"> - <span ng-if="aMetaRules.id !== list.getShowDetailValue().id"> - <span class="glyphicon glyphicon-eye-open"></span> - <span class="control-label" data-translate="moon.model.metarules.action.detail.open">Consult</span> - </span> + <a href="" ng-click="list.showDetail(aMetaRules)"> - <span ng-if="aMetaRules.id === list.getShowDetailValue().id"> - <span class="glyphicon glyphicon-eye-close"></span> - <span class="control-label" data-translate="moon.model.metarules.action.detail.close">Close</span> - </span> + <span ng-if="aMetaRules.id !== list.getShowDetailValue().id"> + <span class="glyphicon glyphicon-eye-open"></span> + <span class="control-label" data-translate="moon.model.metarules.action.detail.open">Consult</span> + </span> - </a> + <span ng-if="aMetaRules.id === list.getShowDetailValue().id"> + <span class="glyphicon glyphicon-eye-close"></span> + <span class="control-label" data-translate="moon.model.metarules.action.detail.close">Close</span> + </span> - </div> + </a> - </td> - </tr> + </div> - </tbody> + </td> + </tr> - </table> + </tbody> - <div ng-if="list.showDetailValue"> - <moon-meta-data-list edit-mode="list.editMode" meta-rule="list.getShowDetailValue()"></moon-meta-data-list> - </div> + </table> + <div ng-if="list.showDetailValue"> + <moon-meta-data-list edit-mode="list.editMode" meta-rule="list.getShowDetailValue()"></moon-meta-data-list> </div> </div> - <div class="row" ng-if="list.editMode"> - - <div class="form-group"> - <a href="" ng-click="list.map.showModal()" class="btn btn-default"> - <span class="glyphicon glyphicon-link"></span> - <span data-translate="moon.model.metarules.action.settings">Settings</span> - </a> - </div> - + <div class="form-group" ng-if="list.editMode"> + <a href="" ng-click="list.map.showModal()" class="btn btn-default"> + <span class="glyphicon glyphicon-link"></span> + <span data-translate="moon.model.metarules.action.settings">Settings</span> + </a> </div> </div> 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 index 8fba0266..120b6a8b 100644 --- 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 @@ -59,6 +59,11 @@ 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 }; @@ -224,8 +229,6 @@ }); - - } function modelUnmappedError(event) { 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 index c86d05ec..4955f441 100644 --- a/moonv4/moon_gui/static/app/model/edit/model-edit.tpl.html +++ b/moonv4/moon_gui/static/app/model/edit/model-edit.tpl.html @@ -53,7 +53,11 @@ </div> <div class="panel-body" ng-if="edit.model.meta_rules_values"> - <moon-meta-rules-list mapped-model="edit.model" edit-mode="edit.editMetaRules"></moon-meta-rules-list> + <div class=""> + + <moon-meta-rules-list mapped-model="edit.model" edit-mode="edit.editMetaRules"></moon-meta-rules-list> + + </div> </div> <div class="panel-body" ng-if="!edit.model.meta_rules_values"> 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 index f5972052..3e10a533 100644 --- a/moonv4/moon_gui/static/app/model/edit/model.controller.edit.js +++ b/moonv4/moon_gui/static/app/model/edit/model.controller.edit.js @@ -6,9 +6,9 @@ .module('moon') .controller('ModelEditController', ModelEditController); - ModelEditController.$inject = ['$scope', '$rootScope', 'model', '$stateParams']; + ModelEditController.$inject = ['$scope', '$rootScope', 'model', 'metaRuleService']; - function ModelEditController($scope, $rootScope, model, $stateParams) { + function ModelEditController($scope, $rootScope, model, metaRuleService) { var edit = this; @@ -48,6 +48,12 @@ edit.model = model; + metaRuleService.findSomeWithCallback(model.meta_rules, function(metaRules){ + + edit.model.meta_rules_values = metaRules; + + }); + } } |