mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
console: improving cloud onboarding for non-PG users
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8276 Co-authored-by: Rikin Kachhia <54616969+rikinsk@users.noreply.github.com> GitOrigin-RevId: 2d4d9f8d0b4d905e59be4b58586cb7968f217f62
This commit is contained in:
parent
b61927acad
commit
cd18fd0762
@ -78,10 +78,10 @@ export function NeonOnboarding(props: {
|
|||||||
useEmitOnboardingEvents(neonIntegrationStatus, installingTemplate);
|
useEmitOnboardingEvents(neonIntegrationStatus, installingTemplate);
|
||||||
|
|
||||||
// allow skipping only when an action is not in-progress
|
// allow skipping only when an action is not in-progress
|
||||||
const allowSkipping =
|
const isActionInProgress =
|
||||||
neonIntegrationStatus.status === 'idle' ||
|
neonIntegrationStatus.status !== 'idle' &&
|
||||||
neonIntegrationStatus.status === 'authentication-error' ||
|
neonIntegrationStatus.status !== 'authentication-error' &&
|
||||||
neonIntegrationStatus.status === 'neon-database-creation-error';
|
neonIntegrationStatus.status !== 'neon-database-creation-error';
|
||||||
|
|
||||||
const neonBannerProps = transformNeonIntegrationStatusToNeonBannerProps(
|
const neonBannerProps = transformNeonIntegrationStatusToNeonBannerProps(
|
||||||
neonIntegrationStatus
|
neonIntegrationStatus
|
||||||
@ -95,17 +95,23 @@ export function NeonOnboarding(props: {
|
|||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="w-full mb-sm">
|
<div className="w-full mb-sm">
|
||||||
<NeonBanner {...neonBannerProps} setStepperIndex={setStepperIndex} />
|
<NeonBanner
|
||||||
|
{...neonBannerProps}
|
||||||
|
setStepperIndex={setStepperIndex}
|
||||||
|
dispatch={dispatch}
|
||||||
|
dismiss={dismiss}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-start items-center w-full">
|
<div className="flex justify-start items-center w-full">
|
||||||
<Analytics name="onboarding-skip-button">
|
<Analytics name="onboarding-skip-button">
|
||||||
<a
|
<a
|
||||||
|
id="onboarding-skip-button"
|
||||||
className={`w-auto text-secondary text-sm hover:text-secondary-dark hover:no-underline ${
|
className={`w-auto text-secondary text-sm hover:text-secondary-dark hover:no-underline ${
|
||||||
allowSkipping ? 'cursor-pointer' : 'cursor-not-allowed'
|
!isActionInProgress ? 'cursor-pointer' : 'cursor-not-allowed'
|
||||||
}`}
|
}`}
|
||||||
title={!allowSkipping ? 'Please wait...' : undefined}
|
title={isActionInProgress ? 'Operation in progress...' : undefined}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (allowSkipping) {
|
if (!isActionInProgress) {
|
||||||
onSkipHandler();
|
onSkipHandler();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
@ -8,8 +8,8 @@ export function OnboardingAnimation() {
|
|||||||
<HasuraOnboarding />
|
<HasuraOnboarding />
|
||||||
</div>
|
</div>
|
||||||
<div className="font-normal text-sm text-gray-600 mt-md">
|
<div className="font-normal text-sm text-gray-600 mt-md">
|
||||||
We recommend connecting a Postgres database to instantly explore your{' '}
|
We recommend connecting a database to instantly explore the
|
||||||
<b>Hasura GraphQL API</b>
|
auto-generated <b>Hasura GraphQL API</b>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -5,6 +5,9 @@ import { IndicatorCard } from '../../../../../new-components/IndicatorCard';
|
|||||||
import { HasuraLogoFull } from '../../../../../new-components/HasuraLogo';
|
import { HasuraLogoFull } from '../../../../../new-components/HasuraLogo';
|
||||||
import { Analytics } from '../../../../Analytics';
|
import { Analytics } from '../../../../Analytics';
|
||||||
import { NeonIcon } from './NeonIcon';
|
import { NeonIcon } from './NeonIcon';
|
||||||
|
import _push from '../../../../../components/Services/Data/push';
|
||||||
|
import { persistSkippedOnboarding } from '../../utils';
|
||||||
|
import { Dispatch } from '../../../../../types';
|
||||||
|
|
||||||
const iconMap = {
|
const iconMap = {
|
||||||
refresh: <MdRefresh />,
|
refresh: <MdRefresh />,
|
||||||
@ -29,12 +32,30 @@ export type Props = {
|
|||||||
buttonText: string;
|
buttonText: string;
|
||||||
icon?: keyof typeof iconMap;
|
icon?: keyof typeof iconMap;
|
||||||
setStepperIndex: (index: number) => void;
|
setStepperIndex: (index: number) => void;
|
||||||
|
dispatch: Dispatch;
|
||||||
|
dismiss: VoidFunction;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function NeonBanner(props: Props) {
|
export function NeonBanner(props: Props) {
|
||||||
const { status, onClickConnect, buttonText, icon, setStepperIndex } = props;
|
const {
|
||||||
|
status,
|
||||||
|
onClickConnect,
|
||||||
|
buttonText,
|
||||||
|
icon,
|
||||||
|
setStepperIndex,
|
||||||
|
dispatch,
|
||||||
|
dismiss,
|
||||||
|
} = props;
|
||||||
const isButtonDisabled = status.status === 'loading';
|
const isButtonDisabled = status.status === 'loading';
|
||||||
|
|
||||||
|
/* This handles if a user wants to connect an existing DB or a non-postgres DB,
|
||||||
|
it registers that user skipped onboarding and take them directly to connect database page*/
|
||||||
|
const onClickConnectOtherDB = () => {
|
||||||
|
dispatch(_push('/data/manage/connect'));
|
||||||
|
persistSkippedOnboarding();
|
||||||
|
dismiss();
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="border border-gray-300 border-l-4 border-l-[#297393] shadow-md rounded bg-white p-md">
|
<div className="border border-gray-300 border-l-4 border-l-[#297393] shadow-md rounded bg-white p-md">
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
@ -43,19 +64,39 @@ export function NeonBanner(props: Props) {
|
|||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<HasuraLogoFull mode="brand" size="sm" />
|
<HasuraLogoFull mode="brand" size="sm" />
|
||||||
<div className="font-bold mx-xs">+</div>
|
<div className="font-bold mx-xs">+</div>
|
||||||
<NeonIcon />
|
<a
|
||||||
|
href="https://neon.tech/"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
<NeonIcon />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-md text-gray-700 ml-xs">
|
<div className="flex flex-col w-3/4 ml-xs">
|
||||||
Need a new database? We've partnered with{' '}
|
<div className="text-md text-gray-700 mb-xs">
|
||||||
<a
|
Need a new database? We've partnered with Neon to help you
|
||||||
href="https://neon.tech/"
|
get started with a free Postgres database.
|
||||||
target="_blank"
|
</div>
|
||||||
rel="noopener noreferrer"
|
<div className="text-md text-gray-700">
|
||||||
>
|
<a
|
||||||
Neon
|
id="onboarding-connect-other-database-link"
|
||||||
</a>{' '}
|
className={`w-auto text-secondary hover:text-secondary-dark ${
|
||||||
to help you get started.
|
!isButtonDisabled ? 'cursor-pointer' : 'cursor-not-allowed'
|
||||||
|
}`}
|
||||||
|
title={
|
||||||
|
isButtonDisabled ? 'Operation in progress...' : undefined
|
||||||
|
}
|
||||||
|
onClick={() => {
|
||||||
|
if (!isButtonDisabled) {
|
||||||
|
onClickConnectOtherDB();
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Click here
|
||||||
|
</a>{' '}
|
||||||
|
to connect any other database.
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex w-1/4 justify-end">
|
<div className="flex w-1/4 justify-end">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NeonBanner } from '../CloudOnboarding/OnboardingWizard/components/NeonConnectBanner/NeonBanner';
|
import { NeonBanner } from '../../components/Services/Data/DataSources/CreateDataSource/Neon/components/Neon/NeonBanner';
|
||||||
import { DatabaseKind } from './types';
|
import { DatabaseKind } from './types';
|
||||||
import { Button } from '../../new-components/Button';
|
import { Button } from '../../new-components/Button';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
@ -34,7 +34,6 @@ export const SelectDatabase: React.VFC = () => {
|
|||||||
}
|
}
|
||||||
status={{ status: 'default' }}
|
status={{ status: 'default' }}
|
||||||
buttonText="Create a Neon Database"
|
buttonText="Create a Neon Database"
|
||||||
setStepperIndex={() => {}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NeonBanner } from '../../../CloudOnboarding/OnboardingWizard/components/NeonConnectBanner/NeonBanner';
|
import { NeonBanner } from '../../../../components/Services/Data/DataSources/CreateDataSource/Neon/components/Neon/NeonBanner';
|
||||||
import Globals from '../../../../Globals';
|
import Globals from '../../../../Globals';
|
||||||
import { Button } from '../../../../new-components/Button';
|
import { Button } from '../../../../new-components/Button';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
@ -60,7 +60,6 @@ export const SelectDatabase = ({
|
|||||||
}
|
}
|
||||||
status={{ status: 'default' }}
|
status={{ status: 'default' }}
|
||||||
buttonText="Create a Neon Database"
|
buttonText="Create a Neon Database"
|
||||||
setStepperIndex={() => {}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user