Fixes bug not filter out deleted items of DMP and Dataset. Refactors redirect when selecting Grant from Search bar. (Issue #215)
This commit is contained in:
parent
72310d8ff1
commit
816ed4dd65
|
@ -144,6 +144,7 @@ public class DashBoardManager {
|
||||||
CompletableFuture<List<SearchBarItem>> dmps = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.asQueryable(), principal.getId(), roles)
|
CompletableFuture<List<SearchBarItem>> dmps = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.asQueryable(), principal.getId(), roles)
|
||||||
.withHint("dmpRecentActivity")
|
.withHint("dmpRecentActivity")
|
||||||
.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%"))
|
.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%"))
|
||||||
|
.where((builder, root) -> builder.notEqual(root.get("status"), DMP.DMPStatus.DELETED.getValue()))
|
||||||
.orderBy((builder, root) -> builder.desc(root.get("modified")))
|
.orderBy((builder, root) -> builder.desc(root.get("modified")))
|
||||||
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DMP.getValue()))
|
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DMP.getValue()))
|
||||||
.whenComplete((dmpItems, throwable) -> searchBarItems.addAll(dmpItems));
|
.whenComplete((dmpItems, throwable) -> searchBarItems.addAll(dmpItems));
|
||||||
|
@ -151,6 +152,8 @@ public class DashBoardManager {
|
||||||
CompletableFuture<List<SearchBarItem>> datasets = datasetRepository.getAuthenticated(datasetRepository.asQueryable(), user)
|
CompletableFuture<List<SearchBarItem>> datasets = datasetRepository.getAuthenticated(datasetRepository.asQueryable(), user)
|
||||||
.withHint("datasetRecentActivity")
|
.withHint("datasetRecentActivity")
|
||||||
.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%"))
|
.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + like.toUpperCase() + "%"))
|
||||||
|
.where((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.DELETED.getValue()))
|
||||||
|
.where((builder, root) -> builder.notEqual(root.get("status"), Dataset.Status.CANCELED.getValue()))
|
||||||
.orderBy((builder, root) -> builder.desc(root.get("modified")))
|
.orderBy((builder, root) -> builder.desc(root.get("modified")))
|
||||||
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DATASET.getValue()))
|
.selectAsync(item -> new SearchBarItem(item.getId().toString(), item.getLabel(), SearchBarItemType.DATASET.getValue()))
|
||||||
.whenComplete((dataSetItems, throwable) -> searchBarItems.addAll(dataSetItems));
|
.whenComplete((dataSetItems, throwable) -> searchBarItems.addAll(dataSetItems));
|
||||||
|
|
|
@ -23,13 +23,13 @@ const routes: Routes = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Uncomment to get dmp plans for grant with grantId
|
// Uncomment to get dmp plans for grant with grantId
|
||||||
// {
|
{
|
||||||
// path: 'grant/:grantId',
|
path: 'grant/:grantId',
|
||||||
// component: DmpListingComponent,
|
component: DmpListingComponent,
|
||||||
// data: {
|
data: {
|
||||||
// breadcrumb: true
|
breadcrumb: true
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'edit/:id',
|
path: 'edit/:id',
|
||||||
component: DmpEditorComponent,
|
component: DmpEditorComponent,
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { BaseComponent } from '@common/base/base.component';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
import { Observable, of as observableOf } from 'rxjs';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { GrantService } from "@app/core/services/grant/grant.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dmp-listing-component',
|
selector: 'app-dmp-listing-component',
|
||||||
|
@ -45,6 +46,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
public enumUtils: EnumUtils,
|
public enumUtils: EnumUtils,
|
||||||
private language: TranslateService,
|
private language: TranslateService,
|
||||||
|
private grantService: GrantService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -56,15 +58,20 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
||||||
let grantLabel;
|
let grantLabel;
|
||||||
if (params['grantId']) {
|
if (params['grantId']) {
|
||||||
this.grantId = params['grantId'];
|
this.grantId = params['grantId'];
|
||||||
this.showGrant = false;
|
this.showGrant = true;
|
||||||
const grant: GrantListingModel = {
|
this.grantService.getSingle(this.grantId)
|
||||||
id: this.grantId
|
.subscribe((grant: GrantListingModel) => {
|
||||||
}
|
// const grant: GrantListingModel = {
|
||||||
this.criteria.setCriteria({ like: null, grants: [grant], groupIds: null, allVersions: false });
|
// id: this.grantId
|
||||||
this.refresh();
|
// }
|
||||||
grantLabel = this.route.snapshot.queryParams.grantLabel;
|
this.criteria.setCriteria({ like: null, grants: [grant], groupIds: null, allVersions: false });
|
||||||
// this.breadCrumbs = Observable.of([{ parentComponentName: 'GrantEditorComponent', label: grantLabel, url: '/grants/edit/' + this.grantId }]);
|
|
||||||
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
this.refresh();
|
||||||
|
grantLabel = this.route.snapshot.queryParams.grantLabel;
|
||||||
|
// this.breadCrumbs = Observable.of([{ parentComponentName: 'GrantEditorComponent', label: grantLabel, url: '/grants/edit/' + this.grantId }]);
|
||||||
|
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||||
|
})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.itemId = params['groupId'];
|
this.itemId = params['groupId'];
|
||||||
this.showGrant = true;
|
this.showGrant = true;
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class SearchComponent implements OnInit {
|
||||||
this.searchControl.patchValue(null);
|
this.searchControl.patchValue(null);
|
||||||
const selectedSearchBarItem = event.option.value;
|
const selectedSearchBarItem = event.option.value;
|
||||||
if (selectedSearchBarItem.type === SearchBarType.Dataset) { this.router.navigate(['datasets/edit/' + selectedSearchBarItem.id]); }
|
if (selectedSearchBarItem.type === SearchBarType.Dataset) { this.router.navigate(['datasets/edit/' + selectedSearchBarItem.id]); }
|
||||||
if (selectedSearchBarItem.type === SearchBarType.Grant) { this.router.navigate(['grants/edit/' + selectedSearchBarItem.id]); }
|
if (selectedSearchBarItem.type === SearchBarType.Grant) { this.router.navigate(['plans/grant/' + selectedSearchBarItem.id]); }
|
||||||
if (selectedSearchBarItem.type === SearchBarType.Dmp) { this.router.navigate(['plans/edit/' + selectedSearchBarItem.id]); }
|
if (selectedSearchBarItem.type === SearchBarType.Dmp) { this.router.navigate(['plans/edit/' + selectedSearchBarItem.id]); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue