mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-605: Use status dialog from index, not status modal.
This commit is contained in:
@@ -72,7 +72,6 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
|
|||||||
var connectionGroupDAO = $injector.get('connectionGroupDAO');
|
var connectionGroupDAO = $injector.get('connectionGroupDAO');
|
||||||
var connectionDAO = $injector.get('connectionDAO');
|
var connectionDAO = $injector.get('connectionDAO');
|
||||||
var ClientProperties = $injector.get('clientProperties');
|
var ClientProperties = $injector.get('clientProperties');
|
||||||
var statusModal = $injector.get('statusModal');
|
|
||||||
|
|
||||||
// Client settings and state
|
// Client settings and state
|
||||||
$scope.clientProperties = new ClientProperties();
|
$scope.clientProperties = new ClientProperties();
|
||||||
@@ -180,7 +179,7 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
|
|||||||
|
|
||||||
// Show new status if not yet connected
|
// Show new status if not yet connected
|
||||||
if (status !== "connected") {
|
if (status !== "connected") {
|
||||||
statusModal.showStatus({
|
$scope.showStatus({
|
||||||
title: "client.status.connectingStatusTitle",
|
title: "client.status.connectingStatusTitle",
|
||||||
text: "client.status.clientStates." + status
|
text: "client.status.clientStates." + status
|
||||||
});
|
});
|
||||||
@@ -188,7 +187,7 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
|
|||||||
|
|
||||||
// Hide status upon connecting
|
// Hide status upon connecting
|
||||||
else
|
else
|
||||||
statusModal.showStatus(false);
|
$scope.showStatus(false);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -201,8 +200,11 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
|
|||||||
// Determine translation name of error
|
// Determine translation name of error
|
||||||
var errorName = (status in CLIENT_ERRORS) ? status.toString(16) : "DEFAULT";
|
var errorName = (status in CLIENT_ERRORS) ? status.toString(16) : "DEFAULT";
|
||||||
|
|
||||||
|
// Override any existing status
|
||||||
|
$scope.showStatus(false);
|
||||||
|
|
||||||
// Show error status
|
// Show error status
|
||||||
statusModal.showStatus({
|
$scope.showStatus({
|
||||||
className: "error",
|
className: "error",
|
||||||
title: "client.error.connectionErrorTitle",
|
title: "client.error.connectionErrorTitle",
|
||||||
text: "client.error.clientErrors." + errorName,
|
text: "client.error.clientErrors." + errorName,
|
||||||
@@ -216,7 +218,7 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
|
|||||||
|
|
||||||
// Show new status only if disconnected
|
// Show new status only if disconnected
|
||||||
if (status === "closed") {
|
if (status === "closed") {
|
||||||
statusModal.showStatus({
|
$scope.showStatus({
|
||||||
title: "client.status.closedStatusTitle",
|
title: "client.status.closedStatusTitle",
|
||||||
text: "client.status.tunnelStates." + status
|
text: "client.status.tunnelStates." + status
|
||||||
});
|
});
|
||||||
@@ -233,8 +235,11 @@ angular.module('home').controller('clientController', ['$scope', '$routeParams',
|
|||||||
// Determine translation name of error
|
// Determine translation name of error
|
||||||
var errorName = (status in TUNNEL_ERRORS) ? status.toString(16) : "DEFAULT";
|
var errorName = (status in TUNNEL_ERRORS) ? status.toString(16) : "DEFAULT";
|
||||||
|
|
||||||
|
// Override any existing status
|
||||||
|
$scope.showStatus(false);
|
||||||
|
|
||||||
// Show error status
|
// Show error status
|
||||||
statusModal.showStatus({
|
$scope.showStatus({
|
||||||
className: "error",
|
className: "error",
|
||||||
title: "client.error.connectionErrorTitle",
|
title: "client.error.connectionErrorTitle",
|
||||||
text: "client.error.tunnelErrors." + errorName,
|
text: "client.error.tunnelErrors." + errorName,
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<script type="text/ng-template" id="nestedGroup.html">
|
<script type="text/ng-template" id="nestedGroup.html">
|
||||||
<div class="connection" ng-show="item.isConnection">
|
<div class="connection" ng-show="item.isConnection">
|
||||||
<a ng-href="#/client/c/{{item.identifier}}" target="_blank">
|
<a ng-href="#/client/c/{{item.identifier}}">
|
||||||
<div class="caption">
|
<div class="caption">
|
||||||
<div class="protocol">
|
<div class="protocol">
|
||||||
<div class="icon type" ng-class="item.protocol"></div>
|
<div class="icon type" ng-class="item.protocol"></div>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<div class="caption">
|
<div class="caption">
|
||||||
<div class="icon group type" ng-click="toggleExpanded(item)" ng-class="{expanded: item.expanded, empty: !item.children.length, balancer: item.balancer && !item.children.length}"></div>
|
<div class="icon group type" ng-click="toggleExpanded(item)" ng-class="{expanded: item.expanded, empty: !item.children.length, balancer: item.balancer && !item.children.length}"></div>
|
||||||
<span class="name">
|
<span class="name">
|
||||||
<a ng-show="item.balancer" ng-href="#/client/cg/{{item.identifier}}" target="_blank">{{item.name}}</a>
|
<a ng-show="item.balancer" ng-href="#/client/cg/{{item.identifier}}">{{item.name}}</a>
|
||||||
<span ng-show="!item.balancer">{{item.name}}</span>
|
<span ng-show="!item.balancer">{{item.name}}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -69,7 +69,47 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
|||||||
// If the user is unknown, force a login
|
// If the user is unknown, force a login
|
||||||
if(!$scope.currentUserID)
|
if(!$scope.currentUserID)
|
||||||
$location.path('/login');
|
$location.path('/login');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows or hides the status modal. If a status modal is currently shown,
|
||||||
|
* no further status modals will be shown until the current status is
|
||||||
|
* hidden.
|
||||||
|
*
|
||||||
|
* @param {Boolean|Object} status The status to show, or false to hide the
|
||||||
|
* current status.
|
||||||
|
* @param {String} [status.title] The title of the status modal.
|
||||||
|
* @param {String} [status.text] The body text of the status modal.
|
||||||
|
* @param {String} [status.className] The CSS class name to apply to the
|
||||||
|
* modal, in addition to the default
|
||||||
|
* "dialog" and "status" classes.
|
||||||
|
* @param {String[]} [status.actions] Array of action names which
|
||||||
|
* correspond to button captions. Each
|
||||||
|
* action will be displayed as a button
|
||||||
|
* within the status modal. Clickin a
|
||||||
|
* button will fire a guacStatusAction
|
||||||
|
* event.
|
||||||
|
*/
|
||||||
|
$scope.showStatus = function showStatus(status) {
|
||||||
|
if (!$scope.status || !status)
|
||||||
|
$scope.status = status;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires a guacStatusAction event signalling a chosen action. The status
|
||||||
|
* modal will be cloased prior to firing the action event.
|
||||||
|
*
|
||||||
|
* @param {String} action The name of the action.
|
||||||
|
*/
|
||||||
|
$scope.fireAction = function fireAction(action) {
|
||||||
|
|
||||||
|
// Hide status modal
|
||||||
|
$scope.status = false;
|
||||||
|
|
||||||
|
// Fire action event
|
||||||
|
$scope.$broadcast('guacAction', action);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
// Allow the permissions to be reloaded elsewhere if needed
|
// Allow the permissions to be reloaded elsewhere if needed
|
||||||
$scope.loadBasicPermissions = function loadBasicPermissions() {
|
$scope.loadBasicPermissions = function loadBasicPermissions() {
|
||||||
|
|
||||||
|
@@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2014 Glyptodon LLC
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The controller for the status modal.
|
|
||||||
*/
|
|
||||||
angular.module('manage').controller('statusController', ['$scope', '$rootScope', '$injector',
|
|
||||||
function statusController($scope, $rootScope, $injector) {
|
|
||||||
|
|
||||||
var statusModal = $injector.get('statusModal');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires a guacStatusAction event signalling a chosen action. The status
|
|
||||||
* modal will be cloased prior to firing the action event.
|
|
||||||
*
|
|
||||||
* @param {String} action The name of the action.
|
|
||||||
*/
|
|
||||||
$scope.fireAction = function fireAction(action) {
|
|
||||||
|
|
||||||
// Hide status modal
|
|
||||||
statusModal.showStatus(false);
|
|
||||||
|
|
||||||
// Fire action event
|
|
||||||
$rootScope.$broadcast('guacAction', action);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2014 Glyptodon LLC
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A modal for displaying the current status.
|
|
||||||
*/
|
|
||||||
angular.module('manage').factory('statusModal', ['btfModal',
|
|
||||||
function statusModal(btfModal) {
|
|
||||||
|
|
||||||
var service = {};
|
|
||||||
|
|
||||||
// Create the modal object to be used later to actually create the modal
|
|
||||||
var modalService = btfModal({
|
|
||||||
controller: 'statusController',
|
|
||||||
controllerAs: 'modal',
|
|
||||||
templateUrl: 'app/index/templates/status.html'
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the status modal is currently displayed.
|
|
||||||
*
|
|
||||||
* @type Boolean
|
|
||||||
*/
|
|
||||||
service.shown = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows or hides the status modal.
|
|
||||||
*
|
|
||||||
* @param {Boolean|Object} status The status to show, or false to hide the
|
|
||||||
* current status.
|
|
||||||
* @param {String} [status.title] The title of the status modal.
|
|
||||||
* @param {String} [status.text] The body text of the status modal.
|
|
||||||
* @param {String} [status.className] The CSS class name to apply to the
|
|
||||||
* modal, in addition to the default
|
|
||||||
* "dialog" and "status" classes.
|
|
||||||
* @param {String[]} [status.actions] Array of action names which
|
|
||||||
* correspond to button captions. Each
|
|
||||||
* action will be displayed as a button
|
|
||||||
* within the status modal. Clickin a
|
|
||||||
* button will fire a guacStatusAction
|
|
||||||
* event.
|
|
||||||
*/
|
|
||||||
service.showStatus = function showStatus(status) {
|
|
||||||
|
|
||||||
// Hide any existing status
|
|
||||||
modalService.deactivate();
|
|
||||||
service.shown = false;
|
|
||||||
|
|
||||||
// Show new status if requested
|
|
||||||
if (status) {
|
|
||||||
modalService.activate(status);
|
|
||||||
service.shown = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
return service;
|
|
||||||
|
|
||||||
}]);
|
|
@@ -20,7 +20,7 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.dialog-container {
|
.status-container {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-outer {
|
.status-outer {
|
||||||
display: table;
|
display: table;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -38,34 +38,17 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
background: rgba(0, 0, 0, 0.5);
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-middle {
|
.status-middle {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: table-cell;
|
display: table-cell;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes show-dialog {
|
.status {
|
||||||
0% {transform: scale(0.75); }
|
|
||||||
100% {transform: scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
@-webkit-keyframes show-dialog {
|
|
||||||
0% {-webkit-transform: scale(0.75); }
|
|
||||||
100% {-webkit-transform: scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.dialog.status {
|
|
||||||
|
|
||||||
animation-name: show-dialog;
|
|
||||||
animation-timing-function: linear;
|
|
||||||
animation-duration: 0.125s;
|
|
||||||
-webkit-animation-name: show-dialog;
|
|
||||||
-webkit-animation-timing-function: linear;
|
|
||||||
-webkit-animation-duration: 0.125s;
|
|
||||||
|
|
||||||
max-width: 75%;
|
max-width: 75%;
|
||||||
width: 4in;
|
width: 4in;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
@@ -87,18 +70,42 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog.status .title {
|
.status .title {
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
border-bottom: 1px solid black;
|
border-bottom: 1px solid black;
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog.status.error {
|
.status.error {
|
||||||
background: #FDD;
|
background: #FDD;
|
||||||
border: 1px solid #964040;
|
border: 1px solid #964040;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog.status > * {
|
.status > * {
|
||||||
margin: 0.75em;
|
margin: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fade entire status area in/out based on shown status */
|
||||||
|
|
||||||
|
.status-outer {
|
||||||
|
visibility: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity, visibility;
|
||||||
|
transition-duration: 0.25s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shown.status-outer {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide dialog immediately based on status */
|
||||||
|
|
||||||
|
.status {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shown .status {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
@@ -1,42 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright 2014 Glyptodon LLC.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Dialog container for the modal -->
|
|
||||||
<div class="dialog-outer">
|
|
||||||
<div class="dialog-middle">
|
|
||||||
<div class="dialog status" ng-class="className">
|
|
||||||
|
|
||||||
<!-- Status title -->
|
|
||||||
<p ng-show="title" class="title">{{title | translate}}</p>
|
|
||||||
|
|
||||||
<!-- Status text -->
|
|
||||||
<p ng-show="text" class="status">{{text | translate}}</p>
|
|
||||||
|
|
||||||
<!-- All action buttons, if any -->
|
|
||||||
<div ng-show="actions && actions.length" class="buttons">
|
|
||||||
<button ng-repeat="action in actions" ng-click="fireAction(action)">{{action | translate}}</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@@ -30,8 +30,28 @@ THE SOFTWARE.
|
|||||||
<link rel="stylesheet" type="text/css" href="guacamole.min.css">
|
<link rel="stylesheet" type="text/css" href="guacamole.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body ng-class="page.bodyClassName">
|
<body ng-class="page.bodyClassName">
|
||||||
|
|
||||||
|
<!-- Global status/error dialog -->
|
||||||
|
<div ng-class="{shown: status}" class="status-outer">
|
||||||
|
<div class="status-middle">
|
||||||
|
<div class="status" ng-class="status.className">
|
||||||
|
|
||||||
|
<!-- Status title -->
|
||||||
|
<p ng-show="status.title" class="title">{{status.title | translate}}</p>
|
||||||
|
|
||||||
|
<!-- Status text -->
|
||||||
|
<p ng-show="status.text" class="text">{{status.text | translate}}</p>
|
||||||
|
|
||||||
|
<!-- All action buttons, if any -->
|
||||||
|
<div ng-show="status.actions && status.actions.length" class="buttons">
|
||||||
|
<button ng-repeat="action in status.actions" ng-click="fireAction(action)">{{action | translate}}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="content" ng-view>
|
<div id="content" ng-view>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript" src="guacamole.min.js"></script>
|
<script type="text/javascript" src="guacamole.min.js"></script>
|
||||||
|
Reference in New Issue
Block a user