diff --git a/static/resources/js/components/replication/list-replication.directive.html b/static/resources/js/components/replication/list-replication.directive.html index d569832a2..e715a04b0 100644 --- a/static/resources/js/components/replication/list-replication.directive.html +++ b/static/resources/js/components/replication/list-replication.directive.html @@ -4,7 +4,7 @@
- +
@@ -55,9 +55,9 @@
- + - +
@@ -67,18 +67,20 @@ Name Operation - Start Time + Start Time Status + Logs

No replication jobs.

- //r.tags != null ? r.tags.join(',') : 'N/A'// + //r.repository// //r.operation// //r.update_time | dateL : 'YYYY-MM-DD HH:mm:ss'// //r.status// + diff --git a/static/resources/js/components/replication/list-replication.directive.js b/static/resources/js/components/replication/list-replication.directive.js index 9b6fe826a..611b93be3 100644 --- a/static/resources/js/components/replication/list-replication.directive.js +++ b/static/resources/js/components/replication/list-replication.directive.js @@ -6,9 +6,9 @@ .module('harbor.replication') .directive('listReplication', listReplication); - ListReplicationController.$inject = ['$scope', 'getParameterByName', '$location', 'ListReplicationPolicyService', 'ToggleReplicationPolicyService', 'ListReplicationJobService']; + ListReplicationController.$inject = ['$scope', 'getParameterByName', '$location', 'ListReplicationPolicyService', 'ToggleReplicationPolicyService', 'ListReplicationJobService', '$window']; - function ListReplicationController($scope, getParameterByName, $location, ListReplicationPolicyService, ToggleReplicationPolicyService, ListReplicationJobService) { + function ListReplicationController($scope, getParameterByName, $location, ListReplicationPolicyService, ToggleReplicationPolicyService, ListReplicationJobService, $window) { var vm = this; $scope.$on('$locationChangeSuccess', function() { @@ -19,19 +19,30 @@ vm.addReplication = addReplication; vm.editReplication = editReplication; - vm.search = search; + vm.searchReplicationPolicy = searchReplicationPolicy; + vm.searchReplicationJob = searchReplicationJob; vm.retrievePolicy = retrievePolicy; vm.retrieveJob = retrieveJob; vm.togglePolicy = togglePolicy; + + vm.downloadLog = downloadLog; vm.last = false; + + vm.projectId = getParameterByName('project_id', $location.absUrl()); vm.retrievePolicy(); - function search() { + function searchReplicationPolicy() { vm.retrievePolicy(); } + function searchReplicationJob() { + if(vm.lastPolicyId !== -1) { + vm.retrieveJob(vm.lastPolicyId); + } + } + function retrievePolicy() { ListReplicationPolicyService('', vm.projectId, vm.replicationPolicyName) .success(listReplicationPolicySuccess) @@ -88,6 +99,9 @@ console.log('Failed toggle replication policy.'); } + function downloadLog(policyId) { + $window.open('/api/jobs/replication/' + policyId + '/log', '_blank'); + } } function listReplication($timeout) { @@ -151,7 +165,7 @@ } }); }); - + function trClickHandler(e) { element .find('#upon-pane table>tbody>tr')