Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x | /* * Copyright 2022 Harness Inc. All rights reserved. * Use of this source code is governed by the PolyForm Shield 1.0.0 license * that can be found in the licenses directory at the root of this repository, also available at * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt. */ import React, { useState } from 'react' import { useParams } from 'react-router-dom' import { Button, Layout, StepProps } from '@wings-software/uicore' import { useStrings } from 'framework/strings' import { useCreateDelegateGroup } from 'services/portal' import { useToaster } from '@common/exports' import type { ProjectPathProps } from '@common/interfaces/RouteInterfaces' import { useTelemetry } from '@common/hooks/useTelemetry' import { Category, DelegateActions } from '@common/constants/TrackingConstants' import StepProcessing from '../../components/StepProcessing/StepProcessing' import type { DockerDelegateWizardData } from '../CreateDockerDelegate' import css from '../Step1Setup/Step1Setup.module.scss' interface StepSuccessVerificationProps { onClose?: any } const Step3Verify: React.FC<StepProps<DockerDelegateWizardData> & StepSuccessVerificationProps> = props => { const { accountId, orgIdentifier, projectIdentifier } = useParams<ProjectPathProps>() const [isVerifiedSuccessfully, setIsVerifiedSuccessfully] = useState(false) const { previousStep, prevStepData } = props const { getString } = useStrings() const { showError } = useToaster() const { trackEvent } = useTelemetry() const onClickBack = (): void => { Iif (previousStep) { previousStep(prevStepData) } } const { mutate: createDelegateGroup } = useCreateDelegateGroup({ queryParams: { accountId } }) const onClickDone = async () => { trackEvent(DelegateActions.SaveCreateDelegate, { category: Category.DELEGATE, ...prevStepData }) if (!isVerifiedSuccessfully) { const dockerData = { delegateType: 'DOCKER', orgIdentifier, projectIdentifier, name: prevStepData?.name, identifier: prevStepData?.identifier, description: prevStepData?.description, tags: prevStepData?.tags, tokenName: prevStepData?.tokenName } as any const response = (await createDelegateGroup(dockerData)) as any if (response?.ok) { props?.onClose() } else { const err = (response as any)?.responseMessages?.[0]?.message showError(err) } } else { props?.onClose() } } return ( <> <Layout.Horizontal className={css.baseContainer}> <Layout.Vertical className={css.leftPanel}> <StepProcessing name={props?.prevStepData?.name} replicas={1} onSuccessHandler={() => setIsVerifiedSuccessfully(true)} /> </Layout.Vertical> </Layout.Horizontal> <Layout.Horizontal padding="xxxlarge"> <Button id="stepReviewScriptBackButton" text={getString('back')} onClick={onClickBack} icon="chevron-left" margin={{ right: 'small' }} /> <Button text={getString('done')} intent="primary" padding="small" onClick={onClickDone} /> </Layout.Horizontal> </> ) } export default Step3Verify |