Files
cloudron-box/dashboard/src/views/support.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-01-22 13:01:38 -08:00
'use strict';
/* global angular:false */
/* global $:false */
2018-01-22 13:01:38 -08:00
angular.module('Application').controller('SupportController', ['$scope', '$location', 'Client', function ($scope, $location, Client) {
2022-10-04 10:24:48 +02:00
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastOwner) $location.path('/'); });
2021-10-19 15:14:52 +02:00
$scope.ready = false;
2018-01-22 13:01:38 -08:00
$scope.config = Client.getConfig();
$scope.user = Client.getUserInfo();
$scope.toggleSshSupportError = '';
2018-01-22 13:01:38 -08:00
$scope.sshSupportEnabled = false;
$scope.toggleSshSupport = function () {
$scope.toggleSshSupportError = '';
Client.enableRemoteSupport(!$scope.sshSupportEnabled, function (error) {
if (error) {
if (error.statusCode === 412 || error.statusCode === 417) $scope.toggleSshSupportError = error.message;
else console.error(error);
return;
}
$scope.sshSupportEnabled = !$scope.sshSupportEnabled;
});
2018-01-22 13:01:38 -08:00
};
2021-10-19 15:14:52 +02:00
Client.onReady(function () {
2023-12-03 16:28:25 +01:00
Client.getRemoteSupport(function (error, enabled) {
if (error) return console.error(error);
2023-12-03 16:28:25 +01:00
$scope.sshSupportEnabled = enabled;
2024-07-12 14:25:11 +02:00
$scope.ready = true;
2018-01-22 13:01:38 -08:00
});
});
$('.modal-backdrop').remove();
}]);