This commit is contained in:
parent
761ad265fa
commit
14d7110b1d
|
@ -21,6 +21,8 @@ app.controller('wfHistoryController', function($scope, $http) {
|
||||||
$scope.currDetailsKey = '';
|
$scope.currDetailsKey = '';
|
||||||
$scope.currDetailsValue = '';
|
$scope.currDetailsValue = '';
|
||||||
$scope.currentWf.arrayDetails = [];
|
$scope.currentWf.arrayDetails = [];
|
||||||
|
$scope.currentWf.duration = $scope.calculateDateDiff(parseInt(wf.details['system:startDate']), parseInt(wf.details['system:endDate']));
|
||||||
|
|
||||||
angular.forEach(wf.details, function(v,k) {
|
angular.forEach(wf.details, function(v,k) {
|
||||||
$scope.currentWf.arrayDetails.push({'k':k, 'v':v});
|
$scope.currentWf.arrayDetails.push({'k':k, 'v':v});
|
||||||
});
|
});
|
||||||
|
@ -29,7 +31,56 @@ app.controller('wfHistoryController', function($scope, $http) {
|
||||||
$scope.setCurrentDetailParam = function(k, v) {
|
$scope.setCurrentDetailParam = function(k, v) {
|
||||||
$scope.currDetailsKey = k;
|
$scope.currDetailsKey = k;
|
||||||
$scope.currDetailsValue = v;
|
$scope.currDetailsValue = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$scope.calculateDateDiff = function(start, end) {
|
||||||
|
if (start <= 0 || end <= 0) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
var seconds = 0;
|
||||||
|
var minutes = 0;
|
||||||
|
var hours = 0;
|
||||||
|
var days = 0;
|
||||||
|
|
||||||
|
if (end > start) {
|
||||||
|
seconds = Math.round((end - start) / 1000);
|
||||||
|
if (seconds > 60) {
|
||||||
|
minutes = Math.floor(seconds / 60);
|
||||||
|
seconds = seconds % 60;
|
||||||
|
if (minutes > 60) {
|
||||||
|
hours = Math.floor(minutes / 60);
|
||||||
|
minutes = minutes % 60;
|
||||||
|
if (hours > 24) {
|
||||||
|
days = Math.floor(hours / 24);
|
||||||
|
hours = hours % 24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var res = '';
|
||||||
|
if (days > 0) {
|
||||||
|
if (res) { res += ', '; }
|
||||||
|
res += days + " day(s)"
|
||||||
|
}
|
||||||
|
if (hours > 0) {
|
||||||
|
if (res) { res += ', '; }
|
||||||
|
res += hours + " hour(s)"
|
||||||
|
}
|
||||||
|
if (minutes > 0) {
|
||||||
|
if (res) { res += ', '; }
|
||||||
|
res += minutes + " minute(s)"
|
||||||
|
}
|
||||||
|
if (seconds > 0) {
|
||||||
|
if (res) { res += ', '; }
|
||||||
|
res += seconds + " second(s)"
|
||||||
|
}
|
||||||
|
if (!res) {
|
||||||
|
res = '0 seconds';
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.reload();
|
$scope.reload();
|
||||||
});
|
});
|
||||||
|
|
|
@ -104,6 +104,12 @@
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
<p>
|
||||||
|
<b>Started at: </b>{{currentWf.startDate}}<br />
|
||||||
|
<b>Finished at: </b>{{currentWf.endDate}}<br />
|
||||||
|
<b>Duration: </b>{{currentWf.duration}}<br />
|
||||||
|
</p>
|
||||||
|
|
||||||
<input type="text" class="form-control form-control-sm" ng-model="detailsFilter" placeholder="Filter..."/>
|
<input type="text" class="form-control form-control-sm" ng-model="detailsFilter" placeholder="Filter..."/>
|
||||||
|
|
||||||
<table class="table table-sm table-striped small mt-2" style="table-layout: fixed;">
|
<table class="table table-sm table-striped small mt-2" style="table-layout: fixed;">
|
||||||
|
|
Loading…
Reference in New Issue