mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-09 09:27:42 +01:00
Merge pull request #1107 from wknet123/dev-restrict-timespan
Updates for restriction to time span. need more test
This commit is contained in:
commit
3be2fb7733
@ -20,9 +20,9 @@
|
|||||||
.module('harbor.log')
|
.module('harbor.log')
|
||||||
.directive('advancedSearch', advancedSearch);
|
.directive('advancedSearch', advancedSearch);
|
||||||
|
|
||||||
AdvancedSearchController.$inject = ['$scope', 'ListLogService'];
|
AdvancedSearchController.$inject = ['$scope', 'ListLogService', '$filter', 'trFilter'];
|
||||||
|
|
||||||
function AdvancedSearchController($scope, ListLogService) {
|
function AdvancedSearchController($scope, ListLogService, $filter, trFilter) {
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.checkOperation = checkOperation;
|
vm.checkOperation = checkOperation;
|
||||||
@ -121,8 +121,21 @@
|
|||||||
if(vm.opOthers && $.trim(vm.others) !== '') {
|
if(vm.opOthers && $.trim(vm.others) !== '') {
|
||||||
e.op.push(vm.others);
|
e.op.push(vm.others);
|
||||||
}
|
}
|
||||||
|
if(vm.fromDate && vm.toDate && (getDateValue(vm.fromDate) > getDateValue(vm.toDate))) {
|
||||||
|
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||||
|
$scope.$emit('modalMessage', $filter('tr')('begin_date_is_later_than_end_date'));
|
||||||
|
$scope.$emit('raiseError', true);
|
||||||
|
return
|
||||||
|
}
|
||||||
vm.search(e);
|
vm.search(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDateValue(date) {
|
||||||
|
if(date) {
|
||||||
|
return new Date(date);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function advancedSearch(I18nService) {
|
function advancedSearch(I18nService) {
|
||||||
|
@ -105,6 +105,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refreshReplicationJob() {
|
function refreshReplicationJob() {
|
||||||
|
if(vm.fromDate && vm.toDate && (getDateValue(vm.fromDate) > getDateValue(vm.toDate))) {
|
||||||
|
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||||
|
$scope.$emit('modalMessage', $filter('tr')('begin_date_is_later_than_end_date'));
|
||||||
|
$scope.$emit('raiseError', true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(vm.lastPolicyId !== -1) {
|
if(vm.lastPolicyId !== -1) {
|
||||||
vm.refreshJobTIP = true;
|
vm.refreshJobTIP = true;
|
||||||
vm.retrieveJob(vm.lastPolicyId, vm.page, vm.pageSize);
|
vm.retrieveJob(vm.lastPolicyId, vm.page, vm.pageSize);
|
||||||
@ -288,6 +294,13 @@
|
|||||||
return t.getTime() / 1000;
|
return t.getTime() / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDateValue(date) {
|
||||||
|
if(date) {
|
||||||
|
return new Date(date);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
listReplication.inject = ['$timeout', 'I18nService'];
|
listReplication.inject = ['$timeout', 'I18nService'];
|
||||||
|
@ -283,5 +283,6 @@ var locale_messages = {
|
|||||||
'confirm_to_toggle_enabled_policy_title': 'Enable Policy',
|
'confirm_to_toggle_enabled_policy_title': 'Enable Policy',
|
||||||
'confirm_to_toggle_enabled_policy': 'After enabling the replication policy, all repositories under the project will be replicated to the destination registry. Please confirm to continue.',
|
'confirm_to_toggle_enabled_policy': 'After enabling the replication policy, all repositories under the project will be replicated to the destination registry. Please confirm to continue.',
|
||||||
'confirm_to_toggle_disabled_policy_title': 'Disable Policy',
|
'confirm_to_toggle_disabled_policy_title': 'Disable Policy',
|
||||||
'confirm_to_toggle_disabled_policy': 'After disabling the policy, all unfinished replication jobs of this policy will be stopped and canceled. Please confirm to continue.'
|
'confirm_to_toggle_disabled_policy': 'After disabling the policy, all unfinished replication jobs of this policy will be stopped and canceled. Please confirm to continue.',
|
||||||
|
'begin_date_is_later_than_end_date': 'Begin date should not be later than end date.'
|
||||||
};
|
};
|
||||||
|
@ -285,5 +285,6 @@ var locale_messages = {
|
|||||||
'confirm_to_toggle_enabled_policy_title': '启用策略',
|
'confirm_to_toggle_enabled_policy_title': '启用策略',
|
||||||
'confirm_to_toggle_enabled_policy': '启用策略后,该项目下的所有镜像仓库将复制到目标实例。请确认继续。',
|
'confirm_to_toggle_enabled_policy': '启用策略后,该项目下的所有镜像仓库将复制到目标实例。请确认继续。',
|
||||||
'confirm_to_toggle_disabled_policy_title': '停用策略',
|
'confirm_to_toggle_disabled_policy_title': '停用策略',
|
||||||
'confirm_to_toggle_disabled_policy': '停用策略后,所有未完成的复制任务将被终止和取消。请确认继续。'
|
'confirm_to_toggle_disabled_policy': '停用策略后,所有未完成的复制任务将被终止和取消。请确认继续。',
|
||||||
|
'begin_date_is_later_than_end_date': '起始日期不能晚于结束日期。'
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user