}
} else if (!anonymous) {
- return Promise.reject(
- 'Use "anonymous" To retrieve org settings without an authtoken');
+ console.warn('Attempt to fetch org setting(s)',
+ name, 'in non-anonymous mode without an authtoken');
+ return Promise.resolve({});
}
if (useCache) {
<span class="material-icons">search</span>
<span i18n>Search the Catalog</span>
</a>
- <!--
- Link to experimental Angular staff catalog.
- Leaving disabled until more functionality can be fleshed out.
- -->
- <a class="dropdown-item"
- routerLink="/staff/catalog/search">
+ <a *ngIf="showAngularCatalog"
+ class="dropdown-item"
+ routerLink="/staff/catalog/search">
<span class="material-icons">search</span>
<span i18n>Staff Catalog (Experimental)</span>
</a>
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common';
+import {OrgService} from '@eg/core/org.service';
import {AuthService} from '@eg/core/auth.service';
import {PcrudService} from '@eg/core/pcrud.service';
import {LocaleService} from '@eg/core/locale.service';
locales: any[];
currentLocale: any;
+ // When active, show a link to the experimental Angular staff catalog
+ showAngularCatalog: boolean;
+
constructor(
private router: Router,
+ private org: OrgService,
private auth: AuthService,
private pcrud: PcrudService,
private locale: LocaleService,
l => l.code() === this.locale.currentLocaleCode())[0];
}
);
+
+ // NOTE: this can eventually go away.
+ // Avoid attempts to fetch org settings if the user has not yet
+ // logged in (e.g. this is the login page).
+ if (this.user()) {
+ this.org.settings('ui.staff.angular_catalog.enabled')
+ .then(settings => this.showAngularCatalog =
+ Boolean(settings['ui.staff.angular_catalog.enabled']));
+ }
}
user() {
'lib.timezone',
'webstaff.format.dates',
'webstaff.format.date_and_time',
- 'ui.staff.max_recent_patrons'
+ 'ui.staff.max_recent_patrons',
+ 'ui.staff.angular_catalog.enabled' // navbar
]).then(settings => {
this.format.wsOrgTimezone = settings['lib.timezone'];
this.format.dateFormat = settings['webstaff.format.dates'];
)
);
-
+-- NOTE: This setting should be removed once the Angular catalog
+-- becomes the default.
+INSERT into config.org_unit_setting_type
+ (name, datatype, grp, label, description)
+VALUES (
+ 'ui.staff.angular_catalog.enabled', 'bool', 'gui',
+ oils_i18n_gettext(
+ 'ui.staff.angular_catalog.enabled',
+ 'GUI: Enable Experimental Angular Staff Catalog',
+ 'coust', 'label'
+ ),
+ oils_i18n_gettext(
+ 'ui.staff.angular_catalog.enabled',
+ 'Display an entry point in the browser client for the ' ||
+ 'experimental Angular staff catalog.',
+ 'coust', 'description'
+ )
+);
INSERT INTO config.org_unit_setting_type
(name, label, description, grp, datatype)
--- /dev/null
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT into config.org_unit_setting_type
+ (name, datatype, grp, label, description)
+VALUES (
+ 'ui.staff.angular_catalog.enabled', 'bool', 'gui',
+ oils_i18n_gettext(
+ 'ui.staff.angular_catalog.enabled',
+ 'GUI: Enable Experimental Angular Staff Catalog',
+ 'coust', 'label'
+ ),
+ oils_i18n_gettext(
+ 'ui.staff.angular_catalog.enabled',
+ 'Display an entry point in the browser client for the ' ||
+ 'experimental Angular staff catalog.',
+ 'coust', 'description'
+ )
+);
+
+COMMIT;
+
</li>
<!--
Link to experimental Angular staff catalog.
- Leaving disabled until more functionality can be fleshed out.
-->
- <!--
- <li>
- <a href="/eg2/staff/catalog/search" target="_self">
+ <li ng-if="showAngularCatalog">
+ <a href="/eg2/staff/catalog/search">
<span class="glyphicon glyphicon-search"></span>
<span>[% l('Staff Catalog (Experimental)') %]</span>
</a>
</li>
- -->
<li>
<a href="./cat/bucket/record/view" target="_self">
<span class="glyphicon glyphicon-list-alt"></span>
$scope.username = egCore.auth.user().usrname();
$scope.workstation = egCore.auth.workstation();
- egCore.org.settings('ui.staff.max_recent_patrons')
- .then(function(s) {
+ egCore.org.settings([
+ 'ui.staff.max_recent_patrons',
+ 'ui.staff.angular_catalog.enabled'
+ ]).then(function(s) {
var val = s['ui.staff.max_recent_patrons'];
$scope.showRecentPatron = val > 0;
$scope.showRecentPatrons = val > 1;
+
+ $scope.showAngularCatalog =
+ s['ui.staff.angular_catalog.enabled'];
});
}
// need to defer initialization of hotkeys to this point
'webstaff.format.dates',
'webstaff.format.date_and_time',
'ui.staff.max_recent_patrons', // affects navbar
+ 'ui.staff.angular_catalog.enabled', // affects navbar
'lib.timezone'
]).then(
function(set) {