mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-38: Updated AngularJS components for compatibility with 1.6.x.
This commit is contained in:
@@ -20,28 +20,16 @@
|
|||||||
/**
|
/**
|
||||||
* The controller for making ad-hoc (quick) connections
|
* The controller for making ad-hoc (quick) connections
|
||||||
*/
|
*/
|
||||||
angular.module('guacQuickConnect').controller('quickconnectController', ['$scope', '$injector', '$log',
|
angular.module('guacQuickConnect').controller('quickconnectController', ['$scope', '$injector',
|
||||||
function manageConnectionController($scope, $injector, $log) {
|
function manageConnectionController($scope, $injector) {
|
||||||
|
|
||||||
// Required types
|
// Required types
|
||||||
var ClientIdentifier = $injector.get('ClientIdentifier');
|
var ClientIdentifier = $injector.get('ClientIdentifier');
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $location = $injector.get('$location');
|
var $location = $injector.get('$location');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
var guacNotification = $injector.get('guacNotification');
|
||||||
var quickConnectService = $injector.get('quickConnectService');
|
var quickConnectService = $injector.get('quickConnectService');
|
||||||
|
|
||||||
/**
|
|
||||||
* An action to be provided along with the object sent to showStatus which
|
|
||||||
* closes the currently-shown status dialog.
|
|
||||||
*/
|
|
||||||
var ACKNOWLEDGE_ACTION = {
|
|
||||||
name : "MANAGE_CONNECTION.ACTION_ACKNOWLEDGE",
|
|
||||||
// Handle action
|
|
||||||
callback : function acknowledgeCallback() {
|
|
||||||
guacNotification.showStatus(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The URI that will be passed in to the extension to create
|
* The URI that will be passed in to the extension to create
|
||||||
@@ -56,21 +44,13 @@ angular.module('guacQuickConnect').controller('quickconnectController', ['$scope
|
|||||||
$scope.quickConnect = function quickConnect() {
|
$scope.quickConnect = function quickConnect() {
|
||||||
|
|
||||||
quickConnectService.createConnection($scope.uri)
|
quickConnectService.createConnection($scope.uri)
|
||||||
.success(function createdConnection(connectionId) {
|
.then(function createdConnection(connectionId) {
|
||||||
$location.url('/client/' + ClientIdentifier.toString({
|
$location.url('/client/' + ClientIdentifier.toString({
|
||||||
dataSource : 'quickconnect',
|
dataSource : 'quickconnect',
|
||||||
type : ClientIdentifier.Types.CONNECTION,
|
type : ClientIdentifier.Types.CONNECTION,
|
||||||
id : connectionId
|
id : connectionId
|
||||||
}));
|
}));
|
||||||
})
|
}, guacNotification.SHOW_REQUEST_ERROR);
|
||||||
.error(function createFailed(error) {
|
|
||||||
guacNotification.showStatus({
|
|
||||||
'className' : 'error',
|
|
||||||
'title' : 'MANAGE_CONNECTION.DIALOG_HEADER_ERROR',
|
|
||||||
'text' : error.translatableMessage,
|
|
||||||
'actions' : [ ACKNOWLEDGE_ACTION ]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -24,9 +24,9 @@ angular.module('guacQuickConnect').factory('quickConnectService', ['$injector',
|
|||||||
function quickConnectService($injector) {
|
function quickConnectService($injector) {
|
||||||
|
|
||||||
// Required services
|
// Required services
|
||||||
var $http = $injector.get('$http');
|
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var cacheService = $injector.get('cacheService');
|
var cacheService = $injector.get('cacheService');
|
||||||
|
var requestService = $injector.get('requestService');
|
||||||
|
|
||||||
var service = {};
|
var service = {};
|
||||||
|
|
||||||
@@ -47,17 +47,20 @@ angular.module('guacQuickConnect').factory('quickConnectService', ['$injector',
|
|||||||
token : authenticationService.getCurrentToken()
|
token : authenticationService.getCurrentToken()
|
||||||
};
|
};
|
||||||
|
|
||||||
return $http({
|
return requestService({
|
||||||
method : 'POST',
|
method : 'POST',
|
||||||
url : 'api/session/ext/quickconnect/create',
|
url : 'api/session/ext/quickconnect/create',
|
||||||
params : httpParameters,
|
params : httpParameters,
|
||||||
data : $.param({uri: uri }),
|
data : $.param({uri: uri}),
|
||||||
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
|
headers : {'Content-Type': 'application/x-www-form-urlencoded'}
|
||||||
})
|
})
|
||||||
.success(function connectionCreated() {
|
.then(function connectionCreated(connectionId) {
|
||||||
// Clear connections and users from cache.
|
// Clear connections and users from cache.
|
||||||
cacheService.connections.removeAll();
|
cacheService.connections.removeAll();
|
||||||
cacheService.users.removeAll();
|
cacheService.users.removeAll();
|
||||||
|
|
||||||
|
// Pass on the connection identifier
|
||||||
|
return connectionId;
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user