mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-724: Migrate usage of var to const/let in all directly touched code.
This commit is contained in:
@@ -24,26 +24,26 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
function clientController($scope, $routeParams, $injector) {
|
function clientController($scope, $routeParams, $injector) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ConnectionGroup = $injector.get('ConnectionGroup');
|
const ConnectionGroup = $injector.get('ConnectionGroup');
|
||||||
var ManagedClient = $injector.get('ManagedClient');
|
const ManagedClient = $injector.get('ManagedClient');
|
||||||
var ManagedClientGroup = $injector.get('ManagedClientGroup');
|
const ManagedClientGroup = $injector.get('ManagedClientGroup');
|
||||||
var ManagedClientState = $injector.get('ManagedClientState');
|
const ManagedClientState = $injector.get('ManagedClientState');
|
||||||
var ManagedFilesystem = $injector.get('ManagedFilesystem');
|
const ManagedFilesystem = $injector.get('ManagedFilesystem');
|
||||||
var Protocol = $injector.get('Protocol');
|
const Protocol = $injector.get('Protocol');
|
||||||
var ScrollState = $injector.get('ScrollState');
|
const ScrollState = $injector.get('ScrollState');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $location = $injector.get('$location');
|
const $location = $injector.get('$location');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
const authenticationService = $injector.get('authenticationService');
|
||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
const connectionGroupService = $injector.get('connectionGroupService');
|
||||||
var clipboardService = $injector.get('clipboardService');
|
const clipboardService = $injector.get('clipboardService');
|
||||||
var dataSourceService = $injector.get('dataSourceService');
|
const dataSourceService = $injector.get('dataSourceService');
|
||||||
var guacClientManager = $injector.get('guacClientManager');
|
const guacClientManager = $injector.get('guacClientManager');
|
||||||
var iconService = $injector.get('iconService');
|
const iconService = $injector.get('iconService');
|
||||||
var preferenceService = $injector.get('preferenceService');
|
const preferenceService = $injector.get('preferenceService');
|
||||||
var requestService = $injector.get('requestService');
|
const requestService = $injector.get('requestService');
|
||||||
var tunnelService = $injector.get('tunnelService');
|
const tunnelService = $injector.get('tunnelService');
|
||||||
var userPageService = $injector.get('userPageService');
|
const userPageService = $injector.get('userPageService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The minimum number of pixels a drag gesture must move to result in the
|
* The minimum number of pixels a drag gesture must move to result in the
|
||||||
@@ -230,7 +230,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
$scope.addRemoveClient = function addRemoveClient(id, remove) {
|
$scope.addRemoveClient = function addRemoveClient(id, remove) {
|
||||||
|
|
||||||
// Deconstruct current path into corresponding client IDs
|
// Deconstruct current path into corresponding client IDs
|
||||||
var ids = ManagedClientGroup.getClientIdentifiers($routeParams.id);
|
const ids = ManagedClientGroup.getClientIdentifiers($routeParams.id);
|
||||||
|
|
||||||
// Add/remove ID as requested
|
// Add/remove ID as requested
|
||||||
if (remove)
|
if (remove)
|
||||||
@@ -247,9 +247,9 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
* Reloads the contents of $scope.clientGroup to reflect the client IDs
|
* Reloads the contents of $scope.clientGroup to reflect the client IDs
|
||||||
* currently listed in the URL.
|
* currently listed in the URL.
|
||||||
*/
|
*/
|
||||||
var reparseRoute = function reparseRoute() {
|
const reparseRoute = function reparseRoute() {
|
||||||
|
|
||||||
var previousClients = $scope.clientGroup ? $scope.clientGroup.clients.slice() : [];
|
const previousClients = $scope.clientGroup ? $scope.clientGroup.clients.slice() : [];
|
||||||
|
|
||||||
// Replace existing group with new group
|
// Replace existing group with new group
|
||||||
setAttachedGroup(guacClientManager.getManagedClientGroup($routeParams.id));
|
setAttachedGroup(guacClientManager.getManagedClientGroup($routeParams.id));
|
||||||
@@ -282,7 +282,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
* @param {ManagedClientGroup} [managedClientGroup]
|
* @param {ManagedClientGroup} [managedClientGroup]
|
||||||
* The ManagedClientGroup to attach to the interface, if any.
|
* The ManagedClientGroup to attach to the interface, if any.
|
||||||
*/
|
*/
|
||||||
var setAttachedGroup = function setAttachedGroup(managedClientGroup) {
|
const setAttachedGroup = function setAttachedGroup(managedClientGroup) {
|
||||||
|
|
||||||
if ($scope.clientGroup) {
|
if ($scope.clientGroup) {
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
// seen their status)
|
// seen their status)
|
||||||
_.filter($scope.clientGroup.clients, client => {
|
_.filter($scope.clientGroup.clients, client => {
|
||||||
|
|
||||||
var connectionState = client.clientState.connectionState;
|
const connectionState = client.clientState.connectionState;
|
||||||
return connectionState === ManagedClientState.ConnectionState.DISCONNECTED
|
return connectionState === ManagedClientState.ConnectionState.DISCONNECTED
|
||||||
|| connectionState === ManagedClientState.ConnectionState.TUNNEL_ERROR
|
|| connectionState === ManagedClientState.ConnectionState.TUNNEL_ERROR
|
||||||
|| connectionState === ManagedClientState.ConnectionState.CLIENT_ERROR;
|
|| connectionState === ManagedClientState.ConnectionState.CLIENT_ERROR;
|
||||||
@@ -393,7 +393,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
* true if Ctrl+Alt+Shift has been pressed, false otherwise.
|
* true if Ctrl+Alt+Shift has been pressed, false otherwise.
|
||||||
*/
|
*/
|
||||||
var isMenuShortcutPressed = function isMenuShortcutPressed(keyboard) {
|
const isMenuShortcutPressed = function isMenuShortcutPressed(keyboard) {
|
||||||
|
|
||||||
// Ctrl+Alt+Shift has NOT been pressed if any key is currently held
|
// Ctrl+Alt+Shift has NOT been pressed if any key is currently held
|
||||||
// down that isn't Ctrl, Alt, or Shift
|
// down that isn't Ctrl, Alt, or Shift
|
||||||
@@ -468,7 +468,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
// Automatically track and cache the currently-focused client
|
// Automatically track and cache the currently-focused client
|
||||||
$scope.$on('guacClientFocused', function focusedClientChanged(event, newFocusedClient) {
|
$scope.$on('guacClientFocused', function focusedClientChanged(event, newFocusedClient) {
|
||||||
|
|
||||||
var oldFocusedClient = $scope.focusedClient;
|
const oldFocusedClient = $scope.focusedClient;
|
||||||
$scope.focusedClient = newFocusedClient;
|
$scope.focusedClient = newFocusedClient;
|
||||||
|
|
||||||
// Apply any parameter changes when focus is changing
|
// Apply any parameter changes when focus is changing
|
||||||
@@ -543,7 +543,7 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams
|
|||||||
|
|
||||||
// Count total number of links within the ManagedClient's share link map
|
// Count total number of links within the ManagedClient's share link map
|
||||||
var linkCount = 0;
|
var linkCount = 0;
|
||||||
for (var dummy in $scope.focusedClient.shareLinks)
|
for (const dummy in $scope.focusedClient.shareLinks)
|
||||||
linkCount++;
|
linkCount++;
|
||||||
|
|
||||||
return linkCount;
|
return linkCount;
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
angular.module('client').directive('guacClient', [function guacClient() {
|
angular.module('client').directive('guacClient', [function guacClient() {
|
||||||
|
|
||||||
var directive = {
|
const directive = {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
replace: true,
|
replace: true,
|
||||||
templateUrl: 'app/client/templates/guacClient.html'
|
templateUrl: 'app/client/templates/guacClient.html'
|
||||||
@@ -51,31 +51,31 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
function guacClientController($scope, $injector, $element) {
|
function guacClientController($scope, $injector, $element) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ManagedClient = $injector.get('ManagedClient');
|
const ManagedClient = $injector.get('ManagedClient');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $window = $injector.get('$window');
|
const $window = $injector.get('$window');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the local, hardware mouse cursor is in use.
|
* Whether the local, hardware mouse cursor is in use.
|
||||||
*
|
*
|
||||||
* @type Boolean
|
* @type Boolean
|
||||||
*/
|
*/
|
||||||
var localCursor = false;
|
let localCursor = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current Guacamole client instance.
|
* The current Guacamole client instance.
|
||||||
*
|
*
|
||||||
* @type Guacamole.Client
|
* @type Guacamole.Client
|
||||||
*/
|
*/
|
||||||
var client = null;
|
let client = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The display of the current Guacamole client instance.
|
* The display of the current Guacamole client instance.
|
||||||
*
|
*
|
||||||
* @type Guacamole.Display
|
* @type Guacamole.Display
|
||||||
*/
|
*/
|
||||||
var display = null;
|
let display = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The element associated with the display of the current
|
* The element associated with the display of the current
|
||||||
@@ -83,21 +83,21 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
*
|
*
|
||||||
* @type Element
|
* @type Element
|
||||||
*/
|
*/
|
||||||
var displayElement = null;
|
let displayElement = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The element which must contain the Guacamole display element.
|
* The element which must contain the Guacamole display element.
|
||||||
*
|
*
|
||||||
* @type Element
|
* @type Element
|
||||||
*/
|
*/
|
||||||
var displayContainer = $element.find('.display')[0];
|
const displayContainer = $element.find('.display')[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main containing element for the entire directive.
|
* The main containing element for the entire directive.
|
||||||
*
|
*
|
||||||
* @type Element
|
* @type Element
|
||||||
*/
|
*/
|
||||||
var main = $element[0];
|
const main = $element[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guacamole mouse event object, wrapped around the main client
|
* Guacamole mouse event object, wrapped around the main client
|
||||||
@@ -105,7 +105,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
*
|
*
|
||||||
* @type Guacamole.Mouse
|
* @type Guacamole.Mouse
|
||||||
*/
|
*/
|
||||||
var mouse = new Guacamole.Mouse(displayContainer);
|
const mouse = new Guacamole.Mouse(displayContainer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guacamole absolute mouse emulation object, wrapped around the
|
* Guacamole absolute mouse emulation object, wrapped around the
|
||||||
@@ -113,7 +113,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
*
|
*
|
||||||
* @type Guacamole.Mouse.Touchscreen
|
* @type Guacamole.Mouse.Touchscreen
|
||||||
*/
|
*/
|
||||||
var touchScreen = new Guacamole.Mouse.Touchscreen(displayContainer);
|
const touchScreen = new Guacamole.Mouse.Touchscreen(displayContainer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guacamole relative mouse emulation object, wrapped around the
|
* Guacamole relative mouse emulation object, wrapped around the
|
||||||
@@ -121,7 +121,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
*
|
*
|
||||||
* @type Guacamole.Mouse.Touchpad
|
* @type Guacamole.Mouse.Touchpad
|
||||||
*/
|
*/
|
||||||
var touchPad = new Guacamole.Mouse.Touchpad(displayContainer);
|
const touchPad = new Guacamole.Mouse.Touchpad(displayContainer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guacamole touch event handling object, wrapped around the main
|
* Guacamole touch event handling object, wrapped around the main
|
||||||
@@ -129,13 +129,13 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
*
|
*
|
||||||
* @type Guacamole.Touch
|
* @type Guacamole.Touch
|
||||||
*/
|
*/
|
||||||
var touch = new Guacamole.Touch(displayContainer);
|
const touch = new Guacamole.Touch(displayContainer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the scale of the attached Guacamole.Client based on current window
|
* Updates the scale of the attached Guacamole.Client based on current window
|
||||||
* size and "auto-fit" setting.
|
* size and "auto-fit" setting.
|
||||||
*/
|
*/
|
||||||
var updateDisplayScale = function updateDisplayScale() {
|
const updateDisplayScale = function updateDisplayScale() {
|
||||||
|
|
||||||
if (!display) return;
|
if (!display) return;
|
||||||
|
|
||||||
@@ -163,19 +163,19 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
* @param {Guacamole.Mouse.State} mouseState The current mouse
|
* @param {Guacamole.Mouse.State} mouseState The current mouse
|
||||||
* state.
|
* state.
|
||||||
*/
|
*/
|
||||||
var scrollToMouse = function scrollToMouse(mouseState) {
|
const scrollToMouse = function scrollToMouse(mouseState) {
|
||||||
|
|
||||||
// Determine mouse position within view
|
// Determine mouse position within view
|
||||||
var mouse_view_x = mouseState.x + displayContainer.offsetLeft - main.scrollLeft;
|
const mouse_view_x = mouseState.x + displayContainer.offsetLeft - main.scrollLeft;
|
||||||
var mouse_view_y = mouseState.y + displayContainer.offsetTop - main.scrollTop;
|
const mouse_view_y = mouseState.y + displayContainer.offsetTop - main.scrollTop;
|
||||||
|
|
||||||
// Determine viewport dimensions
|
// Determine viewport dimensions
|
||||||
var view_width = main.offsetWidth;
|
const view_width = main.offsetWidth;
|
||||||
var view_height = main.offsetHeight;
|
const view_height = main.offsetHeight;
|
||||||
|
|
||||||
// Determine scroll amounts based on mouse position relative to document
|
// Determine scroll amounts based on mouse position relative to document
|
||||||
|
|
||||||
var scroll_amount_x;
|
let scroll_amount_x;
|
||||||
if (mouse_view_x > view_width)
|
if (mouse_view_x > view_width)
|
||||||
scroll_amount_x = mouse_view_x - view_width;
|
scroll_amount_x = mouse_view_x - view_width;
|
||||||
else if (mouse_view_x < 0)
|
else if (mouse_view_x < 0)
|
||||||
@@ -183,7 +183,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
else
|
else
|
||||||
scroll_amount_x = 0;
|
scroll_amount_x = 0;
|
||||||
|
|
||||||
var scroll_amount_y;
|
let scroll_amount_y;
|
||||||
if (mouse_view_y > view_height)
|
if (mouse_view_y > view_height)
|
||||||
scroll_amount_y = mouse_view_y - view_height;
|
scroll_amount_y = mouse_view_y - view_height;
|
||||||
else if (mouse_view_y < 0)
|
else if (mouse_view_y < 0)
|
||||||
@@ -206,7 +206,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
* @param {Guacamole.Mouse.MouseEvent} event
|
* @param {Guacamole.Mouse.MouseEvent} event
|
||||||
* The mouse event to handle.
|
* The mouse event to handle.
|
||||||
*/
|
*/
|
||||||
var handleMouseEvent = function handleMouseEvent(event) {
|
const handleMouseEvent = function handleMouseEvent(event) {
|
||||||
|
|
||||||
// Do not attempt to handle mouse state changes if the client
|
// Do not attempt to handle mouse state changes if the client
|
||||||
// or display are not yet available
|
// or display are not yet available
|
||||||
@@ -231,7 +231,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
* @param {Guacamole.Mouse.MouseEvent} event
|
* @param {Guacamole.Mouse.MouseEvent} event
|
||||||
* The mouse event to handle.
|
* The mouse event to handle.
|
||||||
*/
|
*/
|
||||||
var handleEmulatedMouseEvent = function handleEmulatedMouseEvent(event) {
|
const handleEmulatedMouseEvent = function handleEmulatedMouseEvent(event) {
|
||||||
|
|
||||||
// Do not attempt to handle mouse state changes if the client
|
// Do not attempt to handle mouse state changes if the client
|
||||||
// or display are not yet available
|
// or display are not yet available
|
||||||
@@ -256,7 +256,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
* @param {Guacamole.Touch.Event} touchEvent
|
* @param {Guacamole.Touch.Event} touchEvent
|
||||||
* The touch event.
|
* The touch event.
|
||||||
*/
|
*/
|
||||||
var handleTouchEvent = function handleTouchEvent(event) {
|
const handleTouchEvent = function handleTouchEvent(event) {
|
||||||
|
|
||||||
// Do not attempt to handle touch state changes if the client
|
// Do not attempt to handle touch state changes if the client
|
||||||
// or display are not yet available
|
// or display are not yet available
|
||||||
@@ -404,9 +404,9 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
// Connect, if not already connected
|
// Connect, if not already connected
|
||||||
ManagedClient.connect($scope.client, main.offsetWidth, main.offsetHeight);
|
ManagedClient.connect($scope.client, main.offsetWidth, main.offsetHeight);
|
||||||
|
|
||||||
var pixelDensity = $window.devicePixelRatio || 1;
|
const pixelDensity = $window.devicePixelRatio || 1;
|
||||||
var width = main.offsetWidth * pixelDensity;
|
const width = main.offsetWidth * pixelDensity;
|
||||||
var height = main.offsetHeight * pixelDensity;
|
const height = main.offsetHeight * pixelDensity;
|
||||||
|
|
||||||
if (display.getWidth() !== width || display.getHeight() !== height)
|
if (display.getWidth() !== width || display.getHeight() !== height)
|
||||||
client.sendSize(width, height);
|
client.sendSize(width, height);
|
||||||
@@ -436,7 +436,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
*
|
*
|
||||||
* @type Number
|
* @type Number
|
||||||
*/
|
*/
|
||||||
var initialScale = null;
|
let initialScale = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a pinch gesture is in progress, the X coordinate of the point on the
|
* If a pinch gesture is in progress, the X coordinate of the point on the
|
||||||
@@ -445,7 +445,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
*
|
*
|
||||||
* @type Number
|
* @type Number
|
||||||
*/
|
*/
|
||||||
var initialCenterX = 0;
|
let initialCenterX = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If a pinch gesture is in progress, the Y coordinate of the point on the
|
* If a pinch gesture is in progress, the Y coordinate of the point on the
|
||||||
@@ -454,7 +454,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
*
|
*
|
||||||
* @type Number
|
* @type Number
|
||||||
*/
|
*/
|
||||||
var initialCenterY = 0;
|
let initialCenterY = 0;
|
||||||
|
|
||||||
// Zoom and pan client via pinch gestures
|
// Zoom and pan client via pinch gestures
|
||||||
$scope.clientPinch = function clientPinch(inProgress, startLength, currentLength, centerX, centerY) {
|
$scope.clientPinch = function clientPinch(inProgress, startLength, currentLength, centerX, centerY) {
|
||||||
@@ -484,7 +484,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine new scale absolutely
|
// Determine new scale absolutely
|
||||||
var currentScale = initialScale * currentLength / startLength;
|
let currentScale = initialScale * currentLength / startLength;
|
||||||
|
|
||||||
// Fix scale within limits - scroll will be miscalculated otherwise
|
// Fix scale within limits - scroll will be miscalculated otherwise
|
||||||
currentScale = Math.max(currentScale, $scope.client.clientProperties.minScale);
|
currentScale = Math.max(currentScale, $scope.client.clientProperties.minScale);
|
||||||
@@ -564,7 +564,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
* @param {Event} e
|
* @param {Event} e
|
||||||
* The event related to the in-progress drag/drop operation.
|
* The event related to the in-progress drag/drop operation.
|
||||||
*/
|
*/
|
||||||
var notifyDragStart = function notifyDragStart(e) {
|
const notifyDragStart = function notifyDragStart(e) {
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -583,7 +583,7 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
* @param {Event} e
|
* @param {Event} e
|
||||||
* The event related to the end of the former drag/drop operation.
|
* The event related to the end of the former drag/drop operation.
|
||||||
*/
|
*/
|
||||||
var notifyDragEnd = function notifyDragEnd(e) {
|
const notifyDragEnd = function notifyDragEnd(e) {
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -608,8 +608,8 @@ angular.module('client').directive('guacClient', [function guacClient() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Upload each file
|
// Upload each file
|
||||||
var files = e.dataTransfer.files;
|
const files = e.dataTransfer.files;
|
||||||
for (var i=0; i<files.length; i++)
|
for (let i = 0; i < files.length; i++)
|
||||||
ManagedClient.uploadFile($scope.client, files[i]);
|
ManagedClient.uploadFile($scope.client, files[i]);
|
||||||
|
|
||||||
}, false);
|
}, false);
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
angular.module('client').directive('guacClientNotification', [function guacClientNotification() {
|
angular.module('client').directive('guacClientNotification', [function guacClientNotification() {
|
||||||
|
|
||||||
var directive = {
|
const directive = {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
replace: true,
|
replace: true,
|
||||||
templateUrl: 'app/client/templates/guacClientNotification.html'
|
templateUrl: 'app/client/templates/guacClientNotification.html'
|
||||||
@@ -45,16 +45,16 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
function guacClientNotificationController($scope, $injector, $element) {
|
function guacClientNotificationController($scope, $injector, $element) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ManagedClient = $injector.get('ManagedClient');
|
const ManagedClient = $injector.get('ManagedClient');
|
||||||
var ManagedClientState = $injector.get('ManagedClientState');
|
const ManagedClientState = $injector.get('ManagedClientState');
|
||||||
var Protocol = $injector.get('Protocol');
|
const Protocol = $injector.get('Protocol');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $location = $injector.get('$location');
|
const $location = $injector.get('$location');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
const authenticationService = $injector.get('authenticationService');
|
||||||
var guacClientManager = $injector.get('guacClientManager');
|
const guacClientManager = $injector.get('guacClientManager');
|
||||||
var requestService = $injector.get('requestService');
|
const requestService = $injector.get('requestService');
|
||||||
var userPageService = $injector.get('userPageService');
|
const userPageService = $injector.get('userPageService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Notification object describing the client status to display as a
|
* A Notification object describing the client status to display as a
|
||||||
@@ -70,7 +70,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* code not present in this list will be represented by the "DEFAULT"
|
* code not present in this list will be represented by the "DEFAULT"
|
||||||
* translation.
|
* translation.
|
||||||
*/
|
*/
|
||||||
var CLIENT_ERRORS = {
|
const CLIENT_ERRORS = {
|
||||||
0x0201: true,
|
0x0201: true,
|
||||||
0x0202: true,
|
0x0202: true,
|
||||||
0x0203: true,
|
0x0203: true,
|
||||||
@@ -89,7 +89,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* All error codes for which automatic reconnection is appropriate when a
|
* All error codes for which automatic reconnection is appropriate when a
|
||||||
* client error occurs.
|
* client error occurs.
|
||||||
*/
|
*/
|
||||||
var CLIENT_AUTO_RECONNECT = {
|
const CLIENT_AUTO_RECONNECT = {
|
||||||
0x0200: true,
|
0x0200: true,
|
||||||
0x0202: true,
|
0x0202: true,
|
||||||
0x0203: true,
|
0x0203: true,
|
||||||
@@ -104,7 +104,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* code not present in this list will be represented by the "DEFAULT"
|
* code not present in this list will be represented by the "DEFAULT"
|
||||||
* translation.
|
* translation.
|
||||||
*/
|
*/
|
||||||
var TUNNEL_ERRORS = {
|
const TUNNEL_ERRORS = {
|
||||||
0x0201: true,
|
0x0201: true,
|
||||||
0x0202: true,
|
0x0202: true,
|
||||||
0x0203: true,
|
0x0203: true,
|
||||||
@@ -122,7 +122,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* All error codes for which automatic reconnection is appropriate when a
|
* All error codes for which automatic reconnection is appropriate when a
|
||||||
* tunnel error occurs.
|
* tunnel error occurs.
|
||||||
*/
|
*/
|
||||||
var TUNNEL_AUTO_RECONNECT = {
|
const TUNNEL_AUTO_RECONNECT = {
|
||||||
0x0200: true,
|
0x0200: true,
|
||||||
0x0202: true,
|
0x0202: true,
|
||||||
0x0203: true,
|
0x0203: true,
|
||||||
@@ -134,7 +134,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
/**
|
/**
|
||||||
* Action which logs out from Guacamole entirely.
|
* Action which logs out from Guacamole entirely.
|
||||||
*/
|
*/
|
||||||
var LOGOUT_ACTION = {
|
const LOGOUT_ACTION = {
|
||||||
name : "CLIENT.ACTION_LOGOUT",
|
name : "CLIENT.ACTION_LOGOUT",
|
||||||
className : "logout button",
|
className : "logout button",
|
||||||
callback : function logoutCallback() {
|
callback : function logoutCallback() {
|
||||||
@@ -147,7 +147,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* Action which returns the user to the home screen. If the home page has
|
* Action which returns the user to the home screen. If the home page has
|
||||||
* not yet been determined, this will be null.
|
* not yet been determined, this will be null.
|
||||||
*/
|
*/
|
||||||
var NAVIGATE_HOME_ACTION = null;
|
let NAVIGATE_HOME_ACTION = null;
|
||||||
|
|
||||||
// Assign home page action once user's home page has been determined
|
// Assign home page action once user's home page has been determined
|
||||||
userPageService.getHomePage()
|
userPageService.getHomePage()
|
||||||
@@ -169,7 +169,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
/**
|
/**
|
||||||
* Action which replaces the current client with a newly-connected client.
|
* Action which replaces the current client with a newly-connected client.
|
||||||
*/
|
*/
|
||||||
var RECONNECT_ACTION = {
|
const RECONNECT_ACTION = {
|
||||||
name : "CLIENT.ACTION_RECONNECT",
|
name : "CLIENT.ACTION_RECONNECT",
|
||||||
className : "reconnect button",
|
className : "reconnect button",
|
||||||
callback : function reconnectCallback() {
|
callback : function reconnectCallback() {
|
||||||
@@ -182,7 +182,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* The reconnect countdown to display if an error or status warrants an
|
* The reconnect countdown to display if an error or status warrants an
|
||||||
* automatic, timed reconnect.
|
* automatic, timed reconnect.
|
||||||
*/
|
*/
|
||||||
var RECONNECT_COUNTDOWN = {
|
const RECONNECT_COUNTDOWN = {
|
||||||
text: "CLIENT.TEXT_RECONNECT_COUNTDOWN",
|
text: "CLIENT.TEXT_RECONNECT_COUNTDOWN",
|
||||||
callback: RECONNECT_ACTION.callback,
|
callback: RECONNECT_ACTION.callback,
|
||||||
remaining: 15
|
remaining: 15
|
||||||
@@ -200,7 +200,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* The status notification to show, as would be accepted by
|
* The status notification to show, as would be accepted by
|
||||||
* guacNotification.showStatus().
|
* guacNotification.showStatus().
|
||||||
*/
|
*/
|
||||||
var notifyConnectionClosed = function notifyConnectionClosed(status) {
|
const notifyConnectionClosed = function notifyConnectionClosed(status) {
|
||||||
|
|
||||||
// Re-authenticate to verify auth status at end of connection
|
// Re-authenticate to verify auth status at end of connection
|
||||||
authenticationService.updateCurrentToken($location.search())
|
authenticationService.updateCurrentToken($location.search())
|
||||||
@@ -220,7 +220,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* The current connection state, as defined by
|
* The current connection state, as defined by
|
||||||
* ManagedClientState.ConnectionState.
|
* ManagedClientState.ConnectionState.
|
||||||
*/
|
*/
|
||||||
var notifyConnectionState = function notifyConnectionState(connectionState) {
|
const notifyConnectionState = function notifyConnectionState(connectionState) {
|
||||||
|
|
||||||
// Hide any existing status
|
// Hide any existing status
|
||||||
$scope.status = false;
|
$scope.status = false;
|
||||||
@@ -230,14 +230,14 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Build array of available actions
|
// Build array of available actions
|
||||||
var actions;
|
let actions;
|
||||||
if (NAVIGATE_HOME_ACTION)
|
if (NAVIGATE_HOME_ACTION)
|
||||||
actions = [ NAVIGATE_HOME_ACTION, RECONNECT_ACTION, LOGOUT_ACTION ];
|
actions = [ NAVIGATE_HOME_ACTION, RECONNECT_ACTION, LOGOUT_ACTION ];
|
||||||
else
|
else
|
||||||
actions = [ RECONNECT_ACTION, LOGOUT_ACTION ];
|
actions = [ RECONNECT_ACTION, LOGOUT_ACTION ];
|
||||||
|
|
||||||
// Get any associated status code
|
// Get any associated status code
|
||||||
var status = $scope.client.clientState.statusCode;
|
const status = $scope.client.clientState.statusCode;
|
||||||
|
|
||||||
// Connecting
|
// Connecting
|
||||||
if (connectionState === ManagedClientState.ConnectionState.CONNECTING
|
if (connectionState === ManagedClientState.ConnectionState.CONNECTING
|
||||||
@@ -254,10 +254,10 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
else if (connectionState === ManagedClientState.ConnectionState.CLIENT_ERROR) {
|
else if (connectionState === ManagedClientState.ConnectionState.CLIENT_ERROR) {
|
||||||
|
|
||||||
// Determine translation name of error
|
// Determine translation name of error
|
||||||
var errorName = (status in CLIENT_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
|
const errorName = (status in CLIENT_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
|
||||||
|
|
||||||
// Determine whether the reconnect countdown applies
|
// Determine whether the reconnect countdown applies
|
||||||
var countdown = (status in CLIENT_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
|
const countdown = (status in CLIENT_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
|
||||||
|
|
||||||
// Show error status
|
// Show error status
|
||||||
notifyConnectionClosed({
|
notifyConnectionClosed({
|
||||||
@@ -276,10 +276,10 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
else if (connectionState === ManagedClientState.ConnectionState.TUNNEL_ERROR) {
|
else if (connectionState === ManagedClientState.ConnectionState.TUNNEL_ERROR) {
|
||||||
|
|
||||||
// Determine translation name of error
|
// Determine translation name of error
|
||||||
var errorName = (status in TUNNEL_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
|
const errorName = (status in TUNNEL_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT";
|
||||||
|
|
||||||
// Determine whether the reconnect countdown applies
|
// Determine whether the reconnect countdown applies
|
||||||
var countdown = (status in TUNNEL_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
|
const countdown = (status in TUNNEL_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null;
|
||||||
|
|
||||||
// Show error status
|
// Show error status
|
||||||
notifyConnectionClosed({
|
notifyConnectionClosed({
|
||||||
@@ -322,18 +322,18 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* instructions, where each object key is the name of a requested
|
* instructions, where each object key is the name of a requested
|
||||||
* parameter and each value is the current value entered by the user.
|
* parameter and each value is the current value entered by the user.
|
||||||
*/
|
*/
|
||||||
var notifyParametersRequired = function notifyParametersRequired(requiredParameters) {
|
const notifyParametersRequired = function notifyParametersRequired(requiredParameters) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action which submits the current set of parameter values, requesting
|
* Action which submits the current set of parameter values, requesting
|
||||||
* that the connection continue.
|
* that the connection continue.
|
||||||
*/
|
*/
|
||||||
var SUBMIT_PARAMETERS = {
|
const SUBMIT_PARAMETERS = {
|
||||||
name : "CLIENT.ACTION_CONTINUE",
|
name : "CLIENT.ACTION_CONTINUE",
|
||||||
className : "button",
|
className : "button",
|
||||||
callback : function submitParameters() {
|
callback : function submitParameters() {
|
||||||
if ($scope.client) {
|
if ($scope.client) {
|
||||||
var params = $scope.client.requiredParameters;
|
const params = $scope.client.requiredParameters;
|
||||||
$scope.client.requiredParameters = null;
|
$scope.client.requiredParameters = null;
|
||||||
ManagedClient.sendArguments($scope.client, params);
|
ManagedClient.sendArguments($scope.client, params);
|
||||||
}
|
}
|
||||||
@@ -344,7 +344,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* Action which cancels submission of additional parameters and
|
* Action which cancels submission of additional parameters and
|
||||||
* disconnects from the current connection.
|
* disconnects from the current connection.
|
||||||
*/
|
*/
|
||||||
var CANCEL_PARAMETER_SUBMISSION = {
|
const CANCEL_PARAMETER_SUBMISSION = {
|
||||||
name : "CLIENT.ACTION_CANCEL",
|
name : "CLIENT.ACTION_CANCEL",
|
||||||
className : "button",
|
className : "button",
|
||||||
callback : function cancelSubmission() {
|
callback : function cancelSubmission() {
|
||||||
@@ -381,7 +381,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* true if the given connection state allows submission of connection
|
* true if the given connection state allows submission of connection
|
||||||
* parameters via "argv" instructions, false otherwise.
|
* parameters via "argv" instructions, false otherwise.
|
||||||
*/
|
*/
|
||||||
var canSubmitParameters = function canSubmitParameters(connectionState) {
|
const canSubmitParameters = function canSubmitParameters(connectionState) {
|
||||||
return (connectionState === ManagedClientState.ConnectionState.WAITING ||
|
return (connectionState === ManagedClientState.ConnectionState.WAITING ||
|
||||||
connectionState === ManagedClientState.ConnectionState.CONNECTED);
|
connectionState === ManagedClientState.ConnectionState.CONNECTED);
|
||||||
};
|
};
|
||||||
@@ -394,8 +394,8 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
'client.forms'
|
'client.forms'
|
||||||
], function clientStateChanged(newValues) {
|
], function clientStateChanged(newValues) {
|
||||||
|
|
||||||
var connectionState = newValues[0];
|
const connectionState = newValues[0];
|
||||||
var requiredParameters = newValues[1];
|
const requiredParameters = newValues[1];
|
||||||
|
|
||||||
// Prompt for parameters only if parameters can actually be submitted
|
// Prompt for parameters only if parameters can actually be submitted
|
||||||
if (requiredParameters && canSubmitParameters(connectionState))
|
if (requiredParameters && canSubmitParameters(connectionState))
|
||||||
@@ -414,7 +414,7 @@ angular.module('client').directive('guacClientNotification', [function guacClien
|
|||||||
* @param {event} e
|
* @param {event} e
|
||||||
* The AngularJS event to selectively prevent.
|
* The AngularJS event to selectively prevent.
|
||||||
*/
|
*/
|
||||||
var preventDefaultDuringNotification = function preventDefaultDuringNotification(e) {
|
const preventDefaultDuringNotification = function preventDefaultDuringNotification(e) {
|
||||||
if ($scope.status && $scope.client.clientProperties.focused)
|
if ($scope.status && $scope.client.clientProperties.focused)
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
@@ -25,12 +25,12 @@
|
|||||||
angular.module('client').directive('guacClientPanel', ['$injector', function guacClientPanel($injector) {
|
angular.module('client').directive('guacClientPanel', ['$injector', function guacClientPanel($injector) {
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var guacClientManager = $injector.get('guacClientManager');
|
const guacClientManager = $injector.get('guacClientManager');
|
||||||
var sessionStorageFactory = $injector.get('sessionStorageFactory');
|
const sessionStorageFactory = $injector.get('sessionStorageFactory');
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ManagedClientGroup = $injector.get('ManagedClientGroup');
|
const ManagedClientGroup = $injector.get('ManagedClientGroup');
|
||||||
var ManagedClientState = $injector.get('ManagedClientState');
|
const ManagedClientState = $injector.get('ManagedClientState');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter/setter for the boolean flag controlling whether the client panel
|
* Getter/setter for the boolean flag controlling whether the client panel
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
angular.module('client').directive('guacClientZoom', [function guacClientZoom() {
|
angular.module('client').directive('guacClientZoom', [function guacClientZoom() {
|
||||||
|
|
||||||
var directive = {
|
const directive = {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
replace: true,
|
replace: true,
|
||||||
templateUrl: 'app/client/templates/guacClientZoom.html'
|
templateUrl: 'app/client/templates/guacClientZoom.html'
|
||||||
|
@@ -41,9 +41,9 @@ angular.module('client').directive('guacFileTransferManager', [function guacFile
|
|||||||
controller: ['$scope', '$injector', function guacFileTransferManagerController($scope, $injector) {
|
controller: ['$scope', '$injector', function guacFileTransferManagerController($scope, $injector) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ManagedClient = $injector.get('ManagedClient');
|
const ManagedClient = $injector.get('ManagedClient');
|
||||||
var ManagedClientGroup = $injector.get('ManagedClientGroup');
|
const ManagedClientGroup = $injector.get('ManagedClientGroup');
|
||||||
var ManagedFileTransferState = $injector.get('ManagedFileTransferState');
|
const ManagedFileTransferState = $injector.get('ManagedFileTransferState');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the given file transfer state indicates an
|
* Determines whether the given file transfer state indicates an
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
angular.module('client').directive('guacTiledClients', [function guacTiledClients() {
|
angular.module('client').directive('guacTiledClients', [function guacTiledClients() {
|
||||||
|
|
||||||
var directive = {
|
const directive = {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
templateUrl: 'app/client/templates/guacTiledClients.html',
|
templateUrl: 'app/client/templates/guacTiledClients.html',
|
||||||
};
|
};
|
||||||
@@ -63,8 +63,8 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient
|
|||||||
function guacTiledClientsController($scope, $injector, $element) {
|
function guacTiledClientsController($scope, $injector, $element) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ManagedClient = $injector.get('ManagedClient');
|
const ManagedClient = $injector.get('ManagedClient');
|
||||||
var ManagedClientGroup = $injector.get('ManagedClientGroup');
|
const ManagedClientGroup = $injector.get('ManagedClientGroup');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the currently-focused ManagedClient. If there is no such
|
* Returns the currently-focused ManagedClient. If there is no such
|
||||||
@@ -76,9 +76,9 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient
|
|||||||
*/
|
*/
|
||||||
$scope.getFocusedClient = function getFocusedClient() {
|
$scope.getFocusedClient = function getFocusedClient() {
|
||||||
|
|
||||||
var managedClientGroup = $scope.clientGroup;
|
const managedClientGroup = $scope.clientGroup;
|
||||||
if (managedClientGroup) {
|
if (managedClientGroup) {
|
||||||
var focusedClients = _.filter(managedClientGroup.clients, client => client.clientProperties.focused);
|
const focusedClients = _.filter(managedClientGroup.clients, client => client.clientProperties.focused);
|
||||||
if (focusedClients.length === 1)
|
if (focusedClients.length === 1)
|
||||||
return focusedClients[0];
|
return focusedClients[0];
|
||||||
}
|
}
|
||||||
@@ -121,10 +121,10 @@ angular.module('client').directive('guacTiledClients', [function guacTiledClient
|
|||||||
// via shift-click
|
// via shift-click
|
||||||
if (shift) {
|
if (shift) {
|
||||||
|
|
||||||
var minRow = $scope.clientGroup.rows - 1;
|
let minRow = $scope.clientGroup.rows - 1;
|
||||||
var minColumn = $scope.clientGroup.columns - 1;
|
let minColumn = $scope.clientGroup.columns - 1;
|
||||||
var maxRow = 0;
|
let maxRow = 0;
|
||||||
var maxColumn = 0;
|
let maxColumn = 0;
|
||||||
|
|
||||||
// Determine extents of selected area
|
// Determine extents of selected area
|
||||||
ManagedClientGroup.forEach($scope.clientGroup, (client, row, column) => {
|
ManagedClientGroup.forEach($scope.clientGroup, (client, row, column) => {
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
angular.module('client').directive('guacTiledThumbnails', [function guacTiledThumbnails() {
|
angular.module('client').directive('guacTiledThumbnails', [function guacTiledThumbnails() {
|
||||||
|
|
||||||
var directive = {
|
const directive = {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
replace: true,
|
replace: true,
|
||||||
templateUrl: 'app/client/templates/guacTiledThumbnails.html'
|
templateUrl: 'app/client/templates/guacTiledThumbnails.html'
|
||||||
@@ -45,7 +45,7 @@ angular.module('client').directive('guacTiledThumbnails', [function guacTiledThu
|
|||||||
function guacTiledThumbnailsController($scope, $injector, $element) {
|
function guacTiledThumbnailsController($scope, $injector, $element) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ManagedClientGroup = $injector.get('ManagedClientGroup');
|
const ManagedClientGroup = $injector.get('ManagedClientGroup');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The overall height of the thumbnail view of the tiled grid of
|
* The overall height of the thumbnail view of the tiled grid of
|
||||||
|
@@ -24,12 +24,12 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
|||||||
function guacClientManager($injector) {
|
function guacClientManager($injector) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ManagedClient = $injector.get('ManagedClient');
|
const ManagedClient = $injector.get('ManagedClient');
|
||||||
var ManagedClientGroup = $injector.get('ManagedClientGroup');
|
const ManagedClientGroup = $injector.get('ManagedClientGroup');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $window = $injector.get('$window');
|
const $window = $injector.get('$window');
|
||||||
var sessionStorageFactory = $injector.get('sessionStorageFactory');
|
const sessionStorageFactory = $injector.get('sessionStorageFactory');
|
||||||
|
|
||||||
var service = {};
|
var service = {};
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
|||||||
*
|
*
|
||||||
* @type Function
|
* @type Function
|
||||||
*/
|
*/
|
||||||
var storedManagedClientGroups = sessionStorageFactory.create([], function destroyClientGroupStorage() {
|
const storedManagedClientGroups = sessionStorageFactory.create([], function destroyClientGroupStorage() {
|
||||||
|
|
||||||
// Disconnect all clients when storage is destroyed
|
// Disconnect all clients when storage is destroyed
|
||||||
service.clear();
|
service.clear();
|
||||||
@@ -89,13 +89,13 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
|||||||
* @param {string} id
|
* @param {string} id
|
||||||
* The ID of the ManagedClient to remove.
|
* The ID of the ManagedClient to remove.
|
||||||
*/
|
*/
|
||||||
var ungroupManagedClient = function ungroupManagedClient(id) {
|
const ungroupManagedClient = function ungroupManagedClient(id) {
|
||||||
|
|
||||||
var managedClientGroups = storedManagedClientGroups();
|
const managedClientGroups = storedManagedClientGroups();
|
||||||
|
|
||||||
// Remove client from all groups
|
// Remove client from all groups
|
||||||
managedClientGroups.forEach(group => {
|
managedClientGroups.forEach(group => {
|
||||||
var removed = _.remove(group.clients, client => (client.id === id));
|
const removed = _.remove(group.clients, client => (client.id === id));
|
||||||
if (removed.length) {
|
if (removed.length) {
|
||||||
|
|
||||||
// Reset focus state if client is being removed from a group
|
// Reset focus state if client is being removed from a group
|
||||||
@@ -165,20 +165,20 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
|||||||
*/
|
*/
|
||||||
service.replaceManagedClient = function replaceManagedClient(id) {
|
service.replaceManagedClient = function replaceManagedClient(id) {
|
||||||
|
|
||||||
var managedClients = storedManagedClients();
|
const managedClients = storedManagedClients();
|
||||||
var managedClientGroups = storedManagedClientGroups();
|
const managedClientGroups = storedManagedClientGroups();
|
||||||
|
|
||||||
// Remove client if it exists
|
// Remove client if it exists
|
||||||
if (id in managedClients) {
|
if (id in managedClients) {
|
||||||
|
|
||||||
var hadFocus = managedClients[id].clientProperties.focused;
|
const hadFocus = managedClients[id].clientProperties.focused;
|
||||||
managedClients[id].client.disconnect();
|
managedClients[id].client.disconnect();
|
||||||
delete managedClients[id];
|
delete managedClients[id];
|
||||||
|
|
||||||
// Remove client from all groups
|
// Remove client from all groups
|
||||||
managedClientGroups.forEach(group => {
|
managedClientGroups.forEach(group => {
|
||||||
|
|
||||||
var index = _.findIndex(group.clients, client => (client.id === id));
|
const index = _.findIndex(group.clients, client => (client.id === id));
|
||||||
if (index === -1)
|
if (index === -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -235,8 +235,8 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
|||||||
*/
|
*/
|
||||||
service.getManagedClientGroup = function getManagedClientGroup(id) {
|
service.getManagedClientGroup = function getManagedClientGroup(id) {
|
||||||
|
|
||||||
var managedClientGroups = storedManagedClientGroups();
|
const managedClientGroups = storedManagedClientGroups();
|
||||||
var existingGroup = _.find(managedClientGroups, (group) => {
|
const existingGroup = _.find(managedClientGroups, (group) => {
|
||||||
return id === ManagedClientGroup.getIdentifier(group);
|
return id === ManagedClientGroup.getIdentifier(group);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -244,8 +244,8 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
|||||||
if (existingGroup)
|
if (existingGroup)
|
||||||
return existingGroup;
|
return existingGroup;
|
||||||
|
|
||||||
var clients = [];
|
const clients = [];
|
||||||
var clientIds = ManagedClientGroup.getClientIdentifiers(id);
|
const clientIds = ManagedClientGroup.getClientIdentifiers(id);
|
||||||
|
|
||||||
// Separate active clients by whether they should be displayed within
|
// Separate active clients by whether they should be displayed within
|
||||||
// the current view
|
// the current view
|
||||||
@@ -253,7 +253,7 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
|||||||
clients.push(service.getManagedClient(id));
|
clients.push(service.getManagedClient(id));
|
||||||
});
|
});
|
||||||
|
|
||||||
var group = new ManagedClientGroup({
|
const group = new ManagedClientGroup({
|
||||||
clients : clients
|
clients : clients
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -279,17 +279,17 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
|||||||
*/
|
*/
|
||||||
service.removeManagedClientGroup = function removeManagedClientGroup(id) {
|
service.removeManagedClientGroup = function removeManagedClientGroup(id) {
|
||||||
|
|
||||||
var managedClients = storedManagedClients();
|
const managedClients = storedManagedClients();
|
||||||
var managedClientGroups = storedManagedClientGroups();
|
const managedClientGroups = storedManagedClientGroups();
|
||||||
|
|
||||||
// Remove all matching groups (there SHOULD only be one)
|
// Remove all matching groups (there SHOULD only be one)
|
||||||
var removed = _.remove(managedClientGroups, (group) => ManagedClientGroup.getIdentifier(group) === id);
|
const removed = _.remove(managedClientGroups, (group) => ManagedClientGroup.getIdentifier(group) === id);
|
||||||
|
|
||||||
// Disconnect all clients associated with the removed group(s)
|
// Disconnect all clients associated with the removed group(s)
|
||||||
removed.forEach((group) => {
|
removed.forEach((group) => {
|
||||||
group.clients.forEach((client) => {
|
group.clients.forEach((client) => {
|
||||||
|
|
||||||
var id = client.id;
|
const id = client.id;
|
||||||
if (managedClients[id]) {
|
if (managedClients[id]) {
|
||||||
managedClients[id].client.disconnect();
|
managedClients[id].client.disconnect();
|
||||||
delete managedClients[id];
|
delete managedClients[id];
|
||||||
|
@@ -24,34 +24,34 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
function defineManagedClient($rootScope, $injector) {
|
function defineManagedClient($rootScope, $injector) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ClientProperties = $injector.get('ClientProperties');
|
const ClientProperties = $injector.get('ClientProperties');
|
||||||
var ClientIdentifier = $injector.get('ClientIdentifier');
|
const ClientIdentifier = $injector.get('ClientIdentifier');
|
||||||
var ClipboardData = $injector.get('ClipboardData');
|
const ClipboardData = $injector.get('ClipboardData');
|
||||||
var ManagedArgument = $injector.get('ManagedArgument');
|
const ManagedArgument = $injector.get('ManagedArgument');
|
||||||
var ManagedClientState = $injector.get('ManagedClientState');
|
const ManagedClientState = $injector.get('ManagedClientState');
|
||||||
var ManagedClientThumbnail = $injector.get('ManagedClientThumbnail');
|
const ManagedClientThumbnail = $injector.get('ManagedClientThumbnail');
|
||||||
var ManagedDisplay = $injector.get('ManagedDisplay');
|
const ManagedDisplay = $injector.get('ManagedDisplay');
|
||||||
var ManagedFilesystem = $injector.get('ManagedFilesystem');
|
const ManagedFilesystem = $injector.get('ManagedFilesystem');
|
||||||
var ManagedFileUpload = $injector.get('ManagedFileUpload');
|
const ManagedFileUpload = $injector.get('ManagedFileUpload');
|
||||||
var ManagedShareLink = $injector.get('ManagedShareLink');
|
const ManagedShareLink = $injector.get('ManagedShareLink');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $document = $injector.get('$document');
|
const $document = $injector.get('$document');
|
||||||
var $q = $injector.get('$q');
|
const $q = $injector.get('$q');
|
||||||
var $rootScope = $injector.get('$rootScope');
|
const $rootScope = $injector.get('$rootScope');
|
||||||
var $window = $injector.get('$window');
|
const $window = $injector.get('$window');
|
||||||
var activeConnectionService = $injector.get('activeConnectionService');
|
const activeConnectionService = $injector.get('activeConnectionService');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
const authenticationService = $injector.get('authenticationService');
|
||||||
var clipboardService = $injector.get('clipboardService');
|
const clipboardService = $injector.get('clipboardService');
|
||||||
var connectionGroupService = $injector.get('connectionGroupService');
|
const connectionGroupService = $injector.get('connectionGroupService');
|
||||||
var connectionService = $injector.get('connectionService');
|
const connectionService = $injector.get('connectionService');
|
||||||
var preferenceService = $injector.get('preferenceService');
|
const preferenceService = $injector.get('preferenceService');
|
||||||
var requestService = $injector.get('requestService');
|
const requestService = $injector.get('requestService');
|
||||||
var tunnelService = $injector.get('tunnelService');
|
const tunnelService = $injector.get('tunnelService');
|
||||||
var guacAudio = $injector.get('guacAudio');
|
const guacAudio = $injector.get('guacAudio');
|
||||||
var guacHistory = $injector.get('guacHistory');
|
const guacHistory = $injector.get('guacHistory');
|
||||||
var guacImage = $injector.get('guacImage');
|
const guacImage = $injector.get('guacImage');
|
||||||
var guacVideo = $injector.get('guacVideo');
|
const guacVideo = $injector.get('guacVideo');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The minimum amount of time to wait between updates to the client
|
* The minimum amount of time to wait between updates to the client
|
||||||
@@ -253,18 +253,18 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
* A promise which resolves with the string of connection parameters to
|
* A promise which resolves with the string of connection parameters to
|
||||||
* be passed to the Guacamole client, once the string is ready.
|
* be passed to the Guacamole client, once the string is ready.
|
||||||
*/
|
*/
|
||||||
var getConnectString = function getConnectString(identifier, width, height) {
|
const getConnectString = function getConnectString(identifier, width, height) {
|
||||||
|
|
||||||
var deferred = $q.defer();
|
const deferred = $q.defer();
|
||||||
|
|
||||||
// Calculate optimal width/height for display
|
// Calculate optimal width/height for display
|
||||||
var pixel_density = $window.devicePixelRatio || 1;
|
const pixel_density = $window.devicePixelRatio || 1;
|
||||||
var optimal_dpi = pixel_density * 96;
|
const optimal_dpi = pixel_density * 96;
|
||||||
var optimal_width = width * pixel_density;
|
const optimal_width = width * pixel_density;
|
||||||
var optimal_height = height * pixel_density;
|
const optimal_height = height * pixel_density;
|
||||||
|
|
||||||
// Build base connect string
|
// Build base connect string
|
||||||
var connectString =
|
let connectString =
|
||||||
"token=" + encodeURIComponent(authenticationService.getCurrentToken())
|
"token=" + encodeURIComponent(authenticationService.getCurrentToken())
|
||||||
+ "&GUAC_DATA_SOURCE=" + encodeURIComponent(identifier.dataSource)
|
+ "&GUAC_DATA_SOURCE=" + encodeURIComponent(identifier.dataSource)
|
||||||
+ "&GUAC_ID=" + encodeURIComponent(identifier.id)
|
+ "&GUAC_ID=" + encodeURIComponent(identifier.id)
|
||||||
@@ -676,7 +676,7 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Parse connection details from ID
|
// Parse connection details from ID
|
||||||
var clientIdentifier = ClientIdentifier.fromString(managedClient.id);
|
const clientIdentifier = ClientIdentifier.fromString(managedClient.id);
|
||||||
|
|
||||||
// Connect the Guacamole client
|
// Connect the Guacamole client
|
||||||
getConnectString(clientIdentifier, width, height)
|
getConnectString(clientIdentifier, width, height)
|
||||||
|
@@ -33,7 +33,7 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
|
|||||||
* The object whose properties should be copied within the new
|
* The object whose properties should be copied within the new
|
||||||
* ManagedClientGroup.
|
* ManagedClientGroup.
|
||||||
*/
|
*/
|
||||||
var ManagedClientGroup = function ManagedClientGroup(template) {
|
const ManagedClientGroup = function ManagedClientGroup(template) {
|
||||||
|
|
||||||
// Use empty object by default
|
// Use empty object by default
|
||||||
template = template || {};
|
template = template || {};
|
||||||
@@ -97,7 +97,7 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
|
|||||||
*/
|
*/
|
||||||
ManagedClientGroup.recalculateTiles = function recalculateTiles(group) {
|
ManagedClientGroup.recalculateTiles = function recalculateTiles(group) {
|
||||||
|
|
||||||
var recalculated = new ManagedClientGroup({
|
const recalculated = new ManagedClientGroup({
|
||||||
clients : group.clients
|
clients : group.clients
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
|
|||||||
|
|
||||||
// Generate a name from ONLY the focused clients, unless there are no
|
// Generate a name from ONLY the focused clients, unless there are no
|
||||||
// focused clients
|
// focused clients
|
||||||
var relevantClients = _.filter(group.clients, client => client.clientProperties.focused);
|
let relevantClients = _.filter(group.clients, client => client.clientProperties.focused);
|
||||||
if (!relevantClients.length)
|
if (!relevantClients.length)
|
||||||
relevantClients = group.clients;
|
relevantClients = group.clients;
|
||||||
|
|
||||||
@@ -262,9 +262,9 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
|
|||||||
* ManagedClientGroup.
|
* ManagedClientGroup.
|
||||||
*/
|
*/
|
||||||
ManagedClientGroup.forEach = function forEach(group, callback) {
|
ManagedClientGroup.forEach = function forEach(group, callback) {
|
||||||
var current = 0;
|
let current = 0;
|
||||||
for (var row = 0; row < group.rows; row++) {
|
for (let row = 0; row < group.rows; row++) {
|
||||||
for (var column = 0; column < group.columns; column++) {
|
for (let column = 0; column < group.columns; column++) {
|
||||||
|
|
||||||
callback(group.clients[current], row, column, current);
|
callback(group.clients[current], row, column, current);
|
||||||
current++;
|
current++;
|
||||||
@@ -312,22 +312,22 @@ angular.module('client').factory('ManagedClientGroup', ['$injector', function de
|
|||||||
*/
|
*/
|
||||||
ManagedClientGroup.getClientGrid = function getClientGrid(group) {
|
ManagedClientGroup.getClientGrid = function getClientGrid(group) {
|
||||||
|
|
||||||
var index = 0;
|
let index = 0;
|
||||||
|
|
||||||
// Operate on cached copy of grid
|
// Operate on cached copy of grid
|
||||||
var clientGrid = group._grid || (group._grid = []);
|
const clientGrid = group._grid || (group._grid = []);
|
||||||
|
|
||||||
// Delete any rows in excess of the required size
|
// Delete any rows in excess of the required size
|
||||||
clientGrid.splice(group.rows);
|
clientGrid.splice(group.rows);
|
||||||
|
|
||||||
for (var row = 0; row < group.rows; row++) {
|
for (let row = 0; row < group.rows; row++) {
|
||||||
|
|
||||||
// Prefer to use existing column arrays, deleting any columns in
|
// Prefer to use existing column arrays, deleting any columns in
|
||||||
// excess of the required size
|
// excess of the required size
|
||||||
var currentRow = clientGrid[row] || (clientGrid[row] = []);
|
const currentRow = clientGrid[row] || (clientGrid[row] = []);
|
||||||
currentRow.splice(group.columns);
|
currentRow.splice(group.columns);
|
||||||
|
|
||||||
for (var column = 0; column < group.columns; column++) {
|
for (let column = 0; column < group.columns; column++) {
|
||||||
currentRow[column] = group.clients[index++] || null;
|
currentRow[column] = group.clients[index++] || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,10 +27,10 @@ angular.module('clipboard').directive('guacClipboard', ['$injector',
|
|||||||
function guacClipboard($injector) {
|
function guacClipboard($injector) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ClipboardData = $injector.get('ClipboardData');
|
const ClipboardData = $injector.get('ClipboardData');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var clipboardService = $injector.get('clipboardService');
|
const clipboardService = $injector.get('clipboardService');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration object for the guacClipboard directive.
|
* Configuration object for the guacClipboard directive.
|
||||||
@@ -78,7 +78,7 @@ angular.module('clipboard').directive('guacClipboard', ['$injector',
|
|||||||
* The ClipboardData to display within the clipboard editor for
|
* The ClipboardData to display within the clipboard editor for
|
||||||
* editing.
|
* editing.
|
||||||
*/
|
*/
|
||||||
var updateClipboardEditor = function updateClipboardEditor(data) {
|
const updateClipboardEditor = function updateClipboardEditor(data) {
|
||||||
|
|
||||||
// If the clipboard data is a string, render it as text
|
// If the clipboard data is a string, render it as text
|
||||||
if (typeof data.data === 'string')
|
if (typeof data.data === 'string')
|
||||||
|
@@ -26,13 +26,13 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
function clipboardService($injector) {
|
function clipboardService($injector) {
|
||||||
|
|
||||||
// Get required services
|
// Get required services
|
||||||
var $q = $injector.get('$q');
|
const $q = $injector.get('$q');
|
||||||
var $window = $injector.get('$window');
|
const $window = $injector.get('$window');
|
||||||
var $rootScope = $injector.get('$rootScope');
|
const $rootScope = $injector.get('$rootScope');
|
||||||
var sessionStorageFactory = $injector.get('sessionStorageFactory');
|
const sessionStorageFactory = $injector.get('sessionStorageFactory');
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ClipboardData = $injector.get('ClipboardData');
|
const ClipboardData = $injector.get('ClipboardData');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter/setter which retrieves or sets the current stored clipboard
|
* Getter/setter which retrieves or sets the current stored clipboard
|
||||||
@@ -42,7 +42,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
*
|
*
|
||||||
* @type Function
|
* @type Function
|
||||||
*/
|
*/
|
||||||
var storedClipboardData = sessionStorageFactory.create(new ClipboardData());
|
const storedClipboardData = sessionStorageFactory.create(new ClipboardData());
|
||||||
|
|
||||||
var service = {};
|
var service = {};
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
* A promise that will resolve if setting the clipboard was successful,
|
* A promise that will resolve if setting the clipboard was successful,
|
||||||
* and will reject if it failed.
|
* and will reject if it failed.
|
||||||
*/
|
*/
|
||||||
var setLocalClipboard = function setLocalClipboard(data) {
|
const setLocalClipboard = function setLocalClipboard(data) {
|
||||||
|
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ angular.module('clipboard').factory('clipboardService', ['$injector',
|
|||||||
* if getting the clipboard was successful, and will reject if it
|
* if getting the clipboard was successful, and will reject if it
|
||||||
* failed.
|
* failed.
|
||||||
*/
|
*/
|
||||||
var getLocalClipboard = function getLocalClipboard() {
|
const getLocalClipboard = function getLocalClipboard() {
|
||||||
|
|
||||||
// If the clipboard is already being read, do not overlap the read
|
// If the clipboard is already being read, do not overlap the read
|
||||||
// attempts; instead share the result across all requests
|
// attempts; instead share the result across all requests
|
||||||
|
@@ -48,21 +48,21 @@ angular.module('element').directive('guacClick', [function guacClick() {
|
|||||||
*
|
*
|
||||||
* @type guacClick~callback
|
* @type guacClick~callback
|
||||||
*/
|
*/
|
||||||
var guacClick = $scope.$eval($attrs.guacClick);
|
const guacClick = $scope.$eval($attrs.guacClick);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The element which will register the click.
|
* The element which will register the click.
|
||||||
*
|
*
|
||||||
* @type Element
|
* @type Element
|
||||||
*/
|
*/
|
||||||
var element = $element[0];
|
const element = $element[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether either Shift key is currently pressed.
|
* Whether either Shift key is currently pressed.
|
||||||
*
|
*
|
||||||
* @type boolean
|
* @type boolean
|
||||||
*/
|
*/
|
||||||
var shift = false;
|
let shift = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether either Ctrl key is currently pressed. To allow the
|
* Whether either Ctrl key is currently pressed. To allow the
|
||||||
@@ -71,7 +71,7 @@ angular.module('element').directive('guacClick', [function guacClick() {
|
|||||||
*
|
*
|
||||||
* @type boolean
|
* @type boolean
|
||||||
*/
|
*/
|
||||||
var ctrl = false;
|
let ctrl = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the state of the {@link shift} and {@link ctrl} flags
|
* Updates the state of the {@link shift} and {@link ctrl} flags
|
||||||
@@ -81,7 +81,7 @@ angular.module('element').directive('guacClick', [function guacClick() {
|
|||||||
* @param {Guacamole.Keyboard} keyboard
|
* @param {Guacamole.Keyboard} keyboard
|
||||||
* The Guacamole.Keyboard instance to read key states from.
|
* The Guacamole.Keyboard instance to read key states from.
|
||||||
*/
|
*/
|
||||||
var updateModifiers = function updateModifiers(keyboard) {
|
const updateModifiers = function updateModifiers(keyboard) {
|
||||||
|
|
||||||
shift = !!(
|
shift = !!(
|
||||||
keyboard.pressed[0xFFE1] // Left shift
|
keyboard.pressed[0xFFE1] // Left shift
|
||||||
|
@@ -24,12 +24,12 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
|||||||
function indexController($scope, $injector) {
|
function indexController($scope, $injector) {
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $document = $injector.get('$document');
|
const $document = $injector.get('$document');
|
||||||
var $route = $injector.get('$route');
|
const $route = $injector.get('$route');
|
||||||
var $window = $injector.get('$window');
|
const $window = $injector.get('$window');
|
||||||
var clipboardService = $injector.get('clipboardService');
|
const clipboardService = $injector.get('clipboardService');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
const guacNotification = $injector.get('guacNotification');
|
||||||
var guacClientManager = $injector.get('guacClientManager');
|
const guacClientManager = $injector.get('guacClientManager');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The error that prevents the current page from rendering at all. If no
|
* The error that prevents the current page from rendering at all. If no
|
||||||
|
Reference in New Issue
Block a user