Skip to content

Commit 1de8935

Browse files
fix: fix pagination issues with in permissions view
chore: make improvements to permissions Update src/components/Permissions/ManagePermissions/Forms/PermissionForm.tsx Co-authored-by: Moshe Immerman <[email protected]> Update src/components/Permissions/ManagePermissions/Forms/FormikPermissionSelectResourceFields.tsx Co-authored-by: Moshe Immerman <[email protected]> Update src/components/Permissions/ManagePermissions/Forms/DeletePermission.tsx Co-authored-by: Moshe Immerman <[email protected]> Update src/components/Permissions/ManagePermissions/Forms/FormikPermissionSelectResourceFields.tsx Co-authored-by: Moshe Immerman <[email protected]> Update src/components/Permissions/ManagePermissions/Forms/FormikPermissionSelectResourceFields.tsx Co-authored-by: Moshe Immerman <[email protected]> Update src/components/Permissions/ManagePermissions/Forms/PermissionForm.tsx Co-authored-by: Moshe Immerman <[email protected]>
1 parent e1c715e commit 1de8935

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

src/api/services/permissions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ export function fetchPermissions(
7676

7777
const url = `/permissions?${queryParam}&select=${selectFields.join(",")}&limit=${pageSize}&offset=${pageIndex * pageSize}`;
7878
return resolvePostGrestRequestWithPagination(
79-
IncidentCommander.get<PermissionAPIResponse[]>(url)
79+
IncidentCommander.get<PermissionAPIResponse[]>(url, {
80+
headers: {
81+
Prefer: "count=exact"
82+
}
83+
})
8084
);
8185
}
8286

src/components/Permissions/ManagePermissions/Forms/DeletePermission.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default function DeletePermission({
5353
{isConfirmDialogOpen && (
5454
<ConfirmationPromptDialog
5555
title="Delete Permission"
56-
description="Are you sure you want to permission?"
56+
description="Are you sure you want to delete the permission?"
5757
onConfirm={onDeleteResource}
5858
isOpen={isConfirmDialogOpen}
5959
onClose={() => setIsConfirmDialogOpen(false)}

src/components/Permissions/ManagePermissions/Forms/FormikPermissionSelectResourceFields.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function FormikPermissionSelectResourceFields() {
2929
const { setFieldValue } = useFormikContext<Record<string, any>>();
3030

3131
const [switchOption, setSwitchOption] = useState<
32-
"Component" | "Catalog" | "Canary" | "Playbook" | "Connection" | "Object"
32+
"Component" | "Catalog" | "Canary" | "Playbook" | "Connection" | "Global"
3333
>("Catalog");
3434

3535
return (
@@ -43,7 +43,7 @@ export default function FormikPermissionSelectResourceFields() {
4343
"Component",
4444
"Connection",
4545
"Playbook",
46-
"Object"
46+
"Global"
4747
]}
4848
className="w-auto"
4949
itemsClassName=""
@@ -89,7 +89,7 @@ export default function FormikPermissionSelectResourceFields() {
8989
<FormikConnectionField required name="connection_id" />
9090
)}
9191

92-
{switchOption === "Object" && (
92+
{switchOption === "Global" && (
9393
<FormikSelectDropdown
9494
required
9595
name="object"

src/components/Permissions/ManagePermissions/Forms/PermissionForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default function PermissionForm({
101101
onClose={onClose}
102102
open={isOpen}
103103
bodyClass="flex flex-col w-full flex-1 h-full overflow-y-auto"
104-
helpLink="/installation/saas/agent"
104+
helpLink="/reference/permissions"
105105
>
106106
<div className="flex flex-1 flex-col gap-2">
107107
<Formik<Partial<PermissionTable>>
@@ -153,7 +153,7 @@ export default function PermissionForm({
153153
name="action"
154154
label="Action"
155155
/>
156-
<FormikCheckbox name="deny" label="Is deny action" />
156+
<FormikCheckbox name="deny" label="Deny" />
157157
<FormikTextArea name="description" label="Description" />
158158
</div>
159159
<CanEditResource

src/components/Permissions/PermissionsView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function PermissionsView({
6767
}, [isLoading, setIsLoading]);
6868

6969
const totalEntries = data?.totalEntries || 0;
70-
const pageCount = totalEntries ? Math.ceil(totalEntries / pageSize) : -1;
70+
const pageCount = totalEntries ? Math.ceil(totalEntries / pageSize) : 1;
7171
const permissions = data?.data || [];
7272

7373
return (

0 commit comments

Comments
 (0)