this.org.absorbTree();
this.sortedOrgs = this.org.list();
- if (this.initialOrg || this.initialOrgId) {
- this.selected = this.formatForDisplay(
- this.initialOrg || this.org.get(this.initialOrgId)
- );
-
- this.markAsLoaded();
- return;
- }
-
const promise = this.persistKey ?
this.getFromSetting() : Promise.resolve(null);
if (!startupOrgId) {
- if (this.fallbackOrgId) {
+ if (this.selected) {
+ // A value may have been applied while we were
+ // talking to the network.
+ startupOrgId = this.selected.id;
+
+ } else if (this.initialOrg) {
+ startupOrgId = this.initialOrg.id();
+
+ } else if (this.initialOrgId) {
+ startupOrgId = this.initialOrgId;
+
+ } else if (this.fallbackOrgId) {
startupOrgId = this.fallbackOrgId;
} else if (this.fallbackOrg) {
<div class="input-group-text" i18n>Holdings Maintenance</div>
</div>
<eg-org-select [initialOrg]="contextOrg"
- (onChange)="contextOrgChanged($event)">
+ persistKey="catalog.holdings" (onChange)="contextOrgChanged($event)">
</eg-org-select>
</div>
</div>
import {Component, OnInit, Input, ViewChild, ViewEncapsulation
} from '@angular/core';
import {Router} from '@angular/router';
-import {Observable, Observer, of} from 'rxjs';
+import {Observable, Observer, of, empty} from 'rxjs';
import {map} from 'rxjs/operators';
import {Pager} from '@eg/share/util/pager';
import {IdlObject, IdlService} from '@eg/core/idl.service';
contextOrg: IdlObject;
+ // The context org may come from a workstation setting.
+ // Wait for confirmation from the org-select (via onchange in this
+ // case) that the desired context org unit has been found.
+ contextOrgLoaded = false;
+
constructor(
private router: Router,
private org: OrgService,
this.emptyCallNumsCheckbox.checked(settings['cat.holdings_show_empty']);
this.emptyLibsCheckbox.checked(settings['cat.holdings_show_empty_org']);
- this.initHoldingsTree();
this.gridDataSource.getRows = (pager: Pager, sort: any[]) => {
+ if (!this.contextOrgLoaded) { return empty(); }
return this.fetchHoldings(pager);
};
}
+ // No data is loaded until the first occurrence of the org change handler
contextOrgChanged(org: IdlObject) {
+ this.contextOrgLoaded = true;
this.contextOrg = org;
this.hardRefresh();
}
'cwst', 'label'
)
);
+
+INSERT INTO config.workstation_setting_type (name, grp, datatype, fm_class, label)
+VALUES (
+ 'eg.orgselect.catalog.holdings', 'gui', 'link', 'aou',
+ oils_i18n_gettext(
+ 'eg.orgselect.catalog.holdings',
+ 'Default org unit for catalog holdings tab',
+ 'cwst', 'label'
+ )
+);
+
--- /dev/null
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.workstation_setting_type (name, grp, datatype, fm_class, label)
+VALUES (
+ 'eg.orgselect.catalog.holdings', 'gui', 'link', 'aou',
+ oils_i18n_gettext(
+ 'eg.orgselect.catalog.holdings',
+ 'Default org unit for catalog holdings tab',
+ 'cwst', 'label'
+ )
+);
+
+COMMIT;
+
+