update for creation time filter of replication jobs.

This commit is contained in:
kunw 2016-06-30 16:31:53 +08:00
parent 0ec5024351
commit f059029109
4 changed files with 47 additions and 14 deletions

View File

@ -86,7 +86,7 @@
}
function toUTCSeconds(date, hour, min, sec) {
if(date === "") {
if(!angular.isDefined(date) || date === '') {
return 0;
}

View File

@ -100,12 +100,11 @@
<table class="table table-pane table-header">
<thead>
<th width="15%">// 'name' | tr //</th>
<th width="12%">// 'operation' | tr //</th>
<th width="18%">// 'creation_time' | tr //</th>
<th width="18%">// 'start_time' | tr //</th>
<th width="18%">// 'end_time' | tr //</th>
<th width="15%">// 'operation' | tr //</th>
<th width="24%">// 'creation_time' | tr //</th>
<th width="24%">// 'end_time' | tr //</th>
<th width="10%">// 'status' | tr //</th>
<th width="9%">// 'logs' | tr //</th>
<th width="12%">// 'logs' | tr //</th>
</thead>
</table>
</div>
@ -117,12 +116,11 @@
</tr>
<tr ng-if="vm.replicationJobs.length > 0" ng-repeat="r in vm.replicationJobs">
<td width="15%">//r.repository//</td>
<td width="12%">//r.operation//</td>
<td width="18%">//r.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
<td width="18%">//r.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
<td width="18%">//r.update_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
<td width="15%">//r.operation//</td>
<td width="24%">//r.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
<td width="24%">//r.update_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
<td width="10%">//r.status//</td>
<td width="9%">
<td width="12%">
<a style="margin-left: 20px;" ng-show="r.status != 'canceled' && r.status != 'pending'" href="javascript:void(0);" ng-click="vm.downloadLog(r.id)" title="// 'download_log' | tr //"><span class="glyphicon glyphicon-file"></span></a>
</td>
</tr>

View File

@ -54,6 +54,8 @@
vm.jobStatus = jobStatus;
vm.currentStatus = vm.jobStatus()[0];
vm.pickUp = pickUp;
function searchReplicationPolicy() {
vm.retrievePolicy();
}
@ -72,7 +74,7 @@
function retrieveJob(policyId) {
var status = (vm.currentStatus.key === 'all' ? '' : vm.currentStatus.key);
ListReplicationJobService(policyId, vm.replicationJobName, status)
ListReplicationJobService(policyId, vm.replicationJobName, status, toUTCSeconds(vm.fromDate, 0, 0, 0), toUTCSeconds(vm.toDate, 23, 59, 59))
.success(listReplicationJobSuccess)
.error(listReplicationJobFailed);
}
@ -138,6 +140,37 @@
function downloadLog(policyId) {
$window.open('/api/jobs/replication/' + policyId + '/log', '_blank');
}
function pickUp(e) {
switch(e.key){
case 'fromDate':
vm.fromDate = e.value;
break;
case 'toDate':
vm.toDate = e.value;
break;
}
$scope.$apply();
}
function toUTCSeconds(date, hour, min, sec) {
if(!angular.isDefined(date) || date === '') {
return '';
}
var t = new Date(date);
t.setHours(hour);
t.setMinutes(min);
t.setSeconds(sec);
var utcTime = new Date(t.getUTCFullYear(),
t.getUTCMonth(),
t.getUTCDate(),
t.getUTCHours(),
t.getUTCMinutes(),
t.getUTCSeconds());
return utcTime.getTime() / 1000;
}
}
function listReplication($timeout) {

View File

@ -12,13 +12,15 @@
return listReplicationJob;
function listReplicationJob(policyId, repository, status) {
function listReplicationJob(policyId, repository, status, startTime, endTime) {
return $http
.get('/api/jobs/replication/', {
'params': {
'policy_id': policyId,
'repository': repository,
'status': status
'status': status,
'start_time': startTime,
'end_time': endTime
}
});
}