mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
GUACAMOLE-598: Add absolute, global, fatal error handling.
This commit is contained in:
@@ -28,7 +28,15 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
|||||||
var $window = $injector.get('$window');
|
var $window = $injector.get('$window');
|
||||||
var clipboardService = $injector.get('clipboardService');
|
var clipboardService = $injector.get('clipboardService');
|
||||||
var guacNotification = $injector.get('guacNotification');
|
var guacNotification = $injector.get('guacNotification');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error that prevents the current page from rendering at all. If no
|
||||||
|
* such error has occurred, this will be null.
|
||||||
|
*
|
||||||
|
* @type Error
|
||||||
|
*/
|
||||||
|
$scope.fatalError = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The notification service.
|
* The notification service.
|
||||||
*/
|
*/
|
||||||
@@ -159,6 +167,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
|||||||
$scope.loginHelpText = null;
|
$scope.loginHelpText = null;
|
||||||
$scope.acceptedCredentials = {};
|
$scope.acceptedCredentials = {};
|
||||||
$scope.expectedCredentials = error.expected;
|
$scope.expectedCredentials = error.expected;
|
||||||
|
$scope.fatalError = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Prompt for remaining credentials if provided credentials were not enough
|
// Prompt for remaining credentials if provided credentials were not enough
|
||||||
@@ -168,6 +177,15 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
|||||||
$scope.loginHelpText = error.translatableMessage;
|
$scope.loginHelpText = error.translatableMessage;
|
||||||
$scope.acceptedCredentials = parameters;
|
$scope.acceptedCredentials = parameters;
|
||||||
$scope.expectedCredentials = error.expected;
|
$scope.expectedCredentials = error.expected;
|
||||||
|
$scope.fatalError = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Replace absolutely all content with an error message if the page itself
|
||||||
|
// cannot be displayed due to an error
|
||||||
|
$scope.$on('guacFatalPageError', function fatalPageError(error) {
|
||||||
|
$scope.page.title = 'APP.NAME';
|
||||||
|
$scope.page.bodyClassName = '';
|
||||||
|
$scope.fatalError = error;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update title and CSS class upon navigation
|
// Update title and CSS class upon navigation
|
||||||
@@ -181,6 +199,7 @@ angular.module('index').controller('indexController', ['$scope', '$injector',
|
|||||||
$scope.loginHelpText = null;
|
$scope.loginHelpText = null;
|
||||||
$scope.acceptedCredentials = null;
|
$scope.acceptedCredentials = null;
|
||||||
$scope.expectedCredentials = null;
|
$scope.expectedCredentials = null;
|
||||||
|
$scope.fatalError = null;
|
||||||
|
|
||||||
// Set title
|
// Set title
|
||||||
var title = current.$$route.title;
|
var title = current.$$route.title;
|
||||||
|
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.fatal-page-error-outer {
|
||||||
|
display: table;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
z-index: 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fatal-page-error-middle {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
display: table-cell;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fatal-page-error {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 5in;
|
||||||
|
padding: 1em;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fatal-page-error h1 {
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 0;
|
||||||
|
padding-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fatal-page-error h1::before {
|
||||||
|
content: ' ';
|
||||||
|
display: inline-block;
|
||||||
|
background: url('images/warning.png');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
height: 1em;
|
||||||
|
width: 1em;
|
||||||
|
background-size: contain;
|
||||||
|
margin: 0 0.25em;
|
||||||
|
margin-bottom: -0.2em;
|
||||||
|
}
|
@@ -32,26 +32,40 @@
|
|||||||
</head>
|
</head>
|
||||||
<body ng-class="page.bodyClassName">
|
<body ng-class="page.bodyClassName">
|
||||||
|
|
||||||
<!-- Content for logged-in users -->
|
<div ng-if="!fatalError">
|
||||||
<div ng-if="!expectedCredentials">
|
|
||||||
|
<!-- Content for logged-in users -->
|
||||||
<!-- Global status/error dialog -->
|
<div ng-if="!expectedCredentials">
|
||||||
<div ng-class="{shown: guacNotification.getStatus()}" class="status-outer">
|
|
||||||
<div class="status-middle">
|
<!-- Global status/error dialog -->
|
||||||
<guac-notification notification="guacNotification.getStatus()"></guac-notification>
|
<div ng-class="{shown: guacNotification.getStatus()}" class="status-outer">
|
||||||
|
<div class="status-middle">
|
||||||
|
<guac-notification notification="guacNotification.getStatus()"></guac-notification>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="content" ng-view>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="content" ng-view>
|
<!-- Login screen for logged-out users -->
|
||||||
</div>
|
<guac-login ng-show="expectedCredentials"
|
||||||
|
help-text="loginHelpText"
|
||||||
|
form="expectedCredentials"
|
||||||
|
values="acceptedCredentials"></guac-login>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Login screen for logged-out users -->
|
<!-- Absolute fatal error -->
|
||||||
<guac-login ng-show="expectedCredentials"
|
<div ng-if="fatalError" class="fatal-page-error-outer">
|
||||||
help-text="loginHelpText"
|
<div class="fatal-page-error-middle">
|
||||||
form="expectedCredentials"
|
<div class="fatal-page-error">
|
||||||
values="acceptedCredentials"></guac-login>
|
<h1 translate="APP.DIALOG_HEADER_ERROR"></h1>
|
||||||
|
<p translate="APP.ERROR_PAGE_UNAVAILABLE"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Reformat URL for AngularJS if query parameters are present -->
|
<!-- Reformat URL for AngularJS if query parameters are present -->
|
||||||
<script type="text/javascript" src="relocateParameters.js"></script>
|
<script type="text/javascript" src="relocateParameters.js"></script>
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
"DIALOG_HEADER_ERROR" : "Error",
|
"DIALOG_HEADER_ERROR" : "Error",
|
||||||
|
|
||||||
|
"ERROR_PAGE_UNAVAILABLE" : "An error has occurred and this action cannot be completed. If the problem persists, please notify your system administrator or check your system logs.",
|
||||||
"ERROR_PASSWORD_BLANK" : "Your password cannot be blank.",
|
"ERROR_PASSWORD_BLANK" : "Your password cannot be blank.",
|
||||||
"ERROR_PASSWORD_MISMATCH" : "The provided passwords do not match.",
|
"ERROR_PASSWORD_MISMATCH" : "The provided passwords do not match.",
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user