mirror of https://github.com/abpframework/abp.git
3 changed files with 200 additions and 165 deletions
@ -0,0 +1,4 @@ |
|||
{ |
|||
"singleQuote": true, |
|||
"useTabs": true |
|||
} |
|||
@ -1,94 +1,114 @@ |
|||
(function ($) { |
|||
var l = abp.localization.getResource('AbpIdentity'); |
|||
|
|||
var l = abp.localization.getResource('AbpIdentity'); |
|||
var _identityRoleAppService = volo.abp.identity.identityRole; |
|||
var _permissionsModal = new abp.ModalManager( |
|||
abp.appPath + 'AbpPermissionManagement/PermissionManagementModal' |
|||
); |
|||
var _editModal = new abp.ModalManager( |
|||
abp.appPath + 'Identity/Roles/EditModal' |
|||
); |
|||
var _createModal = new abp.ModalManager( |
|||
abp.appPath + 'Identity/Roles/CreateModal' |
|||
); |
|||
|
|||
var _identityRoleAppService = volo.abp.identity.identityRole; |
|||
var _permissionsModal = new abp.ModalManager(abp.appPath + 'AbpPermissionManagement/PermissionManagementModal'); |
|||
var _editModal = new abp.ModalManager(abp.appPath + 'Identity/Roles/EditModal'); |
|||
var _createModal = new abp.ModalManager(abp.appPath + 'Identity/Roles/CreateModal'); |
|||
$(function () { |
|||
var _$wrapper = $('#IdentityRolesWrapper'); |
|||
var _$table = _$wrapper.find('table'); |
|||
|
|||
$(function () { |
|||
var _dataTable = _$table.DataTable( |
|||
abp.libs.datatables.normalizeConfiguration({ |
|||
order: [[1, 'asc']], |
|||
searching: false, |
|||
processing: true, |
|||
serverSide: true, |
|||
scrollX: true, |
|||
paging: true, |
|||
ajax: abp.libs.datatables.createAjax(_identityRoleAppService.getList), |
|||
columnDefs: [ |
|||
{ |
|||
rowAction: { |
|||
items: [ |
|||
{ |
|||
text: l('Edit'), |
|||
visible: abp.auth.isGranted('AbpIdentity.Roles.Update'), |
|||
action: function (data) { |
|||
_editModal.open({ |
|||
id: data.record.id, |
|||
}); |
|||
}, |
|||
}, |
|||
{ |
|||
text: l('Permissions'), |
|||
visible: abp.auth.isGranted( |
|||
'AbpIdentity.Roles.ManagePermissions' |
|||
), |
|||
action: function (data) { |
|||
_permissionsModal.open({ |
|||
providerName: 'R', |
|||
providerKey: data.record.name, |
|||
}); |
|||
}, |
|||
}, |
|||
{ |
|||
text: l('Delete'), |
|||
visible: function (data) { |
|||
return ( |
|||
!data.isStatic && |
|||
abp.auth.isGranted('AbpIdentity.Roles.Delete') |
|||
); //TODO: Check permission
|
|||
}, |
|||
confirmMessage: function (data) { |
|||
return l( |
|||
'RoleDeletionConfirmationMessage', |
|||
data.record.name |
|||
); |
|||
}, |
|||
action: function (data) { |
|||
_identityRoleAppService |
|||
.delete(data.record.id) |
|||
.then(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
}, |
|||
{ |
|||
data: 'name', |
|||
render: function (data, type, row) { |
|||
var name = '<span>' + data + '</span>'; |
|||
if (row.isDefault) { |
|||
name += |
|||
'<span class="badge badge-pill badge-success ml-1">' + |
|||
l('DisplayName:IsDefault') + |
|||
'</span>'; |
|||
} |
|||
if (row.isPublic) { |
|||
name += |
|||
'<span class="badge badge-pill badge-info ml-1">' + |
|||
l('DisplayName:IsPublic') + |
|||
'</span>'; |
|||
} |
|||
return name; |
|||
}, |
|||
}, |
|||
], |
|||
}) |
|||
); |
|||
|
|||
var _$wrapper = $('#IdentityRolesWrapper'); |
|||
var _$table = _$wrapper.find('table'); |
|||
_createModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
var _dataTable = _$table.DataTable(abp.libs.datatables.normalizeConfiguration({ |
|||
order: [[1, "asc"]], |
|||
searching: false, |
|||
processing: true, |
|||
serverSide: true, |
|||
scrollX: true, |
|||
paging: true, |
|||
ajax: abp.libs.datatables.createAjax(_identityRoleAppService.getList), |
|||
columnDefs: [ |
|||
{ |
|||
rowAction: { |
|||
items: |
|||
[ |
|||
{ |
|||
text: l('Edit'), |
|||
visible: abp.auth.isGranted('AbpIdentity.Roles.Update'), |
|||
action: function (data) { |
|||
_editModal.open({ |
|||
id: data.record.id |
|||
}); |
|||
} |
|||
}, |
|||
{ |
|||
text: l('Permissions'), |
|||
visible: abp.auth.isGranted('AbpIdentity.Roles.ManagePermissions'), |
|||
action: function (data) { |
|||
_permissionsModal.open({ |
|||
providerName: 'R', |
|||
providerKey: data.record.name |
|||
}); |
|||
} |
|||
}, |
|||
{ |
|||
text: l('Delete'), |
|||
visible: function (data) { |
|||
return !data.isStatic && abp.auth.isGranted('AbpIdentity.Roles.Delete'); //TODO: Check permission
|
|||
}, |
|||
confirmMessage: function (data) { return l('RoleDeletionConfirmationMessage', data.record.name)}, |
|||
action: function (data) { |
|||
_identityRoleAppService |
|||
.delete(data.record.id) |
|||
.then(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
} |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
{ |
|||
data: "name", |
|||
render: function (data, type, row) { |
|||
var name = '<span>' + data + '</span>'; |
|||
if (row.isDefault) { |
|||
name += '<span class="badge badge-pill badge-success ml-1">' + l('DisplayName:IsDefault') + '</span>'; |
|||
} |
|||
if (row.isPublic) { |
|||
name += '<span class="badge badge-pill badge-info ml-1">' + l('DisplayName:IsPublic') + '</span>'; |
|||
} |
|||
return name; |
|||
} |
|||
} |
|||
] |
|||
})); |
|||
|
|||
_createModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
_editModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
_$wrapper.find('button[name=CreateRole]').click(function (e) { |
|||
e.preventDefault(); |
|||
_createModal.open(); |
|||
}); |
|||
}); |
|||
_editModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
_$wrapper.find('button[name=CreateRole]').click(function (e) { |
|||
e.preventDefault(); |
|||
_createModal.open(); |
|||
}); |
|||
}); |
|||
})(jQuery); |
|||
|
|||
@ -1,86 +1,97 @@ |
|||
(function ($) { |
|||
var l = abp.localization.getResource('AbpIdentity'); |
|||
|
|||
var l = abp.localization.getResource('AbpIdentity'); |
|||
var _identityUserAppService = volo.abp.identity.identityUser; |
|||
var _editModal = new abp.ModalManager( |
|||
abp.appPath + 'Identity/Users/EditModal' |
|||
); |
|||
var _createModal = new abp.ModalManager( |
|||
abp.appPath + 'Identity/Users/CreateModal' |
|||
); |
|||
var _permissionsModal = new abp.ModalManager( |
|||
abp.appPath + 'AbpPermissionManagement/PermissionManagementModal' |
|||
); |
|||
|
|||
var _identityUserAppService = volo.abp.identity.identityUser; |
|||
var _editModal = new abp.ModalManager(abp.appPath + 'Identity/Users/EditModal'); |
|||
var _createModal = new abp.ModalManager(abp.appPath + 'Identity/Users/CreateModal'); |
|||
var _permissionsModal = new abp.ModalManager(abp.appPath + 'AbpPermissionManagement/PermissionManagementModal'); |
|||
$(function () { |
|||
var _$wrapper = $('#IdentityUsersWrapper'); |
|||
var _$table = _$wrapper.find('table'); |
|||
var _dataTable = _$table.DataTable( |
|||
abp.libs.datatables.normalizeConfiguration({ |
|||
order: [[1, 'asc']], |
|||
processing: true, |
|||
serverSide: true, |
|||
scrollX: true, |
|||
paging: true, |
|||
ajax: abp.libs.datatables.createAjax(_identityUserAppService.getList), |
|||
columnDefs: [ |
|||
{ |
|||
rowAction: { |
|||
items: [ |
|||
{ |
|||
text: l('Edit'), |
|||
visible: abp.auth.isGranted('AbpIdentity.Users.Update'), |
|||
action: function (data) { |
|||
_editModal.open({ |
|||
id: data.record.id, |
|||
}); |
|||
}, |
|||
}, |
|||
{ |
|||
text: l('Permissions'), |
|||
visible: abp.auth.isGranted( |
|||
'AbpIdentity.Users.ManagePermissions' |
|||
), |
|||
action: function (data) { |
|||
_permissionsModal.open({ |
|||
providerName: 'U', |
|||
providerKey: data.record.id, |
|||
}); |
|||
}, |
|||
}, |
|||
{ |
|||
text: l('Delete'), |
|||
visible: abp.auth.isGranted('AbpIdentity.Users.Delete'), |
|||
confirmMessage: function (data) { |
|||
return l( |
|||
'UserDeletionConfirmationMessage', |
|||
data.record.userName |
|||
); |
|||
}, |
|||
action: function (data) { |
|||
_identityUserAppService |
|||
.delete(data.record.id) |
|||
.then(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
}, |
|||
}, |
|||
], |
|||
}, |
|||
}, |
|||
{ |
|||
data: 'userName', |
|||
}, |
|||
{ |
|||
data: 'email', |
|||
}, |
|||
{ |
|||
data: 'phoneNumber', |
|||
}, |
|||
], |
|||
}) |
|||
); |
|||
|
|||
$(function () { |
|||
_createModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
var _$wrapper = $('#IdentityUsersWrapper'); |
|||
var _$table = _$wrapper.find('table'); |
|||
var _dataTable = _$table.DataTable(abp.libs.datatables.normalizeConfiguration({ |
|||
order: [[1, "asc"]], |
|||
processing: true, |
|||
serverSide: true, |
|||
scrollX: true, |
|||
paging: true, |
|||
ajax: abp.libs.datatables.createAjax(_identityUserAppService.getList), |
|||
columnDefs: [ |
|||
{ |
|||
rowAction: { |
|||
items: |
|||
[ |
|||
{ |
|||
text: l('Edit'), |
|||
visible: abp.auth.isGranted('AbpIdentity.Users.Update'), |
|||
action: function (data) { |
|||
_editModal.open({ |
|||
id: data.record.id |
|||
}); |
|||
} |
|||
}, |
|||
{ |
|||
text: l('Permissions'), |
|||
visible: abp.auth.isGranted('AbpIdentity.Users.ManagePermissions'), |
|||
action: function (data) { |
|||
_permissionsModal.open({ |
|||
providerName: 'U', |
|||
providerKey: data.record.id |
|||
}); |
|||
} |
|||
}, |
|||
{ |
|||
text: l('Delete'), |
|||
visible: abp.auth.isGranted('AbpIdentity.Users.Delete'), |
|||
confirmMessage: function (data) { return l('UserDeletionConfirmationMessage', data.record.userName); }, |
|||
action: function (data) { |
|||
_identityUserAppService |
|||
.delete(data.record.id) |
|||
.then(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
} |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
{ |
|||
data: "userName" |
|||
}, |
|||
{ |
|||
data: "email" |
|||
}, |
|||
{ |
|||
data: "phoneNumber" |
|||
} |
|||
] |
|||
})); |
|||
|
|||
_createModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
_editModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
_$wrapper.find('button[name=CreateUser]').click(function (e) { |
|||
e.preventDefault(); |
|||
_createModal.open(); |
|||
}); |
|||
}); |
|||
_editModal.onResult(function () { |
|||
_dataTable.ajax.reload(); |
|||
}); |
|||
|
|||
_$wrapper.find('button[name=CreateUser]').click(function (e) { |
|||
e.preventDefault(); |
|||
_createModal.open(); |
|||
}); |
|||
}); |
|||
})(jQuery); |
|||
|
|||
Loading…
Reference in new issue