diff --git a/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/copy-button/copy-button.spec.tsx b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/copy-button/copy-button.spec.tsx new file mode 100644 index 00000000000..22b0ba2fcf6 --- /dev/null +++ b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/copy-button/copy-button.spec.tsx @@ -0,0 +1,10 @@ +import { renderWithProviders } from '@qovery/shared/util-tests' +import CopyButton from './copy-button' + +describe('CopyButton', () => { + test('should render CopyButton component', () => { + const { getByText } = renderWithProviders() + const copyButton = getByText('Copy') + expect(copyButton).toBeInTheDocument() + }) +}) diff --git a/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/copy-button/copy-button.tsx b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/copy-button/copy-button.tsx new file mode 100644 index 00000000000..1665ae13508 --- /dev/null +++ b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/copy-button/copy-button.tsx @@ -0,0 +1,36 @@ +import { type IconName } from '@fortawesome/fontawesome-common-types' +import { useState } from 'react' +import { Button, Icon } from '@qovery/shared/ui' +import { useCopyToClipboard } from '@qovery/shared/util-hooks' + +export interface CopyButtonProps { + content: string +} + +export function CopyButton({ content }: CopyButtonProps) { + const [icon, setIcon] = useState('copy') + const [, copyToClipboard] = useCopyToClipboard() + + const onClickCopyToClipboard = (content: string) => { + copyToClipboard(content) + setIcon('check') + setTimeout(() => { + setIcon('copy') + }, 1000) + } + + return ( + + ) +} + +export default CopyButton diff --git a/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/step-general.spec.tsx b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/step-general.spec.tsx index ba14ca90fed..2c863e804e6 100644 --- a/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/step-general.spec.tsx +++ b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/step-general.spec.tsx @@ -33,6 +33,7 @@ describe('StepGeneral', () => { name: 'my-cluster', description: 'test', production: false, + installation_type: 'MANAGED', }, }) ) @@ -53,6 +54,7 @@ describe('StepGeneral', () => { cloud_provider: CloudProviderEnum.AWS, region: 'paris', credentials: '111-111-111', + installation_type: 'MANAGED', }, }) ) @@ -66,4 +68,32 @@ describe('StepGeneral', () => { expect(button).not.toBeDisabled() expect(props.onSubmit).toHaveBeenCalled() }) + + it('should render local demo cluster', async () => { + renderWithProviders( + wrapWithReactHookForm(, { + defaultValues: { + installation_type: 'LOCAL_DEMO', + }, + }) + ) + + screen.getByText('1. Download/Update Qovery CLI') + screen.getByText('2. Install your cluster') + screen.getByText('3. Deploy your first environment!') + }) + + it('should render self managed cluster', async () => { + renderWithProviders( + wrapWithReactHookForm(, { + defaultValues: { + installation_type: 'SELF_MANAGED', + }, + }) + ) + + screen.getByText('1. Download/Update Qovery CLI') + screen.getByText('2. Install your cluster') + screen.getByText('3. Deploy your first environment!') + }) }) diff --git a/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/step-general.tsx b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/step-general.tsx index 29d6ad6344a..6b56ef32b97 100644 --- a/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/step-general.tsx +++ b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-general/step-general.tsx @@ -21,6 +21,7 @@ import { } from '@qovery/shared/ui' import { upperCaseFirstLetter } from '@qovery/shared/util-js' import { defaultResourcesData } from '../../../feature/page-clusters-create-feature/page-clusters-create-feature' +import CopyButton from './copy-button/copy-button' export interface StepGeneralProps { onSubmit: FormEventHandler @@ -67,10 +68,6 @@ export function StepGeneral(props: StepGeneralProps) {
-
-

General

- -
+
  • Choose Local Demo if you want to install Qovery on your local machine for demo/testing.
  • @@ -130,10 +128,21 @@ export function StepGeneral(props: StepGeneralProps) { - Self-Managed (BETA) + Self-Managed

    - You will manage the infrastructure, including any update/ upgrade. Advanced Kubernetes knowledge - required. + You will manage the infrastructure, including any update/ upgrade.
    Advanced Kubernetes + knowledge required. +

    +
    + + @@ -142,93 +151,158 @@ export function StepGeneral(props: StepGeneralProps) { )} />
    -
    -

    Provider credentials

    - {cloudProviders.length > 0 ? ( - <> - {watch('cloud_provider') === CloudProviderEnum.GCP && ( - - - - - - GCP integration is beta, keep an eye on your cluster costs and report any bugs and/or weird - behavior. - - Setup budget alerts - - - More details - - - - )} - ( - { - const currentProvider = cloudProviders?.filter( - (cloud) => cloud.short_name === value && cloud.regions - )[0] - setCurrentProvider(currentProvider as CloudProvider) - field.onChange(value) - setResourcesData && setResourcesData(defaultResourcesData) - }} - value={field.value} - error={error?.message} - portal - /> - )} - /> - {currentProvider && ( + + {watch('installation_type') === 'MANAGED' && ( + <> +
    +

    General

    + +
    +
    +

    Provider credentials

    + {cloudProviders.length > 0 ? ( <> + {watch('cloud_provider') === CloudProviderEnum.GCP && ( + + + + + + GCP integration is beta, keep an eye on your cluster costs and report any bugs and/or weird + behavior. + + Setup budget alerts + + + More details + + + + )} ( { + const currentProvider = cloudProviders?.filter( + (cloud) => cloud.short_name === value && cloud.regions + )[0] + setCurrentProvider(currentProvider as CloudProvider) + field.onChange(value) + setResourcesData && setResourcesData(defaultResourcesData) + }} value={field.value} error={error?.message} - isSearchable portal /> )} /> - + {currentProvider && ( + <> + ( + + )} + /> + + + )} + ) : ( +
    + +
    )} - - ) : ( -
    -
    - )} -
    + + )} + + {watch('installation_type') !== 'MANAGED' && ( +
    +

    Installation instruction

    + {watch('installation_type') === 'LOCAL_DEMO' ? ( + + See documentation + + ) : ( + + See documentation + + )} + +
      +
    • +
      1. Download/Update Qovery CLI
      +

      + Download and install the Qovery CLI (or update its version to the latest version). +

      + + https://hub.qovery.com/docs/using-qovery/interface/cli/#install + +
    • +
    • +
      2. Install your cluster
      +

      + Run the following command from your terminal and follow the instructions. +

      +
      +                  {watch('installation_type') === 'LOCAL_DEMO' ? (
      +                    <>
      +                      $ qovery demo up 
      +                    
      +                  ) : (
      +                    <>
      +                      $ qovery cluster install 
      +                    
      +                  )}
      +                
      +
    • +
    • +
      3. Deploy your first environment!
      +

      + Once the installation is completed, get back to the Qovery console and deploy your first environment + on your brand new cluster. +

      +
    • +
    +
    + )}
    - + {watch('installation_type') === 'MANAGED' ? ( + + ) : ( + + )}
    diff --git a/libs/pages/clusters/src/lib/ui/page-clusters-create/step-summary/step-summary.tsx b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-summary/step-summary.tsx index 47144542376..f39c11741ff 100644 --- a/libs/pages/clusters/src/lib/ui/page-clusters-create/step-summary/step-summary.tsx +++ b/libs/pages/clusters/src/lib/ui/page-clusters-create/step-summary/step-summary.tsx @@ -111,6 +111,7 @@ export function StepSummary(props: StepSummaryProps) { {match(props.generalData.installation_type) .with('MANAGED', () => 'Managed') .with('SELF_MANAGED', () => 'Self-Managed') + .with('LOCAL_DEMO', () => undefined) .exhaustive()} diff --git a/libs/shared/interfaces/src/lib/domain/cluster-creation-flow.interface.ts b/libs/shared/interfaces/src/lib/domain/cluster-creation-flow.interface.ts index 3db72546e19..4db56d4b86f 100644 --- a/libs/shared/interfaces/src/lib/domain/cluster-creation-flow.interface.ts +++ b/libs/shared/interfaces/src/lib/domain/cluster-creation-flow.interface.ts @@ -8,7 +8,7 @@ export interface ClusterGeneralData { region: string credentials: string credentials_name: string - installation_type: 'MANAGED' | 'SELF_MANAGED' + installation_type: 'MANAGED' | 'SELF_MANAGED' | 'LOCAL_DEMO' } export interface ClusterKubeconfigData { diff --git a/tailwind-workspace-preset.js b/tailwind-workspace-preset.js index 654cd7de389..016e8ff3392 100644 --- a/tailwind-workspace-preset.js +++ b/tailwind-workspace-preset.js @@ -88,7 +88,7 @@ const easingFunctions = { // tailwind-workspace-preset.js module.exports = { - darkMode: ['class', '[data-mode="dark"]'], + darkMode: ['class'], theme: { extend: { transitionProperty: {