Skip to content

Commit 5edc689

Browse files
committed
Fix null/undefined incosistencies
- Introduced pipes for combined null/undefined checks: dsHasValue & dsHasNoValue - Safer to async !== true than async === false - Went over other instances of async === to confirm that they should be fine
1 parent ebbbd64 commit 5edc689

File tree

92 files changed

+210
-154
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+210
-154
lines changed

src/app/access-control/epeople-registry/epeople-registry.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ <h2 id="search" class="border-bottom pb-2">
4343

4444
<ds-themed-loading *ngIf="searching$ | async"></ds-themed-loading>
4545
<ds-pagination
46-
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && (searching$ | async) === false"
46+
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && (searching$ | async) !== true"
4747
[paginationOptions]="config"
4848
[pageInfoState]="pageInfoState$"
4949
[collectionSize]="(pageInfoState$ | async)?.totalElements"

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1 class="border-bottom pb-2">{{messagePrefix + '.edit' | translate}}</h1>
2525
</button>
2626
</div>
2727
<div *ngIf="displayResetPassword" between class="btn-group">
28-
<button class="btn btn-primary" [disabled]="(canReset$ | async) === false" type="button" (click)="resetPassword()">
28+
<button class="btn btn-primary" [disabled]="(canReset$ | async) !== true" type="button" (click)="resetPassword()">
2929
<i class="fa fa-key"></i> {{'admin.access-control.epeople.actions.reset' | translate}}
3030
</button>
3131
</div>
@@ -47,7 +47,7 @@ <h1 class="border-bottom pb-2">{{messagePrefix + '.edit' | translate}}</h1>
4747
<div *ngIf="epersonService.getActiveEPerson() | async">
4848
<h2>{{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}</h2>
4949

50-
<ds-themed-loading [showMessage]="false" *ngIf="(groups$ | async) === undefined"></ds-themed-loading>
50+
<ds-themed-loading [showMessage]="false" *ngIf="groups$ | async | dsHasNoValue"></ds-themed-loading>
5151

5252
<ds-pagination
5353
*ngIf="(groups$ | async)?.payload?.totalElements > 0"

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import { PaginationServiceStub } from '../../../shared/testing/pagination-servic
6161
import { RouterStub } from '../../../shared/testing/router.stub';
6262
import { createPaginatedList } from '../../../shared/testing/utils.test';
6363
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
64+
import { HasNoValuePipe } from '../../../shared/utils/has-no-value.pipe';
6465
import { EPeopleRegistryComponent } from '../epeople-registry.component';
6566
import { EPersonFormComponent } from './eperson-form.component';
6667
import { ValidateEmailNotTaken } from './validators/email-taken.validator';
@@ -231,7 +232,10 @@ describe('EPersonFormComponent', () => {
231232
},
232233
}),
233234
],
234-
declarations: [EPersonFormComponent],
235+
declarations: [
236+
EPersonFormComponent,
237+
HasNoValuePipe,
238+
],
235239
providers: [
236240
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
237241
{ provide: GroupDataService, useValue: groupsDataService },

src/app/access-control/group-registry/group-form/group-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1 class="border-bottom pb-2">
2525

2626
<ds-alert *ngIf="groupBeingEdited?.permanent" [type]="AlertTypeEnum.Warning"
2727
[content]="messagePrefix + '.alert.permanent'"></ds-alert>
28-
<ds-alert *ngIf="(canEdit$ | async) === false && (groupDataService.getActiveGroup() | async)" [type]="AlertTypeEnum.Warning"
28+
<ds-alert *ngIf="(canEdit$ | async) !== true && (groupDataService.getActiveGroup() | async)" [type]="AlertTypeEnum.Warning"
2929
[content]="(messagePrefix + '.alert.workflowGroup' | translate:{ name: dsoNameService.getName((getLinkedDSO(groupBeingEdited) | async)?.payload), comcol: (getLinkedDSO(groupBeingEdited) | async)?.payload?.type, comcolEditRolesRoute: (getLinkedEditRolesRoute(groupBeingEdited) | async) })">
3030
</ds-alert>
3131

src/app/access-control/group-registry/groups-registry.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h2 id="search" class="border-bottom pb-2">{{messagePrefix + 'search.head' | tra
3535

3636
<ds-themed-loading *ngIf="loading$ | async"></ds-themed-loading>
3737
<ds-pagination
38-
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && (loading$ | async) === false"
38+
*ngIf="(pageInfoState$ | async)?.totalElements > 0 && (loading$ | async) !== true"
3939
[paginationOptions]="config"
4040
[pageInfoState]="pageInfoState$"
4141
[collectionSize]="(pageInfoState$ | async)?.totalElements"

src/app/admin/admin-notify-dashboard/admin-notify-logs/admin-notify-logs-result/admin-notify-logs-result.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="col-md-9">
55
<div class="h4">
66
<button (click)="resetDefaultConfiguration()" *ngIf="(selectedSearchConfig$ | async) !== defaultConfiguration" class="badge badge-primary mr-1 mb-1">
7-
{{ 'admin-notify-logs.' + (selectedSearchConfig$ | async) | translate}}
7+
{{ 'admin-notify-logs.' + (selectedSearchConfig$ | async) | translate}}
88
<span> ×</span>
99
</button>
1010
</div>

src/app/admin/admin-sidebar/admin-sidebar.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[attr.aria-label]="'menu.header.nav.description' | translate"
44
[ngClass]="{'expanded': sidebarOpen, 'collapsed': sidebarClosed, 'transitioning': sidebarTransitioning}"
55
[@slideSidebar]="{
6-
value: ((sidebarExpanded | async) === false ? 'collapsed' : 'expanded'),
6+
value: ((sidebarExpanded | async) !== true ? 'collapsed' : 'expanded'),
77
params: { collapsedWidth: (collapsedSidebarWidth$ | async), expandedWidth: (expandedSidebarWidth$ | async) }
88
}" (@slideSidebar.done)="finishSlide($event)" (@slideSidebar.start)="startSlide($event)"
99
*ngIf="menuVisible | async"
@@ -49,7 +49,7 @@ <h4 class="my-1">{{ 'menu.header.admin' | translate }}</h4>
4949
<div class="sidebar-fixed-element-wrapper">
5050
<i *ngIf="(menuCollapsed | async)" class="fas fa-fw fa-angle-double-right"
5151
[title]="'menu.section.icon.pin' | translate"></i>
52-
<i *ngIf="(menuCollapsed | async) === false" class="fas fa-fw fa-angle-double-left"
52+
<i *ngIf="(menuCollapsed | async) !== true" class="fas fa-fw fa-angle-double-left"
5353
[title]="'menu.section.icon.unpin' | translate"></i>
5454
</div>
5555
<div class="sidebar-collapsible-element-outer-wrapper">

src/app/browse-by/browse-by-metadata/browse-by-metadata.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<section class="comcol-page-browse-section">
22
<div class="browse-by-metadata w-100">
3-
<ds-themed-browse-by *ngIf="(loading$ | async) === false" class="col-xs-12 w-100"
3+
<ds-themed-browse-by *ngIf="(loading$ | async) !== true" class="col-xs-12 w-100"
44
title="{{'browse.title' | translate:{
55
field: 'browse.metadata.' + browseId | translate,
66
startsWith: (startsWith)? ('browse.startsWith' | translate: { startsWith: '&quot;' + startsWith + '&quot;' }) : '',

src/app/collection-page/delete-collection-page/delete-collection-page.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h1 id="header" class="border-bottom pb-2">{{ 'collection.delete.head' | transla
1111
</button>
1212
<button class="btn btn-danger" (click)="onConfirm(dso)" [disabled]="(processing$ | async)">
1313
<span *ngIf="processing$ | async"><i class='fas fa-circle-notch fa-spin'></i> {{'collection.delete.processing' | translate}}</span>
14-
<span *ngIf="(processing$ | async) === false"><i class="fas fa-trash"></i> {{'collection.delete.confirm' | translate}}</span>
14+
<span *ngIf="(processing$ | async) !== true"><i class="fas fa-trash"></i> {{'collection.delete.confirm' | translate}}</span>
1515
</button>
1616
</div>
1717
</div>

src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h3>{{ 'collection.source.controls.head' | translate }}</h3>
1818
<span>{{contentSource?.message ? contentSource?.message: 'collection.source.controls.harvest.no-information'|translate }}</span>
1919
</div>
2020

21-
<button *ngIf="(testConfigRunning$ |async) === false" class="btn btn-secondary"
21+
<button *ngIf="(testConfigRunning$ |async) !== true" class="btn btn-secondary"
2222
[disabled]="!(isEnabled)"
2323
(click)="testConfiguration(contentSource)">
2424
<span>{{'collection.source.controls.test.submit' | translate}}</span>
@@ -28,7 +28,7 @@ <h3>{{ 'collection.source.controls.head' | translate }}</h3>
2828
<span class="spinner-border spinner-border-sm spinner-button" role="status" aria-hidden="true"></span>
2929
<span>{{'collection.source.controls.test.running' | translate}}</span>
3030
</button>
31-
<button *ngIf="(importRunning$ |async) === false" class="btn btn-primary"
31+
<button *ngIf="(importRunning$ |async) !== true" class="btn btn-primary"
3232
[disabled]="!(isEnabled)"
3333
(click)="importNow()">
3434
<span class="d-none d-sm-inline">{{'collection.source.controls.import.submit' | translate}}</span>
@@ -38,7 +38,7 @@ <h3>{{ 'collection.source.controls.head' | translate }}</h3>
3838
<span class="spinner-border spinner-border-sm spinner-button" role="status" aria-hidden="true"></span>
3939
<span class="d-none d-sm-inline">{{'collection.source.controls.import.running' | translate}}</span>
4040
</button>
41-
<button *ngIf="(reImportRunning$ |async) === false" class="btn btn-primary"
41+
<button *ngIf="(reImportRunning$ |async) !== true" class="btn btn-primary"
4242
[disabled]="!(isEnabled)"
4343
(click)="resetAndReimport()">
4444
<span class="d-none d-sm-inline">&nbsp;{{'collection.source.controls.reset.submit' | translate}}</span>

0 commit comments

Comments
 (0)