Skip to content

Commit 10ad42c

Browse files
Remove Permission tooltip from OSS (#2009)
<!-- Ensure the title clearly reflects what was changed. Provide a clear and concise description of the changes made. The PR should only contain the changes related to the issue, and no other unrelated changes. --> Part of OPS-3675
1 parent 579355e commit 10ad42c

5 files changed

Lines changed: 26 additions & 51 deletions

File tree

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import React from 'react';
22

33
import { authenticationSession } from '@/app/lib/authentication-session';
4+
import { Permission } from '@openops/shared';
45

56
export const useAuthorization = () => {
67
const role = authenticationSession.getUserProjectRole();
78

8-
const checkAccess = React.useCallback(() => true, []);
9+
const checkAccess = React.useCallback((_permission: Permission) => {
10+
return true;
11+
}, []);
912

1013
return { checkAccess, role };
1114
};

packages/react-ui/src/app/features/builder/flow-versions/flow-versions-card.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
DropdownMenuTrigger,
1717
INTERNAL_ERROR_TOAST,
1818
LoadingSpinner,
19-
PermissionNeededTooltip,
2019
toast,
2120
Tooltip,
2221
TooltipContent,
@@ -62,18 +61,16 @@ const UseAsDraftDropdownMenuOption = ({
6261
disabled={!userHasPermissionToWriteFlow}
6362
className="w-full"
6463
>
65-
<PermissionNeededTooltip hasPermission={userHasPermissionToWriteFlow}>
66-
<DropdownMenuItem
67-
className="w-full"
68-
onSelect={(e) => {
69-
e.preventDefault();
70-
}}
71-
disabled={!userHasPermissionToWriteFlow}
72-
>
73-
<Pencil className="mr-2 h-4 w-4" />
74-
<span>{t('Use as Draft')}</span>
75-
</DropdownMenuItem>
76-
</PermissionNeededTooltip>
64+
<DropdownMenuItem
65+
className="w-full"
66+
onSelect={(e) => {
67+
e.preventDefault();
68+
}}
69+
disabled={!userHasPermissionToWriteFlow}
70+
>
71+
<Pencil className="mr-2 h-4 w-4" />
72+
<span>{t('Use as Draft')}</span>
73+
</DropdownMenuItem>
7774
</DialogTrigger>
7875
<DialogContent>
7976
<DialogHeader>

packages/react-ui/src/app/features/connections/components/connection-table.tsx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
INTERNAL_ERROR_TOAST,
1414
PageHeader,
1515
PaginationParams,
16-
PermissionNeededTooltip,
1716
RowDataWithActions,
1817
StatusIconWithText,
1918
toast,
@@ -22,6 +21,7 @@ import {
2221
AppConnection,
2322
AppConnectionStatus,
2423
MinimalFlow,
24+
Permission,
2525
} from '@openops/shared';
2626
import { ColumnDef } from '@tanstack/react-table';
2727
import { t } from 'i18next';
@@ -263,27 +263,25 @@ const fetchData = async (
263263

264264
const ConnectionsHeader = () => {
265265
const { checkAccess } = useAuthorization();
266-
const userHasPermissionToWriteAppConnection = checkAccess();
266+
const userHasPermissionToWriteAppConnection = checkAccess(
267+
Permission.WRITE_APP_CONNECTION,
268+
);
267269

268270
const { setRefresh } = useConnectionsContext();
269271

270272
return (
271273
<PageHeader title={t('Connections')}>
272274
<div className="ml-auto mr-7">
273-
<PermissionNeededTooltip
274-
hasPermission={userHasPermissionToWriteAppConnection}
275+
<NewConnectionTypeDialog
276+
onConnectionCreated={() => setRefresh((prev) => !prev)}
275277
>
276-
<NewConnectionTypeDialog
277-
onConnectionCreated={() => setRefresh((prev) => !prev)}
278+
<Button
279+
variant="default"
280+
disabled={!userHasPermissionToWriteAppConnection}
278281
>
279-
<Button
280-
variant="default"
281-
disabled={!userHasPermissionToWriteAppConnection}
282-
>
283-
{t('New Connection')}
284-
</Button>
285-
</NewConnectionTypeDialog>
286-
</PermissionNeededTooltip>
282+
{t('New Connection')}
283+
</Button>
284+
</NewConnectionTypeDialog>
287285
</div>
288286
</PageHeader>
289287
);

packages/ui-components/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export * from './ui/image-with-fallback';
3232
export * from './ui/input';
3333
export * from './ui/label';
3434
export * from './ui/numeric-input';
35-
export * from './ui/permission-needed-tooltip';
3635
export * from './ui/popover';
3736
export * from './ui/progress';
3837
export * from './ui/radio-group';

packages/ui-components/src/ui/permission-needed-tooltip.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)