diff --git a/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/InputElements/GenericSecretInput.tsx b/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/InputElements/GenericSecretInput.tsx index b12890e14..c7a5c6f82 100644 --- a/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/InputElements/GenericSecretInput.tsx +++ b/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/InputElements/GenericSecretInput.tsx @@ -7,80 +7,75 @@ import { Grid, Group, Stack, - Text, TextInput, ThemeIcon, Title, + Tooltip, } from '@mantine/core'; import { IconDeviceFloppy, TablerIcon } from '@tabler/icons'; -import { ReactNode, useState } from 'react'; +import { useState } from 'react'; interface GenericSecretInputProps { label: string; value: string; - secretIsPresent: boolean; - unsetIcon: TablerIcon; setIcon: TablerIcon; + onClickUpdateButton: (value: string | undefined) => void; } export const GenericSecretInput = ({ label, value, - secretIsPresent, setIcon, - unsetIcon, + onClickUpdateButton, }: GenericSecretInputProps) => { const { classes } = useStyles(); - const [dirty, setDirty] = useState(false); - const IconComponent = secretIsPresent ? setIcon : unsetIcon; + const Icon = setIcon; + + const [fieldValue, setFieldValue] = useState(value); return ( - - + + {label} - - {secretIsPresent - ? 'Secret is defined in the configuration' - : 'Secret has not been defined'} - - {secretIsPresent ? ( - <> - - - - - } - defaultValue={value} - onChange={() => setDirty(true)} - withAsterisk - /> - - ) : ( - - )} + + setFieldValue(event.currentTarget.value)} + rightSection={ + + onClickUpdateButton(fieldValue)}> + + + + } + value={fieldValue} + type="password" + placeholder="no value is set" + withAsterisk + /> diff --git a/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/IntegrationOptionsRenderer/IntegrationOptionsRenderer.tsx b/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/IntegrationOptionsRenderer/IntegrationOptionsRenderer.tsx index 4de85ff6a..a07880ffe 100644 --- a/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/IntegrationOptionsRenderer/IntegrationOptionsRenderer.tsx +++ b/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/Components/IntegrationOptionsRenderer/IntegrationOptionsRenderer.tsx @@ -1,6 +1,6 @@ import { Stack } from '@mantine/core'; import { UseFormReturnType } from '@mantine/form'; -import { IconKey, IconKeyOff } from '@tabler/icons'; +import { IconKey } from '@tabler/icons'; import { IntegrationField, integrationFieldDefinitions, @@ -49,11 +49,13 @@ export const IntegrationOptionsRenderer = ({ form }: IntegrationOptionsRendererP if (!definition) { return ( { + form.setFieldValue(`integration.properties.${index}.value`, value); + }} key={`input-${property}`} label={`${property} (potentionally unmapped)`} secretIsPresent={isPresent} setIcon={IconKey} - unsetIcon={IconKeyOff} {...form.getInputProps(`integration.properties.${index}.value`)} /> ); @@ -61,12 +63,14 @@ export const IntegrationOptionsRenderer = ({ form }: IntegrationOptionsRendererP return ( { + form.setFieldValue(`integration.properties.${index}.value`, value); + }} key={`input-${definition.label}`} label={definition.label} value="" secretIsPresent={isPresent} setIcon={definition.icon} - unsetIcon={definition.iconUnset} {...form.getInputProps(`integration.properties.${index}.value`)} /> ); diff --git a/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/IntegrationTab.tsx b/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/IntegrationTab.tsx index 9d6b1abef..c4615421c 100644 --- a/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/IntegrationTab.tsx +++ b/src/components/Dashboard/Modals/EditService/Tabs/IntegrationTab/IntegrationTab.tsx @@ -21,6 +21,10 @@ export const IntegrationTab = ({ form }: IntegrationTabProps) => { {hasIntegrationSelected && ( <> + + To update a secret, enter a value and click the save button. To remove a secret, use the + clear button. + } color="yellow"> diff --git a/src/types/service.ts b/src/types/service.ts index e0313e5c3..31818aadc 100644 --- a/src/types/service.ts +++ b/src/types/service.ts @@ -1,12 +1,4 @@ -import { - IconKey, - IconKeyOff, - IconLockOff, - IconPassword, - IconUser, - IconUserOff, - TablerIcon, -} from '@tabler/icons'; +import { IconKey, IconPassword, IconUser, TablerIcon } from '@tabler/icons'; import { TileBaseType } from './tile'; export interface ServiceType extends TileBaseType { @@ -62,7 +54,7 @@ export type ConfigServiceIntegrationType = Omit