@serve.zone/dcrouter 12.4.0 → 12.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -414,9 +414,9 @@ export class OpsViewRoutes extends DeesElement {
414
414
  const currentPorts = Array.isArray(route.match.ports)
415
415
  ? route.match.ports.map((p: any) => typeof p === 'number' ? String(p) : `${p.from}-${p.to}`).join(', ')
416
416
  : String(route.match.ports);
417
- const currentDomains = route.match.domains
418
- ? (Array.isArray(route.match.domains) ? route.match.domains.join(', ') : route.match.domains)
419
- : '';
417
+ const currentDomains: string[] = route.match.domains
418
+ ? (Array.isArray(route.match.domains) ? route.match.domains : [route.match.domains])
419
+ : [];
420
420
  const firstTarget = route.action.targets?.[0];
421
421
  const currentTargetHost = firstTarget
422
422
  ? (Array.isArray(firstTarget.host) ? firstTarget.host[0] : firstTarget.host)
@@ -429,7 +429,8 @@ export class OpsViewRoutes extends DeesElement {
429
429
  <dees-form>
430
430
  <dees-input-text .key=${'name'} .label=${'Route Name'} .value=${route.name || ''} .required=${true}></dees-input-text>
431
431
  <dees-input-text .key=${'ports'} .label=${'Ports (comma-separated)'} .value=${currentPorts} .required=${true}></dees-input-text>
432
- <dees-input-text .key=${'domains'} .label=${'Domains (comma-separated, optional)'} .value=${currentDomains}></dees-input-text>
432
+ <dees-input-list .key=${'domains'} .label=${'Domains'} .placeholder=${'Add domain...'} .value=${currentDomains}></dees-input-list>
433
+ <dees-input-text .key=${'priority'} .label=${'Priority (higher = matched first)'} .value=${route.priority != null ? String(route.priority) : ''}></dees-input-text>
433
434
  <dees-input-dropdown .key=${'securityProfileRef'} .label=${'Security Profile'} .options=${profileOptions} .selectedKey=${merged.metadata?.securityProfileRef || ''}></dees-input-dropdown>
434
435
  <dees-input-dropdown .key=${'networkTargetRef'} .label=${'Network Target'} .options=${targetOptions} .selectedKey=${merged.metadata?.networkTargetRef || ''}></dees-input-dropdown>
435
436
  <dees-input-text .key=${'targetHost'} .label=${'Target Host (if no target selected)'} .value=${currentTargetHost}></dees-input-text>
@@ -452,15 +453,16 @@ export class OpsViewRoutes extends DeesElement {
452
453
  if (!formData.name || !formData.ports) return;
453
454
 
454
455
  const ports = formData.ports.split(',').map((p: string) => parseInt(p.trim(), 10)).filter((p: number) => !isNaN(p));
455
- const domains = formData.domains
456
- ? formData.domains.split(',').map((d: string) => d.trim()).filter(Boolean)
457
- : undefined;
456
+ const domains: string[] = Array.isArray(formData.domains)
457
+ ? formData.domains.filter(Boolean)
458
+ : [];
459
+ const priority = formData.priority ? parseInt(formData.priority, 10) : undefined;
458
460
 
459
461
  const updatedRoute: any = {
460
462
  name: formData.name,
461
463
  match: {
462
464
  ports,
463
- ...(domains && domains.length > 0 ? { domains } : {}),
465
+ ...(domains.length > 0 ? { domains } : {}),
464
466
  },
465
467
  action: {
466
468
  type: 'forward',
@@ -471,6 +473,7 @@ export class OpsViewRoutes extends DeesElement {
471
473
  },
472
474
  ],
473
475
  },
476
+ ...(priority != null && !isNaN(priority) ? { priority } : {}),
474
477
  };
475
478
 
476
479
  const metadata: any = {};
@@ -523,7 +526,8 @@ export class OpsViewRoutes extends DeesElement {
523
526
  <dees-form>
524
527
  <dees-input-text .key=${'name'} .label=${'Route Name'} .required=${true}></dees-input-text>
525
528
  <dees-input-text .key=${'ports'} .label=${'Ports (comma-separated)'} .required=${true}></dees-input-text>
526
- <dees-input-text .key=${'domains'} .label=${'Domains (comma-separated, optional)'}></dees-input-text>
529
+ <dees-input-list .key=${'domains'} .label=${'Domains'} .placeholder=${'Add domain...'}></dees-input-list>
530
+ <dees-input-text .key=${'priority'} .label=${'Priority (higher = matched first)'}></dees-input-text>
527
531
  <dees-input-dropdown .key=${'securityProfileRef'} .label=${'Security Profile'} .options=${profileOptions} .selectedKey=${''}></dees-input-dropdown>
528
532
  <dees-input-dropdown .key=${'networkTargetRef'} .label=${'Network Target'} .options=${targetOptions} .selectedKey=${''}></dees-input-dropdown>
529
533
  <dees-input-text .key=${'targetHost'} .label=${'Target Host (if no target selected)'} .value=${'localhost'}></dees-input-text>
@@ -546,15 +550,16 @@ export class OpsViewRoutes extends DeesElement {
546
550
  if (!formData.name || !formData.ports) return;
547
551
 
548
552
  const ports = formData.ports.split(',').map((p: string) => parseInt(p.trim(), 10)).filter((p: number) => !isNaN(p));
549
- const domains = formData.domains
550
- ? formData.domains.split(',').map((d: string) => d.trim()).filter(Boolean)
551
- : undefined;
553
+ const domains: string[] = Array.isArray(formData.domains)
554
+ ? formData.domains.filter(Boolean)
555
+ : [];
556
+ const priority = formData.priority ? parseInt(formData.priority, 10) : undefined;
552
557
 
553
558
  const route: any = {
554
559
  name: formData.name,
555
560
  match: {
556
561
  ports,
557
- ...(domains && domains.length > 0 ? { domains } : {}),
562
+ ...(domains.length > 0 ? { domains } : {}),
558
563
  },
559
564
  action: {
560
565
  type: 'forward',
@@ -565,6 +570,7 @@ export class OpsViewRoutes extends DeesElement {
565
570
  },
566
571
  ],
567
572
  },
573
+ ...(priority != null && !isNaN(priority) ? { priority } : {}),
568
574
  };
569
575
 
570
576
  // Build metadata if profile/target selected