Added events endpoint.

pull/2/head
Kevan Ahlquist 2015-03-26 14:12:44 -05:00
parent d6c524f960
commit 32a4703a53
9 changed files with 49 additions and 8 deletions

View File

@ -1 +1,3 @@
node_modules
.git
Dockerfile

View File

@ -1,4 +1,4 @@
angular.module('dockerui', ['dockerui.templates', 'ngRoute', 'dockerui.services', 'dockerui.filters', 'masthead', 'footer', 'dashboard', 'container', 'containers', 'images', 'image', 'startContainer', 'sidebar', 'info', 'builder', 'containerLogs'])
angular.module('dockerui', ['dockerui.templates', 'ngRoute', 'dockerui.services', 'dockerui.filters', 'masthead', 'footer', 'dashboard', 'container', 'containers', 'images', 'image', 'startContainer', 'sidebar', 'info', 'builder', 'containerLogs', 'events'])
.config(['$routeProvider', function ($routeProvider) {
'use strict';
$routeProvider.when('/', {templateUrl: 'app/components/dashboard/dashboard.html', controller: 'DashboardController'});
@ -8,6 +8,7 @@ angular.module('dockerui', ['dockerui.templates', 'ngRoute', 'dockerui.services'
$routeProvider.when('/images/', {templateUrl: 'app/components/images/images.html', controller: 'ImagesController'});
$routeProvider.when('/images/:id*/', {templateUrl: 'app/components/image/image.html', controller: 'ImageController'});
$routeProvider.when('/info', {templateUrl: 'app/components/info/info.html', controller: 'InfoController'});
$routeProvider.when('/events', {templateUrl: 'app/components/events/events.html', controller: 'EventsController'});
$routeProvider.otherwise({redirectTo: '/'});
}])
// This is your docker url that the api will use to make requests

View File

@ -0,0 +1,18 @@
<h2>Events</h2>
<table class="table">
<tbody>
<tr>
<th>Event</th>
<th>From</th>
<th>ID</th>
<th>Time</th>
</tr>
<tr ng-repeat="event in dockerEvents">
<td ng-bind="event.status"/>
<td ng-bind="event.from"/>
<td ng-bind="event.id"/>
<td ng-bind="event.time"/>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,10 @@
angular.module('events', [])
.controller('EventsController', ['Settings', '$scope', function(Settings, $scope) {
var yesterday = Math.floor(Date.now() / 1000) - 86400; // Today's date minus 24 hours.
$scope.dockerEvents = [];
oboe(Settings.url + '/events' + '?since=' + yesterday)
.done(function(node) {
$scope.dockerEvents.push(node);
$scope.$apply();
});
}]);

View File

@ -1,7 +1,7 @@
angular.module('footer', [])
.controller('FooterController', ['$scope', 'Settings', function($scope, Settings) {
.controller('FooterController', ['$scope', 'Settings', 'Docker', function($scope, Settings, Docker) {
$scope.template = 'app/components/footer/statusbar.html';
$scope.uiVersion = Settings.uiVersion;
$scope.apiVersion = Settings.version;
Docker.get({}, function(d) { $scope.apiVersion = d.ApiVersion; });
}]);

View File

@ -2,9 +2,9 @@
<h2>Docker Information</h2>
<div>
<p class="lead">
<strong>Endpoint: </strong>{{ endpoint }}<br />
<strong>Api Version: </strong>{{ apiVersion }}<br />
<strong>Version: </strong>{{ docker.Version }}<br />
<strong>API Endpoint: </strong>{{ endpoint }}<br />
<strong>API Version: </strong>{{ docker.ApiVersion }}<br />
<strong>Docker version: </strong>{{ docker.Version }}<br />
<strong>Git Commit: </strong>{{ docker.GitCommit }}<br />
<strong>Go Version: </strong>{{ docker.GoVersion }}<br />
</p>
@ -62,12 +62,20 @@
</tr>
<tr>
<td>Storage Driver Status:</td>
<td>{{ info.DriverStatus }}</td>
<td>
<p ng-repeat="val in info.DriverStatus">
{{ val[0] }}: {{ val[1] }}
</p>
</td>
</tr>
<tr>
<td>Execution Driver:</td>
<td>{{ info.ExecutionDriver }}</td>
</tr>
<tr>
<td>Events:</td>
<td><a href="#/events">Events</a></td>
</tr>
<tr>
<td>IPv4 Forwarding:</td>
<td>{{ info.IPv4Forwarding }}</td>

1
assets/js/oboe-browser.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,7 @@
<script src="assets/js/jquery.gritter.min.js"></script>
<script src="assets/js/Chart.min.js"></script>
<script src="assets/js/legend.js"></script>
<script src="assets/js/oboe-browser.min.js"></script>
<script src="<%= pkg.name %>.js"></script>

View File

@ -150,7 +150,7 @@ describe('filters', function () {
describe('getdate', function () {
it('should convert the Docker date to a human readable form', inject(function(getdateFilter) {
expect(getdateFilter(1420424998)).toBe('Mon Jan 05 2015');
expect(getdateFilter(1420424998)).toBe('Sun Jan 04 2015');
}));
});