LP#1942220: change how linking to Dojo interfaces is handled
authorGalen Charlton <gmc@equinoxOLI.org>
Thu, 9 Dec 2021 21:45:24 +0000 (16:45 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Thu, 9 Dec 2021 21:47:29 +0000 (16:47 -0500)
This patch takes out the notion that the Angular acquisitions
interface is experimental in favor of a different setting that
controls whether or not the Angular PO summary links to the
legacy PO interface.

IOW, this change pushes the user towards using the new interfaces
and dipping into the old ones only one necessary.

Additional links (e.g., to the legacy LI worksheet page) could be
readily added as needed.

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
18 files changed:
Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.html
Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.ts
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search-form.component.ts
Open-ILS/src/eg2/src/app/staff/acq/search/acq-search.service.ts
Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts
Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/picklist-results.component.ts
Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/purchase-order-results.component.ts
Open-ILS/src/eg2/src/app/staff/acq/search/resolver.service.ts
Open-ILS/src/eg2/src/app/staff/resolver.service.ts
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.picklist-po-angular.sql
Open-ILS/src/sql/Pg/upgrade/YYYY.data.acq-sprint-4.sql
Open-ILS/src/templates/staff/navbar.tt2
Open-ILS/web/js/ui/default/staff/services/navbar.js

index 7555120..f3df273 100644 (file)
           <span i18n>Finalize Blanket Order</span>
         </a>
       </ng-container>
+      <ng-container *ngIf="showLegacyLinks">
+        <span class="pl-2 pr-2" i18n> | </span>
+        <a href="/eg/staff/acq/legacy/po/view/{{poId}}" target="_blank">
+          Show PO in Legacy Interface
+        </a>
+      </ng-container>
     </div>
   </div>
 
index 7467bc6..66d19d0 100644 (file)
@@ -40,6 +40,7 @@ export class PoSummaryComponent implements OnInit, OnDestroy {
     zeroCopyActivate = false;
     canActivate: boolean = null;
     canFinalize = false;
+    showLegacyLinks = false;
 
     activationBlocks: EgEvent[] = [];
     activationEvent: EgEvent;
@@ -107,7 +108,8 @@ export class PoSummaryComponent implements OnInit, OnDestroy {
 
         })
         .then(_ => this.setCanActivate())
-        .then(_ => this.setCanFinalize());
+        .then(_ => this.setCanFinalize())
+        .then(_ => this.loadUiPrefs());
     }
 
     // Can run via Enter or blur.  If it just ran via Enter, avoid
@@ -273,6 +275,13 @@ export class PoSummaryComponent implements OnInit, OnDestroy {
         .subscribe(_ => this.canFinalize = true);
     }
 
+    loadUiPrefs() {
+        return this.store.getItemBatch(['ui.staff.acq.show_deprecated_links'])
+        .then(settings => {
+            this.showLegacyLinks = settings['ui.staff.acq.show_deprecated_links'];
+        });
+    }
+
     finalizePo() {
 
         this.confirmFinalize.open().subscribe(confirmed => {
index 3e68276..ba724dc 100644 (file)
              [ngModelOptions]="{standalone: true}" [(ngModel)]="runImmediately"/>
       <label for="retrieve-immediately" class="form-check-label" i18n>Retrieve Results Immediately</label>
     </div>
-    <div class="col-xs-3 pl-2" *ngIf="showExpAngOptions()">
-      <div class="form-check form-check-inline">
-        <input class="form-check-input" type="checkbox" 
-          name="show-exp-ang-links" id="show-exp-ang-links"
-          (change)="toggleExpSearchLinks()" [ngModel]="showExpAngLinks()"/>
-        <label class="form-check-label" for="show-exp-ang-links" i18n>
-          Activate Experimental Links
-        </label>
-      </div>
-    </div>
   </div>
 </form>
 </div>
index ef5b921..335153d 100644 (file)
@@ -6,7 +6,7 @@ import {IdlService, IdlObject} from '@eg/core/idl.service';
 import {PcrudService} from '@eg/core/pcrud.service';
 import {StringComponent} from '@eg/share/string/string.component';
 import {ToastService} from '@eg/share/toast/toast.service';
-import {AcqSearchService, AcqSearchTerm, AcqSearch} from './acq-search.service';
+import {AcqSearchTerm, AcqSearch} from './acq-search.service';
 import {ServerStoreService} from '@eg/core/server-store.service';
 
 @Component({
@@ -50,8 +50,7 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit, OnChanges
         private pcrud: PcrudService,
         private store: ServerStoreService,
         private idl: IdlService,
-        private toast: ToastService,
-        private acqSearch: AcqSearchService
+        private toast: ToastService
     ) {}
 
     ngOnInit() {
@@ -246,18 +245,4 @@ export class AcqSearchFormComponent implements OnInit, AfterViewInit, OnChanges
     saveRunImmediately() {
         return this.store.setItem(this.runImmediatelySetting, this.runImmediately);
     }
-
-    showExpAngOptions(): boolean {
-        return this.acqSearch.angSelectionEnabled;
-    }
-
-    showExpAngLinks(): boolean {
-        return this.acqSearch.angSearchLinksEnabled;
-    }
-
-    toggleExpSearchLinks() {
-        this.acqSearch.angSearchLinksEnabled = !this.acqSearch.angSearchLinksEnabled;
-        this.store.setItem('ui.staff.angular_acq_search.enabled',
-            this.acqSearch.angSearchLinksEnabled);
-    }
 }
index b1367da..577f6ba 100644 (file)
@@ -9,7 +9,6 @@ import {Pager} from '@eg/share/util/pager';
 import {IdlObject} from '@eg/core/idl.service';
 import {EventService} from '@eg/core/event.service';
 import {AttrDefsService} from './attr-defs.service';
-import {ServerStoreService} from '@eg/core/server-store.service';
 
 const baseIdlClass = {
     lineitem: 'jub',
@@ -109,15 +108,11 @@ export class AcqSearchService {
     _conjunction = 'all';
     firstRun = true;
 
-    angSelectionEnabled = false;
-    angSearchLinksEnabled = false;
-
     constructor(
         private net: NetService,
         private evt: EventService,
         private auth: AuthService,
         private pcrud: PcrudService,
-        private serverStore: ServerStoreService,
         private attrDefs: AttrDefsService
     ) {
         this.firstRun = true;
@@ -287,14 +282,4 @@ export class AcqSearchService {
         return gridSource;
     }
 
-    loadUiPrefs(): Promise<any> {
-        return this.serverStore.getItemBatch([
-            'ui.staff.angular_acq_selection.enabled',
-            'ui.staff.angular_acq_search.enabled'
-        ]).then(sets => {
-            this.angSelectionEnabled = sets['ui.staff.angular_acq_selection.enabled'];
-            this.angSearchLinksEnabled =
-              sets['ui.staff.angular_acq_search.enabled'] && this.angSelectionEnabled;
-        });
-    }
 }
index 741289d..f52b046 100644 (file)
@@ -4,7 +4,7 @@
 
 <ng-template #idTmpl let-lineitem="row">
 
-  <ng-container *ngIf="showExpAngLinks(); else legacyId">
+  <ng-container>
     <a *ngIf="lineitem.purchase_order()" 
       routerLink="/staff/acq/po/{{lineitem.purchase_order().id()}}"
       fragment="{{lineitem.id()}}" target="_blank">
    </a>
   </ng-container>
 
-  <ng-template #legacyId>
-
-    <a *ngIf="lineitem.purchase_order()" 
-      routerLink="/staff/acq/po/{{lineitem.purchase_order().id()}}" fragment="{{lineitem.id()}}"
-      target="_blank">
-      {{lineitem.id()}}
-    </a>
-    <a *ngIf="lineitem.picklist() && !lineitem.purchase_order()" 
-      href="/eg/staff/acq/legacy/picklist/view/{{lineitem.picklist().id()}}?focus_li={{lineitem.id()}}"
-      target="_blank">
-      {{lineitem.id()}}
-    </a>
-  </ng-template>
 </ng-template>
 
 <ng-template #poTmpl let-lineitem="row">
-  <ng-container *ngIf="showExpAngLinks(); else legacyPo">
+  <ng-container>
     <a *ngIf="lineitem.purchase_order()" 
       routerLink="/staff/acq/po/{{lineitem.purchase_order().id()}}"
       fragment="{{lineitem.id()}}" target="_blank">
       {{lineitem.purchase_order().name()}}
     </a>
   </ng-container>
-  <ng-template #legacyPo>
-    <a *ngIf="lineitem.purchase_order()" 
-      routerLink="/staff/acq/po/{{lineitem.purchase_order().id()}}" fragment="{{lineitem.id()}}"
-      target="_blank">
-      {{lineitem.purchase_order().name()}}
-    </a>
-  </ng-template>
 </ng-template>
 
 <ng-template #plTmpl let-lineitem="row">
-  <ng-container *ngIf="showExpAngLinks(); else legacyPl">
+  <ng-container>
     <a *ngIf="lineitem.picklist()"
       routerLink="/staff/acq/picklist/{{lineitem.picklist().id()}}"
       fragment="{{lineitem.id()}}" target="_blank">
       {{lineitem.picklist().name()}}
    </a>
   </ng-container>
-
-  <ng-template #legacyPl>
-    <a *ngIf="lineitem.picklist()" 
-      href="/eg/staff/acq/legacy/picklist/view/{{lineitem.picklist().id()}}?focus_li={{lineitem.id()}}"
-      target="_blank">
-      {{lineitem.picklist().name()}}
-    </a>
-  </ng-template>
 </ng-template>
 
 <ng-template #liAttrTmpl let-lineitem="row" let-col="col">
       <a routerLink="/staff/catalog/record/{{lineitem.eg_bib_id()}}"
          target="_blank" i18n>Catalog</a></li>
     <li>
-      <ng-container *ngIf="showExpAngLinks(); else legacyWs">
-        <a routerLink="/staff/acq/lineitem/{{lineitem.id()}}/worksheet"
+      <ng-container>
+        <a routerLink="/staff/acq/po/{{lineitem.purchase_order().id()}}/lineitem/{{lineitem.id()}}/worksheet"
           target="_blank" i18n>Worksheet</a>
       </ng-container>
-      <ng-template #legacyWs>
-        <a href="/eg/staff/acq/legacy/lineitem/worksheet/{{lineitem.id()}}"
-           target="_blank" i18n>Worksheet</a>
-      </ng-template>
     </li>
 
     <li *ngIf="lineitem.purchase_order()">
-      <ng-container *ngIf="showExpAngLinks(); else legacyPo2">
+      <ng-container>
         <a routerLink="/staff/acq/po/{{lineitem.purchase_order().id()}}"
           target="_blank" i18n>Purchase Order</a>
       </ng-container>
-      <ng-template #legacyPo2>
-        <a routerLink="/staff/acq/po/{{lineitem.purchase_order().id()}}"
-          target="_blank" i18n>Purchase Order</a>
-      </ng-template>
     </li>
     <li><a href="/eg/staff/acq/requests/lineitem/{{lineitem.id()}}"
            target="_blank" i18n>Requests</a></li>
       <a routerLink="/staff/cat/vandelay/queue/bib/{{lineitem.queued_record().queue()}}"
         target="_blank" i18n>Queue</a></li>
     <li *ngIf="lineitem.picklist()">
-      <ng-container *ngIf="showExpAngLinks(); else legacyPl2">
+      <ng-container>
         <a routerLink="/staff/acq/picklist/{{lineitem.picklist().id()}}"
           target="_blank" i18n>Selection List</a>
       </ng-container>
-      <ng-template #legacyPl2>
-        <a href="/eg/staff/acq/legacy/picklist/view/{{lineitem.picklist().id()}}"
-          target="_blank" i18n>Selection List</a>
-      </ng-template>
     </li>
   </ul>
 </ng-template>
index 6c757f8..4e91b8e 100644 (file)
@@ -68,10 +68,7 @@ export class LineitemResultsComponent implements OnInit {
     }
 
     showRow(row: any) {
-        window.open('/eg/staff/acq/legacy/lineitem/worksheet/' + row.id(), '_blank');
-    }
-
-    showExpAngLinks(): boolean {
-        return this.acqSearch.angSearchLinksEnabled;
+        window.open('/eg2/staff/acq/po/' + row.purchase_order().id() +
+                    '/lineitem/' + row.id() + '/worksheet', '_blank');
     }
 }
index 9aaeea0..7d03199 100644 (file)
 </eg-string>
 
 <ng-template #nameTmpl let-selectionlist="row">
-  <ng-container *ngIf="showExpAngLinks(); else legacyLinks">
+  <ng-container>
     <a routerLink="/staff/acq/picklist/{{selectionlist.id()}}" target="_blank">
       {{selectionlist.name()}}
     </a>
   </ng-container>
-  <ng-template #legacyLinks>
-    <a href="/eg/staff/acq/legacy/picklist/view/{{selectionlist.id()}}"
-      target="_blank">
-      {{selectionlist.name()}}
-    </a>
-  </ng-template>
 </ng-template>
 
 <eg-picklist-create-dialog #picklistCreateDialog>
index 4fafe83..65d27e8 100644 (file)
@@ -85,14 +85,6 @@ export class PicklistResultsComponent implements OnInit {
         };
     }
 
-    showExpAngOptions(): boolean {
-        return this.acqSearch.angSelectionEnabled;
-    }
-
-    showExpAngLinks(): boolean {
-        return this.acqSearch.angSearchLinksEnabled;
-    }
-
     openCreateDialog() {
         this.picklistCreateDialog.open().subscribe(
             modified => {
@@ -138,7 +130,7 @@ export class PicklistResultsComponent implements OnInit {
     }
 
     showRow(row: any) {
-        window.open('/eg/staff/acq/legacy/picklist/view/' + row.id(), '_blank');
+        window.open('/eg2/staff/acq/picklist/' + row.id(), '_blank');
     }
 
     doSearch(search: AcqSearch) {
index 456027e..14f78de 100644 (file)
@@ -4,16 +4,11 @@
   defaultSearchSetting="eg.acq.search.default.purchaseorders"></eg-acq-search-form>
 
 <ng-template #nameTmpl let-purchaseorder="row">
-  <ng-container *ngIf="showExpAngLinks(); else legacyPo">
+  <ng-container>
     <a routerLink="/staff/acq/po/{{purchaseorder.id()}}" target="_blank">
       {{purchaseorder.name()}}
     </a>
   </ng-container>
-  <ng-template #legacyPo>
-    <a routerLink="/staff/acq/po/{{purchaseorder.id()}}" target="_blank">
-      {{purchaseorder.name()}}
-    </a>
-  </ng-template>
 </ng-template>
 
 <ng-template #providerTmpl let-purchaseorder="row">
index 7e583bf..254e124 100644 (file)
@@ -64,9 +64,4 @@ export class PurchaseOrderResultsComponent implements OnInit {
             this.purchaseOrderResultsGrid.reload();
         });
     }
-
-    showExpAngLinks(): boolean {
-        return this.acqSearch.angSearchLinksEnabled;
-    }
-
 }
index c3b559d..bdc4638 100644 (file)
@@ -2,7 +2,6 @@ import {Injectable} from '@angular/core';
 import {Router, Resolve, RouterStateSnapshot,
         ActivatedRouteSnapshot} from '@angular/router';
 import {AttrDefsService} from './attr-defs.service';
-import {AcqSearchService} from './acq-search.service';
 
 @Injectable()
 export class AttrDefsResolver implements Resolve<Promise<any[]>> {
@@ -11,16 +10,16 @@ export class AttrDefsResolver implements Resolve<Promise<any[]>> {
 
     constructor(
         private router: Router,
-        private attrDefs: AttrDefsService,
-        private acqSearch: AcqSearchService
+        private attrDefs: AttrDefsService
     ) {}
 
     resolve(
         route: ActivatedRouteSnapshot,
         state: RouterStateSnapshot): Promise<any[]> {
 
-        return this.attrDefs.fetchAttrDefs()
-        .then(_ => this.acqSearch.loadUiPrefs());
+        return Promise.all([
+            this.attrDefs.fetchAttrDefs()
+        ]);
     }
 
 }
index 13969a6..0ce843c 100644 (file)
@@ -142,7 +142,6 @@ export class StaffResolver implements Resolve<Observable<any>> {
             'webstaff.format.date_and_time',
             'ui.staff.max_recent_patrons',
             'circ.curbside', // navbar
-            'ui.staff.angular_acq_selection.enabled', // navbar
             'ui.staff.angular_catalog.enabled' // navbar
         ]).then(settings => {
             // Avoid clobbering defaults
index b7a549b..c1fdc50 100644 (file)
@@ -21898,10 +21898,10 @@ VALUES (
 
 INSERT INTO config.org_unit_setting_type (name, grp, datatype, label)
 VALUES (
-    'ui.staff.angular_acq_selection.enabled', 'gui', 'bool',
+    'ui.staff.acq.show_deprecated_links', 'gui', 'bool',
     oils_i18n_gettext(
-        'ui.staff.angular_acq_selection.enabled',
-        'Enable Experimental ACQ Selection/Purchase Interfaces',
+        'ui.staff.acq.show_deprecated_links',
+        'Display Links to Deprecated Acquisitions Interfaces',
         'cwst', 'label'
     )
 );
index 242da10..ab370fb 100644 (file)
@@ -40,17 +40,6 @@ VALUES (
     )
 );
 
-INSERT INTO config.org_unit_setting_type (name, grp, datatype, label)
-VALUES (
-    'ui.staff.angular_acq_selection.enabled', 'gui', 'bool',
-    oils_i18n_gettext(
-        'ui.staff.angular_acq_selection.enabled',
-        'Enable Experimental ACQ Selection/Purchase Interfaces',
-        'cwst', 'label'
-    )
-);
-
-
 INSERT INTO config.print_template
     (id, name, label, owner, active, locale, template)
 VALUES (
index c9f9e4d..4f3d556 100644 (file)
@@ -12,4 +12,14 @@ VALUES (
     )
 );
 
+INSERT INTO config.org_unit_setting_type (name, grp, datatype, label)
+VALUES (
+    'ui.staff.acq.show_deprecated_links', 'gui', 'bool',
+    oils_i18n_gettext(
+        'ui.staff.acq.show_deprecated_links',
+        'Display Links to Deprecated Acquisitions Interfaces',
+        'cwst', 'label'
+    )
+);
+
 COMMIT;
index 0fe2efe..3d9b9b9 100644 (file)
        </ul>
       </li>
 
-      <!-- acquisitions experimental -->
-      <li class="dropdown" uib-dropdown>
-        <a href uib-dropdown-toggle>[% l('Acquisitions (Experimental)') %]<b class="caret" 
-          aria-hidden="true"></b>
-        </a>
-        <ul uib-dropdown-menu>
-          <li>
-            <a href="/eg2/staff/acq/po/create">
-              <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
-              [% l('Create Purchase Order') %]
-            </a>
-          </li>
-        </ul>
-      </li>
-
-
       <!-- booking -->
       <li class="dropdown" uib-dropdown>
         <a href uib-dropdown-toggle>[% l('Booking') %]<b class="caret" 
index 34463d0..58e2d3a 100644 (file)
@@ -123,7 +123,6 @@ angular.module('egCoreMod')
                             egCore.org.settings([
                                 'ui.staff.max_recent_patrons',
                                 'ui.staff.angular_catalog.enabled',
-                                'ui.staff.angular_acq_selection.enabled',
                                 'circ.curbside'
                             ]).then(function(s) {
                                 var val = s['ui.staff.max_recent_patrons'];
@@ -132,8 +131,6 @@ angular.module('egCoreMod')
 
                                 $scope.showAngularCatalog = 
                                     s['ui.staff.angular_catalog.enabled'];
-                                $scope.showAngularAcq =
-                                    s['ui.staff.angular_acq_selection.enabled'];
                                 $scope.enableCurbside = 
                                     s['circ.curbside'];
                             }).then(function() {