Commit 1d73bddd by Thomas Bosch

apps

parent 7e845d77
......@@ -6,6 +6,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -32,9 +33,9 @@ public class RegistryController {
registry.register(app);
}
@RequestMapping(value = "/api/application", method = RequestMethod.GET)
@RequestMapping(value = "/api/application/{id}", method = RequestMethod.GET)
@ResponseBody
public Application get(@RequestBody String id) {
public Application get(@PathVariable String id) {
LOGGER.debug("Deliver registered application with ID '{}'", id);
return registry.getApplication(id);
}
......
......@@ -25,6 +25,9 @@
<div class="spring-logo--container">
<a class="spring-logo" href="/"><span></span></a>
</div>
<div class="spring-logo--container">
<a class="spring-boot-logo" href="/"><span></span></a>
</div>
<ul class="nav pull-right" ng-controller='navCtrl'>
<li class="navbar-link" ng-class="{active: $state.includes('apps')}"><a ui-sref="apps.overview">Applications</a></li>
<li class="navbar-link" ng-class="{active: $state.includes('about')}"><a ui-sref="about">About</a></li>
......
......@@ -13,7 +13,8 @@ angular.module('springBootAdmin', [
$stateProvider
.state('apps', {
url: '/apps',
templateUrl: 'views/apps.html',
abstract: true,
template: '<ui-view/>',
})
.state('about', {
url: '/about',
......@@ -26,16 +27,18 @@ angular.module('springBootAdmin', [
})
.state('apps.details', {
url: '/details',
abstract: true,
templateUrl: 'views/apps/details.html'
})
.state('apps.details.infos', {
url: '/infos/{id}',
url: '/infos/:id',
templateUrl: 'views/apps/details/infos.html',
controller: 'infosCtrl'
})
.state('apps.details.metrics', {
url: '/metrics/{id}',
templateUrl: 'views/apps/details/metrics.html'
url: '/metrics/:id',
templateUrl: 'views/apps/details/metrics.html',
controller: 'metricsCtrl'
});
})
.run(function ($rootScope, $state, $stateParams, $log) {
......
'use strict';
angular.module('springBootAdmin')
.controller('overviewCtrl', function ($scope, Applications, ApplicationInfo, $location, $http) {
.controller('overviewCtrl', function ($scope, Applications, ApplicationInfo, $location) {
$scope.applications = Applications.query({}, function(applications) {
for (var i = 0; i < applications.length; i++) {
var app = applications[i];
......@@ -9,6 +9,10 @@ angular.module('springBootAdmin')
ApplicationInfo.getHealth(app);
}
});
// callback for ng-click 'showDetails':
$scope.showDetails = function(id) {
$location.path('/apps/details/infos/' + id);
};
})
.controller('navCtrl', function ($scope, $location) {
$scope.navClass = function(page) {
......@@ -16,8 +20,13 @@ angular.module('springBootAdmin')
return page == currentRoute ? 'active' : '';
};
})
.controller('infosCtrl', function ($scope, Application, ApplicationInfo) {
$scope.application = Application.query({}, function(application) {
.controller('infosCtrl', function ($scope, $stateParams, Application, ApplicationInfo) {
$scope.application = Application.query({id: $stateParams.id}, function(application) {
ApplicationInfo.getInfo(application);
});
})
.controller('metricsCtrl', function ($scope, $stateParams, Application, ApplicationInfo) {
$scope.application = Application.query({id: $stateParams.id}, function(application) {
ApplicationInfo.getInfo(application);
});
});
\ No newline at end of file
......@@ -12,7 +12,7 @@ angular.module('springBootAdmin.services', ['ngResource'])
.factory('Application', ['$resource',
function($resource){
return $resource(
'/api/application', {}, {
'/api/application/:id', {}, {
query: { method:'GET'}
});
}
......
......@@ -28,4 +28,23 @@
background-color: #34302D;
border-color: #34302D;
color: #f1f1f1;
}
a.spring-boot-logo {
background: url("../img/platform-spring-boot.png") -1px -1px no-repeat;
}
a.spring-boot-logo span {
display: block;
width: 160px;
height: 46px;
background: url("../img/platform-spring-boot.png") -1px -48px no-repeat;
opacity: 0;
-moz-transition: opacity 0.12s ease-in-out;
-webkit-transition: opacity 0.12s ease-in-out;
-o-transition: opacity 0.12s ease-in-out;
}
a:hover.spring-boot-logo span {
opacity: 1;
}
\ No newline at end of file
......@@ -8,8 +8,8 @@
<div class="main-template">
<div id="xd-jobs" class="tab-pane active col-md-12">
<ul class="nav nav-tabs">
<li ng-class="{ active: $state.includes('apps.details.infos') }"><a ui-sref="apps.details.infos">Infos</a></li>
<li ng-class="{ active: $state.includes('apps.details.metrics') }"><a ui-sref="apps.details.metrics">Metrics</a></li>
<li ui-sref-active="active"><a ui-sref="apps.details.infos({id: application.id})">Infos</a></li>
<li ui-sref-active="active"><a ui-sref="apps.details.metrics({id: application.id})">Metrics</a></li>
</ul>
<div class="tab-content">
<div ui-view></div>
......
......@@ -10,15 +10,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="application in applications">
<td>{{ application.id }}</td>
<td>{{ application.version }}</td>
<td>{{ application.status }}</td>
<td></td>
<td>
<!-- <button type="button" ng-click="editService(service.id)" class="btn btn-success">Edit</button> -->
</td>
</tr>
</tbody>
</table>
Info-Endpoint
......@@ -10,15 +10,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="application in applications">
<td>{{ application.id }}</td>
<td>{{ application.version }}</td>
<td>{{ application.status }}</td>
<td></td>
<td>
<!-- <button type="button" ng-click="editService(service.id)" class="btn btn-success">Edit</button> -->
</td>
</tr>
</tbody>
</table>
Metrics-Endpoint
\ No newline at end of file
......@@ -26,7 +26,7 @@
<td></td>
<td></td>
<td>
<!-- <button type="button" ng-click="editService(service.id)" class="btn btn-success">Edit</button> -->
<button type="button" ng-click="showDetails(application.id)" class="btn btn-success">Details</button>
</td>
</tr>
</tbody>
......
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<logger name="de.codecentric" level="DEBUG" />
<logger name="org.springframework.data" level="INFO" />
</configuration>
\ No newline at end of file
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