Revision 41984
Added by Michele Artini about 8 years ago
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/js/dnet_wf_journal.js | ||
---|---|---|
1 |
var module = angular.module('wfJournalUI', ['ngGrid']); |
|
2 |
|
|
3 |
module.controller('wfJournalCtrl', function($scope, $http, $sce) { |
|
4 |
//commonInitialize($scope, $http, $sce); |
|
5 |
|
|
6 |
initSpinner(); |
|
7 |
|
|
8 |
$scope.journal = []; |
|
9 |
|
|
10 |
$scope.current = {}; |
|
11 |
$scope.family = getFamily(); |
|
12 |
$scope.filterJournal = {filterText: ''}; |
|
13 |
$scope.currentParam = {}; |
|
14 |
|
|
15 |
$scope.maxDate = new Date(); |
|
16 |
$scope.minDate = new Date(2014, 0, 1); |
|
17 |
|
|
18 |
$scope.endDate = new Date(); |
|
19 |
$scope.startDate = new Date(); |
|
20 |
|
|
21 |
$scope.updateDates = function (start, end) { |
|
22 |
$scope.startDate = start; |
|
23 |
$scope.endDate = end; |
|
24 |
$scope.$apply(); |
|
25 |
$scope.refresh(); |
|
26 |
} |
|
27 |
|
|
28 |
// Set date range to [7 days before today, today] inclusive |
|
29 |
$scope.startDate.setDate($scope.endDate.getDate() - 7); |
|
30 |
|
|
31 |
// Grid configuration |
|
32 |
$scope.gridWfJournal = { |
|
33 |
data: 'journal', |
|
34 |
enableCellSelection: false, |
|
35 |
enableRowSelection: false, |
|
36 |
enableCellEditOnFocus: false, |
|
37 |
enablePaging: false, |
|
38 |
enableHighlighting: true, |
|
39 |
sortInfo: {fields: ['date'], directions: ['desc']}, |
|
40 |
filterOptions: $scope.filterJournal, |
|
41 |
columnDefs: [{ |
|
42 |
field: 'procId', |
|
43 |
displayName: 'Process ID', |
|
44 |
width: '15%', |
|
45 |
cellTemplate: '<div class="ngCellText"><a href="javascript:void(0)" ng-click="showProcess(row.getProperty(col.field))" data-target="#currentLogDetailsModal" data-toggle="modal">{{row.getProperty(col.field)}}</a></div>' |
|
46 |
}, |
|
47 |
{field: 'name', displayName: 'Workflow name', width: '20%'}, |
|
48 |
{field: 'family', displayName: 'Workflow family', width: '15%'}, |
|
49 |
{field: 'datasource', displayName: 'Datasource'}, |
|
50 |
{ |
|
51 |
field: 'status', |
|
52 |
displayName: 'Status', |
|
53 |
width: '10%', |
|
54 |
headerClass: 'text-center', |
|
55 |
cellTemplate: '<div class="ngCellText text-center"><span class="label label-default" ng-class="{ \'label-success\': row.getProperty(col.field) == \'SUCCESS\', \'label-danger\': row.getProperty(col.field) == \'FAILURE\', \'label-info\': row.getProperty(col.field) == \'EXECUTING\'}">{{row.getProperty(col.field)}}</span></div>' |
|
56 |
}, |
|
57 |
{ |
|
58 |
field: 'date', |
|
59 |
displayName: 'Date', |
|
60 |
width: '10%', |
|
61 |
headerClass: 'text-right', |
|
62 |
cellTemplate: '<div class="ngCellText text-right">{{ (row.getProperty("date") > 0 && row.getProperty("date") < 9999999999999) ? (row.getProperty("date") | date:"yyyy-MM-dd HH:mm:ss") : "not yet started" }}</div>' |
|
63 |
} |
|
64 |
] |
|
65 |
}; |
|
66 |
|
|
67 |
$scope.showProcess = function(procId) { |
|
68 |
$scope.current = { 'procId' : procId }; |
|
69 |
$scope.currentParam = {}; |
|
70 |
|
|
71 |
showSpinner(); |
|
72 |
|
|
73 |
$http.get("wf/journal.get?id="+procId).success( |
|
74 |
function (data) { |
|
75 |
$scope.current = data; |
|
76 |
hideSpinner(); |
|
77 |
} |
|
78 |
).error( |
|
79 |
function () { |
|
80 |
showError('Something really bad must have happened to our fellow hamster..'); |
|
81 |
hideSpinner(); |
|
82 |
} |
|
83 |
); |
|
84 |
} |
|
85 |
|
|
86 |
$scope.formatDate = function (date) { |
|
87 |
var year = date.getFullYear(); |
|
88 |
var month = ("00" + (date.getMonth() + 1)).slice(-2); |
|
89 |
var day = ("00" + date.getDate()).slice(-2); |
|
90 |
return year + '-' + month + '-' + day; |
|
91 |
} |
|
92 |
|
|
93 |
$scope.refresh = function () { |
|
94 |
showSpinner(); |
|
95 |
$scope.current = {}; |
|
96 |
$scope.currentParam = {}; |
|
97 |
var url = ''; |
|
98 |
|
|
99 |
if ($scope.family) { |
|
100 |
url = 'wf/journal_byFamily.find?family=' + $scope.family; |
|
101 |
} else { |
|
102 |
url = 'wf/journal.range?start=' + $scope.formatDate($scope.startDate) + '&end=' + $scope.formatDate($scope.endDate); |
|
103 |
} |
|
104 |
$http.get(url).success( |
|
105 |
function (data) { |
|
106 |
$scope.journal = data; |
|
107 |
hideSpinner(); |
|
108 |
} |
|
109 |
).error( |
|
110 |
function () { |
|
111 |
showError('Something really bad must have happened to our fellow hamster..'); |
|
112 |
hideSpinner(); |
|
113 |
} |
|
114 |
); |
|
115 |
} |
|
116 |
|
|
117 |
$scope.calculateDateDiff = function (start, end) { |
|
118 |
if (start <= 0 || end <= 0) { |
|
119 |
return '-'; |
|
120 |
} |
|
121 |
var seconds = 0; |
|
122 |
var minutes = 0; |
|
123 |
var hours = 0; |
|
124 |
var days = 0; |
|
125 |
|
|
126 |
if (end > start) { |
|
127 |
seconds = Math.round((end - start) / 1000); |
|
128 |
|
|
129 |
if (seconds > 60) { |
|
130 |
minutes = Math.floor(seconds / 60); |
|
131 |
seconds = seconds % 60; |
|
132 |
if (minutes > 60) { |
|
133 |
hours = Math.floor(minutes / 60); |
|
134 |
minutes = minutes % 60; |
|
135 |
if (hours > 24) { |
|
136 |
days = Math.floor(hours / 24); |
|
137 |
hours = hours % 24; |
|
138 |
} |
|
139 |
} |
|
140 |
} |
|
141 |
} |
|
142 |
|
|
143 |
var res = ''; |
|
144 |
if (days > 0) { |
|
145 |
if (res) { |
|
146 |
res += ', '; |
|
147 |
} |
|
148 |
res += days + " day(s)" |
|
149 |
} |
|
150 |
if (hours > 0) { |
|
151 |
if (res) { |
|
152 |
res += ', '; |
|
153 |
} |
|
154 |
res += hours + " hour(s)" |
|
155 |
} |
|
156 |
if (minutes > 0) { |
|
157 |
if (res) { |
|
158 |
res += ', '; |
|
159 |
} |
|
160 |
res += minutes + " minute(s)" |
|
161 |
} |
|
162 |
if (seconds > 0) { |
|
163 |
if (res) { |
|
164 |
res += ', '; |
|
165 |
} |
|
166 |
res += seconds + " second(s)" |
|
167 |
} |
|
168 |
|
|
169 |
if (!res) { |
|
170 |
res = '0 seconds'; |
|
171 |
} |
|
172 |
|
|
173 |
return res; |
|
174 |
} |
|
175 |
|
|
176 |
$scope.setCurrentParam = function (p) { |
|
177 |
$scope.currentParam = p; |
|
178 |
} |
|
179 |
|
|
180 |
$scope.resizeMainElement = function (elem) { |
|
181 |
var height = 0; |
|
182 |
var body = window.document.body; |
|
183 |
if (window.innerHeight) { |
|
184 |
height = window.innerHeight; |
|
185 |
} else if (body.parentElement.clientHeight) { |
|
186 |
height = body.parentElement.clientHeight; |
|
187 |
} else if (body && body.clientHeight) { |
|
188 |
height = body.clientHeight; |
|
189 |
} |
|
190 |
elem.style.height = ((height - elem.offsetTop - 280) + "px"); |
|
191 |
} |
|
192 |
|
|
193 |
$scope.refresh(); |
|
194 |
$scope.resizeMainElement(document.getElementById('wfJournalTable')); |
|
195 |
|
|
196 |
if (initProcId()) { |
|
197 |
$scope.showProcess(initProcId()); |
|
198 |
} |
|
199 |
}); |
|
200 |
|
|
201 |
window.onresize = function () { |
|
202 |
var elem = document.getElementById('wfJournalTable'); |
|
203 |
angular.element(elem).scope().resizeMainElement(elem); |
|
204 |
}; |
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/workflow_journal.st | ||
---|---|---|
1 | 1 |
$common/master( header={ |
2 | 2 |
$ui/workflows/common/header()$ |
3 | 3 |
|
4 |
<script type="text/javascript" src="../resources/js/dnet_wf_journal.js"></script> |
|
5 |
<!-- <script type="text/javascript" src="../resources/js/ui-bootstrap.min.js"></script> --> |
|
6 |
|
|
7 |
<!-- |
|
8 |
<script type="text/javascript" src="../resources/js/jquery-ui-1.10.4.min.js"></script> |
|
9 |
<script type="text/javascript" src="../resources/js/jQDateRangeSlider-withRuler-min.js"></script> |
|
10 |
<link rel="stylesheet" type="text/css" href="../resources/css/jquery-ui-1.10.4.min.css" /> |
|
11 |
<link rel="stylesheet" type="text/css" href="../resources/css/jQRangeSlider-dnet.min.css" /> |
|
12 |
--> |
|
4 |
<script type="text/javascript" src="../resources/js/workflows/wf_process_viewer.js"></script> |
|
5 |
<script type="text/javascript" src="../resources/js/workflows/wf_journal.js"></script> |
|
13 | 6 |
|
14 | 7 |
<style> |
15 | 8 |
#wfJournalTable { |
... | ... | |
39 | 32 |
|
40 | 33 |
}, body={ |
41 | 34 |
<div ng-app="wfJournalUI" ng-controller="wfJournalCtrl"> |
42 |
<div id="currentLogDetailsModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-title" aria-hidden="true"> |
|
43 |
<div class="modal-dialog modal-lg"> |
|
44 |
<div class="modal-content"> |
|
45 |
<div class="modal-header"> |
|
46 |
<button type="button" class="close" data-dismiss="modal">×</button> |
|
47 |
<h4 class="modal-title" id="logDetailsLabel">Process <i>{{current.procId}}</i></h4> |
|
48 |
</div> |
|
49 |
<div class="modal-body"> |
|
50 |
<p> |
|
51 |
<strong>Started at: </strong>{{current.startDate | date:'yyyy-MM-dd HH:mm:ss'}}<br/> |
|
52 |
<strong>Finished at: </strong>{{current.endDate | date:'yyyy-MM-dd HH:mm:ss'}}<br/> |
|
53 |
<strong>Duration: </strong> {{calculateDateDiff(current.startDate, current.endDate)}}<br/> |
|
54 |
</p> |
|
35 |
|
|
36 |
<wf-process-modal proc-id="currentId" visible="showModal"></wf-process-modal> |
|
55 | 37 |
|
56 |
<table class="table table-condensed table-striped" style="table-layout: fixed; font-size: 12px;"> |
|
57 |
<tr ng-repeat="p in current.currentEnv"> |
|
58 |
<th class="col-xs-4"><a href="javascript:void(0)" ng-click="setCurrentParam(p)">{{p.name}}</a></th> |
|
59 |
<td style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">{{p.value}}</td> |
|
60 |
</tr> |
|
61 |
</table> |
|
62 |
|
|
63 |
<div class="well" style="font-size: 11px" ng-show="currentParam.name"> |
|
64 |
<p><strong>{{currentParam.name}}</strong></p> |
|
65 |
<p>{{currentParam.value}}</p> |
|
66 |
</div> |
|
67 |
</div> |
|
68 |
<div class="modal-footer"> |
|
69 |
<button class="btn btn-default pull-left" data-dismiss="modal" data-toggle="modal" data-target="#monitorProcWfModal" ng-show="currentProc">Show graph</button> |
|
70 |
<button class="btn btn-primary" data-dismiss="modal">Close</button> |
|
71 |
</div> |
|
72 |
</div> |
|
73 |
</div> |
|
74 |
</div> |
|
75 |
|
|
76 | 38 |
<div ng-hide="family"> |
77 | 39 |
<div class="row"> |
78 | 40 |
<div class="col-xs-12 col-md-9"> |
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/html/wf/wf_process_viewer.html | ||
---|---|---|
1 |
<div id="procLogDetailsModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-title" aria-hidden="true"> |
|
2 |
<div class="modal-dialog modal-lg"> |
|
3 |
<div class="modal-content"> |
|
4 |
<div class="modal-header"> |
|
5 |
<button type="button" class="close" data-dismiss="modal">×</button> |
|
6 |
<h4 class="modal-title" id="logDetailsLabel">Process <i>{{procId}}</i></h4> |
|
7 |
</div> |
|
8 |
<div class="modal-body"> |
|
9 |
<p> |
|
10 |
<strong>Started at: </strong>{{proc.startDate | date:'yyyy-MM-dd HH:mm:ss'}}<br/> |
|
11 |
<strong>Finished at: </strong>{{proc.endDate | date:'yyyy-MM-dd HH:mm:ss'}}<br/> |
|
12 |
<strong>Duration: </strong> {{calculateDateDiff(proc.startDate, proc.endDate)}}<br/> |
|
13 |
</p> |
|
14 |
|
|
15 |
<table class="table table-condensed table-striped" style="table-layout: fixed; font-size: 12px;"> |
|
16 |
<tr ng-repeat="p in proc.currentEnv"> |
|
17 |
<th class="col-xs-4"><a href="javascript:void(0)" ng-click="setCurrentParam(p)">{{p.name}}</a></th> |
|
18 |
<td style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap;">{{p.value}}</td> |
|
19 |
</tr> |
|
20 |
</table> |
|
21 |
|
|
22 |
<div class="well" style="font-size: 11px" ng-show="currentParam.name"> |
|
23 |
<p><strong>{{currentParam.name}}</strong></p> |
|
24 |
<p>{{currentParam.value}}</p> |
|
25 |
</div> |
|
26 |
</div> |
|
27 |
<div class="modal-footer"> |
|
28 |
<button class="btn btn-primary" data-dismiss="modal">Close</button> |
|
29 |
</div> |
|
30 |
</div> |
|
31 |
</div> |
|
32 |
</div> |
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/js/workflows/wf_journal.js | ||
---|---|---|
1 |
var module = angular.module('wfJournalUI', ['ngGrid', 'wfProcessViewer']); |
|
2 |
|
|
3 |
module.controller('wfJournalCtrl', function($scope, $http, $sce) { |
|
4 |
//commonInitialize($scope, $http, $sce); |
|
5 |
|
|
6 |
initSpinner(); |
|
7 |
|
|
8 |
$scope.journal = []; |
|
9 |
|
|
10 |
$scope.currentId = ''; |
|
11 |
$scope.showModal = false; |
|
12 |
|
|
13 |
$scope.family = getFamily(); |
|
14 |
$scope.filterJournal = {filterText: ''}; |
|
15 |
|
|
16 |
$scope.maxDate = new Date(); |
|
17 |
$scope.minDate = new Date(2014, 0, 1); |
|
18 |
|
|
19 |
$scope.endDate = new Date(); |
|
20 |
$scope.startDate = new Date(); |
|
21 |
|
|
22 |
$scope.updateDates = function (start, end) { |
|
23 |
$scope.startDate = start; |
|
24 |
$scope.endDate = end; |
|
25 |
$scope.$apply(); |
|
26 |
$scope.refresh(); |
|
27 |
} |
|
28 |
|
|
29 |
// Set date range to [7 days before today, today] inclusive |
|
30 |
$scope.startDate.setDate($scope.endDate.getDate() - 7); |
|
31 |
|
|
32 |
// Grid configuration |
|
33 |
$scope.gridWfJournal = { |
|
34 |
data: 'journal', |
|
35 |
enableCellSelection: false, |
|
36 |
enableRowSelection: false, |
|
37 |
enableCellEditOnFocus: false, |
|
38 |
enablePaging: false, |
|
39 |
enableHighlighting: true, |
|
40 |
sortInfo: {fields: ['date'], directions: ['desc']}, |
|
41 |
filterOptions: $scope.filterJournal, |
|
42 |
columnDefs: [{ |
|
43 |
field: 'procId', |
|
44 |
displayName: 'Process ID', |
|
45 |
width: '15%', |
|
46 |
cellTemplate: '<div class="ngCellText"><a href="javascript:void(0)" ng-click="showProcess(row.getProperty(col.field))">{{row.getProperty(col.field)}}</a></div>' |
|
47 |
}, |
|
48 |
{field: 'name', displayName: 'Workflow name', width: '20%'}, |
|
49 |
{field: 'family', displayName: 'Workflow family', width: '15%'}, |
|
50 |
{field: 'datasource', displayName: 'Datasource'}, |
|
51 |
{ |
|
52 |
field: 'status', |
|
53 |
displayName: 'Status', |
|
54 |
width: '10%', |
|
55 |
headerClass: 'text-center', |
|
56 |
cellTemplate: '<div class="ngCellText text-center"><span class="label label-default" ng-class="{ \'label-success\': row.getProperty(col.field) == \'SUCCESS\', \'label-danger\': row.getProperty(col.field) == \'FAILURE\', \'label-info\': row.getProperty(col.field) == \'EXECUTING\'}">{{row.getProperty(col.field)}}</span></div>' |
|
57 |
}, |
|
58 |
{ |
|
59 |
field: 'date', |
|
60 |
displayName: 'Date', |
|
61 |
width: '10%', |
|
62 |
headerClass: 'text-right', |
|
63 |
cellTemplate: '<div class="ngCellText text-right">{{ (row.getProperty("date") > 0 && row.getProperty("date") < 9999999999999) ? (row.getProperty("date") | date:"yyyy-MM-dd HH:mm:ss") : "not yet started" }}</div>' |
|
64 |
} |
|
65 |
] |
|
66 |
}; |
|
67 |
|
|
68 |
$scope.showProcess = function(procId) { |
|
69 |
$scope.currentId = procId; |
|
70 |
$scope.showModal = true; |
|
71 |
} |
|
72 |
|
|
73 |
$scope.formatDate = function (date) { |
|
74 |
var year = date.getFullYear(); |
|
75 |
var month = ("00" + (date.getMonth() + 1)).slice(-2); |
|
76 |
var day = ("00" + date.getDate()).slice(-2); |
|
77 |
return year + '-' + month + '-' + day; |
|
78 |
} |
|
79 |
|
|
80 |
$scope.refresh = function () { |
|
81 |
showSpinner(); |
|
82 |
$scope.current = {}; |
|
83 |
$scope.currentParam = {}; |
|
84 |
var url = ''; |
|
85 |
|
|
86 |
if ($scope.family) { |
|
87 |
url = 'wf/journal_byFamily.find?family=' + $scope.family; |
|
88 |
} else { |
|
89 |
url = 'wf/journal.range?start=' + $scope.formatDate($scope.startDate) + '&end=' + $scope.formatDate($scope.endDate); |
|
90 |
} |
|
91 |
$http.get(url).success( |
|
92 |
function (data) { |
|
93 |
$scope.journal = data; |
|
94 |
hideSpinner(); |
|
95 |
} |
|
96 |
).error( |
|
97 |
function () { |
|
98 |
showError('Something really bad must have happened to our fellow hamster..'); |
|
99 |
hideSpinner(); |
|
100 |
} |
|
101 |
); |
|
102 |
} |
|
103 |
|
|
104 |
$scope.resizeMainElement = function (elem) { |
|
105 |
var height = 0; |
|
106 |
var body = window.document.body; |
|
107 |
if (window.innerHeight) { |
|
108 |
height = window.innerHeight; |
|
109 |
} else if (body.parentElement.clientHeight) { |
|
110 |
height = body.parentElement.clientHeight; |
|
111 |
} else if (body && body.clientHeight) { |
|
112 |
height = body.clientHeight; |
|
113 |
} |
|
114 |
elem.style.height = ((height - elem.offsetTop - 280) + "px"); |
|
115 |
} |
|
116 |
|
|
117 |
$scope.refresh(); |
|
118 |
$scope.resizeMainElement(document.getElementById('wfJournalTable')); |
|
119 |
|
|
120 |
if (initProcId()) { |
|
121 |
$scope.showProcess(initProcId()); |
|
122 |
} |
|
123 |
}); |
|
124 |
|
|
125 |
window.onresize = function () { |
|
126 |
var elem = document.getElementById('wfJournalTable'); |
|
127 |
angular.element(elem).scope().resizeMainElement(elem); |
|
128 |
}; |
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/js/workflows/wf_process_viewer.js | ||
---|---|---|
1 |
var wfProcessViewer = angular.module("wfProcessViewer", []); |
|
2 |
|
|
3 |
wfProcessViewer.directive("wfProcessModal", function ($http) { |
|
4 |
return { |
|
5 |
restrict: 'E', |
|
6 |
transclude: true, |
|
7 |
replace:true, |
|
8 |
scope: { |
|
9 |
'procId' : '=', |
|
10 |
'visible' : '=' |
|
11 |
}, |
|
12 |
templateUrl: '../resources/html/wf/wf_process_viewer.html', |
|
13 |
|
|
14 |
link: function (scope, element, attrs, ctrl) { |
|
15 |
scope.currentParam = {}; |
|
16 |
scope.current = {}; |
|
17 |
|
|
18 |
$(element).modal({'show': false}); |
|
19 |
|
|
20 |
scope.$watch(function() { |
|
21 |
return scope.visible; |
|
22 |
}, function(value) { |
|
23 |
if (value == true && scope.procId) { |
|
24 |
$(element).modal('show'); |
|
25 |
scope.visible = false; |
|
26 |
scope.proc = {}; |
|
27 |
scope.currentParam = {}; |
|
28 |
|
|
29 |
showSpinner(); |
|
30 |
|
|
31 |
$http.get("wf/journal.get?id=" + scope.procId).success( |
|
32 |
function (data) { |
|
33 |
scope.proc = data; |
|
34 |
hideSpinner(); |
|
35 |
} |
|
36 |
).error( |
|
37 |
function () { |
|
38 |
showError('Something really bad must have happened to our fellow hamster..'); |
|
39 |
hideSpinner(); |
|
40 |
} |
|
41 |
); |
|
42 |
} |
|
43 |
}); |
|
44 |
|
|
45 |
|
|
46 |
scope.calculateDateDiff = function (start, end) { |
|
47 |
if (start <= 0 || end <= 0) { |
|
48 |
return '-'; |
|
49 |
} |
|
50 |
var seconds = 0; |
|
51 |
var minutes = 0; |
|
52 |
var hours = 0; |
|
53 |
var days = 0; |
|
54 |
|
|
55 |
if (end > start) { |
|
56 |
seconds = Math.round((end - start) / 1000); |
|
57 |
|
|
58 |
if (seconds > 60) { |
|
59 |
minutes = Math.floor(seconds / 60); |
|
60 |
seconds = seconds % 60; |
|
61 |
if (minutes > 60) { |
|
62 |
hours = Math.floor(minutes / 60); |
|
63 |
minutes = minutes % 60; |
|
64 |
if (hours > 24) { |
|
65 |
days = Math.floor(hours / 24); |
|
66 |
hours = hours % 24; |
|
67 |
} |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
71 |
|
|
72 |
var res = ''; |
|
73 |
if (days > 0) { |
|
74 |
if (res) { |
|
75 |
res += ', '; |
|
76 |
} |
|
77 |
res += days + " day(s)" |
|
78 |
} |
|
79 |
if (hours > 0) { |
|
80 |
if (res) { |
|
81 |
res += ', '; |
|
82 |
} |
|
83 |
res += hours + " hour(s)" |
|
84 |
} |
|
85 |
if (minutes > 0) { |
|
86 |
if (res) { |
|
87 |
res += ', '; |
|
88 |
} |
|
89 |
res += minutes + " minute(s)" |
|
90 |
} |
|
91 |
if (seconds > 0) { |
|
92 |
if (res) { |
|
93 |
res += ', '; |
|
94 |
} |
|
95 |
res += seconds + " second(s)" |
|
96 |
} |
|
97 |
|
|
98 |
if (!res) { |
|
99 |
res = '0 seconds'; |
|
100 |
} |
|
101 |
|
|
102 |
return res; |
|
103 |
} |
|
104 |
|
|
105 |
scope.setCurrentParam = function (p) { |
|
106 |
scope.currentParam = p; |
|
107 |
} |
|
108 |
} |
|
109 |
} |
|
110 |
}); |
Also available in: Unified diff