From 4e8516b8ed682de7c1dcf7690c85e86a41dd61f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C3=87otur?= Date: Thu, 9 Jul 2020 14:43:52 +0300 Subject: [PATCH] Identity Module - prettier settings added and js files reformatted --- modules/identity/.prettierrc | 4 + .../Pages/Identity/Roles/index.js | 192 ++++++++++-------- .../Pages/Identity/Users/index.js | 169 ++++++++------- 3 files changed, 200 insertions(+), 165 deletions(-) create mode 100644 modules/identity/.prettierrc diff --git a/modules/identity/.prettierrc b/modules/identity/.prettierrc new file mode 100644 index 0000000000..7d1b8aa721 --- /dev/null +++ b/modules/identity/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "useTabs": true +} diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js index 8332a95ac7..c5c15136e3 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js @@ -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 = '' + data + ''; + if (row.isDefault) { + name += + '' + + l('DisplayName:IsDefault') + + ''; + } + if (row.isPublic) { + name += + '' + + l('DisplayName:IsPublic') + + ''; + } + 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 = '' + data + ''; - if (row.isDefault) { - name += '' + l('DisplayName:IsDefault') + ''; - } - if (row.isPublic) { - name += '' + l('DisplayName:IsPublic') + ''; - } - 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); diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js index 64505509ba..40e1c1b3c1 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js @@ -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);