From: Bill Erickson Date: Wed, 23 Apr 2014 14:14:53 +0000 (-0400) Subject: browser staff : print config UI cont. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=519d65c5abfa41486f30e41b59e9da603c694b23;p=working%2FEvergreen.git browser staff : print config UI cont. Signed-off-by: Bill Erickson --- 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 c4eb1dc14c..9ae2a3c62e 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 @@ -38,6 +38,7 @@ function($scope , egPrintStore) { $scope.setContext = function(ctx) { $scope.context = ctx; $scope.isTestView = false; + $scope.actionPending = false; } $scope.setContext('default'); @@ -86,6 +87,7 @@ function($scope , egPrintStore) { }); $scope.printerConfString = function() { + if ($scope.printConfigError) return $scope.printConfigError; if (!$scope.printConfig) return; if (!$scope.printConfig[$scope.context]) return; return JSON.stringify( @@ -93,6 +95,8 @@ function($scope , egPrintStore) { } $scope.resetConfig = function() { + $scope.actionPending = true; + $scope.printConfigError = null; $scope.printConfig[$scope.context] = { context : $scope.context } @@ -101,15 +105,22 @@ function($scope , egPrintStore) { $scope.printConfig[$scope.context].printer = $scope.defaultPrinter.name; } + + egPrintStore.setPrintConfig($scope.printConfig) + .finally(function() {$scope.actionPending = false}); } $scope.configurePrinter = function() { + $scope.printConfigError = null; $scope.actionPending = true; egPrintStore.configurePrinter( $scope.context, $scope.printConfig[$scope.context].printer ) - .then(function(config) {$scope.printConfig = config}) + .then( + function(config) {$scope.printConfig = config}, + function(error) {$scope.printConfigError = error} + ) .finally(function() {$scope.actionPending = false}); } diff --git a/Open-ILS/web/js/ui/default/staff/services/printstore.js b/Open-ILS/web/js/ui/default/staff/services/printstore.js index cd8dfccee0..8992db2610 100644 --- a/Open-ILS/web/js/ui/default/staff/services/printstore.js +++ b/Open-ILS/web/js/ui/default/staff/services/printstore.js @@ -246,7 +246,7 @@ angular.module('egCoreMod') }); } - service.setPrintConfig = function() { + service.setPrintConfig = function(conf) { service.printConfig = conf; return service.setItem('eg.printing.config', conf); } @@ -271,8 +271,12 @@ angular.module('egCoreMod') // set the returned settings to the requested context .then(function(newconf) { - newconf.printer = printer; - return service.printConfig[context] = newconf; + if (angular.isObject(newconf)) { + newconf.printer = printer; + return service.printConfig[context] = newconf; + } else { + console.warn("configurePrinter() returned " + newconf); + } }) // store the newly linked settings