From 7cdef05ca5d0220a6ec21f42ec73aaff590a9c2c Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 19 Aug 2024 15:57:50 +0300 Subject: [PATCH 1/6] chore: init --- frontend/graph/schema.resolvers.go | 1 - .../connect-destination-modal-body/index.tsx | 35 ++++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend/graph/schema.resolvers.go b/frontend/graph/schema.resolvers.go index 910c5273ff..983b6a2187 100644 --- a/frontend/graph/schema.resolvers.go +++ b/frontend/graph/schema.resolvers.go @@ -213,7 +213,6 @@ func (r *mutationResolver) TestConnectionForDestination(ctx context.Context, inp return nil, err } - // Assuming testconnection.TestConnection returns a struct with fields similar to res.Succeeded, res.StatusCode, etc. res := testconnection.TestConnection(ctx, configurer) if !res.Succeeded { return &model.TestConnectionResponse{ diff --git a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx index 498b58c321..aa3e0b4edd 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/connect-destination-modal-body/index.tsx @@ -2,9 +2,12 @@ import React, { useEffect, useMemo, useState } from 'react'; import styled from 'styled-components'; import { SideMenu } from '@/components'; import { useQuery } from '@apollo/client'; -import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; +import { useDispatch } from 'react-redux'; +import { addConfiguredDestination } from '@/store'; +import { TestConnection } from '../test-connection'; import { GET_DESTINATION_TYPE_DETAILS } from '@/graphql'; import { Body, Container, SideMenuWrapper } from '../styled'; +import { useConnectDestinationForm, useConnectEnv } from '@/hooks'; import { DynamicConnectDestinationFormFields } from '../dynamic-form-fields'; import { StepProps, @@ -22,9 +25,6 @@ import { NotificationNote, SectionTitle, } from '@/reuseable-components'; -import { addConfiguredDestination } from '@/store'; -import { useDispatch } from 'react-redux'; -import { TestConnection } from '../test-connection'; const SIDE_MENU_DATA: StepProps[] = [ { @@ -60,26 +60,27 @@ export function ConnectDestinationModalBody({ destination, onSubmitRef, }: ConnectDestinationModalBodyProps) { - const { data } = useQuery( - GET_DESTINATION_TYPE_DETAILS, - { - variables: { type: destination?.type }, - skip: !destination, - } - ); + const [formData, setFormData] = useState>({}); + const [destinationName, setDestinationName] = useState(''); + const [showConnectionError, setShowConnectionError] = useState(false); + const [dynamicFields, setDynamicFields] = useState([]); const [exportedSignals, setExportedSignals] = useState({ logs: false, metrics: false, traces: false, }); - const [showConnectionError, setShowConnectionError] = useState(false); - const [destinationName, setDestinationName] = useState(''); - const [dynamicFields, setDynamicFields] = useState([]); - const [formData, setFormData] = useState>({}); - const { buildFormDynamicFields } = useConnectDestinationForm(); - const { connectEnv } = useConnectEnv(); const dispatch = useDispatch(); + const { connectEnv } = useConnectEnv(); + const { buildFormDynamicFields } = useConnectDestinationForm(); + + const { data } = useQuery( + GET_DESTINATION_TYPE_DETAILS, + { + variables: { type: destination?.type }, + skip: !destination, + } + ); const monitors = useMemo(() => { if (!destination) return []; From ffde50852a79a81d3ab5d0bed23f1ab6114a5787 Mon Sep 17 00:00:00 2001 From: alonkeyval Date: Mon, 19 Aug 2024 16:47:24 +0300 Subject: [PATCH 2/6] chore: wip --- .../dynamic-form-fields/index.tsx | 10 +- .../destinations/useConnectDestinationForm.ts | 10 +- frontend/webapp/reuseable-components/index.ts | 1 + .../reuseable-components/textarea/index.tsx | 157 ++++++++++++++++++ 4 files changed, 167 insertions(+), 11 deletions(-) create mode 100644 frontend/webapp/reuseable-components/textarea/index.tsx diff --git a/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx b/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx index 196767bcf6..190be415da 100644 --- a/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx +++ b/frontend/webapp/containers/main/destinations/add-destination/dynamic-form-fields/index.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { INPUT_TYPES } from '@/utils/constants/string'; -import { Dropdown, Input } from '@/reuseable-components'; +import { Dropdown, Input, TextArea } from '@/reuseable-components'; export function DynamicConnectDestinationFormFields({ fields, @@ -35,7 +35,13 @@ export function DynamicConnectDestinationFormFields({ case INPUT_TYPES.KEY_VALUE_PAIR: return
; case INPUT_TYPES.TEXTAREA: - return
; + return ( +