Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: fga ui feedbacks (#11403)

SagarRajput-7727442189507
diff --git a/frontend/package.json b/frontend/package.json
index 69d44bf80e..ea625e8072 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -49,7 +49,7 @@
"@signozhq/design-tokens": "2.1.4",
"@signozhq/icons": "0.4.0",
"@signozhq/resizable": "0.0.2",
- "@signozhq/ui": "0.0.19",
+ "@signozhq/ui": "0.0.21",
"@tanstack/react-table": "8.21.3",
"@tanstack/react-virtual": "3.13.22",
"@uiw/codemirror-theme-copilot": "4.23.11",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index dd92bd638d..ff43ab1b58 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -77,8 +77,8 @@ importers:
specifier: 0.0.2
'@signozhq/ui':
- specifier: 0.0.19
+ specifier: 0.0.21
'@tanstack/react-table':
specifier: 8.21.3
@@ -3269,8 +3269,8 @@ packages:
peerDependencies:
react: ^18.2.0
- '@signozhq/[email protected]':
- resolution: {integrity: sha512-2q6aRxN/PR4PlR2xJZAREEuvLPiDFggfFKzCW2Z5vHVVbrgnvZHWD1jPUuwszfEg0ceH3UvkwqceO7wN4uRJAA==}
+ '@signozhq/[email protected]':
+ resolution: {integrity: sha512-uLM3Vqwxlk2USXbwtb3qRLpjZR9b9QSHFQq/jtcfYNMDmIE/sNjSj0nRkEhX4RqqRgsLRt2PVA33aeWxDOLO3g==}
peerDependencies:
'@signozhq/icons': 0.3.0
react: ^18.2.0
@@ -3851,27 +3851,6 @@ packages:
peerDependencies:
vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
- '@webassemblyjs/[email protected]':
- resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==}
-
- '@webassemblyjs/[email protected]':
- resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==}
-
- '@webassemblyjs/[email protected]':
- resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==}
-
- '@webassemblyjs/[email protected]':
- resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==}
-
- '@webassemblyjs/[email protected]':
- resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==}
-
- '@webassemblyjs/[email protected]':
- resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==}
-
- '@webassemblyjs/[email protected]':
- resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==}
-
'@xmldom/[email protected]':
resolution: {integrity: sha512-KRYzxepc14G/CEpEGc3Yn+JKaAeT63smlDr+vjB8jRfgTBBI9wRj/nkQEO+ucV8p8I9bfKLWp37uHgFrbntPvw==}
engines: {node: '>=10.0.0'}
@@ -12034,7 +12013,7 @@ snapshots:
- react-dom
- tailwindcss
dependencies:
'@chenglou/pretext': 0.0.5
diff --git a/frontend/src/components/AuthZTooltip/AuthZTooltip.test.tsx b/frontend/src/components/AuthZTooltip/AuthZTooltip.authz.test.tsx
similarity index 100%
rename from frontend/src/components/AuthZTooltip/AuthZTooltip.test.tsx
rename to frontend/src/components/AuthZTooltip/AuthZTooltip.authz.test.tsx
diff --git a/frontend/src/components/CreateServiceAccountModal/CreateServiceAccountModal.tsx b/frontend/src/components/CreateServiceAccountModal/CreateServiceAccountModal.tsx
index 24ab6bcec6..8278128594 100644
--- a/frontend/src/components/CreateServiceAccountModal/CreateServiceAccountModal.tsx
+++ b/frontend/src/components/CreateServiceAccountModal/CreateServiceAccountModal.tsx
@@ -137,7 +137,6 @@ function CreateServiceAccountModal(): JSX.Element {
<AuthZTooltip checks={[SACreatePermission]}>
<Button
type="submit"
- // @ts-expect-error -- form prop not in @signozhq/ui Button type - TODO: Fix this - @SagarRajput
form="create-sa-form"
variant="solid"
color="primary"
diff --git a/frontend/src/components/GuardAuthZ/GuardAuthZ.test.tsx b/frontend/src/components/GuardAuthZ/GuardAuthZ.authz.test.tsx
similarity index 81%
rename from frontend/src/components/GuardAuthZ/GuardAuthZ.test.tsx
rename to frontend/src/components/GuardAuthZ/GuardAuthZ.authz.test.tsx
index 89101130fc..99e0876d0d 100644
--- a/frontend/src/components/GuardAuthZ/GuardAuthZ.test.tsx
+++ b/frontend/src/components/GuardAuthZ/GuardAuthZ.authz.test.tsx
@@ -11,9 +11,6 @@ import { GuardAuthZ } from './GuardAuthZ';
describe('GuardAuthZ', () => {
const TestChild = (): ReactElement => <div>Protected Content</div>;
const LoadingFallback = (): ReactElement => <div>Loading...</div>;
- const ErrorFallback = (error: Error): ReactElement => (
- <div>Error occurred: {error.message}</div>
- );
const NoPermissionFallback = (_response: {
requiredPermissionName: BrandedPermission;
}): ReactElement => <div>Access denied</div>;
@@ -90,40 +87,28 @@ describe('GuardAuthZ', () => {
expect(screen.queryByText('Protected Content')).not.toBeInTheDocument();
});
- it('should render fallbackOnError when API error occurs', async () => {
- const errorMessage = 'Internal Server Error';
-
+ it('should render children when API error occurs and no fallbackOnError provided (fail open)', async () => {
server.use(
rest.post(AUTHZ_CHECK_URL, (_req, res, ctx) => {
- return res(ctx.status(500), ctx.json({ error: errorMessage }));
+ return res(ctx.status(500), ctx.json({ error: 'Internal Server Error' }));
}),
);
render(
- <GuardAuthZ relation="read" object="role:*" fallbackOnError={ErrorFallback}>
+ <GuardAuthZ relation="read" object="role:*">
<TestChild />
</GuardAuthZ>,
);
await waitFor(() => {
- expect(screen.getByText(/Error occurred:/)).toBeInTheDocument();
+ expect(screen.getByText('Protected Content')).toBeInTheDocument();
});
-
- expect(screen.queryByText('Protected Content')).not.toBeInTheDocument();
});
- it('should pass error object to fallbackOnError function', async () => {
- const errorMessage = 'Network request failed';
- let receivedError: Error | null = null;
-
- const errorFallbackWithCapture = (error: Error): ReactElement => {
- receivedError = error;
- return <div>Captured error: {error.message}</div>;
- };
-
+ it('should render fallbackOnError when API error occurs and fallbackOnError is provided', async () => {
server.use(
rest.post(AUTHZ_CHECK_URL, (_req, res, ctx) => {
- return res(ctx.status(500), ctx.json({ error: errorMessage }));
+ return res(ctx.status(500), ctx.json({ error: 'Internal Server Error' }));
}),
);
@@ -131,35 +116,14 @@ describe('GuardAuthZ', () => {
<GuardAuthZ
relation="read"
object="role:*"
- fallbackOnError={errorFallbackWithCapture}
+ fallbackOnError={<div>Custom error fallback</div>}
>
<TestChild />
</GuardAuthZ>,
);
await waitFor(() => {
- expect(receivedError).not.toBeNull();
- });
-
- expect(receivedError).toBeInstanceOf(Error);
- expect(screen.getByText(/Captured error:/)).toBeInTheDocument();
- });
-
- it('should render null when error occurs and no fallbackOnError provided', async () => {
- server.use(
- rest.post(AUTHZ_CHECK_URL, (_req, res, ctx) => {
- return res(ctx.status(500), ctx.json({ error: 'Internal Server Error' }));
- }),
- );
-
- const { container } = render(
- <GuardAuthZ relation="read" object="role:*">
- <TestChild />
- </GuardAuthZ>,
- );
-
- await waitFor(() => {
- expect(container.firstChild).toBeNull();
+ expect(screen.getByText('Custom error fallback')).toBeInTheDocument();
});
expect(screen.queryByText('Protected Content')).not.toBeInTheDocument();
diff --git a/frontend/src/components/GuardAuthZ/GuardAuthZ.tsx b/frontend/src/components/GuardAuthZ/GuardAuthZ.tsx
index cde7b2d3c6..fdfae8309f 100644
--- a/frontend/src/components/GuardAuthZ/GuardAuthZ.tsx
+++ b/frontend/src/components/GuardAuthZ/GuardAuthZ.tsx
@@ -12,7 +12,7 @@ export type GuardAuthZProps<R extends AuthZRelation> = {
relation: R;
object: AuthZObject<R>;
fallbackOnLoading?: JSX.Element;
- fallbackOnError?: (error: Error) => JSX.Element;
+ fallbackOnError?: JSX.Element;
fallbackOnNoPermissions?: (response: {
requiredPermissionName: BrandedPermission;
}) => JSX.Element;
@@ -35,7 +35,7 @@ export function GuardAuthZ<R extends AuthZRelation>({
}
if (error) {
- return fallbackOnError?.(error) ?? null;
+ return fallbackOnError ?? children;
}
if (!permissions?.[permission]?.isGranted) {
diff --git a/frontend/src/components/ServiceAccountDrawer/AddKeyModal/KeyFormPhase.tsx b/frontend/src/components/ServiceAccountDrawer/AddKeyModal/KeyFormPhase.tsx
index 9a652044cc..71d9b0a8a9 100644
--- a/frontend/src/components/ServiceAccountDrawer/AddKeyModal/KeyFormPhase.tsx
+++ b/frontend/src/components/ServiceAccountDrawer/AddKeyModal/KeyFormPhase.tsx
@@ -127,7 +127,6 @@ function KeyFormPhase({
>
<Button
type="submit"
- // @ts-expect-error -- form prop not in @signozhq/ui Button type - TODO: Fix this - @SagarRajput
form={FORM_ID}
variant="solid"
color="primary"
diff --git a/frontend/src/components/ServiceAccountDrawer/EditKeyModal/EditKeyForm.tsx b/frontend/src/components/ServiceAccountDrawer/EditKeyModal/EditKeyForm.tsx
index 9d4e1c0a2e..749886c383 100644
--- a/frontend/src/components/ServiceAccountDrawer/EditKeyModal/EditKeyForm.tsx
+++ b/frontend/src/components/ServiceAccountDrawer/EditKeyModal/EditKeyForm.tsx
@@ -190,7 +190,6 @@ function EditKeyForm({
>
<Button
type="submit"
- // @ts-expect-error -- form prop not in @signozhq/ui Button type - TODO: Fix this - @SagarRajput
form={FORM_ID}
variant="solid"
color="primary"
diff --git a/frontend/src/components/createGuardedRoute/createGuardedRoute.test.tsx b/frontend/src/components/createGuardedRoute/createGuardedRoute.authz.test.tsx
similarity index 97%
rename from frontend/src/components/createGuardedRoute/createGuardedRoute.test.tsx
rename to frontend/src/components/createGuardedRoute/createGuardedRoute.authz.test.tsx
index 80c61b9398..93f4711b4a 100644
--- a/frontend/src/components/createGuardedRoute/createGuardedRoute.test.tsx
+++ b/frontend/src/components/createGuardedRoute/createGuardedRoute.authz.test.tsx
@@ -204,7 +204,7 @@ describe('createGuardedRoute', () => {
).not.toBeInTheDocument();
});
- it('should render error fallback when API error occurs', async () => {
+ it('should render the component when API error occurs (fail open)', async () => {
server.use(
rest.post(AUTHZ_CHECK_URL, (_req, res, ctx) => {
return res(ctx.status(500), ctx.json({ error: 'Internal Server Error' }));
@@ -230,12 +230,8 @@ describe('createGuardedRoute', () => {
render(<GuardedComponent {...props} />);
await waitFor(() => {
- expect(screen.getByText(/Something went wrong/i)).toBeInTheDocument();
+ expect(screen.getByText('Test Component: test-value')).toBeInTheDocument();
});
-
- expect(
- screen.queryByText('Test Component: test-value'),
- ).not.toBeInTheDocument();
});
it('should render no permissions fallback when permission is denied', async () => {
diff --git a/frontend/src/components/createGuardedRoute/createGuardedRoute.tsx b/frontend/src/components/createGuardedRoute/createGuardedRoute.tsx
index ad94ea266a..dc602e9945 100644
--- a/frontend/src/components/createGuardedRoute/createGuardedRoute.tsx
+++ b/frontend/src/components/createGuardedRoute/createGuardedRoute.tsx
@@ -9,14 +9,11 @@ import { parsePermission } from 'hooks/useAuthZ/utils';
import noDataUrl from '@/assets/Icons/no-data.svg';
-import ErrorBoundaryFallback from '../../pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
import AppLoading from '../AppLoading/AppLoading';
import { GuardAuthZ } from '../GuardAuthZ/GuardAuthZ';
import './createGuardedRoute.styles.scss';
-const onErrorFallback = (): JSX.Element => <ErrorBoundaryFallback />;
-
function OnNoPermissionsFallback(response: {
requiredPermissionName: BrandedPermission;
}): ReactElement {
@@ -63,7 +60,6 @@ export function createGuardedRoute<P extends object, R extends AuthZRelation>(
relation={relation}
object={resolvedObject}
fallbackOnLoading={<AppLoading />}
- fallbackOnError={onErrorFallback}
fallbackOnNoPermissions={(response): ReactElement => (
<OnNoPermissionsFallback {...response} />
)}
diff --git a/frontend/src/container/RolesSettings/RoleDetails/__tests__/RoleDetailsPage.test.tsx b/frontend/src/container/RolesSettings/RoleDetails/__tests__/RoleDetailsPage.authz.test.tsx
similarity index 100%
rename from frontend/src/container/RolesSettings/RoleDetails/__tests__/RoleDetailsPage.test.tsx
rename to frontend/src/container/RolesSettings/RoleDetails/__tests__/RoleDetailsPage.authz.test.tsx
diff --git a/frontend/src/container/RolesSettings/__tests__/RolesSettings.test.tsx b/frontend/src/container/RolesSettings/__tests__/RolesSettings.authz.test.tsx
similarity index 100%
rename from frontend/src/container/RolesSettings/__tests__/RolesSettings.test.tsx
rename to frontend/src/container/RolesSettings/__tests__/RolesSettings.authz.test.tsx
diff --git a/frontend/src/container/RolesSettings/__tests__/utils.test.ts b/frontend/src/container/RolesSettings/__tests__/utils.authz.test.ts
similarity index 100%
rename from frontend/src/container/RolesSettings/__tests__/utils.test.ts
rename to frontend/src/container/RolesSettings/__tests__/utils.authz.test.ts
diff --git a/frontend/src/container/ServiceAccountsSettings/ServiceAccountsSettings.test.tsx b/frontend/src/container/ServiceAccountsSettings/ServiceAccountsSettings.authz.test.tsx
similarity index 100%
rename from frontend/src/container/ServiceAccountsSettings/ServiceAccountsSettings.test.tsx
rename to frontend/src/container/ServiceAccountsSettings/ServiceAccountsSettings.authz.test.tsx
diff --git a/frontend/src/container/ServiceAccountsSettings/__tests__/ServiceAccountsSettings.integration.test.tsx b/frontend/src/container/ServiceAccountsSettings/__tests__/ServiceAccountsSettings.authz.integration.test.tsx
similarity index 100%
rename from frontend/src/container/ServiceAccountsSettings/__tests__/ServiceAccountsSettings.integration.test.tsx
rename to frontend/src/container/ServiceAccountsSettings/__tests__/ServiceAccountsSettings.authz.integration.test.tsx
diff --git a/frontend/src/hooks/useAuthZ/useAuthZ.test.tsx b/frontend/src/hooks/useAuthZ/useAuthZ.authz.test.tsx
similarity index 98%
rename from frontend/src/hooks/useAuthZ/useAuthZ.test.tsx
rename to frontend/src/hooks/useAuthZ/useAuthZ.authz.test.tsx
index db4d38f998..85bf0ace3e 100644
--- a/frontend/src/hooks/useAuthZ/useAuthZ.test.tsx
+++ b/frontend/src/hooks/useAuthZ/useAuthZ.authz.test.tsx
@@ -48,11 +48,10 @@ describe('useAuthZ', () => {
expect(result.current.isLoading).toBe(false);
});
- expect(result.current.error).toBeNull();
expect(result.current.permissions).toStrictEqual(expectedResponse);
});
- it('should handle API errors', async () => {
+ it('should return error and null permissions when API errors', async () => {
const permission = buildPermission('read', 'role:*');
server.use(
@@ -191,7 +190,6 @@ describe('useAuthZ', () => {
});
expect(result.current.isLoading).toBe(false);
- expect(result.current.error).toBeNull();
expect(result.current.permissions).toStrictEqual({});
});
diff --git a/frontend/src/periscope/components/PrettyView/PrettyView.tsx b/frontend/src/periscope/components/PrettyView/PrettyView.tsx
index 3e7f372956..075de728b4 100644
--- a/frontend/src/periscope/components/PrettyView/PrettyView.tsx
+++ b/frontend/src/periscope/components/PrettyView/PrettyView.tsx
@@ -227,10 +227,8 @@ function PrettyView({
menu={{ items: menuItems }}
align="start"
className="pretty-view-actions-dropdown"
- // onClick on the dropdown content is forwarded to the underlying div via ...props
- // but is not in the public type. Stop click bubbling so item clicks don't reach
- // clickable ancestors of the trigger through the React tree.
- // @ts-expect-error see comment above
+ // Stop click bubbling so item clicks don't reach clickable ancestors
+ // of the trigger through the React tree.
onClick={(e: React.MouseEvent): void => e.stopPropagation()}
>
<span
diff --git a/frontend/src/providers/App/App.tsx b/frontend/src/providers/App/App.tsx
index db737e72a6..72f80c2647 100644
--- a/frontend/src/providers/App/App.tsx
+++ b/frontend/src/providers/App/App.tsx
@@ -129,14 +129,13 @@ export function AppProvider({ children }: PropsWithChildren): JSX.Element {
const {
permissions: permissionsResult,
isFetching: isFetchingPermissions,
- error: errorOnPermissions,
refetchPermissions,
} = useAuthZ([IsAdminPermission, IsEditorPermission, IsViewerPermission], {
enabled: isLoggedIn,
});
const isFetchingUser = isFetchingUserData || isFetchingPermissions;
- const userFetchError = userFetchDataError || errorOnPermissions;
+ const userFetchError = userFetchDataError;
const userRole = useMemo(() => {
if (permissionsResult?.[IsAdminPermission]?.isGranted) {
diff --git a/frontend/src/providers/App/__tests__/App.test.tsx b/frontend/src/providers/App/__tests__/App.test.tsx
index 2a6a020c10..55ff07b05e 100644
--- a/frontend/src/providers/App/__tests__/App.test.tsx
+++ b/frontend/src/providers/App/__tests__/App.test.tsx
@@ -298,9 +298,32 @@ describe('AppProvider when authz/check fails', () => {
beforeEach(() => {
queryClient.clear();
setLocalStorageApi(LOCALSTORAGE.IS_LOGGED_IN, 'true');
+ server.use(
+ rest.get(MY_USER_URL, (_, res, ctx) =>
+ res(
+ ctx.status(200),
+ ctx.json({
+ data: {
+ id: 'u-1',
+ displayName: 'Test User',
+ email: '[email protected]',
+ orgId: 'org-1',
+ isRoot: false,
+ status: 'active',
+ },
+ }),
+ ),
+ ),
+ rest.get(MY_ORG_URL, (_, res, ctx) =>
+ res(
+ ctx.status(200),
+ ctx.json({ data: { id: 'org-1', displayName: 'Org' } }),
+ ),
+ ),
+ );
});
- it('sets userFetchError when authz/check returns 500 (same as user fetch error)', async () => {
+ it('does not set userFetchError when authz/check returns 500 (authz errors are ignored)', async () => {
server.use(
rest.post(AUTHZ_CHECK_URL, (_, res, ctx) =>
res(ctx.status(500), ctx.json({ error: 'Internal Server Error' })),
@@ -314,13 +337,13 @@ describe('AppProvider when authz/check fails', () => {
await waitFor(
() => {
- expect(result.current.userFetchError).toBeTruthy();
+ expect(result.current.userFetchError).toBeFalsy();
},
{ timeout: 2000 },
);
});
- it('sets userFetchError when authz/check fails with network error (same as user fetch error)', async () => {
+ it('does not set userFetchError when authz/check fails with network error (authz errors are ignored)', async () => {
server.use(
rest.post(AUTHZ_CHECK_URL, (_, res) => res.networkError('Network error')),
);
@@ -332,7 +355,7 @@ describe('AppProvider when authz/check fails', () => {
await waitFor(
() => {
- expect(result.current.userFetchError).toBeTruthy();
+ expect(result.current.userFetchError).toBeFalsy();
},
{ timeout: 2000 },
);