Skip to content

Commit

Permalink
fix(list-view): correct display logic (#1378)
Browse files Browse the repository at this point in the history
  • Loading branch information
domsteinbach committed Jan 24, 2024
1 parent 2c4852b commit b68f8db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Expand Up @@ -40,7 +40,7 @@
</div>

<!-- In case of 0 result -->
<div class="list-view no-results" *ngIf="!loading && (numberOfAllResults >= 0 && !resources?.resources.length)">
<div class="list-view no-results" *ngIf="!loading && resources?.resources?.length === 0">
<!-- Case A: user did a fulltext search -->
<div *ngIf="search.mode === 'fulltext'">
<p>Your search - <strong> {{search.query}}</strong> - did not match any documents.</p>
Expand All @@ -66,12 +66,12 @@
</button>
</div>
<!-- Case B1: there is no resources created-->
<div *ngIf="hasPermission" class="no-results-container">
<div *ngIf="numberOfAllResults === 0" class="no-results-container">
<mat-icon>warning</mat-icon>
<div>No results were found for your query.</div>
</div>
<!-- Case B2: no permission-->
<div *ngIf="!hasPermission" class="no-results-container">
<div *ngIf="numberOfAllResults > 0" class="no-results-container">
<mat-icon>warning</mat-icon>
<div>
It seems like you don’t have the necessary permissions.<br />
Expand Down
Expand Up @@ -107,15 +107,12 @@ export class ListViewComponent implements OnChanges, OnInit, OnDestroy {

resetCheckBoxes = false;

// number of all results
// number of all results including the ones not included as resources in the response bc. the user does not have the permissions to see them
numberOfAllResults: number;

// progress status
loading = true;

// flag to set permission to see resources
hasPermission = false;

currentIndex = 0;

currentRangeStart = 1;
Expand Down Expand Up @@ -342,7 +339,6 @@ export class ListViewComponent implements OnChanges, OnInit, OnDestroy {
}

this.resources = response;
this.hasPermission = !(numberOfAllResults > 0 && this.resources.resources.length === 0);
this.loading = false;
this._cd.markForCheck();
},
Expand Down

0 comments on commit b68f8db

Please sign in to comment.