mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-09 06:06:08 +00:00
feat(clients): hide disabled inbounds in the client form selector
The attach-inbounds select in the client add/edit modal listed every inbound, so panels with many disabled inbounds had to scroll past dead entries. InboundOption now carries the inbound's enable flag and the form drops disabled inbounds from the options, keeping ones the client is already attached to so edit mode still renders existing assignments. Closes #5645
This commit is contained in:
@@ -399,6 +399,7 @@ export const EXAMPLES: Record<string, unknown> = {
|
||||
"xver": 0
|
||||
},
|
||||
"InboundOption": {
|
||||
"enable": true,
|
||||
"id": 1,
|
||||
"listen": "",
|
||||
"nodeAddress": "",
|
||||
|
||||
@@ -1798,6 +1798,10 @@ export const SCHEMAS: Record<string, unknown> = {
|
||||
},
|
||||
"InboundOption": {
|
||||
"properties": {
|
||||
"enable": {
|
||||
"example": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"id": {
|
||||
"example": 1,
|
||||
"type": "integer"
|
||||
@@ -1854,6 +1858,7 @@ export const SCHEMAS: Record<string, unknown> = {
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"enable",
|
||||
"id",
|
||||
"port",
|
||||
"protocol",
|
||||
|
||||
@@ -393,6 +393,7 @@ export interface InboundFallback {
|
||||
}
|
||||
|
||||
export interface InboundOption {
|
||||
enable: boolean;
|
||||
id: number;
|
||||
listen?: string;
|
||||
nodeAddress?: string;
|
||||
|
||||
@@ -420,6 +420,7 @@ export const InboundFallbackSchema = z.object({
|
||||
export type InboundFallback = z.infer<typeof InboundFallbackSchema>;
|
||||
|
||||
export const InboundOptionSchema = z.object({
|
||||
enable: z.boolean(),
|
||||
id: z.number().int(),
|
||||
listen: z.string().optional(),
|
||||
nodeAddress: z.string().optional(),
|
||||
|
||||
@@ -376,12 +376,13 @@ export default function ClientFormModal({
|
||||
const inboundOptions = useMemo(
|
||||
() => (inbounds || [])
|
||||
.filter((ib) => MULTI_CLIENT_PROTOCOLS.has(ib.protocol || ''))
|
||||
.filter((ib) => ib.enable || (form.inboundIds || []).includes(ib.id))
|
||||
.map((ib) => ({
|
||||
label: formatInboundLabel(ib.tag, ib.remark),
|
||||
value: ib.id,
|
||||
title: formatInboundLabel(ib.tag, ib.remark),
|
||||
})),
|
||||
[inbounds],
|
||||
[inbounds, form.inboundIds],
|
||||
);
|
||||
|
||||
const linkRows = useMemo(() => form.externalLinks.filter((r) => r.kind === 'link'), [form.externalLinks]);
|
||||
|
||||
Reference in New Issue
Block a user