Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jkmarx/fix dashboard search bugs #3202

Merged
merged 6 commits into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions refinery/ui/source/js/dashboard/controllers/data-sets-card-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
vm.refreshDataSets = refreshDataSets;
vm.resetDataSetSearch = resetDataSetSearch;
vm.searchDataSets = searchDataSets;
vm.areDataSetsTextSearched = false; // data sets text searched via solr api
vm.searchQueryDataSets = '';
vm.totalDataSets = dataSetCardFactory.dataSetStats.totalCount;

Expand Down Expand Up @@ -111,6 +112,7 @@
vm.totalDataSets = dataSetCardFactory.dataSetStats.totalCount;
vm.numPages = Math.ceil(vm.totalDataSets / vm.itemsPerPage);
vm.dataSetsError = false;
vm.areDataSetsTextSearched = false;
}, function (error) {
vm.loadingDataSets = false;
$log.error(error);
Expand Down Expand Up @@ -217,6 +219,7 @@
**/
function resetDataSetSearch () {
vm.searchQueryDataSets = '';
vm.areDataSetsTextSearched = false;
vm.refreshDataSets();
}

Expand All @@ -229,13 +232,20 @@
function searchDataSets (query) {
// reset perm filter until we can search & check perms
vm.groupFilter = { selectedName: 'All' };
vm.params = { limit: vm.itemsPerPage, offset: vm.pageStartOffset };
if (query && query.length > 1) {
vm.loadingDataSets = true;
var apiRequest = new DataSetSearchApi(query);
apiRequest(200).then(function (response) {
vm.dataSets = response.data;
angular.copy(response.data, dataSetCardFactory.dataSets);
dataSetCardFactory.dataSetStats.totalCount = response.data.length;
vm.dataSets = dataSetCardFactory.dataSets.slice(0, vm.itemsPerPage);
vm.totalDataSets = dataSetCardFactory.dataSetStats.totalCount;
vm.numPages = Math.ceil(vm.totalDataSets / vm.itemsPerPage);
vm.loadingDataSets = false;
vm.dataSetsError = false;
vm.areDataSetsTextSearched = true;
}, function (error) {
$log.error(error);
vm.dataSetsError = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
expect(ctrl.groupFilter.selectedName).toEqual('All');
expect(ctrl.params.limit).toEqual(ctrl.itemsPerPage);
expect(ctrl.params.limit).toEqual(ctrl.itemsPerPage);
expect(ctrl.areDataSetsTextSearched).toEqual(false);
});

it('Pagination variables should be initialized', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h3>
<span ng-if="$ctrl.dataSets.length">
{{ $ctrl.totalDataSets }} data sets
</span>
<span ng-if="$ctrl.searchQueryDataSets.length > 0 && $ctrl.isFiltersEmpty()">
<span ng-if="$ctrl.areDataSetsTextSearched">
<button
class="refinery-base btn btn-default btn-xs m-l-1-2"
ng-click="$ctrl.resetDataSetSearch()">
Expand Down
5 changes: 4 additions & 1 deletion refinery/ui/source/styles/dashboard.less
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ body.repo-mode .refinery-dashboard {
margin: 0 0 0 1em;
}
.fa-times-circle {
right: 80px;
right: 90px;
}
}

Expand Down Expand Up @@ -2071,6 +2071,9 @@ body.repo-mode .refinery-dashboard {
}
#search-interface-dashboard {
margin-top: 5px;
.fa-times-circle {
right: 60px;
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions refinery/ui/source/styles/refinery-style.less
Original file line number Diff line number Diff line change
Expand Up @@ -766,10 +766,9 @@ a.analysis-header {
.search-query {
box-sizing: border-box;
width: 100%;
height: 25px;
height: 27px;
font-size: 15px;
line-height: normal;
padding-left: 25px;
padding-right: 25px;
margin: 0;
}
Expand Down