update for adding confirm to delete in users and destinations.

This commit is contained in:
kunw 2016-06-20 17:05:48 +08:00
parent fb88d85984
commit 96a9106beb
7 changed files with 32 additions and 9 deletions

View File

@ -31,6 +31,9 @@
function link(scope, element, attrs, ctrl) {
if(!angular.isDefined(ctrl.contentType)) {
ctrl.contentType = 'text/plain';
}
console.log('Received contentType in modal:' + ctrl.contentType);
scope.$watch('vm.message', function(current) {

View File

@ -10,7 +10,8 @@
<button ng-if="!vm.isOpen" class="btn btn-success" type="button" ng-click="vm.addDestination()" data-toggle="modal" data-target="#createDestinationModal"><span class="glyphicon glyphicon-plus"></span>New Destination</button>
<create-destination action="//vm.action//" target-id="//vm.targetId//" reload="vm.retrieve()"></create-destination>
</div>
<div class="pane">
<div class="pane">
<modal-dialog title="// 'confirm_to_delete_destination_title' | tr //" message="// 'confirm_to_delete_destination' | tr //" action="vm.deleteDestination()"></modal-dialog>
<div class="sub-pane">
<table class="table table-pane">
<thead>
@ -30,7 +31,7 @@
<td>
<a href="javascript:void(0);" data-toggle="modal" data-target="#createDestinationModal" ng-click="vm.editDestination(r.id)"><span class="glyphicon glyphicon-pencil"></span></a>
&nbsp;
<a href="javascript:void(0);" ng-click="vm.deleteDestination(r.id)"><span class="glyphicon glyphicon-trash"></span></a>
<a href="javascript:void(0);" data-toggle="modal" data-target="#myModal" ng-click="vm.confirmToDelete(r.id)"><span class="glyphicon glyphicon-trash"></span></a>
</td>
</tr>
</tbody>

View File

@ -15,6 +15,7 @@
vm.search = search;
vm.addDestination = addDestination;
vm.editDestination = editDestination;
vm.confirmToDelete = confirmToDelete;
vm.deleteDestination = deleteDestination;
vm.retrieve();
@ -40,8 +41,12 @@
console.log('Action for destination:' + vm.action + ', target ID:' + vm.targetId);
}
function deleteDestination(targetId) {
DeleteDestinationService(targetId)
function confirmToDelete(targetId) {
vm.selectedTargetId = targetId;
}
function deleteDestination() {
DeleteDestinationService(vm.selectedTargetId)
.success(deleteDestinationSuccess)
.error(deleteDestinationFailed);
}

View File

@ -9,6 +9,7 @@
</div>
</div>
<div class="pane project-pane">
<modal-dialog title="// 'confirm_to_delete_user_title' | tr //" message="// 'confirm_to_delete_user' | tr //" action="vm.deleteUser()"></modal-dialog>
<div class="sub-pane">
<table class="table">
<thead>
@ -21,7 +22,7 @@
<td>//u.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
<td>
<toggle-admin has-admin-role="u.has_admin_role == 1" user-id="//u.user_id//"></toggle-admin>&nbsp;&nbsp;
&nbsp;&nbsp;<a href="javascript:void(0)" ng-click="vm.deleteUser(u.user_id)"><span class="glyphicon glyphicon-trash"></span></a>
&nbsp;&nbsp;<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>
</td>
</tr>
</tbody>

View File

@ -14,6 +14,7 @@
vm.username = '';
vm.searchUser = searchUser;
vm.deleteUser = deleteUser;
vm.confirmToDelete = confirmToDelete;
vm.retrieve = retrieve;
vm.retrieve();
@ -22,12 +23,16 @@
vm.retrieve();
}
function deleteUser(userId) {
DeleteUserService(userId)
function deleteUser() {
DeleteUserService(vm.selectedUserId)
.success(deleteUserSuccess)
.error(deleteUserFailed);
}
function confirmToDelete(userId) {
vm.selectedUserId = userId;
}
function retrieve() {
ListUserService(vm.username)
.success(listUserSuccess)

View File

@ -130,5 +130,9 @@ var locale_messages = {
'no_projects_add_new_project': 'No projects, add new project now.',
'no_repositories': 'No repositories found, please use "docker push" to upload images.',
'confirm_to_delete_member_title': 'Delete project member',
'confirm_to_delete_member': 'Are you sure to delete the current project member?'
'confirm_to_delete_member': 'Are you sure to delete the current project member?',
'confirm_to_delete_user_title': 'Delete user',
'confirm_to_delete_user': 'Are you sure to delete the current user?',
'confirm_to_delete_destination_title': 'Delete destination',
'confirm_to_delete_destination': 'Are you sure to delete the current destination?'
};

View File

@ -128,5 +128,9 @@ var locale_messages = {
'no_projects_add_new_project': '当前没有项目,请新增项目。',
'no_repositories': '未发现镜像,请用"docker push"命令上传镜像。',
'confirm_to_delete_member_title': '删除项目成员',
'confirm_to_delete_member': '确认删除当前项目成员吗?'
'confirm_to_delete_member': '确认删除当前项目成员吗?',
'confirm_to_delete_user_title': '删除用户',
'confirm_to_delete_user': '确认删除当前用户吗?',
'confirm_to_delete_destination_title': '删除目标',
'confirm_to_delete_destination': '确认删除当前目标吗?'
};