Commit 44b6acec by Thomas Bosch

CSS

parent e0e201d2
......@@ -5,8 +5,7 @@
<artifactId>spring-boot-admin</artifactId>
<version>1.0.0-RC1</version>
<properties>
<spring-boot.version>1.0.2.RELEASE</spring-boot.version>
<spring.version>4.0.3.RELEASE</spring.version>
<spring-boot.version>1.1.0.RELEASE</spring-boot.version>
<bootstrap.version>2.3.2</bootstrap.version>
<jquery.version>1.11.0</jquery.version>
<angularjs.version>1.2.12</angularjs.version>
......@@ -61,12 +60,6 @@
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
......
......@@ -2,12 +2,14 @@ package de.codecentric.boot.admin;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import de.codecentric.boot.admin.config.WebappConfig;
@Configuration
@EnableAutoConfiguration
@ComponentScan
@Import(WebappConfig.class)
public class SpringBootAdmin {
public static void main(String[] args) {
......
......@@ -2,13 +2,15 @@ package de.codecentric.boot.admin.config;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import de.codecentric.boot.admin.controller.RegistryController;
import de.codecentric.boot.admin.service.ApplicationRegistry;
@Configuration
public class WebappConfig extends WebMvcConfigurerAdapter {
......@@ -17,12 +19,14 @@ public class WebappConfig extends WebMvcConfigurerAdapter {
converters.add(new MappingJackson2HttpMessageConverter());
}
@Controller
static class Routes {
@RequestMapping({ "/applications", "/applications/{id:\\w+}" })
public String index() {
return "/index.html";
@Bean
public RegistryController registryController() {
return new RegistryController();
}
@Bean
public ApplicationRegistry applicationRegistry() {
return new ApplicationRegistry();
}
}
'use strict';
angular.module('springBootAdmin')
.controller('overviewCtrl', function ($scope, Applications, ApplicationOverview, $location) {
.controller('overviewCtrl', function ($scope, Applications, Application, ApplicationOverview, $location) {
$scope.applications = Applications.query({}, function(applications) {
for (var i = 0; i < applications.length; i++) {
var app = applications[i];
......@@ -13,6 +13,12 @@ angular.module('springBootAdmin')
$scope.showDetails = function(id) {
$location.path('/apps/details/' + id + '/infos');
};
// callback for ng-click 'refresh':
$scope.refresh = function(id) {
$scope.application = Application.query({id: id}, function(application) {
ApplicationOverview.refresh(application);
});
};
})
.controller('navCtrl', function ($scope, $location) {
$scope.navClass = function(page) {
......
......@@ -25,15 +25,20 @@ angular.module('springBootAdmin.services', ['ngResource'])
}
this.getHealth = function(app) {
return $http.get(app.url + '/health').success(function(response) {
if (response.indexOf('ok') != -1 || response.status.indexOf('ok') != -1) {
app.status = 'online';
if (typeof(response) === 'string' && response.indexOf('ok') != -1
|| typeof(response.status) === 'string' &&
(response.status.indexOf('ok') != -1 || response.status.indexOf('UP') != -1)) {
app.online = true;
} else {
app.status = 'offline';
app.online = false;
}
}).error(function() {
app.status = 'offline';
app.online = false;
});
}
this.refresh = function(app) {
return $http.post(app.url + '/refresh');
};
}])
.service('ApplicationDetails', ['$http', function($http) {
this.getInfo = function(app) {
......
......@@ -48,3 +48,12 @@ a.spring-boot-logo span {
a:hover.spring-boot-logo span {
opacity: 1;
}
span.online {
color: #00AA00;
}
span.offline {
color: #DD0000;
font-weight: bold;
}
\ No newline at end of file
......@@ -14,19 +14,19 @@
<th>Version</th>
<th>Status</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="application in applications">
<td>{{ application.id }}</td>
<td>{{ application.version }}</td>
<td>{{ application.status }}</td>
<td></td>
<td></td>
<td>
<span ng-show="application.online" class="online">online</span>
<span ng-show="!application.online" class="offline">offline</span>
</td>
<td align="right">
<button type="button" ng-click="showDetails(application.id)" class="btn btn-success">Details</button>
<!-- <button type="button" ng-click="refresh(application.id)" class="btn btn-success">Refresh</button> -->
</td>
</tr>
</tbody>
......
package de.codecentric.boot.admin;
import org.springframework.web.client.RestTemplate;
import de.codecentric.boot.admin.model.Application;
public class RegisterExampleApp {
public static void main(String[] args) {
RestTemplate template = new RestTemplate();
Application app = new Application();
app.setId("app");
app.setUrl("http://localhost:8081");
template.postForObject("http://localhost:8080/api/applications", app, String.class);
}
}
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