2023-09-23 20:24:43 +08:00
|
|
|
import { IconNetwork } from '@tabler/icons-solidjs'
|
2023-09-10 17:55:53 +08:00
|
|
|
import { Component, Show } from 'solid-js'
|
2023-09-23 20:24:43 +08:00
|
|
|
import { Modal } from '~/components'
|
|
|
|
import { useI18n } from '~/i18n'
|
2023-09-10 17:55:53 +08:00
|
|
|
import { allConnections } from '~/signals'
|
|
|
|
|
|
|
|
export const ConnectionsTableDetailsModal: Component<{
|
2023-09-23 20:24:43 +08:00
|
|
|
ref?: (el: HTMLDialogElement) => void
|
2023-09-10 17:55:53 +08:00
|
|
|
selectedConnectionID?: string
|
|
|
|
}> = (props) => {
|
2023-09-23 20:24:43 +08:00
|
|
|
const [t] = useI18n()
|
2023-09-19 00:35:58 +08:00
|
|
|
|
2023-09-10 17:55:53 +08:00
|
|
|
return (
|
2023-09-23 20:24:43 +08:00
|
|
|
<Modal
|
|
|
|
ref={(el) => props.ref?.(el)}
|
|
|
|
icon={<IconNetwork size={24} />}
|
|
|
|
title={t('connectionsDetails')}
|
|
|
|
>
|
|
|
|
<Show when={props.selectedConnectionID}>
|
|
|
|
<pre>
|
|
|
|
<code>
|
|
|
|
{JSON.stringify(
|
|
|
|
allConnections().find(
|
|
|
|
({ id }) => id === props.selectedConnectionID,
|
|
|
|
),
|
|
|
|
null,
|
|
|
|
2,
|
|
|
|
)}
|
|
|
|
</code>
|
|
|
|
</pre>
|
|
|
|
</Show>
|
|
|
|
</Modal>
|
2023-09-10 17:55:53 +08:00
|
|
|
)
|
|
|
|
}
|