Update events for v1beta3 api

This commit is contained in:
BC Broussard
2015-05-21 00:28:12 -07:00
parent 0bea034edb
commit b4ab5eddf0
3 changed files with 102 additions and 87 deletions

View File

@@ -6,7 +6,7 @@
app.controller('ListEventsCtrl', [
'$scope',
'$routeParams',
'k8sApi',
'k8sv1Beta3Api',
'$location',
'$filter',
function($scope, $routeParams, k8sApi, $location, $filter) {
@@ -19,26 +19,20 @@ app.controller('ListEventsCtrl', [
$scope.serverView = false;
$scope.headers = [
{name: 'Time', field: 'time'},
{name: 'From', field: 'from'},
{name: 'Sub Object Path', field: 'subobject'},
{name: 'First Seen', field: 'firstSeen'},
{name: 'Last Seen', field: 'lastSeen'},
{name: 'Count', field: 'count'},
{name: 'Name', field: 'name'},
{name: 'Kind', field: 'kind'},
{name: 'SubObject', field: 'subObject'},
{name: 'Reason', field: 'reason'},
{name: 'Source', field: 'source'},
{name: 'Message', field: 'message'}
];
$scope.custom = {
time: '',
from: 'grey',
subobject: 'grey',
reason: 'grey',
message: 'grey'
};
$scope.sortable = ['time', 'from', 'subobject'];
$scope.thumbs = 'thumb';
$scope.sortable = ['firstSeen', 'lastSeen', 'count', 'name', 'kind', 'subObject', 'reason', 'source'];
$scope.count = 10;
$scope.go = function(d) { $location.path('/dashboard/pods/' + d.id); };
function handleError(data, status, headers, config) {
console.log("Error (" + status + "): " + data);
$scope.loading = false;
@@ -60,15 +54,26 @@ app.controller('ListEventsCtrl', [
};
data.items.forEach(function(event) {
var _sources = '';
if (event.source) {
_sources = event.source.component + ' ' + event.source.host;
}
$scope.content.push({
time: $filter('date')(event.timestamp, 'medium'),
from: event.source,
subobject: event.involvedObject.fieldPath,
firstSeen: $filter('date')(event.firstTimestamp, 'medium'),
lastSeen: $filter('date')(event.lastTimestamp, 'medium'),
count: event.count,
name: event.involvedObject.name,
kind: event.involvedObject.kind,
subObject: event.involvedObject.fieldPath,
reason: event.reason,
source: _sources,
message: event.message
});
});
}).error($scope.handleError);