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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | 219x 219x 219x 219x 219x 219x 219x 219x 219x 219x 4x 3x 3x 3x 3x 1x 1x 1x 1x 1x 1x 3x 1x 3x 3x 1x 6x 219x | /* * 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, { useContext, useEffect } from 'react' import { Button, Container, Formik, FormikForm, Heading, Layout, StepProps, FormInput, Text } from '@wings-software/uicore' import { get } from 'lodash-es' import { useStrings } from 'framework/strings' import { DialogExtensionContext } from '@connectors/common/ConnectorExtention/DialogExtention' import type { GcpBillingExportSpec, GcpCloudCostConnector } from 'services/cd-ng' import { CE_GCP_CONNECTOR_CREATION_EVENTS } from '@connectors/trackingConstants' import { useStepLoadTelemetry } from '@connectors/common/useTrackStepLoad/useStepLoadTelemetry' import type { CEGcpConnectorDTO } from './OverviewStep' import BillingExportExtention from './BillingExportExtention' import css from '../CreateCeGcpConnector.module.scss' const BillingExport: React.FC<StepProps<CEGcpConnectorDTO>> = props => { const { getString } = useStrings() useStepLoadTelemetry(CE_GCP_CONNECTOR_CREATION_EVENTS.LOAD_BILLING_EXPORT_SETUP) const { prevStepData, nextStep, previousStep } = props const { triggerExtension, closeExtension } = useContext(DialogExtensionContext) const handleSubmit = (formData: GcpBillingExportSpec) => { const newSpec: GcpCloudCostConnector = { projectId: '', featuresEnabled: ['BILLING'], ...prevStepData?.spec, billingExportSpec: { datasetId: formData.datasetId, tableId: formData.tableId || '' }, serviceAccountEmail: '' } const payload = prevStepData Eif (payload) { payload.spec = newSpec } closeExtension() Eif (nextStep) nextStep(payload) } useEffect(() => { triggerExtension(BillingExportExtention) }, []) const handlePrev = () => { closeExtension() previousStep?.({ ...(prevStepData as CEGcpConnectorDTO) }) } return ( <Layout.Vertical className={css.stepContainer}> <Heading level={2} className={css.header}> {getString('connectors.ceGcp.billingExport.heading')} </Heading> <div className={css.subHeader} style={{ paddingRight: 40 }}> {getString('connectors.ceGcp.billingExport.description')} </div> <Text font="small" className={css.info} color="primary7" inline icon="info-sign" iconProps={{ size: 15, color: 'primary7', margin: { right: 'xsmall' } }} > {getString('connectors.ceGcp.billingExport.followInstruction')} </Text> <Container> <Button className={css.launchTemplateBut} text={getString('connectors.ceGcp.billingExport.launchTemplate')} rightIcon="chevron-right" onClick={() => { window.open('https://console.cloud.google.com/bigquery') }} /> </Container> <div style={{ flex: 1 }}> <Formik<GcpBillingExportSpec> initialValues={{ datasetId: prevStepData?.spec.billingExportSpec?.datasetId || '', tableId: get(prevStepData, 'spec.billingExportSpec.tableId', '') }} onSubmit={formData => handleSubmit(formData)} formName="ceGcpBillingExport" > {() => ( <FormikForm> <div> <FormInput.Text name={'datasetId'} tooltipProps={{ dataTooltipId: 'gcp-dataset-name' }} label={getString('connectors.ceGcp.billingExport.datasetIdLabel')} className={css.dataFields} /> <FormInput.Text name={'tableId'} tooltipProps={{ dataTooltipId: 'gcp-table-name' }} label={getString('connectors.ceGcp.billingExport.tableIdLabel')} className={css.dataFields} /> </div> <Layout.Horizontal className={css.buttonPanel} spacing="small"> <Button text={getString('previous')} icon="chevron-left" onClick={handlePrev}></Button> <Button type="submit" intent="primary" text={getString('continue')} rightIcon="chevron-right" /> </Layout.Horizontal> </FormikForm> )} </Formik> </div> </Layout.Vertical> ) } export default BillingExport |