<span i18n>Make Items Bookable</span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<ng-container>
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close()" i18n>Cancel</button>
<ng-container *ngIf="!updateComplete">
<button type="button" class="btn btn-success"
(click)="makeBookable()" i18n>Make Bookable</button>
<span i18n>Attach/Modify {{copyIds.length}} Conjoined Item(s)</span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<ng-container>
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close()" i18n>Cancel</button>
<button type="button" class="btn btn-success"
(click)="linkCopies()" [disabled]="!peerType" i18n>
Attach/Modify
</ng-container>
</div>
</ng-template>
-
\ No newline at end of file
+
<span i18n></span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary"
- (click)="dismiss('canceled')" i18n>Close</button>
+ (click)="close()" i18n>Close</button>
<ng-container *ngIf="mode == 'manage'">
<button class="btn btn-success mr-2"
(click)="applyChanges()" i18n>Apply Changes</button>
import {Component, OnInit, Input, ViewChild} from '@angular/core';
-import {Observable, throwError} from 'rxjs';
+import {Observable, throwError, from} from 'rxjs';
+import {switchMap} from 'rxjs/operators';
import {NetService} from '@eg/core/net.service';
import {IdlService, IdlObject} from '@eg/core/idl.service';
import {EventService} from '@eg/core/event.service';
}
}
- this.getAlertTypes()
- .then(() => this.getCopies())
- .then(() => {
- if (this.mode === 'manage') {
- this.getCopyAlerts()
- .then(() => super.open(args) );
- }
- return super.open(args);
- });
+ // Observerify data loading
+ const obs = from(
+ this.getAlertTypes()
+ .then(_ => this.getCopies())
+ .then(_ => this.mode === 'manage' ? this.getCopyAlerts() : null)
+ );
+
+ // Return open() observable to caller
+ return obs.pipe(switchMap(_ => super.open(args)));
}
getAlertTypes(): Promise<any> {
<span i18n>Delete Holdings</span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<ng-container>
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close()" i18n>Cancel</button>
<button type="button" class="btn btn-success"
(click)="deleteHoldings()" i18n>
Delete Holdings
</ng-container>
</div>
</ng-template>
-
\ No newline at end of file
+
<span i18n>Mark Item Damaged</span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close(false)">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<ng-container *ngIf="!chargeResponse">
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close(false)" i18n>Cancel</button>
<button type="button" class="btn btn-success"
(click)="markDamaged()" i18n>Mark Damaged</button>
</ng-container>
<ng-container *ngIf="chargeResponse">
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close(false)" i18n>Cancel</button>
<button class="btn btn-info mr-2"
(click)="amountChangeRequested = true" i18n>Change Amount</button>
<button class="btn btn-secondary mr-2"
import {Component, OnInit, Input, ViewChild} from '@angular/core';
-import {Observable, throwError} from 'rxjs';
+import {Observable, throwError, from} from 'rxjs';
+import {switchMap} from 'rxjs/operators';
import {NetService} from '@eg/core/net.service';
import {IdlObject} from '@eg/core/idl.service';
import {EventService} from '@eg/core/event.service';
return throwError('copy ID required');
}
- this.getBillingTypes()
- .then(() => { this.getData(); })
- .then(() => super.open(args));
+ // Map data-loading promises to an observable
+ const obs = from(
+ this.getBillingTypes().then(_ => this.getData()));
+
+ // Fire data loading observable and replace results with
+ // dialog opener observable.
+ return obs.pipe(switchMap(_ => super.open(args)));
}
// Fetch-cache billing types
<span i18n>Mark Item Missing</span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<ng-container *ngIf="!chargeResponse">
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close()" i18n>Cancel</button>
<button type="button" class="btn btn-success"
(click)="markItemsMissing()" i18n>Mark Missing</button>
</ng-container>
</div>
</ng-template>
-
\ No newline at end of file
+
<span i18n>Replace Item Barcode</span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<ng-container>
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close()" i18n>Cancel</button>
<button type="button" class="btn btn-success"
(click)="replaceOneBarcode()" [disabled]="!newBarcode" i18n>
Replace Barcode
</ng-container>
</div>
</ng-template>
-
\ No newline at end of file
+
import {Component, OnInit, Input, ViewChild, Renderer2} from '@angular/core';
import {Observable, throwError} from 'rxjs';
-import {flatMap, map, tap} from 'rxjs/operators';
+import {switchMap, map, tap} from 'rxjs/operators';
import {IdlObject} from '@eg/core/idl.service';
import {NetService} from '@eg/core/net.service';
import {EventService} from '@eg/core/event.service';
this.numFailed = 0;
return this.getNextCopy()
- .pipe(flatMap(() => {
- return super.open(args)
- .pipe(tap(() => {this.renderer.selectRootElement('#new-barcode-input').focus(); }));
- }));
+ .pipe(switchMap(() => super.open(args)))
+ .pipe(tap(() =>
+ this.renderer.selectRootElement('#new-barcode-input').focus())
+ );
}
getNextCopy(): Observable<any> {
<span i18n>Cancel Hold</span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<ng-container *ngIf="!chargeResponse">
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close()" i18n>Cancel</button>
<button type="button" class="btn btn-success"
(click)="cancelBatch()" i18n>Cancel Hold</button>
</ng-container>
</div>
- </ng-template>
\ No newline at end of file
+ </ng-template>
<h4 class="modal-title">Batch Modify {{holdIds.length}} Holds</h4>
</ng-container>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<eg-hold-manage [holdIds]="holdIds" (onComplete)="onComplete($event)">
</eg-hold-manage>
</div>
- </ng-template>
\ No newline at end of file
+ </ng-template>
<span i18n>Retarget Hold</span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<ng-container *ngIf="!chargeResponse">
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close()" i18n>Cancel</button>
<button type="button" class="btn btn-success"
(click)="retargetBatch()" i18n>Retarget</button>
</ng-container>
</div>
- </ng-template>
\ No newline at end of file
+ </ng-template>
<span i18n>Transfer Hold(s) To Marked Target</span>
</h4>
<button type="button" class="close"
- i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ i18n-aria-label aria-label="Close" (click)="close()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-footer">
<ng-container *ngIf="!chargeResponse">
<button type="button" class="btn btn-warning"
- (click)="dismiss('canceled')" i18n>Cancel</button>
+ (click)="close()" i18n>Cancel</button>
<button type="button" class="btn btn-success"
(click)="transferBatch()" i18n>Transfer</button>
</ng-container>
</div>
- </ng-template>
\ No newline at end of file
+ </ng-template>
if (!this.transferTarget) {
this.targetNeeded.current()
- .then((msg) => this.toast.warning(msg))
- .then(() => throwError('Transfer Target Required'));
+ .then((msg) => this.toast.warning(msg));
+
+ return throwError('Transfer Target Required');
}
return super.open(args);