Fix: search box on listing remain on page if no result
This commit is contained in:
parent
0c9396bc11
commit
02d79165c4
|
@ -1,7 +1,7 @@
|
|||
<div class="main-content listing-main-container h-100">
|
||||
<div class="container-fluid">
|
||||
<div class="d-flex flex-direction-row">
|
||||
<div *ngIf="hasListingItems && listingItems && listingItems.length === 0" class="card mt-0">
|
||||
<div *ngIf="hasListingItems && listingItems && listingItems.length === 0 && !hasLikeCriteria()" class="card mt-0">
|
||||
<!-- <div class="card mt-0" [style.display]="isVisible ? 'block' : 'none'"> -->
|
||||
<!-- <a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a> -->
|
||||
<div class="card-content info-text mb-0">
|
||||
|
@ -15,15 +15,15 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p *ngIf="listingItems && listingItems.length > 0" class="col-auto header-title">{{(isPublic ? 'GENERAL.TITLES.EXPLORE' : 'GENERAL.TITLES.DATASETS') | translate}}</p>
|
||||
<div *ngIf="listingItems && listingItems.length > 0 && !isPublic" class="ml-auto">
|
||||
<p *ngIf="listingItems && listingItems.length > 0 || this.criteria.like" class="col-auto header-title">{{(isPublic ? 'GENERAL.TITLES.EXPLORE' : 'GENERAL.TITLES.DATASETS') | translate}}</p>
|
||||
<div *ngIf="listingItems && listingItems.length > 0 && !isPublic || this.criteria.like" class="ml-auto">
|
||||
<div class="col-auto">
|
||||
<button mat-raised-button class="add-dataset align-self-center yellow-btn" (click)="addNewDataset()">
|
||||
{{'DASHBOARD.ACTIONS.ADD-DATASET' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="listingItems && listingItems.length > 0" class="filter-btn" [style.right]="dialog.getDialogById('filters') ? '446px' : '0px'" [style.width]="scrollbar ? '57px' : '37px'" (click)="openFiltersDialog()">
|
||||
<div *ngIf="listingItems && listingItems.length > 0 || this.criteria.like" class="filter-btn" [style.right]="dialog.getDialogById('filters') ? '446px' : '0px'" [style.width]="scrollbar ? '57px' : '37px'" (click)="openFiltersDialog()">
|
||||
<button mat-raised-button class="p-0">
|
||||
<mat-icon class="mr-4">filter_alt</mat-icon>
|
||||
</button>
|
||||
|
@ -31,7 +31,7 @@
|
|||
</div>
|
||||
<div>
|
||||
<div class="listing row pb-2">
|
||||
<div *ngIf="listingItems && listingItems.length > 0" class="col-md-12">
|
||||
<div *ngIf="listingItems && listingItems.length > 0 || this.criteria.like" class="col-md-12">
|
||||
<div class="d-flex flex-direction-row pt-4">
|
||||
<!-- Sort by -->
|
||||
<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 d-flex justify-content-center pt-4 mt-4 mb-4 pb-4" *ngIf="hasListingItems && listingItems && listingItems.length === 0">
|
||||
<div *ngIf="hasListingItems && listingItems && listingItems.length === 0 && this.criteria.like !== ''" class="col-md-12 d-flex justify-content-center pt-4 mt-4 mb-4 pb-4">
|
||||
<span class="empty-list">{{'DATASET-LISTING.EMPTY-LIST' | translate}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -430,6 +430,10 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
|||
});
|
||||
}
|
||||
|
||||
hasLikeCriteria(): boolean {
|
||||
return this.criteria.like !== undefined && this.criteria.like !== null;
|
||||
}
|
||||
|
||||
// rowClicked(dataset: DatasetListingModel) {
|
||||
// this.router.navigate(['/datasets/edit/' + dataset.id]);
|
||||
// }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="main-content listing-main-container h-100">
|
||||
<div class="container-fluid">
|
||||
<div class="d-flex flex-direction-row">
|
||||
<div *ngIf="hasListingItems && listingItems && listingItems.length === 0" class="card mt-0">
|
||||
<div *ngIf="hasListingItems && listingItems && listingItems.length === 0 && !hasLikeCriteria()" class="card mt-0">
|
||||
<!-- <div *ngIf="listingItems && listingItems.length === 0" class="card mt-0" [style.display]="isVisible ? 'block' : 'none'"> -->
|
||||
<!-- <a class="col-auto d-flex" (click)="closeCard()"><span class="ml-auto pt-3 material-icons clear-icon">clear</span></a> -->
|
||||
<div class="card-content info-text mb-0">
|
||||
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p *ngIf="listingItems && listingItems.length > 0" class="col-auto header-title">{{(isPublic ? 'GENERAL.TITLES.EXPLORE-PLANS' : 'GENERAL.TITLES.PLANS') | translate}}</p>
|
||||
<p *ngIf="listingItems && listingItems.length > 0 || this.criteria.like" class="col-auto header-title">{{(isPublic ? 'GENERAL.TITLES.EXPLORE-PLANS' : 'GENERAL.TITLES.PLANS') | translate}}</p>
|
||||
<div class="filter-btn" [style.right]="this.dialog.getDialogById('filters') ? '446px' : '0px'" [style.width]="scrollbar || this.dialog.getDialogById('filters') ? '57px' : '37px'" (click)="openFiltersDialog()">
|
||||
<button mat-raised-button class="p-0">
|
||||
<mat-icon class="mr-4">filter_alt</mat-icon>
|
||||
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
<div>
|
||||
<div class="listing row pb-2">
|
||||
<div *ngIf="listingItems && listingItems.length > 0" class="col-md-12">
|
||||
<div *ngIf="listingItems && listingItems.length > 0 || this.criteria.like" class="col-md-12">
|
||||
<div class="d-flex flex-direction-row pt-4">
|
||||
<!-- Sort by -->
|
||||
<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
|
||||
|
@ -62,7 +62,7 @@
|
|||
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 d-flex justify-content-center pt-4 mt-4 mb-4 pb-4" *ngIf="hasListingItems && listingItems && listingItems.length === 0">
|
||||
<div *ngIf="hasListingItems && listingItems && listingItems.length === 0 && this.criteria.like !== ''" class="col-md-12 d-flex justify-content-center pt-4 mt-4 mb-4 pb-4">
|
||||
<span class="empty-list">{{'DMP-LISTING.EMPTY-LIST' | translate}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -257,7 +257,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
});
|
||||
this.listingItems = result.data;
|
||||
this.hasListingItems = true;
|
||||
if (!this.isPublic && this.listingItems.length === 0 && !this.hasCriteria()) {
|
||||
if (!this.isPublic && this.listingItems.length === 0 && !this.hasCriteria() && !this.hasLikeCriteria()) {
|
||||
this.openTour();
|
||||
}
|
||||
this.totalCount = result.totalCount;
|
||||
|
@ -538,6 +538,10 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
this.setDashboardTourDatasetText();
|
||||
this.guidedTourService.startTour(this.dashboardTour);
|
||||
}
|
||||
|
||||
public hasLikeCriteria(): boolean {
|
||||
return this.criteria.like !== undefined && this.criteria.like !== null;
|
||||
}
|
||||
}
|
||||
|
||||
// export class DmpDataSource extends DataSource<DmpListingModel> {
|
||||
|
|
Loading…
Reference in New Issue