[open-ils-commits] [GIT] Evergreen ILS branch master updated. fdb1b355d501c9e3043cab23d45e920fb51e42dd

Evergreen Git git at git.evergreen-ils.org
Fri May 24 13:58:21 EDT 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  fdb1b355d501c9e3043cab23d45e920fb51e42dd (commit)
       via  cea65e3827b455d0fa839ddfafcbcd6d0a5f5e42 (commit)
       via  832c23bf584295f6d8caa20304a9c8b352375c7d (commit)
       via  0bdb373741359bb674272cd0f4f11f3cbc178e89 (commit)
       via  50e5b64d54704ecddc71df5da3e43b480d4df982 (commit)
       via  713598a0083197b9608042e3f58c4a5996d6a4c1 (commit)
      from  1a4a74a839a999db763b6eb3ab7469e467cccacb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fdb1b355d501c9e3043cab23d45e920fb51e42dd
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Thu May 23 12:51:21 2019 -0400

    LP#1823393: add release notes
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/docs/RELEASE_NOTES_NEXT/Client/angular-aout-admin-page.adoc b/docs/RELEASE_NOTES_NEXT/Client/angular-aout-admin-page.adoc
new file mode 100644
index 0000000000..11a196dcb6
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Client/angular-aout-admin-page.adoc
@@ -0,0 +1,4 @@
+Port Org Unit Type Admin to Angular
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Migrate the Admin => Server Admin => Organization Types admin page to 
+Angular.

commit cea65e3827b455d0fa839ddfafcbcd6d0a5f5e42
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date:   Thu May 23 12:47:56 2019 -0400

    LP#1823393: various usability improvements
    
    - display the number of org units associated with the selected type
    - disable the Delete button if a type either has children types
      or org units linked to it
    - ensure that the type name and label fields are required
    - ensure that the tree is fully refreshed after an update
    
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.html
index d812d124ff..3c0af3b95c 100644
--- a/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.html
@@ -16,7 +16,9 @@
   dialogBody="Delete Org Unit Type {{selected ? selected.label : ''}}?">
 </eg-confirm-dialog>
 
-<eg-fm-record-editor #editDialog idlClass="aout" readonlyFields="depth,parent">
+<eg-fm-record-editor #editDialog idlClass="aout" readonlyFields="depth,parent"
+  [fieldOptions]="{name:{isRequired:true},opac_label:{isRequired:true}}"
+>
 </eg-fm-record-editor>
 
 <div class="row">
@@ -39,7 +41,8 @@
         <div class="col-lg-9">
           <button class="btn btn-info mr-2" (click)="edit()" i18n>Edit</button>
           <button class="btn btn-info mr-2" (click)="addChild()" i18n>Add Child</button>
-          <button class="btn btn-warning mr-2" (click)="remove()" i18n>Delete</button>
+          <button class="btn btn-warning mr-2" (click)="remove()"
+            [disabled]="selected.callerData.aout.children().length > 0 || selected.callerData.orgCount > 0" i18n>Delete</button>
         </div>
       </div>
       <div class="row">
@@ -48,7 +51,7 @@
           <label i18n>Name: </label>
         </div>
         <div class="col-lg-8 font-weight-bold">
-          {{selected.callerData.name()}}
+          {{selected.callerData.aout.name()}}
         </div>
       </div>
       <div class="row">
@@ -56,7 +59,7 @@
           <label i18n>Label: </label>
         </div>
         <div class="col-lg-8 font-weight-bold">
-          {{selected.callerData.opac_label()}}
+          {{selected.callerData.aout.opac_label()}}
         </div>
       </div>
       <div class="row">
@@ -65,7 +68,7 @@
         </div>
         <div class="col-lg-8 font-weight-bold">
           <!-- TODO: use <eg-bool/> once merged-->
-          {{selected.callerData.can_have_users() == 't'}}
+          {{selected.callerData.aout.can_have_users() == 't'}}
         </div>
       </div>
       <div class="row">
@@ -74,7 +77,7 @@
           </div>
           <div class="col-lg-8 font-weight-bold">
             <!-- TODO: use <eg-bool/> once merged-->
-            {{selected.callerData.can_have_vols() == 't'}}
+            {{selected.callerData.aout.can_have_vols() == 't'}}
           </div>
         </div>
       <div class="row">
@@ -82,7 +85,15 @@
           <label i18n>Depth: </label>
         </div>
         <div class="col-lg-8 font-weight-bold">
-          {{selected.callerData.depth()}}
+          {{selected.callerData.aout.depth()}}
+        </div>
+      </div>
+      <div class="row">
+        <div class="col-lg-4">
+          <label i18n>Number of Org Units Of This Type: </label>
+        </div>
+        <div class="col-lg-8 font-weight-bold">
+          {{selected.callerData.orgCount}}
         </div>
       </div>
     </div>
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.ts
index 1820cc8e4e..978b46f19a 100644
--- a/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.ts
@@ -38,7 +38,7 @@ export class OrgUnitTypeComponent implements OnInit {
 
     loadAoutTree() {
         this.pcrud.search('aout', {depth: 0},
-            {flesh: -1, flesh_fields: {aout: ['children']}},
+            {flesh: -1, flesh_fields: {aout: ['children','org_units']}},
             {anonymous: true}
         ).subscribe(aoutTree => this.ingestAoutTree(aoutTree));
     }
@@ -49,10 +49,16 @@ export class OrgUnitTypeComponent implements OnInit {
         const handleNode = (aoutNode: IdlObject): TreeNode => {
             if (!aoutNode) { return; }
 
+            // grab number of associated org units, then
+            // clear it so that FmRecordEditor doesn't try
+            // to render the list
+            const orgCount = aoutNode.org_units().length;
+            aoutNode.org_units(null);
+
             const treeNode = new TreeNode({
                 id: aoutNode.id(),
                 label: aoutNode.name(),
-                callerData: aoutNode
+                callerData: { aout: aoutNode, orgCount: orgCount },
             });
 
             aoutNode.children().forEach(childNode =>
@@ -83,11 +89,14 @@ export class OrgUnitTypeComponent implements OnInit {
 
     edit() {
         this.editDialog.mode = 'update';
-        this.editDialog.setRecord(this.selected.callerData);
+        this.editDialog.setRecord(this.selected.callerData.aout);
 
         this.editDialog.open().then(
             success => {
                 this.postUpdate(this.editString);
+                this.loadAoutTree(); // since the tree is never going to
+                                     // be large, just reload the whole
+                                     // thing
             },
             rejected => {
                 if (rejected && rejected.dismissed) {
@@ -102,7 +111,7 @@ export class OrgUnitTypeComponent implements OnInit {
     remove() {
         this.delConfirm.open().then(
             ok => {
-                this.pcrud.remove(this.selected.callerData)
+                this.pcrud.remove(this.selected.callerData.aout)
                 .subscribe(
                     ok2 => {},
                     err => {
@@ -112,7 +121,9 @@ export class OrgUnitTypeComponent implements OnInit {
                     ()  => {
                         // Avoid updating until we know the entire
                         // pcrud action/transaction completed.
-                        this.tree.removeNode(this.selected);
+                        this.loadAoutTree(); // since the tree is never going to
+                                             // be large, just reload the whole
+                                             // thing
                         this.selected = null;
                         this.postUpdate(this.editString);
                     }
@@ -124,7 +135,7 @@ export class OrgUnitTypeComponent implements OnInit {
 
     addChild() {
         const parentTreeNode = this.selected;
-        const parentType = parentTreeNode.callerData;
+        const parentType = parentTreeNode.callerData.aout;
 
         const newType = this.idl.create('aout');
         newType.parent(parentType.id());
@@ -140,9 +151,11 @@ export class OrgUnitTypeComponent implements OnInit {
                 const newNode = new TreeNode({
                     id: result.id(),
                     label: result.name(),
-                    callerData: result
+                    callerData: { aout: result, orgCount: 0 }
                 });
-                parentTreeNode.children.push(newNode);
+                this.loadAoutTree(); // since the tree is never going to
+                                     // be large, just reload the whole
+                                     // thing
                 this.postUpdate(this.createString);
             },
 

commit 832c23bf584295f6d8caa20304a9c8b352375c7d
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Apr 5 14:59:43 2019 -0400

    LP1823393 FMEditor component i18n translate buttons
    
    When editing a record in the fieldmapper editor component, offer a
    translate option for each i18n field on the object, in the form of a
    button next to the field.  Once clicked, the translate component dialog
    appears and allows the user to add/modify translations on the selected
    field.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html
index aad65d15d6..1b0935fb0a 100644
--- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html
+++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html
@@ -1,3 +1,6 @@
+<!-- idlObject and fieldName applied programmatically -->
+<eg-translate #translator></eg-translate>
+
 <ng-template #dialogContent>
   <div class="modal-header bg-info">
     <h4 class="modal-title" i18n>Record Editor: {{recordLabel}}</h4>
@@ -10,7 +13,7 @@
   <div class="modal-body">
     <form #fmEditForm="ngForm" role="form" class="form-validated common-form striped-odd">
       <div class="form-group row" *ngFor="let field of fields">
-        <div class="col-lg-3 offset-lg-1">
+        <div class="col-lg-3">
           <label for="{{idPrefix}}-{{field.name}}">{{field.label}}</label>
         </div>
         <div class="col-lg-7">
@@ -133,6 +136,14 @@
             </ng-container>
           </ng-container> <!-- switch -->
         </div>
+        <div class="col-lg-1" *ngIf="field.i18n && !field.readOnly">
+          <a (click)="openTranslator(field.name)"
+            i18n-title title="Translate">
+            <button class="btn btn-outline-info mat-icon-in-button">
+              <span class="material-icons">translate</span>
+            </button>
+          </a>
+        </div>
       </div>
     </form>
   </div>
diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
index 14aa386581..e9a4531113 100644
--- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
+++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
@@ -1,4 +1,4 @@
-import {Component, OnInit, Input,
+import {Component, OnInit, Input, ViewChild,
     Output, EventEmitter, TemplateRef} from '@angular/core';
 import {IdlService, IdlObject} from '@eg/core/idl.service';
 import {Observable} from 'rxjs';
@@ -8,6 +8,8 @@ import {PcrudService} from '@eg/core/pcrud.service';
 import {DialogComponent} from '@eg/share/dialog/dialog.component';
 import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
 import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
+import {TranslateComponent} from '@eg/staff/share/translate/translate.component';
+
 
 interface CustomFieldTemplate {
     template: TemplateRef<any>;
@@ -129,6 +131,8 @@ export class FmRecordEditorComponent
     // Emit an error message when the save action fails.
     @Output() onError$ = new EventEmitter<string>();
 
+    @ViewChild('translator') private translator: TranslateComponent;
+
     // IDL info for the the selected IDL class
     idlDef: any;
 
@@ -212,13 +216,15 @@ export class FmRecordEditorComponent
             update: pc.update ? pc.update.perms : [],
         };
 
+        this.pkeyIsEditable = !('pkey_sequence' in this.idlDef);
+
         if (this.mode === 'update' || this.mode === 'view') {
 
             let promise;
             if (this.record && this.recId === null) {
                 promise = Promise.resolve(this.record);
             } else {
-                promise = 
+                promise =
                     this.pcrud.retrieve(this.idlClass, this.recId).toPromise();
             }
 
@@ -235,14 +241,12 @@ export class FmRecordEditorComponent
             });
         }
 
-        // create a new record from scratch or from a stub record
-        // provided by the caller.
-        this.pkeyIsEditable = !('pkey_sequence' in this.idlDef);
-        if (!this.record || this.recId) {
-            // user provided no seed record, create one.
-            this.recId = null;
-            this.record = this.idl.create(this.idlClass);
-        }
+        // In 'create' mode.
+        //
+        // Create a new record from the stub record provided by the
+        // caller or a new from-scratch record
+        this.setRecord(this.record || this.idl.create(this.idlClass));
+
         return this.getFieldList();
     }
 
@@ -517,6 +521,21 @@ export class FmRecordEditorComponent
         // datatype == text / interval / editable-pkey
         return 'text';
     }
+
+    openTranslator(field: string) {
+        this.translator.fieldName = field;
+        this.translator.idlObject = this.record;
+
+        // TODO: will need to change once LP1823041 is merged
+        this.translator.open().then(
+            newValue => {
+                if (newValue) {
+                    this.record[field](newValue);
+                }
+            },
+            () => {} // avoid console error
+        );
+    }
 }
 
 
diff --git a/Open-ILS/src/eg2/src/app/staff/share/translate/translate.component.ts b/Open-ILS/src/eg2/src/app/staff/share/translate/translate.component.ts
index 9c7361cb4c..48809738c1 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/translate/translate.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/share/translate/translate.component.ts
@@ -116,7 +116,7 @@ export class TranslateComponent
             this.pcrud.update(entry).toPromise().then(
                 ok => {
                     if (!this.nextString) {
-                        this.close('Translation updated');
+                        this.close(this.translatedValue);
                     }
                 },
                 err => console.error(err)
@@ -134,7 +134,7 @@ export class TranslateComponent
         this.pcrud.create(entry).toPromise().then(
             ok => {
                 if (!this.nextString) {
-                    this.close('Translation created');
+                    this.close(this.translatedValue);
                 }
             },
             err => console.error('Translation creation failed')

commit 0bdb373741359bb674272cd0f4f11f3cbc178e89
Author: Bill Erickson <berickxx at gmail.com>
Date:   Thu Jan 24 12:22:42 2019 -0500

    LP1823393 Org unit type Angular admin UI
    
    Ports the "Organization Types" admin UI from Dojo to Angular.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
index 3e41fa221d..14aa386581 100644
--- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
+++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
@@ -85,7 +85,6 @@ export class FmRecordEditorComponent
     recId: any;
 
     // IDL record we are editing
-    // TODO: allow this to be update in real time by the caller?
     record: IdlObject;
 
     // Permissions extracted from the permacrud defs in the IDL
@@ -180,6 +179,13 @@ export class FmRecordEditorComponent
         );
     }
 
+    // Set the record value and clear the recId value to
+    // indicate the record is our current source of data.
+    setRecord(record: IdlObject) {
+        this.record = record;
+        this.recId = null;
+    }
+
     // Translate comma-separated string versions of various inputs
     // to arrays.
     private listifyInputs() {
@@ -207,8 +213,16 @@ export class FmRecordEditorComponent
         };
 
         if (this.mode === 'update' || this.mode === 'view') {
-            return this.pcrud.retrieve(this.idlClass, this.recId)
-            .toPromise().then(rec => {
+
+            let promise;
+            if (this.record && this.recId === null) {
+                promise = Promise.resolve(this.record);
+            } else {
+                promise = 
+                    this.pcrud.retrieve(this.idlClass, this.recId).toPromise();
+            }
+
+            return promise.then(rec => {
 
                 if (!rec) {
                     return Promise.reject(`No '${this.idlClass}'
@@ -224,7 +238,9 @@ export class FmRecordEditorComponent
         // create a new record from scratch or from a stub record
         // provided by the caller.
         this.pkeyIsEditable = !('pkey_sequence' in this.idlDef);
-        if (!this.record) {
+        if (!this.record || this.recId) {
+            // user provided no seed record, create one.
+            this.recId = null;
             this.record = this.idl.create(this.idlClass);
         }
         return this.getFieldList();
diff --git a/Open-ILS/src/eg2/src/app/share/tree/tree.component.ts b/Open-ILS/src/eg2/src/app/share/tree/tree.component.ts
index d3fccdae8f..f519268f46 100644
--- a/Open-ILS/src/eg2/src/app/share/tree/tree.component.ts
+++ b/Open-ILS/src/eg2/src/app/share/tree/tree.component.ts
@@ -47,6 +47,7 @@ export class TreeComponent implements OnInit {
     ngOnInit() {}
 
     displayNodes(): TreeNode[] {
+        if (!this.tree) { return []; }
         return this.tree.nodeList(true);
     }
 
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server-splash.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server-splash.component.html
index 5e6058da9c..211283e341 100644
--- a/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server-splash.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server-splash.component.html
@@ -72,7 +72,7 @@
     <eg-link-table-link i18n-label label="Org Unit Proximity Adjustments"  
       routerLink="/staff/admin/server/actor/org_unit_proximity_adjustment"></eg-link-table-link>
     <eg-link-table-link i18n-label label="Organization Types"  
-      url="/eg/staff/admin/server/legacy/actor/org_unit_type"></eg-link-table-link>
+      routerLink="/staff/admin/server/actor/org_unit_type"></eg-link-table-link>
     <eg-link-table-link i18n-label label="Org Unit Setting Types"  
       routerLink="/staff/admin/server/config/org_unit_setting_type"></eg-link-table-link>
     <eg-link-table-link i18n-label label="Organizational Units"  
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server.module.ts
index 1f00a8a0af..8e76239e8b 100644
--- a/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server.module.ts
+++ b/Open-ILS/src/eg2/src/app/staff/admin/server/admin-server.module.ts
@@ -1,16 +1,20 @@
 import {NgModule} from '@angular/core';
+import {TreeModule} from '@eg/share/tree/tree.module';
 import {StaffCommonModule} from '@eg/staff/common.module';
 import {AdminServerRoutingModule} from './routing.module';
 import {AdminCommonModule} from '@eg/staff/admin/common.module';
 import {AdminServerSplashComponent} from './admin-server-splash.component';
+import {OrgUnitTypeComponent} from './org-unit-type.component';
 
 @NgModule({
   declarations: [
-      AdminServerSplashComponent
+      AdminServerSplashComponent,
+      OrgUnitTypeComponent
   ],
   imports: [
     AdminCommonModule,
-    AdminServerRoutingModule
+    AdminServerRoutingModule,
+    TreeModule
   ],
   exports: [
   ],
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.html
new file mode 100644
index 0000000000..d812d124ff
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.html
@@ -0,0 +1,90 @@
+<eg-staff-banner bannerText="Org Unit Type Configuration" i18n-bannerText>
+</eg-staff-banner>
+
+<ng-template #editStrTmpl i18n>Org Unit Type Update Succeeded</ng-template>
+<eg-string #editString [template]="editStrTmpl"></eg-string>
+
+<ng-template #createStrTmpl i18n>Org Unit Type Succeessfully Created</ng-template>
+<eg-string #createString [template]="createStrTmpl"></eg-string>
+
+<ng-template #errorStrTmpl i18n>Org Unit Type Update Failed</ng-template>
+<eg-string #errorString [template]="errorStrTmpl"></eg-string>
+
+<eg-confirm-dialog #delConfirm 
+  i18n-dialogTitle i18n-dialogBody
+  dialogTitle="Confirm Delete"
+  dialogBody="Delete Org Unit Type {{selected ? selected.label : ''}}?">
+</eg-confirm-dialog>
+
+<eg-fm-record-editor #editDialog idlClass="aout" readonlyFields="depth,parent">
+</eg-fm-record-editor>
+
+<div class="row">
+  <div class="col-lg-4">
+    <h3 i18n>Org Unit Types</h3>
+    <eg-tree [tree]="tree" (nodeClicked)="nodeClicked($event)"></eg-tree>
+  </div>
+  <div class="col-lg-8">
+    <h3 i18n class="mb-3">Selected Org Unit Type</h3>
+    <ng-container *ngIf="!selected">
+      <div class="alert alert-info font-italic" i18n>
+        Select an org unit type from the tree on the left.
+      </div>
+    </ng-container>
+    <div *ngIf="selected" class="common-form striped-even">
+      <div class="row">
+        <div class="col-lg-3">
+          <label i18n>Actions for Selected: </label>
+        </div>
+        <div class="col-lg-9">
+          <button class="btn btn-info mr-2" (click)="edit()" i18n>Edit</button>
+          <button class="btn btn-info mr-2" (click)="addChild()" i18n>Add Child</button>
+          <button class="btn btn-warning mr-2" (click)="remove()" i18n>Delete</button>
+        </div>
+      </div>
+      <div class="row">
+        <!-- TODO: use FmRecordEditPaneComponent once it exists -->
+        <div class="col-lg-4">
+          <label i18n>Name: </label>
+        </div>
+        <div class="col-lg-8 font-weight-bold">
+          {{selected.callerData.name()}}
+        </div>
+      </div>
+      <div class="row">
+        <div class="col-lg-4">
+          <label i18n>Label: </label>
+        </div>
+        <div class="col-lg-8 font-weight-bold">
+          {{selected.callerData.opac_label()}}
+        </div>
+      </div>
+      <div class="row">
+        <div class="col-lg-4">
+          <label i18n>Can Have Users: </label>
+        </div>
+        <div class="col-lg-8 font-weight-bold">
+          <!-- TODO: use <eg-bool/> once merged-->
+          {{selected.callerData.can_have_users() == 't'}}
+        </div>
+      </div>
+      <div class="row">
+          <div class="col-lg-4">
+            <label i18n>Can Have Volumes: </label>
+          </div>
+          <div class="col-lg-8 font-weight-bold">
+            <!-- TODO: use <eg-bool/> once merged-->
+            {{selected.callerData.can_have_vols() == 't'}}
+          </div>
+        </div>
+      <div class="row">
+        <div class="col-lg-4">
+          <label i18n>Depth: </label>
+        </div>
+        <div class="col-lg-8 font-weight-bold">
+          {{selected.callerData.depth()}}
+        </div>
+      </div>
+    </div>
+  </div>
+</div>
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.ts
new file mode 100644
index 0000000000..1820cc8e4e
--- /dev/null
+++ b/Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.ts
@@ -0,0 +1,159 @@
+import {Component, Input, ViewChild, OnInit} from '@angular/core';
+import {Tree, TreeNode} from '@eg/share/tree/tree';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
+import {AuthService} from '@eg/core/auth.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {StringComponent} from '@eg/share/string/string.component';
+import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
+import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
+
+ at Component({
+    templateUrl: './org-unit-type.component.html'
+})
+
+export class OrgUnitTypeComponent implements OnInit {
+
+    tree: Tree;
+    selected: TreeNode;
+    @ViewChild('editDialog') editDialog: FmRecordEditorComponent;
+    @ViewChild('editString') editString: StringComponent;
+    @ViewChild('createString') createString: StringComponent;
+    @ViewChild('errorString') errorString: StringComponent;
+    @ViewChild('delConfirm') delConfirm: ConfirmDialogComponent;
+
+    constructor(
+        private idl: IdlService,
+        private org: OrgService,
+        private auth: AuthService,
+        private pcrud: PcrudService,
+        private toast: ToastService
+    ) {}
+
+
+    ngOnInit() {
+        this.loadAoutTree();
+    }
+
+    loadAoutTree() {
+        this.pcrud.search('aout', {depth: 0},
+            {flesh: -1, flesh_fields: {aout: ['children']}},
+            {anonymous: true}
+        ).subscribe(aoutTree => this.ingestAoutTree(aoutTree));
+    }
+
+    // Translate the org unt type tree into a structure EgTree can use.
+    ingestAoutTree(aoutTree) {
+
+        const handleNode = (aoutNode: IdlObject): TreeNode => {
+            if (!aoutNode) { return; }
+
+            const treeNode = new TreeNode({
+                id: aoutNode.id(),
+                label: aoutNode.name(),
+                callerData: aoutNode
+            });
+
+            aoutNode.children().forEach(childNode =>
+                treeNode.children.push(handleNode(childNode))
+            );
+
+            return treeNode;
+        };
+
+        const rootNode = handleNode(aoutTree);
+        this.tree = new Tree(rootNode);
+    }
+
+    nodeClicked($event: any) {
+        this.selected = $event;
+    }
+
+    postUpdate(message: StringComponent) {
+        // Modifying org unit types means refetching the org unit
+        // data normally fetched on page load, since it includes
+        // org unit type data.
+        this.org.fetchOrgs().then(
+            ok => {
+                message.current().then(str => this.toast.success(str));
+            }
+        );
+    }
+
+    edit() {
+        this.editDialog.mode = 'update';
+        this.editDialog.setRecord(this.selected.callerData);
+
+        this.editDialog.open().then(
+            success => {
+                this.postUpdate(this.editString);
+            },
+            rejected => {
+                if (rejected && rejected.dismissed) {
+                    return;
+                }
+                this.errorString.current()
+                    .then(str => this.toast.danger(str));
+            }
+        );
+    }
+
+    remove() {
+        this.delConfirm.open().then(
+            ok => {
+                this.pcrud.remove(this.selected.callerData)
+                .subscribe(
+                    ok2 => {},
+                    err => {
+                        this.errorString.current()
+                          .then(str => this.toast.danger(str));
+                    },
+                    ()  => {
+                        // Avoid updating until we know the entire
+                        // pcrud action/transaction completed.
+                        this.tree.removeNode(this.selected);
+                        this.selected = null;
+                        this.postUpdate(this.editString);
+                    }
+                );
+            },
+            notConfirmed => {}
+        );
+    }
+
+    addChild() {
+        const parentTreeNode = this.selected;
+        const parentType = parentTreeNode.callerData;
+
+        const newType = this.idl.create('aout');
+        newType.parent(parentType.id());
+        newType.depth(Number(parentType.depth()) + 1);
+
+        this.editDialog.setRecord(newType);
+        this.editDialog.mode = 'create';
+
+        this.editDialog.open().then(
+            result => { // aout object
+
+                // Add our new node to the tree
+                const newNode = new TreeNode({
+                    id: result.id(),
+                    label: result.name(),
+                    callerData: result
+                });
+                parentTreeNode.children.push(newNode);
+                this.postUpdate(this.createString);
+            },
+
+            rejected => {
+                if (rejected && rejected.dismissed) {
+                    return;
+                }
+                this.errorString.current()
+                    .then(str => this.toast.danger(str));
+            }
+        );
+    }
+}
+
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/routing.module.ts
index ceb60f27f4..c971ed74a7 100644
--- a/Open-ILS/src/eg2/src/app/staff/admin/server/routing.module.ts
+++ b/Open-ILS/src/eg2/src/app/staff/admin/server/routing.module.ts
@@ -2,11 +2,15 @@ import {NgModule} from '@angular/core';
 import {RouterModule, Routes} from '@angular/router';
 import {AdminServerSplashComponent} from './admin-server-splash.component';
 import {BasicAdminPageComponent} from '@eg/staff/admin/basic-admin-page.component';
+import {OrgUnitTypeComponent} from './org-unit-type.component';
 
 const routes: Routes = [{
     path: 'splash',
     component: AdminServerSplashComponent
 }, {
+    path: 'actor/org_unit_type',
+    component: OrgUnitTypeComponent
+}, {
     path: ':schema/:table',
     component: BasicAdminPageComponent
 }];

commit 50e5b64d54704ecddc71df5da3e43b480d4df982
Author: Bill Erickson <berickxx at gmail.com>
Date:   Thu Jan 24 17:43:33 2019 -0500

    LP1823393 Tree component collapsed node display fix
    
    Avoid added child tree nodes when parent nodes are hidden.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/share/tree/tree.ts b/Open-ILS/src/eg2/src/app/share/tree/tree.ts
index cca36d4a70..68e01fee9f 100644
--- a/Open-ILS/src/eg2/src/app/share/tree/tree.ts
+++ b/Open-ILS/src/eg2/src/app/share/tree/tree.ts
@@ -73,9 +73,8 @@ export class Tree {
                 // Avoid adding hidden child nodes to the list.
             } else {
                 nodes.push(node);
+                node.children.forEach(n => recurseTree(n, depth, !node.expanded));
             }
-
-            node.children.forEach(n => recurseTree(n, depth, !node.expanded));
         };
 
         recurseTree(this.rootNode, 0, false);

commit 713598a0083197b9608042e3f58c4a5996d6a4c1
Author: Bill Erickson <berickxx at gmail.com>
Date:   Thu Jan 24 17:43:06 2019 -0500

    LP1823393 Pcrud bubbles up transaction close errors
    
    Ensure these errors make their way out to the caller instead of only
    logging an error.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/core/pcrud.service.ts b/Open-ILS/src/eg2/src/app/core/pcrud.service.ts
index 9e14191c0f..7fb0c7ccf6 100644
--- a/Open-ILS/src/eg2/src/app/core/pcrud.service.ts
+++ b/Open-ILS/src/eg2/src/app/core/pcrud.service.ts
@@ -233,12 +233,16 @@ export class PcrudContext {
                     res => observer.next(res),
                     err => observer.error(err),
                     ()  => {
-                        this.xactClose().toPromise().then(() => {
-                            // 5. disconnect
-                            this.disconnect();
-                            // 6. all done
-                            observer.complete();
-                        });
+                        this.xactClose().toPromise().then(
+                            ok => {
+                                // 5. disconnect
+                                this.disconnect();
+                                // 6. all done
+                                observer.complete();
+                            },
+                            // xact close error
+                            err => observer.error(err)
+                        );
                     }
                 );
             });

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/eg2/src/app/core/pcrud.service.ts     |  16 +-
 .../app/share/fm-editor/fm-editor.component.html   |  13 +-
 .../src/app/share/fm-editor/fm-editor.component.ts |  55 +++++--
 .../src/eg2/src/app/share/tree/tree.component.ts   |   1 +
 Open-ILS/src/eg2/src/app/share/tree/tree.ts        |   3 +-
 .../server/admin-server-splash.component.html      |   2 +-
 .../app/staff/admin/server/admin-server.module.ts  |   8 +-
 .../admin/server/org-unit-type.component.html      | 101 ++++++++++++
 .../staff/admin/server/org-unit-type.component.ts  | 172 +++++++++++++++++++++
 .../src/app/staff/admin/server/routing.module.ts   |   4 +
 .../staff/share/translate/translate.component.ts   |   4 +-
 .../Client/angular-aout-admin-page.adoc            |   4 +
 12 files changed, 359 insertions(+), 24 deletions(-)
 create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.html
 create mode 100644 Open-ILS/src/eg2/src/app/staff/admin/server/org-unit-type.component.ts
 create mode 100644 docs/RELEASE_NOTES_NEXT/Client/angular-aout-admin-page.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list