Skip to content

Commit

Permalink
Merge pull request #157 from amansinghbais/128-search-on-permissionid
Browse files Browse the repository at this point in the history
Improved: removed other category, fetched permission description at fetching (#128)
  • Loading branch information
ravilodhi authored Mar 8, 2024
2 parents 2db5b5c + 25cabfe commit d0bd4cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/components/PermissionItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ion-card-header>
<div>
<ion-card-title>{{ permission.permissionId }}</ion-card-title>
<ion-card-subtitle>{{ getPermissionDescription(permission.permissionId) }}</ion-card-subtitle>
<ion-card-subtitle>{{ permission.description }}</ion-card-subtitle>
</div>
<ion-checkbox :disabled="!hasPermission(Actions.APP_PERMISSION_UPDATE)" :checked="permission.isChecked" @click="updatePermissionAssociation($event, permission)" />
</ion-card-header>
Expand Down Expand Up @@ -80,8 +80,7 @@ export default defineComponent({
query: 'permission/getQuery',
currentGroupPermissions: 'permission/getCurrentGroupPermissions',
currentGroup: "permission/getCurrentGroup",
filteredPermissions: "permission/getFilteredPermissions",
getPermissionDescription: "permission/getPermissionDescription"
filteredPermissions: "permission/getFilteredPermissions"
})
},
methods: {
Expand Down
13 changes: 3 additions & 10 deletions src/store/modules/permission/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,14 @@ const actions: ActionTree<PermissionState, RootState> = {
}
})

// Filtering all the permissions which are not part of any group type.
const otherPermissions = JSON.parse(JSON.stringify(state.allPermissions))
// Mapping permission description to the desciption of permission data fetched.
const allPermissions = state.allPermissions
Object.values(groupTypes).map((group: any) => {
group.permissions.map((permission: any) => {
delete otherPermissions[permission.permissionId]
permission.description = allPermissions[permission.permissionId]?.description
})
})

// Others category for permissions not in any internal group.
groupTypes['OTHERS'] = {
groupId: 'OTHERS',
groupName: 'Other Category',
permissions: Object.values(otherPermissions)
}

commit(types.PERMISSION_BY_CLASSIFICATION_GROUPS_UPDATED, groupTypes)
},

Expand Down
3 changes: 0 additions & 3 deletions src/store/modules/permission/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ const getters: GetterTree<PermissionState, RootState> = {
},
getAllPermissions(state) {
return state.allPermissions
},
getPermissionDescription: (state) => (permissionId: any) => {
return state.allPermissions[permissionId]?.description ? state.allPermissions[permissionId].description : permissionId
}
}
export default getters;

0 comments on commit d0bd4cf

Please sign in to comment.