mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 17:13:21 +00:00 
			
		
		
		
	GUAC-605: Use status dialog from index, not status modal.
This commit is contained in:
		| @@ -69,7 +69,47 @@ angular.module('index').controller('indexController', ['$scope', '$injector', | ||||
|     // If the user is unknown, force a login | ||||
|     if(!$scope.currentUserID) | ||||
|         $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 | ||||
|     $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. | ||||
|  */ | ||||
|  | ||||
| .dialog-container { | ||||
| .status-container { | ||||
|     position: fixed; | ||||
|     top: 0; | ||||
|     left: 0; | ||||
| @@ -30,7 +30,7 @@ | ||||
|     padding: 1em; | ||||
| } | ||||
|  | ||||
| .dialog-outer { | ||||
| .status-outer { | ||||
|     display: table; | ||||
|     height: 100%; | ||||
|     width: 100%; | ||||
| @@ -38,34 +38,17 @@ | ||||
|     left: 0; | ||||
|     top: 0; | ||||
|     background: rgba(0, 0, 0, 0.5); | ||||
|     z-index: 1; | ||||
| } | ||||
|  | ||||
| .dialog-middle { | ||||
| .status-middle { | ||||
|     width: 100%; | ||||
|     text-align: center; | ||||
|     display: table-cell; | ||||
|     vertical-align: middle; | ||||
| } | ||||
|  | ||||
| @keyframes show-dialog { | ||||
|     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; | ||||
|   | ||||
| .status { | ||||
|     max-width: 75%; | ||||
|     width: 4in; | ||||
|     margin-left: auto; | ||||
| @@ -87,18 +70,42 @@ | ||||
|      | ||||
| } | ||||
|  | ||||
| .dialog.status .title { | ||||
| .status .title { | ||||
|     font-size: 1.1em; | ||||
|     font-weight: bold; | ||||
|     border-bottom: 1px solid black; | ||||
|     margin-bottom: 0.5em; | ||||
| } | ||||
|  | ||||
| .dialog.status.error { | ||||
| .status.error { | ||||
|     background: #FDD; | ||||
|     border: 1px solid #964040; | ||||
| } | ||||
|  | ||||
| .dialog.status > * { | ||||
| .status > * { | ||||
|     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> | ||||
		Reference in New Issue
	
	Block a user