From: Bill Erickson Date: Wed, 18 Jan 2017 21:22:30 +0000 (-0500) Subject: LP#1646166 Hatch availability display improvements X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=357ce1e1144e104edf7aaebd17e38b44174749f0;p=evergreen%2Fpines.git LP#1646166 Hatch availability display improvements Hide printer settings in the print config UI when Hatch is not available and provide better inline alerts. Avoid attempts by the printer config UI from talking to Hatch when Hatch is known not to be available. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/templates/staff/admin/workstation/t_print_config.tt2 b/Open-ILS/src/templates/staff/admin/workstation/t_print_config.tt2 index 4c88af276d..8cd6bf9747 100644 --- a/Open-ILS/src/templates/staff/admin/workstation/t_print_config.tt2 +++ b/Open-ILS/src/templates/staff/admin/workstation/t_print_config.tt2 @@ -15,19 +15,15 @@
-

[% l('Remote Printer Settings') %]

- -
-[% l('Remote printing is not available on this browser. The settings below will have no effect.') %] -
+

[% l('Hatch Printer Settings') %]

-[% l("Remote printing is not enabled on this browser. The settings below will have no effect until remote printing is enabled.") %] +[% l("Hatch printing is not enabled on this browser. The settings below will have no effect until Hatch printing is enabled.") %] - [% l('Enable Remote Printing.') %] + [% l('Enable Hatch Printing.') %]

@@ -59,8 +55,12 @@
+
+[% l('Hatch is not installed in this browser. Printing must be configured via the native browser print configuration.') %] +
+ -
+
@@ -100,7 +100,7 @@
-
+
@@ -351,7 +351,7 @@
-
+

[% l('Compiled Printer Settings') %]

{{printerConfString()}}
diff --git a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js index 0eac5795f5..a62cd1150f 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/workstation/app.js @@ -215,6 +215,9 @@ function($scope , egCore) { } $scope.setContext('default'); + $scope.setContentType = function(type) { $scope.contentType = type } + $scope.setContentType('text/plain'); + $scope.useHatchPrinting = function() { return egCore.hatch.usePrinting(); } @@ -231,33 +234,6 @@ function($scope , egCore) { return printer; } - // fetch info on all remote printers - egCore.hatch.getPrinters() - .then(function(printers) { - $scope.printers = printers; - - var def = $scope.getPrinterByAttr('is-default', true); - if (!def && printers.length) def = printers[0]; - - if (def) { - $scope.defaultPrinter = def; - loadPrinterOptions(def.name); - } - }).then(function() { - angular.forEach( - ['default','receipt','label','mail','offline'], - function(ctx) { - egCore.hatch.getPrintConfig(ctx).then(function(conf) { - if (conf) { - $scope.printConfig[ctx] = conf; - } else { - $scope.resetPrinterSettings(ctx); - } - }); - } - ); - }); - $scope.resetPrinterSettings = function(context) { $scope.printConfig[context] = { context : context, @@ -291,9 +267,6 @@ function($scope , egCore) { loadPrinterOptions(name); } - // for testing - $scope.setContentType = function(type) { $scope.contentType = type } - $scope.testPrint = function(withDialog) { if ($scope.contentType == 'text/plain') { egCore.print.print({ @@ -317,7 +290,36 @@ function($scope , egCore) { } } - $scope.setContentType('text/plain'); + // Load startup data.... + // Don't bother talking to Hatch if it's not there. + if (!egCore.hatch.hatchAvailable) return; + + // fetch info on all remote printers + egCore.hatch.getPrinters() + .then(function(printers) { + $scope.printers = printers; + + var def = $scope.getPrinterByAttr('is-default', true); + if (!def && printers.length) def = printers[0]; + + if (def) { + $scope.defaultPrinter = def; + loadPrinterOptions(def.name); + } + }).then(function() { + angular.forEach( + ['default','receipt','label','mail','offline'], + function(ctx) { + egCore.hatch.getPrintConfig(ctx).then(function(conf) { + if (conf) { + $scope.printConfig[ctx] = conf; + } else { + $scope.resetPrinterSettings(ctx); + } + }); + } + ); + }); }]) @@ -522,8 +524,10 @@ function($scope , $q , egCore , egConfirmDialog) { function refreshKeys() { $scope.keys = {local : [], remote : []}; - egCore.hatch.getRemoteKeys().then( - function(keys) { $scope.keys.remote = keys.sort() }) + if (egCore.hatch.hatchAvailable) { + egCore.hatch.getRemoteKeys().then( + function(keys) { $scope.keys.remote = keys.sort() }) + } // local calls are non-async $scope.keys.local = egCore.hatch.getLocalKeys();