fix(container) - correct since date for created containers (#822)

pull/838/head
Thomas Krzero 8 years ago committed by Anthony Lapenna
parent 87250d13d7
commit 5a07638f4d

@ -54,15 +54,20 @@
<tr> <tr>
<td>Status</td> <td>Status</td>
<td> <td>
<i ng-class="{true: 'fa fa-heartbeat space-right green-icon', false: 'fa fa-heartbeat space-right red-icon'}[container.State.Running]"></i> <i class="fa fa-heartbeat space-right green-icon" ng-if="container.State.Running"></i>
{{ container.State|getstatetext }} since {{ activityTime }}<span ng-if="!container.State.Running"> with exit code {{ container.State.ExitCode }}</span> <i class="fa fa-heartbeat space-right red-icon" ng-if="!container.State.Running && container.State.Status !== 'created'"></i>
{{ container.State|getstatetext }} since {{ activityTime }}<span ng-if="!container.State.Running && container.State.Status !== 'created'"> with exit code {{ container.State.ExitCode }}</span>
</td> </td>
</tr> </tr>
<tr>
<td>Created</td>
<td>{{ container.Created|getisodate }}</td>
</tr>
<tr ng-if="container.State.Running"> <tr ng-if="container.State.Running">
<td>Start time</td> <td>Start time</td>
<td>{{ container.State.StartedAt|getisodate }}</td> <td>{{ container.State.StartedAt|getisodate }}</td>
</tr> </tr>
<tr ng-if="!container.State.Running"> <tr ng-if="!container.State.Running && container.State.Status !== 'created'">
<td>Finished</td> <td>Finished</td>
<td>{{ container.State.FinishedAt|getisodate }}</td> <td>{{ container.State.FinishedAt|getisodate }}</td>
</tr> </tr>

@ -23,6 +23,8 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima
if (d.State.Running) { if (d.State.Running) {
$scope.activityTime = moment.duration(moment(d.State.StartedAt).utc().diff(moment().utc())).humanize(); $scope.activityTime = moment.duration(moment(d.State.StartedAt).utc().diff(moment().utc())).humanize();
} else if (d.State.Status === "created") {
$scope.activityTime = moment.duration(moment(d.Created).utc().diff(moment().utc())).humanize();
} else { } else {
$scope.activityTime = moment.duration(moment().utc().diff(moment(d.State.FinishedAt).utc())).humanize(); $scope.activityTime = moment.duration(moment().utc().diff(moment(d.State.FinishedAt).utc())).humanize();
} }

@ -109,6 +109,9 @@ angular.module('portainer.filters', [])
if (state.Running) { if (state.Running) {
return 'Running'; return 'Running';
} }
if (state.Status === 'created') {
return 'Created';
}
return 'Stopped'; return 'Stopped';
}; };
}) })

Loading…
Cancel
Save