mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
parse time with momentjs - fix #197
This commit is contained in:
parent
9e22f5cd56
commit
6731829792
@ -3,7 +3,7 @@
|
||||
h3.no-top-margin Project activity
|
||||
ul.list-unstyled
|
||||
li(ng-repeat="event in events")
|
||||
strong: time(ng-bind="event.created | date:'short'")
|
||||
strong: time(ng-bind="event.createdFormatted")
|
||||
span :
|
||||
span(ng-bind="event.object_name")
|
||||
span(ng-if="event.object_name.length > 0") -
|
||||
@ -16,8 +16,8 @@
|
||||
span(ng-class="{ 'text-muted': task.status == 'waiting', 'text-info': task.status == 'running', 'text-danger': task.status == 'error', 'text-success': task.status == 'success' }")
|
||||
span(ng-if="task.playbook.length == 0") {{ task.tpl_playbook }}
|
||||
span(ng-if="task.playbook.length > 0") {{ task.playbook }}
|
||||
span.pull-right(ng-if="task.status == 'waiting'") {{ task.created | date:'short' }}
|
||||
span.pull-right(ng-if="task.status != 'waiting'") {{ task.start | date:'short' }}
|
||||
span.pull-right(ng-if="task.status == 'waiting'") {{ task.createdFormatted }}
|
||||
span.pull-right(ng-if="task.status != 'waiting'") {{ task.startFormatted }}
|
||||
|
||||
br
|
||||
span
|
||||
|
@ -7,11 +7,11 @@
|
||||
dt User
|
||||
dd {{ task.user_name }}
|
||||
dt Started
|
||||
dd {{ task.start | date:'short' }}
|
||||
dd {{ task.startFormatted }}
|
||||
dt Ended
|
||||
dd {{ task.end | date:'short' }}
|
||||
dd {{ task.endFormatted }}
|
||||
dt Created
|
||||
dd {{ task.created | date:'short' }}
|
||||
dd {{ task.createdFormatted }}
|
||||
dt Raw output
|
||||
dd: input(type="checkbox" ng-model="raw" title="show logs unbesmirched")
|
||||
|
||||
|
@ -1,38 +1,51 @@
|
||||
define(['controllers/projects/taskRunner'], function () {
|
||||
app.registerController('ProjectDashboardCtrl', ['$scope', '$http', 'Project', '$uibModal', '$rootScope', function ($scope, $http, Project, $modal, $rootScope) {
|
||||
$http.get(Project.getURL() + '/events').success(function (events) {
|
||||
$scope.events = events;
|
||||
});
|
||||
define(['controllers/projects/taskRunner'], function() {
|
||||
app.registerController('ProjectDashboardCtrl', ['$scope', '$http', 'Project', '$uibModal', '$rootScope', function($scope, $http, Project, $modal, $rootScope) {
|
||||
$http.get(Project.getURL() + '/events').success(function(events) {
|
||||
$scope.events = events;
|
||||
|
||||
$scope.reload = function () {
|
||||
$http.get(Project.getURL() + '/tasks').success(function (tasks) {
|
||||
$scope.tasks = tasks;
|
||||
events.forEach(function(evt) {
|
||||
evt.createdFormatted = moment(evt.created).format('DD/M/YY HH:MM')
|
||||
})
|
||||
});
|
||||
|
||||
$scope.tasks.forEach(function (t) {
|
||||
if (!t.start || !t.end) {
|
||||
return;
|
||||
}
|
||||
$scope.reload = function() {
|
||||
$http.get(Project.getURL() + '/tasks').success(function(tasks) {
|
||||
$scope.tasks = tasks;
|
||||
|
||||
// t.duration = moment(t.start).from(moment(t.end), true);
|
||||
t.duration = moment(t.start).diff(moment(t.end), 'minutes');
|
||||
});
|
||||
});
|
||||
}
|
||||
$scope.reload();
|
||||
$scope.tasks.forEach(function(t) {
|
||||
if (t.created) {
|
||||
t.createdFormatted = moment(t.created).format('DD/M/YY HH:MM')
|
||||
}
|
||||
if (t.start) {
|
||||
t.startFormatted = moment(t.start).format('DD/M/YY HH:MM:ss')
|
||||
}
|
||||
if (t.end) {
|
||||
t.endFormatted = moment(t.end).format('DD/M/YY HH:MM:ss')
|
||||
}
|
||||
|
||||
$scope.openTask = function (task) {
|
||||
var scope = $rootScope.$new();
|
||||
scope.task = task;
|
||||
scope.project = Project;
|
||||
if (!t.start || !t.end) {
|
||||
return;
|
||||
}
|
||||
|
||||
$modal.open({
|
||||
templateUrl: '/tpl/projects/taskModal.html',
|
||||
controller: 'TaskCtrl',
|
||||
scope: scope,
|
||||
size: 'lg'
|
||||
}).result.then(function () {
|
||||
$scope.reload();
|
||||
});
|
||||
}
|
||||
}]);
|
||||
t.duration = moment(t.start).diff(moment(t.end), 'minutes');
|
||||
});
|
||||
});
|
||||
}
|
||||
$scope.reload();
|
||||
|
||||
$scope.openTask = function(task) {
|
||||
var scope = $rootScope.$new();
|
||||
scope.task = task;
|
||||
scope.project = Project;
|
||||
|
||||
$modal.open({
|
||||
templateUrl: '/tpl/projects/taskModal.html',
|
||||
controller: 'TaskCtrl',
|
||||
scope: scope,
|
||||
size: 'lg'
|
||||
}).result.then(function() {
|
||||
$scope.reload();
|
||||
});
|
||||
}
|
||||
}]);
|
||||
});
|
Loading…
Reference in New Issue
Block a user