mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-28 19:47:58 +01:00
Merge pull request #504 from wknet123/master
fixed issues for #502, #503.
This commit is contained in:
commit
a2722a8b89
@ -56,8 +56,8 @@
|
||||
</td>
|
||||
<td width="12%">
|
||||
<div class="display-inline-block" ng-switch on="//r.enabled//">
|
||||
<a href="javascript:void(0);" ng-click="vm.togglePolicy(r.id, 0)" title="// 'disable' | tr //"><span ng-switch-when="1" class="glyphicon glyphicon-stop color-danger"></span></a>
|
||||
<a href="javascript:void(0);" ng-click="vm.togglePolicy(r.id, 1)" title="// 'enable' | tr //"><span ng-switch-when="0" class="glyphicon glyphicon-play color-success"></span></a>
|
||||
<a href="javascript:void(0);" ng-click="vm.confirmToTogglePolicy(r.id, 0, r.name)" title="// 'disable' | tr //"><span ng-switch-when="1" class="glyphicon glyphicon-stop color-danger"></span></a>
|
||||
<a href="javascript:void(0);" ng-click="vm.confirmToTogglePolicy(r.id, 1, r.name)" title="// 'enable' | tr //"><span ng-switch-when="0" class="glyphicon glyphicon-play color-success"></span></a>
|
||||
</div>
|
||||
|
||||
<a href="javascript:void(0);" data-toggle="modal" data-target="#createPolicyModal" ng-click="vm.editReplication(r.id)" title="// 'edit_policy' | tr //"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
|
@ -29,6 +29,7 @@
|
||||
var vm = this;
|
||||
vm.retrieve = retrieve;
|
||||
vm.search = search;
|
||||
vm.confirmToTogglePolicy = confirmToTogglePolicy;
|
||||
vm.togglePolicy = togglePolicy;
|
||||
vm.editReplication = editReplication;
|
||||
vm.retrieve();
|
||||
@ -53,9 +54,36 @@
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed to list replication policy.');
|
||||
}
|
||||
|
||||
function confirmToTogglePolicy(policyId, enabled, name) {
|
||||
vm.policyId = policyId;
|
||||
vm.enabled = enabled;
|
||||
|
||||
var status = $filter('tr')(vm.enabled === 1 ? 'enable':'disable');
|
||||
|
||||
var title;
|
||||
var message;
|
||||
if(enabled === 1){
|
||||
title = $filter('tr')('confirm_to_toggle_enabled_policy_title');
|
||||
message = $filter('tr')('confirm_to_toggle_enabled_policy');
|
||||
}else{
|
||||
title = $filter('tr')('confirm_to_toggle_disabled_policy_title');
|
||||
message = $filter('tr')('confirm_to_toggle_disabled_policy');
|
||||
}
|
||||
$scope.$emit('modalTitle', title);
|
||||
$scope.$emit('modalMessage', message);
|
||||
|
||||
var emitInfo = {
|
||||
'contentType': 'text/html',
|
||||
'confirmOnly': false,
|
||||
'action': vm.togglePolicy
|
||||
}
|
||||
|
||||
$scope.$emit('raiseInfo', emitInfo);
|
||||
}
|
||||
|
||||
function togglePolicy(policyId, enabled) {
|
||||
ToggleReplicationPolicyService(policyId, enabled)
|
||||
function togglePolicy() {
|
||||
ToggleReplicationPolicyService(vm.policyId, vm.enabled)
|
||||
.success(toggleReplicationPolicySuccess)
|
||||
.error(toggleReplicationPolicyFailed);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@
|
||||
<tr ng-if="vm.projects.length > 0" ng-repeat="p in vm.projects">
|
||||
<td width="15%"><a href="/repository#/repositories?project_id=//p.project_id//&is_public=//p.public//">//p.name//</a></td>
|
||||
<td width="20%">//p.repo_count//</td>
|
||||
<td width="15%" ng-if="!vm.publicity">//vm.getProjectRole(p.current_user_role_id)//</td>
|
||||
<td width="15%" ng-if="!vm.publicity">//vm.getProjectRole(p.current_user_role_id) | tr//</td>
|
||||
<td width="30%">//p.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
||||
<td width="15%"><publicity-button is-public="p.public" owned="p.owner_id == vm.user.user_id" project-id="p.project_id"></publicity-button></td>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user