From: Jane Sandberg Date: Wed, 18 Mar 2020 00:34:01 +0000 (-0700) Subject: LP1837802: Add records to shared record buckets from the Staff Catalog X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=35a76574b824d47d66274efa809d3d71da1b5daa;p=evergreen%2Fmasslnc.git LP1837802: Add records to shared record buckets from the Staff Catalog To test: 1) As User A, create a bucket. 2) As User B, search in the Staff Catalog, and add some items to your basket. 3) As User B, click Basket Actions, and choose add Basket to Bucket 4) Click on the "Shared Bucket" tab and enter the id of User A's bucket Some potential scenarios to test: * Trying to add to a bucket that does not exist * Trying to add to an unshared bucket when User B does not have the VIEW_CONTAINER permission * Trying to add to existing and new buckets as before Signed-off-by: Jane Sandberg Signed-off-by: Terran McCanna Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/share/buckets/bucket-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/share/buckets/bucket-dialog.component.html index de4d29cee8..5c33108046 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/buckets/bucket-dialog.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/buckets/bucket-dialog.component.html @@ -15,45 +15,77 @@ + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/buckets/bucket-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/buckets/bucket-dialog.component.ts index 1300f0f3e3..b743edded9 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/buckets/bucket-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/buckets/bucket-dialog.component.ts @@ -1,4 +1,6 @@ -import {Component, OnInit, Input, Renderer2} from '@angular/core'; +import {Component, OnInit, Input, ViewChild, Renderer2} from '@angular/core'; +import {throwError} from 'rxjs'; +import {switchMap} from 'rxjs/operators'; import {NetService} from '@eg/core/net.service'; import {IdlService} from '@eg/core/idl.service'; import {EventService} from '@eg/core/event.service'; @@ -6,6 +8,7 @@ import {ToastService} from '@eg/share/toast/toast.service'; import {AuthService} from '@eg/core/auth.service'; import {DialogComponent} from '@eg/share/dialog/dialog.component'; import {NgbModal} from '@ng-bootstrap/ng-bootstrap'; +import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component'; import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; /** @@ -20,6 +23,8 @@ import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; export class BucketDialogComponent extends DialogComponent implements OnInit { selectedBucket: number; + sharedBucketId: number; + sharedBucketName: string; newBucketName: string; newBucketDesc: string; buckets: any[]; @@ -37,6 +42,8 @@ export class BucketDialogComponent extends DialogComponent implements OnInit { bucketFmClass: 'ccb' | 'ccnb' | 'cbreb' | 'cub'; targetField: string; + @ViewChild('confirmAddToShared', {static: true}) confirmAddToShared: ConfirmDialogComponent; + constructor( private modal: NgbModal, // required for passing to parent private renderer: Renderer2, @@ -65,6 +72,8 @@ export class BucketDialogComponent extends DialogComponent implements OnInit { reset() { this.selectedBucket = null; + this.sharedBucketId = null; + this.sharedBucketName = ''; this.newBucketName = ''; this.newBucketDesc = ''; @@ -102,6 +111,25 @@ export class BucketDialogComponent extends DialogComponent implements OnInit { this.addToBucket(this.selectedBucket); } + addToShared() { + this.net.request('open-ils.actor', + 'open-ils.actor.container.flesh', + this.auth.token(), this.bucketClass, + this.sharedBucketId) + .pipe(switchMap((resp) => { + const evt = this.evt.parse(resp); + if (evt) { + this.toast.danger(evt.toString()); + return throwError(evt); + } else { + this.sharedBucketName = resp.name(); + return this.confirmAddToShared.open(); + } + })).subscribe(() => { + this.addToBucket(this.sharedBucketId); + }); + } + bucketChanged(entry: ComboboxEntry) { if (entry) { this.selectedBucket = entry.id; @@ -194,3 +222,4 @@ export class BucketDialogComponent extends DialogComponent implements OnInit { +