mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-22 06:41:36 +01:00
update for common message dialog.
This commit is contained in:
parent
7970dc8607
commit
291ea9e0e1
@ -6,9 +6,9 @@
|
||||
.module('harbor.details')
|
||||
.directive('retrieveProjects', retrieveProjects);
|
||||
|
||||
RetrieveProjectsController.$inject = ['$scope', 'nameFilter', '$filter', 'ListProjectService', '$location', 'getParameterByName', 'CurrentProjectMemberService', '$window'];
|
||||
RetrieveProjectsController.$inject = ['$scope', 'nameFilter', '$filter', 'trFilter', 'ListProjectService', '$location', 'getParameterByName', 'CurrentProjectMemberService', '$window'];
|
||||
|
||||
function RetrieveProjectsController($scope, nameFilter, $filter, ListProjectService, $location, getParameterByName, CurrentProjectMemberService, $window) {
|
||||
function RetrieveProjectsController($scope, nameFilter, $filter, trFilter, ListProjectService, $location, getParameterByName, CurrentProjectMemberService, $window) {
|
||||
var vm = this;
|
||||
|
||||
vm.projectName = '';
|
||||
@ -20,7 +20,7 @@
|
||||
}
|
||||
|
||||
vm.retrieve = retrieve;
|
||||
vm.filterInput = "";
|
||||
vm.filterInput = '';
|
||||
vm.selectItem = selectItem;
|
||||
vm.checkProjectMember = checkProjectMember;
|
||||
|
||||
@ -78,6 +78,9 @@
|
||||
}
|
||||
|
||||
function getProjectFailed(response) {
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_get_project'));
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed to list projects:' + response);
|
||||
}
|
||||
|
||||
@ -104,8 +107,13 @@
|
||||
}
|
||||
|
||||
function getCurrentProjectMemberFailed(data, status) {
|
||||
console.log('Use has no member for current project:' + status + ', location.url:' + $location.url());
|
||||
vm.isProjectMember = false;
|
||||
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_get_project_member'));
|
||||
$scope.$emit('raiseError', true);
|
||||
|
||||
console.log('Current user has no member for the project:' + status + ', location.url:' + $location.url());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
<modal-dialog modal-title="// vm.modalTitle //" modal-message="// vm.modalMessage //" confirm-only="vm.confirmOnly" action="vm.action()"></modal-dialog>
|
||||
<div class="tab-pane" id="logs" element-height>
|
||||
<div class="col-xs-12 col-md-12 each-tab-pane">
|
||||
<div class="form-inline">
|
||||
|
@ -49,26 +49,7 @@
|
||||
};
|
||||
retrieve(vm.queryParams);
|
||||
});
|
||||
|
||||
//Error message dialog handler for logs.
|
||||
$scope.$on('modalTitle', function(e, val) {
|
||||
vm.modalTitle = val;
|
||||
});
|
||||
|
||||
$scope.$on('modalMessage', function(e, val) {
|
||||
vm.modalMessage = val;
|
||||
});
|
||||
|
||||
$scope.$on('raiseError', function(e, val) {
|
||||
if(val) {
|
||||
vm.action = function() {
|
||||
$scope.$broadcast('showDialog', false);
|
||||
};
|
||||
vm.confirmOnly = true;
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function search(e) {
|
||||
if(e.op[0] === 'all') {
|
||||
vm.queryParams.keywords = '';
|
||||
@ -99,6 +80,7 @@
|
||||
|
||||
function listLogComplete(response) {
|
||||
vm.logs = response.data;
|
||||
vm.isOpen = false;
|
||||
}
|
||||
function listLogFailed(response){
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
|
@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" id="btnOk">// 'ok' | tr //</button>
|
||||
<button type="button" ng-show="!vm.confirmOnly" class="btn btn-default" data-dismiss="modal">// 'close' | tr //</button>
|
||||
<button type="button" ng-show="!vm.confirmOnly" class="btn btn-default" data-dismiss="modal">// 'cancel' | tr //</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
|
@ -56,7 +56,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
scope.$on('showDialog', function(e, val) {
|
||||
if(val) {
|
||||
element.find('#myModal').modal('show');
|
||||
|
@ -1,4 +1,3 @@
|
||||
<modal-dialog modal-title="// vm.modalTitle //" modal-message="// vm.modalMessage //" confirm-only="vm.confirmOnly" action="vm.action()"></modal-dialog>
|
||||
<div class="tab-pane" id="users">
|
||||
<div class="col-xs-12 col-md-12 each-tab-pane">
|
||||
<div class="form-inline">
|
||||
|
@ -30,26 +30,7 @@
|
||||
vm.projectId = getParameterByName('project_id', $location.absUrl());
|
||||
vm.retrieve();
|
||||
});
|
||||
|
||||
//Error message dialog handler for project members.
|
||||
$scope.$on('modalTitle', function(e, val) {
|
||||
vm.modalTitle = val;
|
||||
});
|
||||
|
||||
$scope.$on('modalMessage', function(e, val) {
|
||||
vm.modalMessage = val;
|
||||
});
|
||||
|
||||
$scope.$on('raiseError', function(e, val) {
|
||||
if(val) {
|
||||
vm.action = function() {
|
||||
$scope.$broadcast('showDialog', false);
|
||||
};
|
||||
vm.confirmOnly = true;
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function search(e) {
|
||||
vm.projectId = e.projectId;
|
||||
vm.username = e.username;
|
||||
|
@ -1,4 +1,3 @@
|
||||
<modal-dialog action="vm.action()" content-type="//vm.contentType//" modal-title="//vm.modalTitle//" modal-message="//vm.modalMessage//" confirm-only="vm.confirmOnly"></modal-dialog>
|
||||
<div class="tab-pane" id="repositories" element-height>
|
||||
<div class="col-xs-12 col-md-12 each-tab-pane">
|
||||
<div class="form-inline">
|
||||
@ -24,7 +23,7 @@
|
||||
<a ng-if="vm.tagCount[repo] === 0" role="button" style="text-decoration: none;" data-toggle="collapse" data-parent="" aria-expanded="true" aria-controls="collapse//$index+1//">
|
||||
<span class="glyphicon glyphicon-book"></span> //repo// <span class="badge">//vm.tagCount[repo]//</span>
|
||||
</a>
|
||||
<a ng-show="vm.tagCount[repo] > 0" class="pull-right" style="margin-right: 75px;" href="javascript:void(0)" data-toggle="modal" data-target="#myModal" ng-click="vm.deleteByRepo(repo)" title="// 'delete_repo' | tr //" loading-progress hide-target="true" toggle-in-progress="vm.toggleInProgress[repo + '|']"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
<a ng-show="vm.tagCount[repo] > 0" class="pull-right" style="margin-right: 75px;" href="javascript:void(0)" ng-click="vm.deleteByRepo(repo)" title="// 'delete_repo' | tr //" loading-progress hide-target="true" toggle-in-progress="vm.toggleInProgress[repo + '|']"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</h4>
|
||||
</div>
|
||||
<list-tag ng-show="vm.tagCount[repo] > 0" associate-id="$index + 1" repo-name="repo" tag-count="vm.tagCount" toggle-in-progress="vm.toggleInProgress" delete-by-tag="vm.deleteByTag()"></list-tag>
|
||||
|
@ -61,26 +61,7 @@
|
||||
$scope.$on('tags', function(e, val) {
|
||||
vm.tags = val;
|
||||
});
|
||||
|
||||
//Error message dialog handler for repositories.
|
||||
$scope.$on('modalTitle', function(e, val) {
|
||||
vm.modalTitle = val;
|
||||
});
|
||||
|
||||
$scope.$on('modalMessage', function(e, val) {
|
||||
vm.modalMessage = val;
|
||||
});
|
||||
|
||||
$scope.$on('raiseError', function(e, val) {
|
||||
if(val) {
|
||||
vm.action = function() {
|
||||
$scope.$broadcast('showDialog', false);
|
||||
};
|
||||
vm.confirmOnly = true;
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
vm.deleteByRepo = deleteByRepo;
|
||||
vm.deleteByTag = deleteByTag;
|
||||
vm.deleteImage = deleteImage;
|
||||
@ -104,28 +85,40 @@
|
||||
vm.repoName = repoName;
|
||||
vm.tag = '';
|
||||
|
||||
vm.modalTitle = $filter('tr')('alert_delete_repo_title', [repoName]);
|
||||
vm.modalMessage = $filter('tr')('alert_delete_repo', [repoName]);
|
||||
vm.confirmOnly = false;
|
||||
vm.contentType = 'text/html';
|
||||
vm.action = vm.deleteImage;
|
||||
$scope.$emit('modalTitle', $filter('tr')('alert_delete_repo_title', [repoName]));
|
||||
$scope.$emit('modalMessage', $filter('tr')('alert_delete_repo', [repoName]));
|
||||
|
||||
var emitInfo = {
|
||||
'confirmOnly': false,
|
||||
'contentType': 'text/html',
|
||||
'action' : vm.deleteImage
|
||||
};
|
||||
|
||||
$scope.$emit('raiseInfo', emitInfo);
|
||||
}
|
||||
|
||||
function deleteByTag() {
|
||||
vm.modalTitle = $filter('tr')('alert_delete_tag_title', [vm.tag]);
|
||||
$scope.$emit('modalTitle', $filter('tr')('alert_delete_tag_title', [vm.tag]));
|
||||
var message;
|
||||
if(vm.tags.length === 1) {
|
||||
console.log('vm.tagCount:' + angular.toJson(vm.tagCount[vm.repoName]));
|
||||
if(vm.tagCount[vm.repoName] === 1) {
|
||||
message = $filter('tr')('alert_delete_last_tag', [vm.tag]);
|
||||
}else {
|
||||
message = $filter('tr')('alert_delete_tag', [vm.tag]);
|
||||
}
|
||||
vm.modalMessage = message;
|
||||
vm.confirmOnly = false;
|
||||
vm.contentType = 'text/html';
|
||||
vm.action = vm.deleteImage;
|
||||
$scope.$emit('modalMessage', message);
|
||||
|
||||
var emitInfo = {
|
||||
'confirmOnly': false,
|
||||
'contentType': 'text/html',
|
||||
'action' : vm.deleteImage
|
||||
};
|
||||
|
||||
$scope.$emit('raiseInfo', emitInfo);
|
||||
}
|
||||
|
||||
function deleteImage() {
|
||||
|
||||
console.log('Delete image, repoName:' + vm.repoName + ', tag:' + vm.tag);
|
||||
vm.toggleInProgress[vm.repoName + '|' + vm.tag] = true;
|
||||
DeleteRepositoryService(vm.repoName, vm.tag)
|
||||
@ -136,13 +129,11 @@
|
||||
function deleteRepositorySuccess(data, status) {
|
||||
vm.toggleInProgress[vm.repoName + '|' + vm.tag] = false;
|
||||
vm.retrieve();
|
||||
$scope.$broadcast('showDialog', false);
|
||||
}
|
||||
|
||||
function deleteRepositoryFailed(data, status) {
|
||||
vm.toggleInProgress[vm.repoName + '|' + vm.tag] = false;
|
||||
vm.contentType = 'text/plain';
|
||||
|
||||
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
var message;
|
||||
if(status === 401) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
<td>
|
||||
<pull-command repo-name="//vm.repoName//" tag="//tag//"></pull-command>
|
||||
</td>
|
||||
<td style="text-align: center;"><a href="javascript:void(0);" data-toggle="modal" data-target="#myModal" ng-click="vm.deleteTag({repoName: vm.repoName, tag: tag})" title="// 'delete_tag' | tr //" loading-progress hide-target="true" toggle-in-progress="vm.toggleInProgress[vm.repoName +'|'+ tag]"><span class="glyphicon glyphicon-trash"></span></a></td>
|
||||
<td style="text-align: center;"><a href="javascript:void(0);" ng-click="vm.deleteTag({repoName: vm.repoName, tag: tag})" title="// 'delete_tag' | tr //" loading-progress hide-target="true" toggle-in-progress="vm.toggleInProgress[vm.repoName +'|'+ tag]"><span class="glyphicon glyphicon-trash"></span></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -36,9 +36,11 @@
|
||||
}
|
||||
|
||||
function getTagComplete(response) {
|
||||
|
||||
vm.tags = response.data;
|
||||
$scope.$emit('tags', vm.tags);
|
||||
vm.tagCount[vm.repoName] = vm.tags.length;
|
||||
|
||||
$scope.$emit('tags', vm.tags);
|
||||
$scope.$emit('tagCount', vm.tagCount);
|
||||
|
||||
angular.forEach(vm.tags, function(item) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
<modal-dialog modal-title="// vm.modalDialogTitle //" modal-message="// vm.modalDialogMessage //" action="vm.deleteDestination()"></modal-dialog>
|
||||
<div class="tab-pane" element-height>
|
||||
<div class="col-xs-12 col-md-12 each-tab-pane">
|
||||
<div class="form-inline">
|
||||
|
@ -46,9 +46,17 @@
|
||||
|
||||
function confirmToDelete(targetId) {
|
||||
vm.selectedTargetId = targetId;
|
||||
vm.modalDialogTitle = $filter('tr')('confirm_to_delete_destination_title');
|
||||
vm.modalDialogMessage = $filter('tr')('confirm_to_delete_destination');
|
||||
$scope.$broadcast('showDialog', true);
|
||||
|
||||
$scope.$emit('modalTitle', $filter('tr')('confirm_to_delete_destination_title'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('confirm_to_delete_destination'));
|
||||
|
||||
var emitInfo = {
|
||||
'confirmOnly': false,
|
||||
'contentType': 'text/plain',
|
||||
'action': vm.deleteDestination
|
||||
};
|
||||
|
||||
$scope.$emit('raiseInfo', emitInfo);
|
||||
}
|
||||
|
||||
function deleteDestination() {
|
||||
@ -62,6 +70,9 @@
|
||||
}
|
||||
|
||||
function listDestinationFailed(data, status) {
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_list_destination'));
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed list destination:' + data);
|
||||
}
|
||||
|
||||
@ -71,8 +82,10 @@
|
||||
}
|
||||
|
||||
function deleteDestinationFailed(data, status) {
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_delete_destination'));
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed delete destination.');
|
||||
alert($filter('tr')('failed_delete_destination', []) + data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
.module('harbor.system.management')
|
||||
.directive('replication', replication);
|
||||
|
||||
ReplicationController.$inject = ['$scope', 'ListReplicationPolicyService', 'ToggleReplicationPolicyService'];
|
||||
ReplicationController.$inject = ['$scope', 'ListReplicationPolicyService', 'ToggleReplicationPolicyService', '$filter', 'trFilter'];
|
||||
|
||||
function ReplicationController($scope, ListReplicationPolicyService, ToggleReplicationPolicyService) {
|
||||
function ReplicationController($scope, ListReplicationPolicyService, ToggleReplicationPolicyService, $filter, trFilter) {
|
||||
|
||||
$scope.subsSubPane = 276;
|
||||
|
||||
@ -34,6 +34,9 @@
|
||||
}
|
||||
|
||||
function listReplicationPolicyFailed(data, status) {
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_list_replication'));
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed list replication policy.');
|
||||
}
|
||||
|
||||
@ -49,6 +52,9 @@
|
||||
}
|
||||
|
||||
function toggleReplicationPolicyFailed(data, status) {
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_toggle_policy'));
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed toggle replication policy.');
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,15 @@
|
||||
angular
|
||||
.module('harbor.system.management')
|
||||
.directive('systemManagement', systemManagement);
|
||||
|
||||
SystemManagementController.$inject = ['$scope', '$location'];
|
||||
|
||||
function SystemManagementController() {
|
||||
function SystemManagementController($scope, $location) {
|
||||
var vm = this;
|
||||
vm.target = 'destinations';
|
||||
$scope.$on('$locationChangeSuccess', function(e) {
|
||||
vm.target = $location.path().substring(1);
|
||||
});
|
||||
}
|
||||
|
||||
function systemManagement() {
|
||||
|
@ -8,7 +8,6 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<modal-dialog modal-title="// 'confirm_to_delete_user_title' | tr //" modal-message="// 'confirm_to_delete_user' | tr //" action="vm.deleteUser()"></modal-dialog>
|
||||
<div class="pane">
|
||||
<div class="sub-pane">
|
||||
<div class="table-head-container">
|
||||
@ -34,7 +33,7 @@
|
||||
<toggle-admin has-admin-role="u.has_admin_role == 1" user-id="//u.user_id//"></toggle-admin>
|
||||
</td>
|
||||
<td width="20%">
|
||||
<a href="javascript:void(0)" data-toggle="modal" data-target="#myModal" ng-click="vm.confirmToDelete(u.user_id)"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
<a href="javascript:void(0)" ng-click="vm.confirmToDelete(u.user_id)"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -6,9 +6,9 @@
|
||||
.module('harbor.user')
|
||||
.directive('listUser', listUser);
|
||||
|
||||
ListUserController.$inject = ['$scope', 'ListUserService', 'DeleteUserService'];
|
||||
ListUserController.$inject = ['$scope', 'ListUserService', 'DeleteUserService', '$filter', 'trFilter'];
|
||||
|
||||
function ListUserController($scope, ListUserService, DeleteUserService) {
|
||||
function ListUserController($scope, ListUserService, DeleteUserService, $filter, $trFilter) {
|
||||
|
||||
$scope.subsSubPane = 226;
|
||||
|
||||
@ -34,6 +34,17 @@
|
||||
|
||||
function confirmToDelete(userId) {
|
||||
vm.selectedUserId = userId;
|
||||
|
||||
$scope.$emit('modalTitle', $filter('tr')('confirm_to_delete_user_title'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('confirm_to_delete_user'));
|
||||
|
||||
var emitInfo = {
|
||||
'confirmOnly': false,
|
||||
'contentType': 'text/plain',
|
||||
'action': vm.deleteUser
|
||||
};
|
||||
|
||||
$scope.$emit('raiseInfo', emitInfo);
|
||||
}
|
||||
|
||||
function retrieve() {
|
||||
@ -48,6 +59,9 @@
|
||||
}
|
||||
|
||||
function deleteUserFailed(data, status) {
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_delete_user'));
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed delete user.');
|
||||
}
|
||||
|
||||
@ -56,6 +70,9 @@
|
||||
}
|
||||
|
||||
function listUserFailed(data, status) {
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_list_user'));
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed list user:' + data);
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
.module('harbor.user')
|
||||
.directive('toggleAdmin', toggleAdmin);
|
||||
|
||||
ToggleAdminController.$inject = ['$scope', 'ToggleAdminService'];
|
||||
ToggleAdminController.$inject = ['$scope', 'ToggleAdminService', '$filter', 'trFilter'];
|
||||
|
||||
function ToggleAdminController($scope, ToggleAdminService) {
|
||||
function ToggleAdminController($scope, ToggleAdminService, $filter, trFilter) {
|
||||
var vm = this;
|
||||
|
||||
vm.isAdmin = (vm.hasAdminRole == 1) ? true : false;
|
||||
@ -31,6 +31,9 @@
|
||||
}
|
||||
|
||||
function toggleAdminFailed(data, status) {
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_toggle_admin'));
|
||||
$scope.$emit('raiseError', true);
|
||||
console.log('Failed toggle admin:' + data);
|
||||
}
|
||||
}
|
||||
|
@ -6,22 +6,74 @@
|
||||
.module('harbor.layout.admin.option')
|
||||
.controller('AdminOptionController', AdminOptionController);
|
||||
|
||||
AdminOptionController.$inject = ['$scope'];
|
||||
AdminOptionController.$inject = ['$scope', '$timeout', '$location'];
|
||||
|
||||
function AdminOptionController($scope) {
|
||||
function AdminOptionController($scope, $timeout, $location) {
|
||||
|
||||
$scope.subsSubPane = 296;
|
||||
|
||||
var vm = this;
|
||||
vm.toggle = false;
|
||||
vm.target = 'users';
|
||||
vm.toggleAdminOption = toggleAdminOption;
|
||||
|
||||
$scope.$on('$locationChangeSuccess', function(e) {
|
||||
if($location.path() === '') {
|
||||
vm.target = 'users';
|
||||
vm.toggle = false;
|
||||
}else{
|
||||
vm.target = 'system_management';
|
||||
vm.toggle = true;
|
||||
}
|
||||
});
|
||||
|
||||
//Message dialog handler for admin-options.
|
||||
$scope.$on('modalTitle', function(e, val) {
|
||||
vm.modalTitle = val;
|
||||
});
|
||||
|
||||
function toggleAdminOption() {
|
||||
if(vm.toggle) {
|
||||
vm.toggle = false;
|
||||
}else{
|
||||
vm.toggle = true;
|
||||
$scope.$on('modalMessage', function(e, val) {
|
||||
vm.modalMessage = val;
|
||||
});
|
||||
|
||||
$scope.$on('raiseError', function(e, val) {
|
||||
if(val) {
|
||||
vm.action = function() {
|
||||
$scope.$broadcast('showDialog', false);
|
||||
};
|
||||
vm.contentType = 'text/plain';
|
||||
vm.confirmOnly = true;
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}, 350);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('raiseInfo', function(e, val) {
|
||||
if(val) {
|
||||
vm.action = function() {
|
||||
val.action();
|
||||
$scope.$broadcast('showDialog', false);
|
||||
}
|
||||
vm.contentType = val.contentType;
|
||||
vm.confirmOnly = val.confirmOnly;
|
||||
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function toggleAdminOption(e) {
|
||||
switch(e.target) {
|
||||
case 'users':
|
||||
vm.toggle = false;
|
||||
break;
|
||||
case 'system_management':
|
||||
vm.toggle = true;
|
||||
break;
|
||||
}
|
||||
vm.target = e.target;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
.module('harbor.details')
|
||||
.controller('DetailsController', DetailsController);
|
||||
|
||||
DetailsController.$inject = ['$scope'];
|
||||
DetailsController.$inject = ['$scope', '$timeout'];
|
||||
|
||||
function DetailsController($scope) {
|
||||
function DetailsController($scope, $timeout) {
|
||||
var vm = this;
|
||||
|
||||
vm.publicity = false;
|
||||
@ -19,6 +19,42 @@
|
||||
|
||||
vm.sectionDefaultHeight = {'min-height': '579px'};
|
||||
|
||||
//Message dialog handler for details.
|
||||
$scope.$on('modalTitle', function(e, val) {
|
||||
vm.modalTitle = val;
|
||||
});
|
||||
|
||||
$scope.$on('modalMessage', function(e, val) {
|
||||
vm.modalMessage = val;
|
||||
});
|
||||
|
||||
$scope.$on('raiseError', function(e, val) {
|
||||
if(val) {
|
||||
vm.action = function() {
|
||||
$scope.$broadcast('showDialog', false);
|
||||
};
|
||||
vm.contentType = 'text/plain';
|
||||
vm.confirmOnly = true;
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}, 350);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('raiseInfo', function(e, val) {
|
||||
if(val) {
|
||||
vm.action = function() {
|
||||
val.action();
|
||||
$scope.$broadcast('showDialog', false);
|
||||
}
|
||||
vm.contentType = val.contentType;
|
||||
vm.confirmOnly = val.confirmOnly;
|
||||
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}
|
||||
});
|
||||
|
||||
function togglePublicity(e) {
|
||||
vm.publicity = e.publicity;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
$scope.$broadcast('showDialog', false);
|
||||
};
|
||||
vm.contentType = 'text/plain';
|
||||
vm.confirmOnly = true;
|
||||
vm.confirmOnly = true;
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}
|
||||
});
|
||||
@ -73,7 +73,7 @@
|
||||
|
||||
if(status === 500) {
|
||||
$scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_send_mail'));
|
||||
$scope.$emit('modalMessage', $filter('tr')('failed_send_email'));
|
||||
$scope.$emit('raiseError', true);
|
||||
}
|
||||
console.log('Failed send mail:' + data);
|
||||
|
@ -6,9 +6,9 @@
|
||||
.module('harbor.layout.index')
|
||||
.controller('IndexController', IndexController);
|
||||
|
||||
IndexController.$inject = ['$scope', '$filter', 'trFilter'];
|
||||
IndexController.$inject = ['$scope', '$filter', 'trFilter', '$timeout'];
|
||||
|
||||
function IndexController($scope, $filter, trFilter) {
|
||||
function IndexController($scope, $filter, trFilter, $timeout) {
|
||||
|
||||
$scope.subsHeight = 110;
|
||||
$scope.subsSection = 32;
|
||||
@ -27,8 +27,8 @@
|
||||
var indexDesc4 = $filter('tr')('index_desc_4', []);
|
||||
var indexDesc5 = $filter('tr')('index_desc_5', []);
|
||||
|
||||
vm.modalTitle = $filter('tr')('harbor_intro_title');
|
||||
vm.modalMessage = '<p class="page-content text-justify">'+
|
||||
$scope.$emit('modalTitle', $filter('tr')('harbor_intro_title'));
|
||||
$scope.$emit('modalMessage', '<p class="page-content text-justify">'+
|
||||
indexDesc +
|
||||
'</p>' +
|
||||
'<ul>' +
|
||||
@ -37,16 +37,18 @@
|
||||
'<li class="long-line">▪︎ ' + indexDesc3 + '</li>' +
|
||||
'<li class="long-line">▪︎ ' + indexDesc4 + '</li>' +
|
||||
'<li class="long-line">▪︎ ' + indexDesc5 + '</li>' +
|
||||
'</ul>';
|
||||
vm.contentType = 'text/html';
|
||||
vm.confirmOnly = true;
|
||||
$scope.$broadcast('showDialog', true);
|
||||
vm.action = function() {
|
||||
$scope.$broadcast('showDialog', false);
|
||||
}
|
||||
'</ul>');
|
||||
var emitInfo = {
|
||||
'contentType': 'text/html',
|
||||
'confirmOnly': true,
|
||||
'action': function() {
|
||||
$scope.$broadcast('showDialog', false);
|
||||
}
|
||||
};
|
||||
$scope.$emit('raiseInfo', emitInfo);
|
||||
}
|
||||
|
||||
//Error message dialog handler for index.
|
||||
//Message dialog handler for index.
|
||||
$scope.$on('modalTitle', function(e, val) {
|
||||
vm.modalTitle = val;
|
||||
});
|
||||
@ -61,10 +63,27 @@
|
||||
$scope.$broadcast('showDialog', false);
|
||||
};
|
||||
vm.contentType = 'text/plain';
|
||||
vm.confirmOnly = true;
|
||||
$scope.$broadcast('showDialog', true);
|
||||
vm.confirmOnly = true;
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}, 350);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('raiseInfo', function(e, val) {
|
||||
if(val) {
|
||||
vm.action = function() {
|
||||
val.action();
|
||||
$scope.$broadcast('showDialog', false);
|
||||
}
|
||||
vm.contentType = val.contentType;
|
||||
vm.confirmOnly = val.confirmOnly;
|
||||
|
||||
$scope.$broadcast('showDialog', true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
})();
|
@ -226,5 +226,11 @@ var locale_messages = {
|
||||
'failed_reset_pasword': 'Failed reset password.',
|
||||
'failed_in_search': 'Failed in search.',
|
||||
'failed_sign_up': 'Failed sign up.',
|
||||
'failed_add_user': 'Failed add user'
|
||||
'failed_add_user': 'Failed add user.',
|
||||
'failed_delete_user': 'Failed delete user.',
|
||||
'failed_list_user': 'Failed list user data.',
|
||||
'failed_toggle_admin': 'Failed toggle admin user.',
|
||||
'failed_list_destination': 'Failed list destinations.',
|
||||
'failed_list_replication': 'Failed list replication policies.',
|
||||
'failed_toggle_policy': 'Failed toggle replication policy.'
|
||||
};
|
@ -222,9 +222,15 @@ var locale_messages = {
|
||||
'failed_get_stat': '获取统计数据失败。',
|
||||
'failed_get_top_repo': '获取Top镜像仓库数据失败。',
|
||||
'failed_get_user_log': '获取用户日志数据失败。',
|
||||
'failed_send_mail': '发送邮件失败。',
|
||||
'failed_send_email': '发送邮件失败。',
|
||||
'failed_reset_pasword': '重置邮件失败。',
|
||||
'failed_in_search': '搜索操作失败。',
|
||||
'failed_sign_up': '注册用户失败。',
|
||||
'failed_add_user': '新增用户失败。'
|
||||
'failed_add_user': '新增用户失败。',
|
||||
'failed_delete_user': '删除用户失败。',
|
||||
'failed_list_user': '获取用户数据失败。',
|
||||
'failed_toggle_admin': '切换管理员用户失败。',
|
||||
'failed_list_destination': '获取目标数据失败。',
|
||||
'failed_list_replication': '获取复制策略数据失败。',
|
||||
'failed_toggle_policy': '切换复制策略状态失败。'
|
||||
};
|
@ -1,16 +1,17 @@
|
||||
<div class="container-fluid container-fluid-custom" element-height ng-controller="AdminOptionController as vm">
|
||||
<modal-dialog action="vm.action()" content-type="//vm.contentType//" modal-title="//vm.modalTitle//" modal-message="//vm.modalMessage//" confirm-only="vm.confirmOnly"></modal-dialog>
|
||||
<div class="container container-custom">
|
||||
<div class="row extend-height">
|
||||
<div class="section">
|
||||
<h4 class="page-header">
|
||||
<span ng-if="!vm.toggle">// 'users' | tr //</span>
|
||||
<a ng-if="vm.toggle" href="#" ng-click="vm.toggleAdminOption()">// 'users' | tr //</a>
|
||||
<a ng-if="vm.toggle" href="#" ng-click="vm.toggleAdminOption({target: 'users'})">// 'users' | tr //</a>
|
||||
<span class="gutter">|</span>
|
||||
<span ng-if="vm.toggle">// 'system_management' | tr //</span>
|
||||
<a ng-if="!vm.toggle" href="#/destinations" class="title-color" ng-click="vm.toggleAdminOption()">// 'system_management' | tr //</a>
|
||||
<a ng-if="!vm.toggle" href="#/destinations" class="title-color" ng-click="vm.toggleAdminOption({target: 'system_management'})">// 'system_management' | tr //</a>
|
||||
</h4>
|
||||
<list-user ng-if="!vm.toggle"></list-user>
|
||||
<system-management ng-if="vm.toggle"></system-management>
|
||||
<list-user ng-if="vm.target === 'users'"></list-user>
|
||||
<system-management ng-if="vm.target === 'system_management'"></system-management>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,5 @@
|
||||
<div class="container-fluid container-fluid-custom" element-height ng-controller="DetailsController as vm">
|
||||
<modal-dialog action="vm.action()" content-type="//vm.contentType//" modal-title="//vm.modalTitle//" modal-message="//vm.modalMessage//" confirm-only="vm.confirmOnly"></modal-dialog>
|
||||
<div class="container container-custom">
|
||||
<div class="row extend-height">
|
||||
<div class="col-xs-12 col-md-12 extend-height">
|
||||
|
Loading…
Reference in New Issue
Block a user