Skip to content

Commit

Permalink
[dashboard] add switchToPAYG feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTugarev authored and roboquat committed Feb 21, 2023
1 parent 532513a commit 2d15009
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions components/dashboard/src/contexts/FeatureFlagContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const FeatureFlagContext = createContext<{
enablePersonalAccessTokens: boolean;
oidcServiceEnabled: boolean;
orgGitAuthProviders: boolean;
switchToPAYG: boolean;
}>({
startWithOptions: false,
showUsageView: false,
Expand All @@ -32,6 +33,7 @@ const FeatureFlagContext = createContext<{
enablePersonalAccessTokens: false,
oidcServiceEnabled: false,
orgGitAuthProviders: false,
switchToPAYG: false,
});

const FeatureFlagContextProvider: React.FC = ({ children }) => {
Expand All @@ -47,6 +49,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
const [usePublicApiWorkspacesService, setUsePublicApiWorkspacesService] = useState<boolean>(false);
const [oidcServiceEnabled, setOidcServiceEnabled] = useState<boolean>(false);
const [orgGitAuthProviders, setOrgGitAuthProviders] = useState<boolean>(false);
const [switchToPAYG, setSwitchToPAYG] = useState<boolean>(false);

useEffect(() => {
if (!user) return;
Expand All @@ -63,6 +66,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
},
oidcServiceEnabled: { defaultValue: false, setter: setOidcServiceEnabled },
orgGitAuthProviders: { defaultValue: false, setter: setOrgGitAuthProviders },
switchToPAYG: { defaultValue: false, setter: setSwitchToPAYG },
};

for (const [flagName, config] of Object.entries(featureFlags)) {
Expand Down Expand Up @@ -110,6 +114,7 @@ const FeatureFlagContextProvider: React.FC = ({ children }) => {
usePublicApiWorkspacesService,
oidcServiceEnabled,
orgGitAuthProviders,
switchToPAYG,
}}
>
{children}
Expand Down

0 comments on commit 2d15009

Please sign in to comment.