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 <berickxx@gmail.com>
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) {
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();