diff --git a/validation_service/app/css/app.css b/validation_service/app/css/app.css index 3e00ce3bb..9110f860f 100644 --- a/validation_service/app/css/app.css +++ b/validation_service/app/css/app.css @@ -377,4 +377,77 @@ table { background-position: center; margin: -100px 0 0 -100px; /* is width and height divided by two */ +} + + +/*ui-tree*/ + +.btn { + margin-right: 8px; +} + +.angular-ui-tree-handle { + /*background: #f8faff;*/ + border: 1px solid #dae2ea; + color: #687074; + padding: 10px 10px; +} + + +/*.angular-ui-tree-handle:hover { + color: #438eb9; + background: #f4f6f7; + border-color: #dce2e8; +}*/ + +.angular-ui-tree-placeholder { + background: #f0f9ff; + border: 2px dashed #bed2db; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +tr.angular-ui-tree-empty { + height: 100px +} + +.group-title { + background-color: #687074; + color: #FFF; +} + + +/* --- Tree --- */ + +.tree-node { + border: 1px solid #dae2ea; + /*background: #f8faff;*/ + /*color: #7c9eb2;*/ + /*color: darkgrey;*/ +} + +.nodrop { + background-color: #f2dede; +} + +.tree-node-content { + margin: 10px; +} + +.tree-handle { + padding: 10px; + /*background: #428bca;*/ + /*color: #FFF;*/ + margin-right: 10px; +} + +.angular-ui-tree-handle:hover {} + +.angular-ui-tree-placeholder { + /*background: #f0f9ff;*/ + border: 2px dashed #bed2db; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; } \ No newline at end of file diff --git a/validation_service/app/js/app.js b/validation_service/app/js/app.js index 3628b7d3f..8296c06bf 100644 --- a/validation_service/app/js/app.js +++ b/validation_service/app/js/app.js @@ -64,6 +64,7 @@ 'clb-app', 'hbpCollaboratory', 'angularUtils.directives.dirPagination', + 'ui.tree', // 'hbpCollaboratory', // 'clbBoostrap', // 'clb-env', diff --git a/validation_service/app/js/controller.js b/validation_service/app/js/controller.js index c6e64e2c6..78cdf8b47 100644 --- a/validation_service/app/js/controller.js +++ b/validation_service/app/js/controller.js @@ -12,8 +12,19 @@ testApp.controller('HomeCtrl', ['$scope', '$rootScope', '$http', '$location', "S $scope.$on('models_updated', function(event, models) { $scope.models = models; + $scope.collab_ids_to_select = $scope._get_collab_and_app_ids_from_models(); }); + $scope._get_collab_and_app_ids_from_models = function() { + for (var i in $scope.models.models) { + if ($scope.models.models[i].app != null) { + if ($scope.collab_ids_to_select.indexOf($scope.models.models[i].app.collab_id.toString()) == -1) { + $scope.collab_ids_to_select.push($scope.models.models[i].app.collab_id.toString()); + } + } + } + $scope.$apply(); + } Context.setService().then(function() { @@ -47,6 +58,8 @@ testApp.controller('HomeCtrl', ['$scope', '$rootScope', '$http', '$location', "S $('#preloader-models').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website. $('#models-panel').delay(350).css({ 'overflow': 'visible' }); + $scope.collab_ids_to_select = new Array(); + $scope._get_collab_and_app_ids_from_models(); var status = DataHandler.getCurrentStatus(); if (status != "up_to_date") { @@ -715,7 +728,59 @@ testApp.controller('ValTestDetailCtrl', ['$scope', '$rootScope', '$http', '$loca testApp.controller('ValTestResultDetailCtrl', ['$window', '$scope', '$rootScope', '$http', '$sce', '$location', '$stateParams', 'IsCollabMemberRest', 'AppIDRest', 'ValidationResultRest', 'CollabParameters', 'ScientificModelRest', 'ValidationTestDefinitionRest', "Context", "clbStorage", "clbAuth", 'DataHandler', 'clbCollabNav', function($window, $scope, $rootScope, $http, $sce, $location, $stateParams, IsCollabMemberRest, AppIDRest, ValidationResultRest, CollabParameters, ScientificModelRest, ValidationTestDefinitionRest, Context, clbStorage, clbAuth, DataHandler, clbCollabNav) { - // var vm = this; + + //ui-tree + + $scope.toggle = function(scope) { + scope.toggle(); + }; + + $scope.collapseAll = function() { + $scope.$broadcast('angular-ui-tree:collapse-all'); + }; + + $scope.expandAll = function() { + $scope.$broadcast('angular-ui-tree:expand-all'); + }; + + $scope._tranform_data_for_ui_tree = function(storage_folder_children) { + var data = []; + + var i = 0; + for (i; i < storage_folder_children.results.length; i++) { + var elem = storage_folder_children.results[i]; + + if (elem.entity_type == "folder") { + elem.nodes = []; + } + data.push(elem); + } + return data; + } + + $scope.getFolderContent = function(scope, node) { + var nodeData = scope.$modelValue; + if (!node.nodes.length > 0) { + + clbStorage.getChildren({ uuid: node.uuid, entity_type: 'folder' }).then(function(res) { + + var i = 0; + for (i; i < res.results.length; i++) { + var elem = res.results[i]; + if (elem.entity_type == "folder") { + elem.nodes = []; + } + nodeData.nodes.push(elem); + } + }) + } else { + if (!nodeData.nodes.length > 0) { + nodeData.nodes = node.nodes; + } + } + scope.toggle(); + } + ////ui tree $scope.split_result_storage_string = function(storage_string) { storage_string = storage_string.slice(10, storage_string.length) @@ -728,7 +793,7 @@ testApp.controller('ValTestResultDetailCtrl', ['$window', '$scope', '$rootScope' }; //NOT USED? - // $scope.get_correct_folder_using_name = function(name, folders) { + // $scope.get_correct_folder_using_name = function(name, folders) { // for (var i in folders) { // if (folders[i].name == name) { // return (folders[i]); @@ -755,13 +820,14 @@ testApp.controller('ValTestResultDetailCtrl', ['$window', '$scope', '$rootScope' }); }; + + Context.setService().then(function() { $scope.Context = Context; $scope.ctx = Context.getCtx(); $scope.app_id = Context.getAppID(); - CollabParameters.setService($scope.ctx).then(function() { var test_result = ValidationResultRest.get({ id: $stateParams.uuid, order: "", detailed_view: true }); @@ -795,22 +861,19 @@ testApp.controller('ValTestResultDetailCtrl', ['$window', '$scope', '$rootScope' } // $scope.storage_url = //https://collab.humanbrainproject.eu/#/collab/2169/nav/18935 - - }, function(not_working) {}) .finally(function() {}); clbStorage.getEntity({ path: "?path=/" + collab + "/" + folder_name + "/" }).then(function(collabStorageFolder) { - clbStorage.getChildren({ uuid: collabStorageFolder.uuid, entity_type: 'folder' }).then(function(storage_folder_children) { - - $scope.storage_files = storage_folder_children.results + clbStorage.getChildren({ uuid: collabStorageFolder.uuid, entity_type: 'folder' }).then(function(storage_folder_children) { - }, function() {}) - .finally(function() {}); + $scope.storage_files = $scope._tranform_data_for_ui_tree(storage_folder_children) - }, function(not_worked) {}).finally(function() {}); + }); + }, + function(not_worked) {}).finally(function() {}); DataHandler.loadModels({ app_id: $scope.app_id }).then(function(data) { $scope.models = data @@ -954,6 +1017,7 @@ testApp.filter('filterMultiple', ['$parse', '$filter', function($parse, $filter) if (!angular.isArray(items)) { return items; } + var filterObj = { data: items, filteredData: [], @@ -973,9 +1037,15 @@ testApp.filter('filterMultiple', ['$parse', '$filter', function($parse, $filter) if (angular.isDefined(obj[i]['value'])) { fObj[key] = obj[i]['value']; } else { - fObj[key] = obj[i]; + if (key == 'collab_id') { //specific for Model Catalog home: to allow filter by collab (deep filter) + fObj['app'] = {} + fObj['app'][key] = obj[i]; + } else { + fObj[key] = obj[i]; + } } fData = fData.concat($filter('filter')(this.filteredData, fObj)); + } } } @@ -998,14 +1068,11 @@ testApp.filter('filterMultiple', ['$parse', '$filter', function($parse, $filter) filterObj.applyFilter(obj, key); }); } - return filterObj.filteredData; } }]); - - //Model catalog //directives and filters var ModelCatalogApp = angular.module('ModelCatalogApp'); @@ -1141,6 +1208,7 @@ ModelCatalogApp.controller('ModelCatalogCtrl', [ $scope.$on('models_updated', function(event, models) { $scope.models = $scope._change_empty_organization_string(models); $scope.collab_ids_to_select = $scope._get_collab_and_app_ids_from_models(); + }); Context.setService().then(function() { diff --git a/validation_service/app/templates/base.html b/validation_service/app/templates/base.html index f1f4690b7..28cd9d5e0 100644 --- a/validation_service/app/templates/base.html +++ b/validation_service/app/templates/base.html @@ -178,8 +178,9 @@ - - + + + diff --git a/validation_service/app/templates/validation_framework/home_1.tpl.html b/validation_service/app/templates/validation_framework/home_1.tpl.html index db4d07b0f..f62b50f92 100644 --- a/validation_service/app/templates/validation_framework/home_1.tpl.html +++ b/validation_service/app/templates/validation_framework/home_1.tpl.html @@ -12,9 +12,7 @@

Validation Results