Skip to content

Commit

Permalink
HumanBrainProject#193 change on validation framework
Browse files Browse the repository at this point in the history
  • Loading branch information
HFragnaud committed Jun 22, 2018
1 parent 97e44c7 commit c07fe8e
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 23 deletions.
76 changes: 65 additions & 11 deletions validation_service/app/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -713,8 +726,8 @@ 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) {
testApp.controller('ValTestResultDetailCtrl', ['$window', '$scope', '$rootScope', '$http', '$sce', '$location', '$stateParams', 'IsCollabMemberRest', 'AppIDRest', 'ValidationResultRest', 'CollabParameters', 'ScientificModelRest', 'ValidationTestDefinitionRest', "Context", "clbStorage", "clbAuth", 'DataHandler', 'clbCollabNav', 'uiGridTreeViewConstants',
function($window, $scope, $rootScope, $http, $sce, $location, $stateParams, IsCollabMemberRest, AppIDRest, ValidationResultRest, CollabParameters, ScientificModelRest, ValidationTestDefinitionRest, Context, clbStorage, clbAuth, DataHandler, clbCollabNav, uiGridTreeViewConstants) {
// var vm = this;

$scope.split_result_storage_string = function(storage_string) {
Expand All @@ -728,7 +741,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]);
Expand All @@ -755,6 +768,42 @@ testApp.controller('ValTestResultDetailCtrl', ['$window', '$scope', '$rootScope'
});
};

$scope._get_storage_folder_content = function(storage) {

clbStorage.getChildren({ uuid: storage_uuid, entity_type: 'folder' }).then(function(storage_folder_children) {
var storage = storage_folder_children;

return (storage);
});
}

$scope.gridOptions = {
enableSorting: true,
enableFiltering: false,
showTreeExpandNoChildren: false,
columnDefs: [
{ name: 'name', width: '20%' },
{ name: 'content_type', width: '20%' },
{ name: 'created_on', width: '20%' },
{ name: 'preview', width: '20%' },
{ name: 'download', width: '20%' },
],
onRegisterApi: function(gridApi) {
$scope.gridApi = gridApi;
$scope.gridApi.treeBase.on.rowExpanded($scope, function(row) {
if (row.entity.$$hashKey === $scope.gridOptions.data[50].$$hashKey && !$scope.nodeLoaded) {

// $scope.gridOptions.data.splice(51,0,
// {name: 'Dynamic 1', gender: 'female', age: 53, company: 'Griddable grids', balance: 38000, $$treeLevel: 1},
// {name: 'Dynamic 2', gender: 'male', age: 18, company: 'Griddable grids', balance: 29000, $$treeLevel: 1}
// );
// $scope.nodeLoaded = true;

}
});
}
};

Context.setService().then(function() {
$scope.Context = Context;

Expand Down Expand Up @@ -795,20 +844,18 @@ 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

$scope.storage_files = storage_folder_children.results

}, function() {})
.finally(function() {});
$scope.gridOptions.data = $scope.storage_files;
console.log("storage files", $scope.storage_files)
});

}, function(not_worked) {}).finally(function() {});

Expand Down Expand Up @@ -954,6 +1001,7 @@ testApp.filter('filterMultiple', ['$parse', '$filter', function($parse, $filter)
if (!angular.isArray(items)) {
return items;
}

var filterObj = {
data: items,
filteredData: [],
Expand All @@ -973,9 +1021,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));

}
}
}
Expand All @@ -998,7 +1052,6 @@ testApp.filter('filterMultiple', ['$parse', '$filter', function($parse, $filter)
filterObj.applyFilter(obj, key);
});
}

return filterObj.filteredData;
}
}]);
Expand Down Expand Up @@ -1141,6 +1194,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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ <h1 align=center> Validation Results </h1>
<nav>
<table class="table-create">
<tr>
<td>
<label> Search : <input id="search_model" ng-model='search.$'> </label>
</td>


<td>
<multiselect ng-model="selected_species" placeholder="Select species" options="collab_species" show-search="true" show-select-all="true" show-unselect-all="true"></multiselect>
Expand All @@ -37,7 +35,9 @@ <h1 align=center> Validation Results </h1>
<td>
<multiselect ng-model="selected_organization" placeholder="Select organization" options="collab_organization" show-search="true" show-select-all="true" show-unselect-all="true"></multiselect>
</td>

<td>
<multiselect ng-model="selected_collab" placeholder="Select collab" options="collab_ids_to_select"></multiselect>
</td>
<td>
<select id="sorting_option" placeholder="Sorting options" class="form-control" ng-model="selected_sorting_option">
<option value="">Sorting options</option>
Expand All @@ -48,6 +48,13 @@ <h1 align=center> Validation Results </h1>

</tr>
</table>
<table>
<tr>
<td>
<label> Search : <input id="search_model" ng-model='search.$'> </label>
</td>
</tr>
</table>
<br>
<div align=right> <button class="button-MC" ng-click="Context.validation_goToTestCatalogView()">Go to Test Library</button></div>
<br>
Expand All @@ -68,7 +75,7 @@ <h3 align=center> Models</h3>
<th>Author</th>
</thead>
<br>
<tr class=tr-clickable id="test1" dir-paginate="model in models.models | filter: search | filterMultiple:{organization:selected_organization, species:selected_species, brain_region:selected_brain_region, cell_type:selected_cell_type, model_type:selected_model_type} | orderBy: selected_sorting_option | itemsPerPage: itemsPerPages"
<tr class=tr-clickable id="test1" dir-paginate="model in models.models | filter: search | filterMultiple:{organization:selected_organization, species:selected_species, brain_region:selected_brain_region, cell_type:selected_cell_type, model_type:selected_model_type, collab_id: selected_collab} | orderBy: selected_sorting_option | itemsPerPage: itemsPerPages"
pagination-id="models-pagination" ng-mousedown="Context.goToValidationModelView($event, model)">
<td ng-if=!(model.alias) ng-text-truncate=model.name ng-tt-chars-threshold="20" ng-tt-no-toggling> {{model.name}} </td>
<td ng-if=model.alias ng-text-truncate=model.alias ng-tt-chars-threshold="20" ng-tt-no-toggling> {{model.alias}} </td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<html id="test-result-detail">

<head>

</head>



<body>
<nav class="navbar ">
<br>

Expand All @@ -9,11 +15,7 @@

<h1 align=center> Test result ID: {{test_result.id}}</h1>
</nav>
</head>

<br>

<body>
<br>
<div id=conteneur>
<!--test result data -->
<panel class=description-panel-validation-test-detail>
Expand Down Expand Up @@ -228,8 +230,6 @@ <h2 align=center>Storage</h2>
<div ng-if="file.content_type == 'image/png'">
<button class="button-MC" ng-click="open_overview_file(file.uuid);"> Preview </button>&ensp;
</div>


</td>
<td>
<button class="button-MC" ng-click="download_file(file.uuid);"> Download </button>&ensp;
Expand All @@ -240,6 +240,7 @@ <h2 align=center>Storage</h2>
</tbody>
</table>

<div id="grid1" ui-grid="gridOptions" ui-grid-tree-view class="grid"></div>
<div align=center>
<img src="{{image.src}}" alt="" max-height="400" max-width="600">
</div>
Expand Down

0 comments on commit c07fe8e

Please sign in to comment.