Commit 038ff52f authored by Mathieu Rodic's avatar Mathieu Rodic

[FEATURE] we can now filter the datasets by project, then corpus

parent 0caaed78
...@@ -234,10 +234,17 @@ gargantext.controller("DatasetController", function($scope, $http) { ...@@ -234,10 +234,17 @@ gargantext.controller("DatasetController", function($scope, $http) {
$scope.results = []; $scope.results = [];
$scope.resultsCount = undefined; $scope.resultsCount = undefined;
// corpus retrieval // corpus retrieval
$scope.projects = [];
$scope.corpora = []; $scope.corpora = [];
$http.get('/api/nodes?type=Corpus', {cache: true}).success(function(response){ $http.get('/api/nodes?type=Project', {cache: true}).success(function(response){
$scope.corpora = response.data; $scope.projects = response.data;
}); });
// update corpora according to the select parent project
$scope.updateCorpora = function() {
$http.get('/api/nodes?type=Corpus&parent=' + $scope.projectId, {cache: true}).success(function(response){
$scope.corpora = response.data;
});
};
// update entities depending on the selected corpus // update entities depending on the selected corpus
$scope.updateEntities = function() { $scope.updateEntities = function() {
var url = '/api/nodes/' + $scope.corpusId + '/children/metadata'; var url = '/api/nodes/' + $scope.corpusId + '/children/metadata';
......
...@@ -227,10 +227,10 @@ ...@@ -227,10 +227,10 @@
<div class="corpus"> <div class="corpus">
<button ng-click="removeDataset($index)" title="remove this dataset">X</button> <button ng-click="removeDataset($index)" title="remove this dataset">X</button>
<select ng-model="mesured" style="background-color:{{ getColor($index, datasets.length) }}" ng-options="value as key for (key, value) in {'Documents count': 'nodes.count', 'Ngrams count': 'ngrams.count'}" ng-change="updateQuery()"></select> <select ng-model="mesured" style="background-color:{{ getColor($index, datasets.length) }}" ng-options="value as key for (key, value) in {'Documents count': 'nodes.count', 'Ngrams count': 'ngrams.count'}" ng-change="updateQuery()"></select>
in the corpus in the project
<select ng-model="corpusId" ng-change="updateEntities()"> <select ng-model="projectId" ng-change="updateCorpora()" ng-options="project.id as project.name for project in projects"></select>,
<option ng-repeat="corpus in corpora" value="{{corpus.id}}">{{corpus.name}}</option> corpus
</select> <select ng-model="corpusId" ng-change="updateEntities()" ng-options="corpus.id as corpus.name for corpus in corpora"></select>
</div> </div>
<div class="filters" ng-if="entities"> <div class="filters" ng-if="entities">
<ul> <ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment