From: Bill Erickson Date: Mon, 10 Dec 2018 18:09:36 +0000 (-0500) Subject: LP#1807458 Angular admin grid Edit Selected option X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=89948f54cdecb41ee126b96d2404b55a47264dea;p=working%2FEvergreen.git LP#1807458 Angular admin grid Edit Selected option Adds a new "Edit Selected" action to the "Actions for Selected Items" menu in the general purpose admin grid. This only visibly affects the ACQ admin grids at time of writing, but applies to all auto-generated admin grids. Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Dan Wells --- diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html index 0fc5c44b51..8cf50709c1 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html @@ -49,6 +49,8 @@ + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts index 80fd2fdf6c..03ba326894 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.ts @@ -75,6 +75,7 @@ export class AdminPageComponent implements OnInit { pkeyField: string; createNew: () => void; deleteSelected: (rows: IdlObject[]) => void; + editSelected: (rows: IdlObject[]) => void; // True if any columns on the object support translations translateRowIdx: number; @@ -153,20 +154,21 @@ export class AdminPageComponent implements OnInit { // TODO: pass the row activate handler via the grid markup this.grid.onRowActivate.subscribe( - (idlThing: IdlObject) => { - this.editDialog.mode = 'update'; - this.editDialog.recId = idlThing[this.pkeyField](); - this.editDialog.open({size: this.dialogSize}).then( - ok => { - this.successString.current() - .then(str => this.toast.success(str)); - this.grid.reload(); - }, - err => {} - ); - } + (idlThing: IdlObject) => this.showEditDialog(idlThing) ); + this.editSelected = (idlThings: IdlObject[]) => { + + // Edit each IDL thing one at a time + const editOneThing = (thing: IdlObject) => { + if (!thing) return; + + this.showEditDialog(thing).then( + () => editOneThing(idlThings.shift())); + } + + editOneThing(idlThings.shift()); }; + this.createNew = () => { this.editDialog.mode = 'create'; this.editDialog.open({size: this.dialogSize}).then( @@ -309,6 +311,19 @@ export class AdminPageComponent implements OnInit { return this.contextOrg && this.contextOrg.children().length === 0; } + showEditDialog(idlThing: IdlObject) { + this.editDialog.mode = 'update'; + this.editDialog.recId = idlThing[this.pkeyField](); + return this.editDialog.open({size: this.dialogSize}).then( + ok => { + this.successString.current() + .then(str => this.toast.success(str)); + this.grid.reload(); + }, + err => {} + ); + } + }