Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
HFragnaud committed Jun 19, 2018
1 parent f63e928 commit 56235cd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
24 changes: 21 additions & 3 deletions validation_service/app/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,12 @@ ModelCatalogApp.filter('filterMultiple', ['$parse', '$filter', function($parse,
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 Down Expand Up @@ -1121,8 +1126,20 @@ ModelCatalogApp.controller('ModelCatalogCtrl', [
return 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();
}

$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 Expand Up @@ -1167,8 +1184,9 @@ ModelCatalogApp.controller('ModelCatalogCtrl', [
$scope.collab_cell_type = CollabParameters.getParametersOrDefaultByType("cell_type");
$scope.collab_model_type = CollabParameters.getParametersOrDefaultByType("model_type");
$scope.collab_organization = CollabParameters.getParametersOrDefaultByType("organization");


$scope.collab_ids_to_select = new Array();
$scope._get_collab_and_app_ids_from_models();
// $scope.selected_collab = $scope.collab_ids_to_select //initialize


$scope.is_collab_member = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ <h1 align=center> Model Catalog</h1>
<nav>
<table>
<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"></multiselect>
Expand All @@ -30,15 +28,27 @@ <h1 align=center> Model Catalog</h1>
<td>
<multiselect ng-model="selected_privacy" placeholder="Select privacy" options="model_privacy" id-prop="value" display-prop="name"></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>
<option value="-creation_date ">Sorting: Newest first</option>
<option value="creation_date ">Sorting: Oldest first</option>
</select>
</td>
</td>
<td><a class="button-MC " ng-href="#/model-catalog/create " ng-if="is_collab_member==true " class="btn btn-primary ">New model </a></td>
</tr>

</table>
<table>
<tr>
<td width="90%">
<label> Search : <input id="search_model" ng-model='search.$' size=30> </label>

</tr>
</table>
<br>
</nav>
Expand All @@ -58,8 +68,9 @@ <h1 align=center> Model Catalog</h1>
</tr>
</thead>
<tbody>
<tr ng-mousedown="Context.goToModelDetailView($event, model.id)" oncontextmenu="return false" class="tr-clickable " 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, private: selected_privacy}
<tr ng-show="selected_collab.indexOf(model.app.collab_id.toString())!= -1" ng-mousedown="Context.goToModelDetailView($event, model.id)" oncontextmenu="return false" class="tr-clickable " 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, private: selected_privacy, collab_id: selected_collab}
| orderBy: selected_sorting_option | itemsPerPage: itemsPerPages" pagination-id="models">

<td>{{ model.name}}</td>
<td ng-text-truncate=model.alias ng-tt-chars-threshold="50 " ng-tt-no-toggling>{{ model.alias }}</td>
<td ng-text-truncate=model.species ng-tt-chars-threshold="50 " ng-tt-no-toggling>{{ model.species }}</td>
Expand Down

0 comments on commit 56235cd

Please sign in to comment.