mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 00:58:32 +02:00
Default cert to open when just added
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import type { ClientCertificate } from '@yaakapp-internal/models';
|
import type { ClientCertificate } from '@yaakapp-internal/models';
|
||||||
import { patchModel, settingsAtom } from '@yaakapp-internal/models';
|
import { patchModel, settingsAtom } from '@yaakapp-internal/models';
|
||||||
import classNames from 'classnames';
|
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
|
import { useRef } from 'react';
|
||||||
import { showConfirmDelete } from '../../lib/confirm';
|
import { showConfirmDelete } from '../../lib/confirm';
|
||||||
import { Button } from '../core/Button';
|
import { Button } from '../core/Button';
|
||||||
import { Checkbox } from '../core/Checkbox';
|
import { Checkbox } from '../core/Checkbox';
|
||||||
@@ -49,9 +49,11 @@ function CertificateEditor({ certificate, index, onUpdate, onRemove }: Certifica
|
|||||||
|
|
||||||
// Determine certificate type for display
|
// Determine certificate type for display
|
||||||
const certType = hasPfx ? 'PFX' : hasCrtKey ? 'CERT' : null;
|
const certType = hasPfx ? 'PFX' : hasCrtKey ? 'CERT' : null;
|
||||||
|
const defaultOpen = useRef<boolean>(!certificate.host);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DetailsBanner
|
<DetailsBanner
|
||||||
|
open={defaultOpen.current}
|
||||||
summary={
|
summary={
|
||||||
<HStack alignItems="center" justifyContent="between" space={2} className="w-full">
|
<HStack alignItems="center" justifyContent="between" space={2} className="w-full">
|
||||||
<HStack space={1.5}>
|
<HStack space={1.5}>
|
||||||
@@ -63,10 +65,14 @@ function CertificateEditor({ certificate, index, onUpdate, onRemove }: Certifica
|
|||||||
onChange={(enabled) => updateField('enabled', enabled)}
|
onChange={(enabled) => updateField('enabled', enabled)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<InlineCode className={classNames(!certificate.host && 'border-danger')}>
|
{certificate.host ? (
|
||||||
{certificate.host || <> </>}
|
<InlineCode>
|
||||||
{certificate.port != null && `:${certificate.port}`}
|
{certificate.host || <> </>}
|
||||||
</InlineCode>
|
{certificate.port != null && `:${certificate.port}`}
|
||||||
|
</InlineCode>
|
||||||
|
) : (
|
||||||
|
<span className="italic text-sm text-text-subtlest">Configure Certificate</span>
|
||||||
|
)}
|
||||||
{certType && <InlineCode>{certType}</InlineCode>}
|
{certType && <InlineCode>{certType}</InlineCode>}
|
||||||
</HStack>
|
</HStack>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
|||||||
Reference in New Issue
Block a user