Skip to content

Commit

Permalink
Scottx611x/chucks recent prs (#1986)
Browse files Browse the repository at this point in the history
* I was sloppy earlier: We want to OR within, but AND across facets (#1983)

* I was sloppy earlier: We want to OR within, but AND across facets

* We want to reverse the normal order of operations: First OR within, then AND across

* Hide zero facets (#1979)

* Hide zero facets

* Get tests to pass

* Title is unnecessary (#1977)

* Mccalluc/search facet labels (#1976)

* Basic machinery

* A litte style. Case-insensitive matching.

* Mccalluc/preserve facets in fb2 (#1981)

* Demonstrate that outside parameters can be inserted

* Generate a query that looks like what the fb2 generates

* There will also be a "filterQuery" for the download link, and I want to prevent confusion

* Mccalluc/max height (#1975)

* limit the height of the facet lists

* Expand on hover? This is arguable

* Add styles (#1985)
  • Loading branch information
scottx611x committed Aug 15, 2017
1 parent 4b48c15 commit 54f05d6
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 17 deletions.
6 changes: 4 additions & 2 deletions refinery/data_set_manager/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,8 @@ def test_generate_solr_params_no_params(self):
'&q=django_ct%3Adata_set_manager.node'
'&wt=json'
'&facet=true'
'&facet.limit=-1'.format(
'&facet.limit=-1'
'&facet.mincount=1'.format(
self.valid_uuid))

def test_generate_solr_params_for_assay_with_params(self):
Expand Down Expand Up @@ -813,7 +814,8 @@ def test_generate_solr_params_for_assay_with_params(self):
'&q=django_ct%3Adata_set_manager.node'
'&wt=json'
'&facet=true'
'&facet.limit=-1'.format(
'&facet.limit=-1'
'&facet.mincount=1'.format(
self.valid_uuid))

def test_generate_filtered_facet_fields(self):
Expand Down
3 changes: 2 additions & 1 deletion refinery/data_set_manager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,8 @@ def generate_solr_params(params, assay_uuids, facets_from_config=False):
'rows=%s' % row,
'q=django_ct:data_set_manager.node&wt=json',
'facet=%s' % facet_count,
'facet.limit=-1'
'facet.limit=-1',
'facet.mincount=1'
])

if len(assay_uuids) == 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'$log',
'$q',
'userFileBrowserFactory',
'userFileFiltersService',
'userFileSortsService',
'gridOptionsService'
];
Expand All @@ -17,6 +18,7 @@
$log,
$q,
userFileBrowserFactory,
userFileFiltersService,
userFileSortsService,
gridOptionsService
) {
Expand Down Expand Up @@ -60,6 +62,17 @@
};

gridOptionsService.appScopeProvider = vm;
vm.fileBrowserFilterQuery = function () {
var params = {};
Object.keys(userFileFiltersService).forEach(function (key) {
// TODO: The set of filters on /user/files does not match the filters on /data_sets2.
// TODO: I don't know whether a given filter is under "Characteristics" or something else.
// TODO: The target page doesn't load right now, even with the query,
// TODO: and switching between tabs loses the query.
params[key + '_Characteristics_generic_s'] = userFileFiltersService[key];
});
return encodeURIComponent(JSON.stringify(params));
};
vm.gridOptions = gridOptionsService;
vm.gridOptions.onRegisterApi = function (api) {
api.core.on.sortChanged(null, vm.sortChanged);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
<div class="panel-group data-set-filters" id="attribute-filter"
role="tablist"
aria-multiselectable="true">
<div class="refinery-subheader m-t-1">
<h2>
Attribute Filters
</h2>
<div class="refinery-subheader m-t-1">
<input ng-model="search" ng-init="search = ''" style="width: 100%;" placeholder="search...">
</div>
<div
ng-repeat="(attribute, attributeObj) in $ctrl.attributeFilters track by $index"
Expand All @@ -25,7 +23,7 @@ <h4 class="panel-title" ng-click="$ctrl.togglePanel(attribute)">
aria-labelledby="{{ attribute }}">
<div class="panel-body">
<div ng-repeat="field in attributeObj.facetObj track by $index">
<div class="checkbox container">
<div ng-show="field.name.toLowerCase().includes(search.toLowerCase())" class="checkbox container">
<div class="row">
<div class="col-xs-1">
<input
Expand Down
7 changes: 4 additions & 3 deletions refinery/ui/source/js/user-file-browser/services/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@
displayName: '',
cellTemplate:
'<div class="ui-grid-cell-contents" >' +
'<a href="/data_sets/{{grid.getCellValue(row, col)}}">' +
'<i class="fa fa-file"></i>' +
'</a>' +
'<a href="/data_sets2/{{grid.getCellValue(row, col)}}' +
'/#/files/?{{grid.appScope.fileBrowserFilterQuery()}}">' +
'<i class="fa fa-file"></i>' +
'</a>' +
'</div>',
width: 30 }];
settings.djangoApp.userFilesColumns.forEach(function (column) {
Expand Down
9 changes: 4 additions & 5 deletions refinery/ui/source/js/user-file-browser/services/user-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,17 @@
params: {
limit: 100, // Default is 100,000. Immutability make it hard in python.
fq: function () {
var operation = ' OR ';
var filters = Object.keys(userFileFiltersService).map(function (key) {
var values = userFileFiltersService[key];
// TODO: escaping!
return values.map(function (value) {
var orValues = values.map(function (value) {
return '(' +
key + characterSuffix + ':"' + value + '" OR ' +
key + factorSuffix + ':"' + value + '")';
}).join(operation);
}).join(' OR ');
return '(' + orValues + ')';
});
// TODO: Repeated fq params may be more efficient, but not a big deal
return filters.join(operation);
return filters.join(' AND ');
},
sort: function () {
return userFileSortsService.fields.map(function (field) {
Expand Down
12 changes: 12 additions & 0 deletions refinery/ui/source/styles/file-browser.less
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,11 @@

#table-filter {
height: 81vh;
max-height: 81vh;
margin: 0 0 0 10px;
padding: 0;
border: 1px solid #d4d4d4;
overflow: auto;
h3 {
font-weight: bold;
}
Expand Down Expand Up @@ -339,6 +341,16 @@
border-top: none;
padding-top: 0;
padding-bottom: 0;
max-height: 8em;
-moz-transition: .3s;
-ms-transition: .3s;
-o-transition: .3s;
-webkit-transition: .3s;
transition: .3s;
overflow: auto;
}
.panel-body:hover {
max-height: 300px;
}

}
Expand Down
3 changes: 2 additions & 1 deletion refinery/user_files_manager/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ def test_generate_solr_params_for_user(self):
'q=django_ct%3Adata_set_manager.node',
'wt=json',
'facet=true',
'facet.limit=-1'])
'facet.limit=-1',
'facet.mincount=1'])

0 comments on commit 54f05d6

Please sign in to comment.