1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-27 01:19:00 +02:00
unleash.unleash/frontend/src/hooks
Nuno Góis 0b3ed79ecc
refactor: roles - make better plan assumptions (#4113)
https://linear.app/unleash/issue/2-1171/refactor-custom-root-roles-with-correct-plan-assumptions

This cleans up the hotfix `RoleSelect2` component and makes `RoleSelect`
take in a `roles` prop from the parent component.

This also simplifies the role hooks again to assume Enterprise plan by
default. This means, however, that we must ensure that we only call
these hooks in Enterprise features or, if we do call them in other
plans, that we provide a graceful fallback for non-Enterprise.
Non-Enterprise instances do not have this endpoint, and so they are
currently grabbing role information from e.g. `useUsers` and
`useServiceAccounts`.

I'm not sure how I feel about this. Roles are an overarching concept of
Unleash. To me, having to be extremely conscious about the exact
scenario in which you're using such a hook feels like a trap, instead of
"I need roles, so I'll grab the `useRoles` hook and not think much about
it". I also don't like the way `roles` are currently tied to the users,
service accounts, project access, (...) instead of being its own thing.

This could be solved by a `RoleController` exposing the GET endpoints in
OSS, since all of the logic we need for this use-case lives there
anyways. This would then be overridden with the Enterprise-specific
controller when wrapped. This way we could assume the endpoint is always
there, no matter the plan.
This is just an idea and not something I explored in the PR. For now I'm
just focusing on leaving this feature in a sane state.

Tested this manually on `Pro` and `Enterprise` and I believe everything
is acting the way we intend, but would love some extra eyes.
2023-06-28 16:00:14 +01:00
..
api refactor: roles - make better plan assumptions (#4113) 2023-06-28 16:00:14 +01:00
useChangeRequestAddStrategy.ts Change request event tracking (#2570) 2022-11-30 12:04:29 +01:00
useChangeRequestInReviewWarning.tsx Feat/update dialogues (#2559) 2022-11-29 14:52:01 +01:00
useChangeRequestsEnabled.test.tsx feat: skip change request in UI (#3495) 2023-04-11 14:47:54 +02:00
useChangeRequestsEnabled.ts fix: can review CR with skip change request (#3998) 2023-06-16 13:36:23 +02:00
useChangeRequestToggle.ts Fix/cr should activate disabled lag free (#3826) 2023-05-23 10:16:09 +03:00
useCollaborateData.tsx linter fixes (#2561) 2022-11-30 10:52:13 +01:00
useConditionallyHiddenColumns.ts Use new useConditionallyHiddenColumns hook (#2695) 2022-12-16 10:46:04 +01:00
useDefaultProjectSettings.ts chore: remove projectScopedStickinessFlag (#3620) 2023-04-26 17:07:09 +03:00
useDragItem.ts fix: improve drag behaviour when using handle (#2407) 2022-11-14 08:25:20 +00:00
useEventSettings.ts feat: add trial expiration warning banner (#985) 2022-05-19 14:06:18 +02:00
useFormErrors.ts fix: validate feature strategy parameters (#1192) 2022-08-04 13:34:30 +02:00
useGlobalLocalStorage.ts Allow hiding environments from the feature overview screen (#2727) 2023-01-03 15:41:34 +02:00
useGlobalState.ts refactor: improve feature toggle search state (#741) 2022-02-23 15:08:44 +01:00
useHasAccess.ts feat: skip change request in UI (#3495) 2023-04-11 14:47:54 +02:00
useHiddenEnvironments.ts Plausible for hidden environments (#2837) 2023-01-09 15:36:10 +02:00
useId.test.ts refactor: adapt to Vite (#940) 2022-05-05 16:15:22 +01:00
useId.ts refactor: improve icon labels and tooltips (#884) 2022-04-21 08:26:49 +02:00
useIsAppleDevice.ts Search keyboard shortcut (#1048) 2022-06-06 14:23:48 +02:00
useKeyboardShortcut.ts Search keyboard shortcut (#1048) 2022-06-06 14:23:48 +02:00
useLastViewedProject.ts Fix/redirect woes (#2899) 2023-01-17 13:33:52 +01:00
useLoading.ts Refactor: Project Overview fetching (#3035) 2023-02-07 08:57:28 +01:00
useLocationSettings.ts feat: add trial expiration warning banner (#985) 2022-05-19 14:06:18 +02:00
useOnVisible.ts feat: add search to event log pages (#1205) 2022-08-09 16:00:51 +02:00
useOptionalPathParam.ts feat: add new feature strategy create/edit pages (#739) 2022-03-09 14:59:24 +01:00
usePageTitle.ts Refactor project health table (#1098) 2022-06-21 09:08:37 +02:00
usePagination.ts fix: user search pagination (#997) 2022-05-19 14:27:19 +02:00
usePersistentGlobalState.ts Project stats feedback (#3131) 2023-02-17 13:10:27 +01:00
usePinnedFavorites.test.ts Favorite features on project (#2580) 2022-12-01 13:10:42 +01:00
usePinnedFavorites.ts fix: favorites column visibility (#2605) 2022-12-06 10:03:43 +00:00
usePlausibleTracker.ts chore: remove strategyImprovements flag (#4043) 2023-06-28 11:38:21 +03:00
useQueryParams.ts
useQueryStringNumberState.ts feat: add new feature metrics page (#716) 2022-02-21 13:47:54 +01:00
useQueryStringState.ts chore: update react-router to v6 (#946) 2022-05-05 13:42:18 +02:00
useRequiredPathParam.ts feat: add new feature strategy create/edit pages (#739) 2022-03-09 14:59:24 +01:00
useRequiredQueryParam.ts feat: add new feature strategy create/edit pages (#739) 2022-03-09 14:59:24 +01:00
useSearch.test.ts feat: add filtering capabilities to search (#1052) 2022-06-03 11:32:30 +01:00
useSearch.ts UI/bulk select (#3267) 2023-03-14 08:56:03 +00:00
useTabs.ts feat: e2e tests and mobile views (#348) 2021-09-30 11:44:30 +02:00
useThemeMode.ts fix: dark theme UI fixes (#3423) 2023-03-30 16:57:35 +01:00
useToast.tsx Bulk tags (#3337) 2023-03-21 13:37:25 +01:00
useUsersPlan.ts feat: paid users limit in UI (#3210) 2023-03-01 08:49:14 +01:00
useVariant.ts feat: message banner (variants) (#3788) 2023-05-18 09:38:59 +01:00
useVirtualizedRange.ts feat: initial scroll trigger (#4036) 2023-06-21 15:37:04 +02:00
useWeakMap.ts feat: add new feature strategy create/edit pages (#739) 2022-03-09 14:59:24 +01:00