mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
console: update root component for onboarding to have cloud console check
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6093 GitOrigin-RevId: ba8ba274d4a7da7745926cefa63fab2989dfaba0
This commit is contained in:
parent
d32dc881e3
commit
0a72b8edd0
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { ComponentMeta, Story } from '@storybook/react';
|
||||
import { ReactQueryDecorator } from '@/storybook/decorators/react-query';
|
||||
import { useQueryClient } from 'react-query';
|
||||
import { Root } from './Root';
|
||||
import { RootWithCloudCheck as Root } from './Root';
|
||||
import {
|
||||
baseHandlers,
|
||||
fetchAnsweredSurveysHandler,
|
||||
|
@ -1,5 +1,7 @@
|
||||
import React from 'react';
|
||||
import * as Dialog from '@radix-ui/react-dialog';
|
||||
import globals from '@/Globals';
|
||||
import { isCloudConsole } from '@/utils/cloudConsole';
|
||||
import { TopHeaderBar, ConnectDBScreen } from './components';
|
||||
import { useWizardState } from './hooks';
|
||||
import { GrowthExperimentsClient } from '../GrowthExperiments';
|
||||
@ -12,7 +14,7 @@ type Props = {
|
||||
/**
|
||||
* Parent container for the onboarding wizard. Takes care of assembling and rendering all steps.
|
||||
*/
|
||||
export function Root(props: Props) {
|
||||
function Root(props: Props) {
|
||||
const { growthExperimentsClient } = props;
|
||||
|
||||
// dialog cannot be reopened once closed
|
||||
@ -56,3 +58,14 @@ export function Root(props: Props) {
|
||||
</Dialog.Root>
|
||||
);
|
||||
}
|
||||
|
||||
export function RootWithCloudCheck(props: Props) {
|
||||
/*
|
||||
* Don't render Root component if current context is not cloud-console
|
||||
* and current user is not project owner
|
||||
*/
|
||||
if (isCloudConsole(globals)) {
|
||||
return null;
|
||||
}
|
||||
return <Root {...props} />;
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
import { Root } from './Root';
|
||||
import { RootWithCloudCheck } from './Root';
|
||||
|
||||
export const OnboardingWizard = Root;
|
||||
export const OnboardingWizard = RootWithCloudCheck;
|
||||
|
Loading…
Reference in New Issue
Block a user