feat: config port && hide id in table by default

This commit is contained in:
Zephyruso 2023-08-31 11:15:03 +08:00
parent c0fee9d929
commit e0f5c46a2e
2 changed files with 18 additions and 18 deletions

View File

@ -15,31 +15,26 @@ const schema = z.object({
export default () => { export default () => {
const request = useRequest() const request = useRequest()
const formItemList = [ const portsList = [
{ {
label: 'Http Port',
key: 'port', key: 'port',
label: 'port',
type: 'number',
}, },
{ {
label: 'Socks Port',
key: 'socks-port', key: 'socks-port',
label: 'socks-port',
type: 'number',
}, },
{ {
label: 'Redir Port',
key: 'redir-port', key: 'redir-port',
label: 'redir-port',
type: 'number',
}, },
{ {
label: 'Tproxy Port',
key: 'tproxy-port', key: 'tproxy-port',
label: 'tproxy-port',
type: 'number',
}, },
{ {
label: 'Mixed Port',
key: 'mixed-port', key: 'mixed-port',
label: 'mixed-port',
type: 'number',
}, },
] ]
@ -55,15 +50,16 @@ export default () => {
return ( return (
<div> <div>
config <form class="form" use:form={form}>
<form class="contents" use:form={form}> <For each={portsList}>
<For each={formItemList}>
{(item) => ( {(item) => (
<div class="flex flex-row items-center gap-4"> <div class="form-control w-64 max-w-xs">
{item.label}: <label class="label">
<span class="label-text">{item.label}</span>
</label>
<input <input
name={item.key} name={item.key}
type={item.type} type="number"
class="input input-bordered" class="input input-bordered"
placeholder={item.label} placeholder={item.label}
/> />

View File

@ -87,7 +87,7 @@ export default () => {
class="btn btn-circle btn-outline btn-xs" class="btn btn-circle btn-outline btn-xs"
onClick={() => request.delete('connections')} onClick={() => request.delete('connections')}
> >
<IconX /> <IconX class="" />
</button> </button>
</div> </div>
), ),
@ -176,6 +176,9 @@ export default () => {
get sorting() { get sorting() {
return sorting() return sorting()
}, },
columnVisibility: {
ID: false,
},
}, },
get data() { get data() {
return search() return search()
@ -188,6 +191,7 @@ export default () => {
) )
: connectionsWithSpeed() : connectionsWithSpeed()
}, },
enableHiding: true,
columns, columns,
onSortingChange: setSorting, onSortingChange: setSorting,
getSortedRowModel: getSortedRowModel(), getSortedRowModel: getSortedRowModel(),