From 69100557e41020efa43eaaea2065769e1cfb4622 Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Fri, 26 Apr 2024 17:18:03 +0530 Subject: [PATCH] put s3 fields under a cover --- ui/components/PeerForms/ClickhouseConfig.tsx | 94 +++++++++++++------- 1 file changed, 61 insertions(+), 33 deletions(-) diff --git a/ui/components/PeerForms/ClickhouseConfig.tsx b/ui/components/PeerForms/ClickhouseConfig.tsx index 7faf7a555c..f2ea31eb0c 100644 --- a/ui/components/PeerForms/ClickhouseConfig.tsx +++ b/ui/components/PeerForms/ClickhouseConfig.tsx @@ -1,11 +1,14 @@ 'use client'; import { PeerSetter } from '@/app/dto/PeersDTO'; import { PeerSetting } from '@/app/peers/create/[peerType]/helpers/common'; +import { Button } from '@/lib/Button/Button'; +import { Icon } from '@/lib/Icon/Icon'; import { Label } from '@/lib/Label'; import { RowWithSwitch, RowWithTextField } from '@/lib/Layout'; import { Switch } from '@/lib/Switch'; import { TextField } from '@/lib/TextField'; import { Tooltip } from '@/lib/Tooltip'; +import { useState } from 'react'; import { InfoPopover } from '../InfoPopover'; interface ConfigProps { settings: PeerSetting[]; @@ -13,6 +16,7 @@ interface ConfigProps { } export default function ClickhouseForm({ settings, setter }: ConfigProps) { + const [show, setShow] = useState(false); const S3Labels = [ 'S3 Path', 'Access Key ID', @@ -108,40 +112,64 @@ export default function ClickhouseForm({ settings, setter }: ConfigProps) { /> ); })} - } - action={ -
- ) => - handleChange(e.target.value, setting) - } - type={setting.type} - /> - {setting.tips && } -
- } - /> - ))} + + + + {show && + settings + .filter((setting) => S3Labels.includes(setting.label)) + .map((setting, id) => ( + {setting.label}} + action={ +
+ ) => + handleChange(e.target.value, setting) + } + type={setting.type} + /> + {setting.tips && } +
+ } + /> + ))} ); }