1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 18:27:25 +08:00

Show a server disconnected message when user is not able to connect to

server.
This commit is contained in:
Jonathan Leibiusky @xetorthio 2016-11-15 17:48:21 -03:00
parent 7f9cf57f8f
commit 50943ce516
3 changed files with 16 additions and 1 deletions

View File

@ -10,6 +10,7 @@
$scope.selectedInstance = null; $scope.selectedInstance = null;
$scope.isAlive = true; $scope.isAlive = true;
$scope.ttl = '--:--:--'; $scope.ttl = '--:--:--';
$scope.connected = true;
angular.element($window).bind('resize', function(){ angular.element($window).bind('resize', function(){
if ($scope.selectedInstance) { if ($scope.selectedInstance) {
@ -123,6 +124,13 @@
}); });
}); });
socket.on('connect_error', function() {
$scope.connected = false;
});
socket.on('connect', function() {
$scope.connected = true;
});
$scope.socket = socket; $scope.socket = socket;
var i = response.data; var i = response.data;

View File

@ -42,3 +42,7 @@ md-card-content.terminal {
margin-bottom: auto; margin-bottom: auto;
margin-top: 50px; margin-top: 50px;
} }
.disconnected {
background-color: #FDF4B6;
}

View File

@ -18,6 +18,10 @@
<div flex></div> <div flex></div>
</md-content> </md-content>
</section> </section>
<section ng-if="!connected" class="disconnected" layout="row" layout-align="center center">
<h1 class="md-headline">No connection to server. Reconnecting...</h1>
<md-progress-circular class="md-hue-2" md-diameter="20px"></md-progress-circular>
</section>
<section id="popupContainer" layout="row" flex ng-if="isAlive"> <section id="popupContainer" layout="row" flex ng-if="isAlive">
<md-sidenav <md-sidenav
class="md-sidenav-left" class="md-sidenav-left"
@ -43,7 +47,6 @@
</md-content> </md-content>
</md-sidenav> </md-sidenav>
<md-content flex layout-padding ng-if="!instances.length"> <md-content flex layout-padding ng-if="!instances.length">
<div layout="column" layout-align="top center"> <div layout="column" layout-align="top center">
<p> <p>