Commit 7b1e6906 by Johannes Stelzer

Less flickering on overview refresh

parent 47e108bb
......@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<title>Spring Boot Admin</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.png" />
......
......@@ -16,25 +16,36 @@
'use strict';
angular.module('springBootAdmin')
.controller('overviewCtrl', ['$scope', '$location', '$interval', 'Applications', 'ApplicationOverview', 'Application',
function ($scope, $location, $interval, Applications, ApplicationOverview, Application) {
$scope.loadData = function() {
.controller('overviewCtrl', ['$scope', '$location', '$interval', '$q', 'Applications', 'ApplicationOverview', 'Application',
function ($scope, $location, $interval, $q, Applications, ApplicationOverview, Application) {
$scope.loadData = function() {
Applications.query(function(applications) {
for (var i = 0; i< applications.length; i++) {
var app = applications[i];
ApplicationOverview.getInfo(app);
ApplicationOverview.getHealth(app);
ApplicationOverview.getLogfile(app);
(function(app) {
//find application in known applications and copy state --> less flickering
for ( var j = 0; $scope.applications != null && j < $scope.applications.length; j++ ) {
if (app.id === $scope.applications[j].id ) {
app.info = $scope.applications[j].info;
app.version= $scope.applications[j].version;
app.status = $scope.applications[j].status;
app.providesLogfile = $scope.applications[j].providesLogfile;
break;
}
}
app.refreshing = true;
$q.all(ApplicationOverview.getInfo(app),
ApplicationOverview.getHealth(app),
ApplicationOverview.getLogfile(app)).finally(function() {
app.refreshing = false;
});
})(applications[i]);
}
$scope.applications = applications;
});
}
$scope.loadData();
$scope.refresh = function(application) {
ApplicationOverview.refresh(application);
};
$scope.remove = function(application) {
Application.remove({ id: application.id }, function () {
var index = $scope.applications.indexOf(application);
......@@ -43,7 +54,6 @@ angular.module('springBootAdmin')
}
});
}
// reload site every 30 seconds
var task = $interval(function() {
......
......@@ -174,6 +174,13 @@ span.status-UNKNOWN {
color: #FF8800;
}
span.refresh {
display: block;
width: 16px;
height: 16px;
background: url("../img/refresh.gif") no-repeat;
}
/** Headings and Tabs in Detail-View **/
.accordion-heading ,
.accordion-heading > a,
......
......@@ -7,8 +7,7 @@
<th>Application / URL</th>
<th>Version</th>
<th>Info</th>
<th>Status</th>
<th></th>
<th colspan="2">Status</th>
</tr>
</thead>
<tbody>
......@@ -16,7 +15,8 @@
<td>{{ application.name }}<br/><span class="muted">{{ application.url }}</span></td>
<td>{{ application.version }}</td>
<td><span ng-repeat="(name, value) in application.info track by name">{{name}}: {{value}}<br></span></td>
<td><span class="status-{{application.status}}">{{ application.status }}</span></td>
<td><span class="status-{{application.status}}">{{ application.status }}</span>
<span ng-show="application.refreshing" class="refresh"></span></td>
<td>
<div class="btn-group pull-right" ng-hide="application.status == null || application.status == 'OFFLINE'">
<a ng-disabled="!application.providesLogfile" target="_self" class="btn btn-success" ng-href="{{application.providesLogfile ? application.url + '/logfile' :''}}"><i class="icon-file icon-white"></i>Log</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment