From 77d0ba79a6d1ffca494d93d6f5ec328e6165d550 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 22 Apr 2019 14:02:05 -0700 Subject: [PATCH] LP1825891 AngJS support Hatch 'hostname' for registration Populate the workstation name with the hostname of the PC when registring a new workstation for Hatch-enabled workstations. Note the code gracefully returns null if Hatch returns a 404 (not found) or Hatch is not active. Signed-off-by: Bill Erickson --- Open-ILS/web/js/ui/default/staff/admin/workstation/app.js | 4 ++++ Open-ILS/web/js/ui/default/staff/services/hatch.js | 13 +++++++++++++ 2 files changed, 17 insertions(+) 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 d863844e3d..c4b00d082e 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 @@ -823,6 +823,10 @@ function($scope , $q , $window , $location , egCore , egAlertDialog , workstatio console.log('set context org to ' + $scope.contextOrg); + egCore.hatch.hostname().then(function(name) { + $scope.newWSName = name || ''; + }); + // fetch workstation reg perms egCore.perm.hasPermAt('REGISTER_WORKSTATION', true) .then(function(orgList) { diff --git a/Open-ILS/web/js/ui/default/staff/services/hatch.js b/Open-ILS/web/js/ui/default/staff/services/hatch.js index 467091aaae..a6edaa3099 100644 --- a/Open-ILS/web/js/ui/default/staff/services/hatch.js +++ b/Open-ILS/web/js/ui/default/staff/services/hatch.js @@ -890,6 +890,19 @@ angular.module('egCoreMod') return deferred.promise; } + service.hostname = function() { + if (service.hatchAvailable) { + return service.attemptHatchDelivery({action : 'hostname'}) + .then( + function(name) { return name; }, + // Gracefully handle case where Hatch has not yet been + // updated to include the hostname command. + function() {return null} + ); + } + return $q.when(null); + } + // The only requirement for opening Hatch is that the DOM be loaded. // Open the connection now so its state will be immediately available. service.openHatch(); -- 2.11.0