Skip to content

Commit 074e747

Browse files
authored
Add a way to have multiple types of flags. (#1641)
Part of OPS-3117.
1 parent 3799026 commit 074e747

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

packages/react-ui/src/app/common/hooks/flags-hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { usePrefetchQuery, useSuspenseQuery } from '@tanstack/react-query';
22

33
import { QueryKeys } from '@/app/constants/query-keys';
44
import { flagsApi, FlagsMap } from '@/app/lib/flags-api';
5-
import { FlagId } from '@openops/shared';
5+
import { FlagId, OpenOpsFlag } from '@openops/shared';
66

77
type WebsiteBrand = {
88
websiteName: string;
@@ -48,7 +48,7 @@ export const flagsHooks = {
4848
const { data: theme } = flagsHooks.useFlag<WebsiteBrand>(FlagId.THEME);
4949
return theme!;
5050
},
51-
useFlag: <T>(flagId: FlagId) => {
51+
useFlag: <T>(flagId: OpenOpsFlag) => {
5252
const data = useSuspenseQuery<FlagsMap, Error>({
5353
queryKey: [QueryKeys.flags],
5454
queryFn: flagsApi.getAll,

packages/shared/src/lib/flag/flag.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export enum OpsEdition {
1717
CLOUD = 'cloud',
1818
}
1919

20+
export type OpenOpsFlag = FlagId;
21+
2022
export enum FlagId {
2123
SHOW_POWERED_BY_IN_FORM = 'SHOW_POWERED_BY_IN_FORM',
2224
CLOUD_AUTH_ENABLED = 'CLOUD_AUTH_ENABLED',

0 commit comments

Comments
 (0)