feat(remote-ingress): Support auto-derived effective listen ports, make listenPorts optional, add toggle action and refine remote ingress creation/management UI

This commit is contained in:
2026-02-17 11:56:54 +00:00
parent ea32babaac
commit b5e760ae07
6 changed files with 114 additions and 30 deletions

View File

@@ -1,5 +1,14 @@
# Changelog # Changelog
## 2026-02-17 - 6.7.0 - feat(remote-ingress)
Support auto-derived effective listen ports, make listenPorts optional, add toggle action and refine remote ingress creation/management UI
- Add effectiveListenPorts?: number[] to IRemoteIngress interface (present in API responses)
- Make createRemoteIngressAction.listenPorts optional and update creation modal to allow empty ports (auto-derived)
- Add toggleRemoteIngressAction to enable/disable remote ingress edges and wire up Enable/Disable row/context-menu actions
- Update getPortsHtml to prefer manual listenPorts, fall back to effectiveListenPorts, show '(auto)' when derived and 'none' when no ports
- Standardize UI actions to use inRow/contextmenu and actionFunc signatures; update create modal to use explicit Cancel/Create menu options and collect form data programmatically
## 2026-02-17 - 6.6.1 - fix(icons) ## 2026-02-17 - 6.6.1 - fix(icons)
standardize icon identifiers to lucide-prefixed names across operational views standardize icon identifiers to lucide-prefixed names across operational views

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/dcrouter', name: '@serve.zone/dcrouter',
version: '6.6.1', version: '6.7.0',
description: 'A multifaceted routing service handling mail and SMS delivery functions.' description: 'A multifaceted routing service handling mail and SMS delivery functions.'
} }

View File

@@ -12,6 +12,8 @@ export interface IRemoteIngress {
tags?: string[]; tags?: string[];
createdAt: number; createdAt: number;
updatedAt: number; updatedAt: number;
/** Effective ports derived from route configs — only present in API responses. */
effectiveListenPorts?: number[];
} }
/** /**

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/dcrouter', name: '@serve.zone/dcrouter',
version: '6.6.1', version: '6.7.0',
description: 'A multifaceted routing service handling mail and SMS delivery functions.' description: 'A multifaceted routing service handling mail and SMS delivery functions.'
} }

View File

@@ -821,7 +821,7 @@ export const fetchRemoteIngressAction = remoteIngressStatePart.createAction(asyn
export const createRemoteIngressAction = remoteIngressStatePart.createAction<{ export const createRemoteIngressAction = remoteIngressStatePart.createAction<{
name: string; name: string;
listenPorts: number[]; listenPorts?: number[];
tags?: string[]; tags?: string[];
}>(async (statePartArg, dataArg) => { }>(async (statePartArg, dataArg) => {
const context = getActionContext(); const context = getActionContext();
@@ -924,6 +924,34 @@ export const clearNewEdgeSecretAction = remoteIngressStatePart.createAction(
} }
); );
export const toggleRemoteIngressAction = remoteIngressStatePart.createAction<{
id: string;
enabled: boolean;
}>(async (statePartArg, dataArg) => {
const context = getActionContext();
const currentState = statePartArg.getState();
try {
const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
interfaces.requests.IReq_UpdateRemoteIngress
>('/typedrequest', 'updateRemoteIngress');
await request.fire({
identity: context.identity,
id: dataArg.id,
enabled: dataArg.enabled,
});
await remoteIngressStatePart.dispatchAction(fetchRemoteIngressAction, null);
return statePartArg.getState();
} catch (error) {
return {
...currentState,
error: error instanceof Error ? error.message : 'Failed to toggle edge',
};
}
});
// Combined refresh action for efficient polling // Combined refresh action for efficient polling
async function dispatchCombinedRefreshAction() { async function dispatchCombinedRefreshAction() {
const context = getActionContext(); const context = getActionContext();

View File

@@ -187,7 +187,7 @@ export class OpsViewRemoteIngress extends DeesElement {
name: edge.name, name: edge.name,
status: this.getEdgeStatusHtml(edge), status: this.getEdgeStatusHtml(edge),
publicIp: this.getEdgePublicIp(edge.id), publicIp: this.getEdgePublicIp(edge.id),
ports: this.getPortsHtml(edge.listenPorts), ports: this.getPortsHtml(edge),
tunnels: this.getEdgeTunnelCount(edge.id), tunnels: this.getEdgeTunnelCount(edge.id),
lastHeartbeat: this.getLastHeartbeat(edge.id), lastHeartbeat: this.getLastHeartbeat(edge.id),
})} })}
@@ -198,42 +198,80 @@ export class OpsViewRemoteIngress extends DeesElement {
type: ['header'], type: ['header'],
actionFunc: async () => { actionFunc: async () => {
const { DeesModal } = await import('@design.estate/dees-catalog'); const { DeesModal } = await import('@design.estate/dees-catalog');
const result = await DeesModal.createAndShow({ const modal = await DeesModal.createAndShow({
heading: 'Create Edge Node', heading: 'Create Edge Node',
content: html` content: html`
<dees-form> <dees-form>
<dees-input-text .key=${'name'} .label=${'Name'} .required=${true}></dees-input-text> <dees-input-text .key=${'name'} .label=${'Name'} .required=${true}></dees-input-text>
<dees-input-text .key=${'listenPorts'} .label=${'Listen Ports (comma-separated)'} .required=${true} .value=${'443,25'}></dees-input-text> <dees-input-text .key=${'listenPorts'} .label=${'Listen Ports (comma-separated, auto-derived if empty)'}></dees-input-text>
<dees-input-text .key=${'tags'} .label=${'Tags (comma-separated, optional)'}></dees-input-text> <dees-input-text .key=${'tags'} .label=${'Tags (comma-separated, optional)'}></dees-input-text>
</dees-form> </dees-form>
`, `,
menuOptions: [], menuOptions: [
}); {
if (result) { name: 'Cancel',
const formData = result as any; iconName: 'lucide:x',
const ports = (formData.name ? formData.listenPorts : '443') action: async (modalArg: any) => await modalArg.destroy(),
.split(',') },
.map((p: string) => parseInt(p.trim(), 10)) {
.filter((p: number) => !isNaN(p)); name: 'Create',
iconName: 'lucide:plus',
action: async (modalArg: any) => {
const form = modalArg.shadowRoot?.querySelector('.content')?.querySelector('dees-form');
if (!form) return;
const formData = await form.collectFormData();
const name = formData.name;
if (!name) return;
const portsStr = formData.listenPorts?.trim();
const listenPorts = portsStr
? portsStr.split(',').map((p: string) => parseInt(p.trim(), 10)).filter((p: number) => !isNaN(p))
: undefined;
const tags = formData.tags const tags = formData.tags
? formData.tags.split(',').map((t: string) => t.trim()).filter(Boolean) ? formData.tags.split(',').map((t: string) => t.trim()).filter(Boolean)
: undefined; : undefined;
await appstate.remoteIngressStatePart.dispatchAction( await appstate.remoteIngressStatePart.dispatchAction(
appstate.createRemoteIngressAction, appstate.createRemoteIngressAction,
{ { name, listenPorts, tags },
name: formData.name, );
listenPorts: ports, await modalArg.destroy();
tags, },
}, },
],
});
},
},
{
name: 'Enable',
iconName: 'lucide:play',
type: ['inRow', 'contextmenu'] as any,
actionRelevancyCheckFunc: (actionData: any) => !actionData.item.enabled,
actionFunc: async (actionData: any) => {
const edge = actionData.item as interfaces.data.IRemoteIngress;
await appstate.remoteIngressStatePart.dispatchAction(
appstate.toggleRemoteIngressAction,
{ id: edge.id, enabled: true },
);
},
},
{
name: 'Disable',
iconName: 'lucide:pause',
type: ['inRow', 'contextmenu'] as any,
actionRelevancyCheckFunc: (actionData: any) => actionData.item.enabled,
actionFunc: async (actionData: any) => {
const edge = actionData.item as interfaces.data.IRemoteIngress;
await appstate.remoteIngressStatePart.dispatchAction(
appstate.toggleRemoteIngressAction,
{ id: edge.id, enabled: false },
); );
}
}, },
}, },
{ {
name: 'Regenerate Secret', name: 'Regenerate Secret',
iconName: 'lucide:key', iconName: 'lucide:key',
type: ['row'], type: ['inRow', 'contextmenu'] as any,
action: async (edge: interfaces.data.IRemoteIngress) => { actionFunc: async (actionData: any) => {
const edge = actionData.item as interfaces.data.IRemoteIngress;
await appstate.remoteIngressStatePart.dispatchAction( await appstate.remoteIngressStatePart.dispatchAction(
appstate.regenerateRemoteIngressSecretAction, appstate.regenerateRemoteIngressSecretAction,
edge.id, edge.id,
@@ -243,8 +281,9 @@ export class OpsViewRemoteIngress extends DeesElement {
{ {
name: 'Delete', name: 'Delete',
iconName: 'lucide:trash2', iconName: 'lucide:trash2',
type: ['row'], type: ['inRow', 'contextmenu'] as any,
action: async (edge: interfaces.data.IRemoteIngress) => { actionFunc: async (actionData: any) => {
const edge = actionData.item as interfaces.data.IRemoteIngress;
await appstate.remoteIngressStatePart.dispatchAction( await appstate.remoteIngressStatePart.dispatchAction(
appstate.deleteRemoteIngressAction, appstate.deleteRemoteIngressAction,
edge.id, edge.id,
@@ -277,8 +316,14 @@ export class OpsViewRemoteIngress extends DeesElement {
return status?.publicIp || '-'; return status?.publicIp || '-';
} }
private getPortsHtml(ports: number[]): TemplateResult { private getPortsHtml(edge: interfaces.data.IRemoteIngress): TemplateResult {
return html`<div class="portsDisplay">${ports.map(p => html`<span class="portBadge">${p}</span>`)}</div>`; const hasManualPorts = edge.listenPorts && edge.listenPorts.length > 0;
const ports = hasManualPorts ? edge.listenPorts : (edge.effectiveListenPorts || []);
const isAuto = !hasManualPorts && ports.length > 0;
if (ports.length === 0) {
return html`<span style="color: var(--text-muted, #6b7280); font-size: 12px;">none</span>`;
}
return html`<div class="portsDisplay">${ports.map(p => html`<span class="portBadge">${p}</span>`)}${isAuto ? html`<span style="font-size: 11px; color: var(--text-muted, #6b7280); align-self: center;">(auto)</span>` : ''}</div>`;
} }
private getEdgeTunnelCount(edgeId: string): number { private getEdgeTunnelCount(edgeId: string): number {