@serve.zone/dcrouter 13.15.1 → 13.16.1
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.
- package/dist_serve/bundle.js +510 -517
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.dcrouter.d.ts +3 -6
- package/dist_ts/classes.dcrouter.js +39 -53
- package/dist_ts/config/classes.reference-resolver.d.ts +8 -8
- package/dist_ts/config/classes.reference-resolver.js +6 -6
- package/dist_ts/config/classes.route-config-manager.d.ts +13 -13
- package/dist_ts/config/classes.route-config-manager.js +117 -144
- package/dist_ts/config/classes.target-profile-manager.d.ts +2 -2
- package/dist_ts/config/classes.target-profile-manager.js +7 -18
- package/dist_ts/db/documents/{classes.stored-route.doc.d.ts → classes.route.doc.d.ts} +6 -3
- package/dist_ts/db/documents/{classes.stored-route.doc.js → classes.route.doc.js} +21 -9
- package/dist_ts/db/documents/index.d.ts +1 -2
- package/dist_ts/db/documents/index.js +2 -3
- package/dist_ts/opsserver/handlers/network-target.handler.js +3 -3
- package/dist_ts/opsserver/handlers/route-management.handler.js +3 -23
- package/dist_ts/opsserver/handlers/source-profile.handler.js +3 -3
- package/dist_ts_apiclient/classes.route.d.ts +2 -5
- package/dist_ts_apiclient/classes.route.js +13 -42
- package/dist_ts_interfaces/data/route-management.d.ts +8 -17
- package/dist_ts_interfaces/requests/route-management.d.ts +6 -37
- package/dist_ts_migrations/index.js +23 -1
- package/dist_ts_oci_container/plugins.d.ts +3 -0
- package/dist_ts_oci_container/plugins.js +4 -0
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/appstate.d.ts +0 -5
- package/dist_ts_web/appstate.js +1 -38
- package/dist_ts_web/elements/network/ops-view-routes.js +60 -110
- package/package.json +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.dcrouter.ts +45 -55
- package/ts/config/classes.reference-resolver.ts +13 -13
- package/ts/config/classes.route-config-manager.ts +128 -146
- package/ts/config/classes.target-profile-manager.ts +7 -20
- package/ts/db/documents/{classes.stored-route.doc.ts → classes.route.doc.ts} +16 -5
- package/ts/db/documents/index.ts +1 -2
- package/ts/opsserver/handlers/network-target.handler.ts +2 -2
- package/ts/opsserver/handlers/route-management.handler.ts +2 -34
- package/ts/opsserver/handlers/source-profile.handler.ts +2 -2
- package/ts_apiclient/classes.route.ts +12 -49
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/appstate.ts +0 -52
- package/ts_web/elements/network/ops-view-routes.ts +65 -123
- package/dist_ts/db/documents/classes.route-override.doc.d.ts +0 -10
- package/dist_ts/db/documents/classes.route-override.doc.js +0 -91
- package/ts/db/documents/classes.route-override.doc.ts +0 -32
|
@@ -72,7 +72,7 @@ export class RouteManagementHandler {
|
|
|
72
72
|
return { success: false, message: 'Route management not initialized' };
|
|
73
73
|
}
|
|
74
74
|
const id = await manager.createRoute(dataArg.route, userId, dataArg.enabled ?? true, dataArg.metadata);
|
|
75
|
-
return { success: true,
|
|
75
|
+
return { success: true, routeId: id };
|
|
76
76
|
},
|
|
77
77
|
),
|
|
78
78
|
);
|
|
@@ -113,39 +113,7 @@ export class RouteManagementHandler {
|
|
|
113
113
|
),
|
|
114
114
|
);
|
|
115
115
|
|
|
116
|
-
//
|
|
117
|
-
this.typedrouter.addTypedHandler(
|
|
118
|
-
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_SetRouteOverride>(
|
|
119
|
-
'setRouteOverride',
|
|
120
|
-
async (dataArg) => {
|
|
121
|
-
const userId = await this.requireAuth(dataArg, 'routes:write');
|
|
122
|
-
const manager = this.opsServerRef.dcRouterRef.routeConfigManager;
|
|
123
|
-
if (!manager) {
|
|
124
|
-
return { success: false, message: 'Route management not initialized' };
|
|
125
|
-
}
|
|
126
|
-
await manager.setOverride(dataArg.routeName, dataArg.enabled, userId);
|
|
127
|
-
return { success: true };
|
|
128
|
-
},
|
|
129
|
-
),
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
// Remove override from a hardcoded route
|
|
133
|
-
this.typedrouter.addTypedHandler(
|
|
134
|
-
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_RemoveRouteOverride>(
|
|
135
|
-
'removeRouteOverride',
|
|
136
|
-
async (dataArg) => {
|
|
137
|
-
await this.requireAuth(dataArg, 'routes:write');
|
|
138
|
-
const manager = this.opsServerRef.dcRouterRef.routeConfigManager;
|
|
139
|
-
if (!manager) {
|
|
140
|
-
return { success: false, message: 'Route management not initialized' };
|
|
141
|
-
}
|
|
142
|
-
const ok = await manager.removeOverride(dataArg.routeName);
|
|
143
|
-
return { success: ok, message: ok ? undefined : 'Override not found' };
|
|
144
|
-
},
|
|
145
|
-
),
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
// Toggle programmatic route
|
|
116
|
+
// Toggle route
|
|
149
117
|
this.typedrouter.addTypedHandler(
|
|
150
118
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_ToggleRoute>(
|
|
151
119
|
'toggleRoute',
|
|
@@ -136,7 +136,7 @@ export class SourceProfileHandler {
|
|
|
136
136
|
const result = await resolver.deleteProfile(
|
|
137
137
|
dataArg.id,
|
|
138
138
|
dataArg.force ?? false,
|
|
139
|
-
manager.
|
|
139
|
+
manager.getRoutes(),
|
|
140
140
|
);
|
|
141
141
|
|
|
142
142
|
// If force-deleted with affected routes, re-apply
|
|
@@ -160,7 +160,7 @@ export class SourceProfileHandler {
|
|
|
160
160
|
if (!resolver || !manager) {
|
|
161
161
|
return { routes: [] };
|
|
162
162
|
}
|
|
163
|
-
const usage = resolver.getProfileUsageForId(dataArg.id, manager.
|
|
163
|
+
const usage = resolver.getProfileUsageForId(dataArg.id, manager.getRoutes());
|
|
164
164
|
return { routes: usage.map((u) => ({ id: u.id, name: u.routeName })) };
|
|
165
165
|
},
|
|
166
166
|
),
|
|
@@ -7,10 +7,9 @@ export class Route {
|
|
|
7
7
|
|
|
8
8
|
// Data from IMergedRoute
|
|
9
9
|
public routeConfig: IRouteConfig;
|
|
10
|
-
public
|
|
10
|
+
public id: string;
|
|
11
11
|
public enabled: boolean;
|
|
12
|
-
public
|
|
13
|
-
public storedRouteId?: string;
|
|
12
|
+
public origin: 'config' | 'email' | 'dns' | 'api';
|
|
14
13
|
public createdAt?: number;
|
|
15
14
|
public updatedAt?: number;
|
|
16
15
|
|
|
@@ -22,21 +21,17 @@ export class Route {
|
|
|
22
21
|
constructor(clientRef: DcRouterApiClient, data: interfaces.data.IMergedRoute) {
|
|
23
22
|
this.clientRef = clientRef;
|
|
24
23
|
this.routeConfig = data.route;
|
|
25
|
-
this.
|
|
24
|
+
this.id = data.id;
|
|
26
25
|
this.enabled = data.enabled;
|
|
27
|
-
this.
|
|
28
|
-
this.storedRouteId = data.storedRouteId;
|
|
26
|
+
this.origin = data.origin;
|
|
29
27
|
this.createdAt = data.createdAt;
|
|
30
28
|
this.updatedAt = data.updatedAt;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
public async update(changes: Partial<IRouteConfig>): Promise<void> {
|
|
34
|
-
if (!this.storedRouteId) {
|
|
35
|
-
throw new Error('Cannot update a hardcoded route. Use setOverride() instead.');
|
|
36
|
-
}
|
|
37
32
|
const response = await this.clientRef.request<interfaces.requests.IReq_UpdateRoute>(
|
|
38
33
|
'updateRoute',
|
|
39
|
-
this.clientRef.buildRequestPayload({ id: this.
|
|
34
|
+
this.clientRef.buildRequestPayload({ id: this.id, route: changes }) as any,
|
|
40
35
|
);
|
|
41
36
|
if (!response.success) {
|
|
42
37
|
throw new Error(response.message || 'Failed to update route');
|
|
@@ -44,12 +39,9 @@ export class Route {
|
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
public async delete(): Promise<void> {
|
|
47
|
-
if (!this.storedRouteId) {
|
|
48
|
-
throw new Error('Cannot delete a hardcoded route. Use setOverride() instead.');
|
|
49
|
-
}
|
|
50
42
|
const response = await this.clientRef.request<interfaces.requests.IReq_DeleteRoute>(
|
|
51
43
|
'deleteRoute',
|
|
52
|
-
this.clientRef.buildRequestPayload({ id: this.
|
|
44
|
+
this.clientRef.buildRequestPayload({ id: this.id }) as any,
|
|
53
45
|
);
|
|
54
46
|
if (!response.success) {
|
|
55
47
|
throw new Error(response.message || 'Failed to delete route');
|
|
@@ -57,41 +49,15 @@ export class Route {
|
|
|
57
49
|
}
|
|
58
50
|
|
|
59
51
|
public async toggle(enabled: boolean): Promise<void> {
|
|
60
|
-
if (!this.storedRouteId) {
|
|
61
|
-
throw new Error('Cannot toggle a hardcoded route. Use setOverride() instead.');
|
|
62
|
-
}
|
|
63
52
|
const response = await this.clientRef.request<interfaces.requests.IReq_ToggleRoute>(
|
|
64
53
|
'toggleRoute',
|
|
65
|
-
this.clientRef.buildRequestPayload({ id: this.
|
|
54
|
+
this.clientRef.buildRequestPayload({ id: this.id, enabled }) as any,
|
|
66
55
|
);
|
|
67
56
|
if (!response.success) {
|
|
68
57
|
throw new Error(response.message || 'Failed to toggle route');
|
|
69
58
|
}
|
|
70
59
|
this.enabled = enabled;
|
|
71
60
|
}
|
|
72
|
-
|
|
73
|
-
public async setOverride(enabled: boolean): Promise<void> {
|
|
74
|
-
const response = await this.clientRef.request<interfaces.requests.IReq_SetRouteOverride>(
|
|
75
|
-
'setRouteOverride',
|
|
76
|
-
this.clientRef.buildRequestPayload({ routeName: this.name, enabled }) as any,
|
|
77
|
-
);
|
|
78
|
-
if (!response.success) {
|
|
79
|
-
throw new Error(response.message || 'Failed to set route override');
|
|
80
|
-
}
|
|
81
|
-
this.overridden = true;
|
|
82
|
-
this.enabled = enabled;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public async removeOverride(): Promise<void> {
|
|
86
|
-
const response = await this.clientRef.request<interfaces.requests.IReq_RemoveRouteOverride>(
|
|
87
|
-
'removeRouteOverride',
|
|
88
|
-
this.clientRef.buildRequestPayload({ routeName: this.name }) as any,
|
|
89
|
-
);
|
|
90
|
-
if (!response.success) {
|
|
91
|
-
throw new Error(response.message || 'Failed to remove route override');
|
|
92
|
-
}
|
|
93
|
-
this.overridden = false;
|
|
94
|
-
}
|
|
95
61
|
}
|
|
96
62
|
|
|
97
63
|
export class RouteBuilder {
|
|
@@ -144,9 +110,8 @@ export class RouteBuilder {
|
|
|
144
110
|
}
|
|
145
111
|
|
|
146
112
|
// Return a Route instance by re-fetching the list
|
|
147
|
-
// The created route is programmatic, so we find it by storedRouteId
|
|
148
113
|
const { routes } = await new RouteManager(this.clientRef).list();
|
|
149
|
-
const created = routes.find((r) => r.
|
|
114
|
+
const created = routes.find((r) => r.id === response.routeId);
|
|
150
115
|
if (created) {
|
|
151
116
|
return created;
|
|
152
117
|
}
|
|
@@ -154,10 +119,9 @@ export class RouteBuilder {
|
|
|
154
119
|
// Fallback: construct from known data
|
|
155
120
|
return new Route(this.clientRef, {
|
|
156
121
|
route: this.routeConfig as IRouteConfig,
|
|
157
|
-
|
|
122
|
+
id: response.routeId || '',
|
|
158
123
|
enabled: this.isEnabled,
|
|
159
|
-
|
|
160
|
-
storedRouteId: response.storedRouteId,
|
|
124
|
+
origin: 'api',
|
|
161
125
|
});
|
|
162
126
|
}
|
|
163
127
|
}
|
|
@@ -190,10 +154,9 @@ export class RouteManager {
|
|
|
190
154
|
}
|
|
191
155
|
return new Route(this.clientRef, {
|
|
192
156
|
route: routeConfig,
|
|
193
|
-
|
|
157
|
+
id: response.routeId || '',
|
|
194
158
|
enabled: enabled ?? true,
|
|
195
|
-
|
|
196
|
-
storedRouteId: response.storedRouteId,
|
|
159
|
+
origin: 'api',
|
|
197
160
|
});
|
|
198
161
|
}
|
|
199
162
|
|
package/ts_web/appstate.ts
CHANGED
|
@@ -2219,58 +2219,6 @@ export const toggleRouteAction = routeManagementStatePart.createAction<{
|
|
|
2219
2219
|
}
|
|
2220
2220
|
});
|
|
2221
2221
|
|
|
2222
|
-
export const setRouteOverrideAction = routeManagementStatePart.createAction<{
|
|
2223
|
-
routeName: string;
|
|
2224
|
-
enabled: boolean;
|
|
2225
|
-
}>(async (statePartArg, dataArg, actionContext): Promise<IRouteManagementState> => {
|
|
2226
|
-
const context = getActionContext();
|
|
2227
|
-
const currentState = statePartArg.getState()!;
|
|
2228
|
-
|
|
2229
|
-
try {
|
|
2230
|
-
const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
|
2231
|
-
interfaces.requests.IReq_SetRouteOverride
|
|
2232
|
-
>('/typedrequest', 'setRouteOverride');
|
|
2233
|
-
|
|
2234
|
-
await request.fire({
|
|
2235
|
-
identity: context.identity!,
|
|
2236
|
-
routeName: dataArg.routeName,
|
|
2237
|
-
enabled: dataArg.enabled,
|
|
2238
|
-
});
|
|
2239
|
-
|
|
2240
|
-
return await actionContext!.dispatch(fetchMergedRoutesAction, null);
|
|
2241
|
-
} catch (error: unknown) {
|
|
2242
|
-
return {
|
|
2243
|
-
...currentState,
|
|
2244
|
-
error: error instanceof Error ? error.message : 'Failed to set override',
|
|
2245
|
-
};
|
|
2246
|
-
}
|
|
2247
|
-
});
|
|
2248
|
-
|
|
2249
|
-
export const removeRouteOverrideAction = routeManagementStatePart.createAction<string>(
|
|
2250
|
-
async (statePartArg, routeName, actionContext): Promise<IRouteManagementState> => {
|
|
2251
|
-
const context = getActionContext();
|
|
2252
|
-
const currentState = statePartArg.getState()!;
|
|
2253
|
-
|
|
2254
|
-
try {
|
|
2255
|
-
const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
|
2256
|
-
interfaces.requests.IReq_RemoveRouteOverride
|
|
2257
|
-
>('/typedrequest', 'removeRouteOverride');
|
|
2258
|
-
|
|
2259
|
-
await request.fire({
|
|
2260
|
-
identity: context.identity!,
|
|
2261
|
-
routeName,
|
|
2262
|
-
});
|
|
2263
|
-
|
|
2264
|
-
return await actionContext!.dispatch(fetchMergedRoutesAction, null);
|
|
2265
|
-
} catch (error: unknown) {
|
|
2266
|
-
return {
|
|
2267
|
-
...currentState,
|
|
2268
|
-
error: error instanceof Error ? error.message : 'Failed to remove override',
|
|
2269
|
-
};
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
);
|
|
2273
|
-
|
|
2274
2222
|
// ============================================================================
|
|
2275
2223
|
// API Token Actions
|
|
2276
2224
|
// ============================================================================
|
|
@@ -140,9 +140,9 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
140
140
|
public render(): TemplateResult {
|
|
141
141
|
const { mergedRoutes, warnings } = this.routeState;
|
|
142
142
|
|
|
143
|
-
const hardcodedCount = mergedRoutes.filter((mr) => mr.source === 'hardcoded').length;
|
|
144
|
-
const programmaticCount = mergedRoutes.filter((mr) => mr.source === 'programmatic').length;
|
|
145
143
|
const disabledCount = mergedRoutes.filter((mr) => !mr.enabled).length;
|
|
144
|
+
const configCount = mergedRoutes.filter((mr) => mr.origin !== 'api').length;
|
|
145
|
+
const apiCount = mergedRoutes.filter((mr) => mr.origin === 'api').length;
|
|
146
146
|
|
|
147
147
|
const statsTiles: IStatsTile[] = [
|
|
148
148
|
{
|
|
@@ -155,19 +155,19 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
155
155
|
color: '#3b82f6',
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
|
-
id: '
|
|
159
|
-
title: '
|
|
158
|
+
id: 'configRoutes',
|
|
159
|
+
title: 'From Config',
|
|
160
160
|
type: 'number',
|
|
161
|
-
value:
|
|
162
|
-
icon: 'lucide:
|
|
163
|
-
description: '
|
|
161
|
+
value: configCount,
|
|
162
|
+
icon: 'lucide:settings',
|
|
163
|
+
description: 'Seeded from config/email/DNS',
|
|
164
164
|
color: '#8b5cf6',
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
|
-
id: '
|
|
168
|
-
title: '
|
|
167
|
+
id: 'apiRoutes',
|
|
168
|
+
title: 'API Created',
|
|
169
169
|
type: 'number',
|
|
170
|
-
value:
|
|
170
|
+
value: apiCount,
|
|
171
171
|
icon: 'lucide:code',
|
|
172
172
|
description: 'Routes added via API',
|
|
173
173
|
color: '#0ea5e9',
|
|
@@ -186,15 +186,14 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
186
186
|
// Map merged routes to sz-route-list-view format
|
|
187
187
|
const szRoutes = mergedRoutes.map((mr) => {
|
|
188
188
|
const tags = [...(mr.route.tags || [])];
|
|
189
|
-
tags.push(mr.
|
|
189
|
+
tags.push(mr.origin);
|
|
190
190
|
if (!mr.enabled) tags.push('disabled');
|
|
191
|
-
if (mr.overridden) tags.push('overridden');
|
|
192
191
|
|
|
193
192
|
return {
|
|
194
193
|
...mr.route,
|
|
195
194
|
enabled: mr.enabled,
|
|
196
195
|
tags,
|
|
197
|
-
id: mr.
|
|
196
|
+
id: mr.id || mr.route.name || undefined,
|
|
198
197
|
metadata: mr.metadata,
|
|
199
198
|
};
|
|
200
199
|
});
|
|
@@ -238,7 +237,6 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
238
237
|
? html`
|
|
239
238
|
<sz-route-list-view
|
|
240
239
|
.routes=${szRoutes}
|
|
241
|
-
.showActionsFilter=${(route: any) => route.tags?.includes('programmatic') ?? false}
|
|
242
240
|
@route-click=${(e: CustomEvent) => this.handleRouteClick(e)}
|
|
243
241
|
@route-edit=${(e: CustomEvent) => this.handleRouteEdit(e)}
|
|
244
242
|
@route-delete=${(e: CustomEvent) => this.handleRouteDelete(e)}
|
|
@@ -247,7 +245,7 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
247
245
|
: html`
|
|
248
246
|
<div class="empty-state">
|
|
249
247
|
<p>No routes configured</p>
|
|
250
|
-
<p>Add a
|
|
248
|
+
<p>Add a route to get started.</p>
|
|
251
249
|
</div>
|
|
252
250
|
`}
|
|
253
251
|
</div>
|
|
@@ -266,112 +264,56 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
266
264
|
|
|
267
265
|
const { DeesModal } = await import('@design.estate/dees-catalog');
|
|
268
266
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
name: 'Enable Route',
|
|
292
|
-
iconName: 'lucide:play',
|
|
293
|
-
action: async (modalArg: any) => {
|
|
294
|
-
await appstate.routeManagementStatePart.dispatchAction(
|
|
295
|
-
appstate.setRouteOverrideAction,
|
|
296
|
-
{ routeName: merged.route.name!, enabled: true },
|
|
297
|
-
);
|
|
298
|
-
await modalArg.destroy();
|
|
299
|
-
},
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
name: 'Remove Override',
|
|
303
|
-
iconName: 'lucide:undo',
|
|
304
|
-
action: async (modalArg: any) => {
|
|
305
|
-
await appstate.routeManagementStatePart.dispatchAction(
|
|
306
|
-
appstate.removeRouteOverrideAction,
|
|
307
|
-
merged.route.name!,
|
|
308
|
-
);
|
|
309
|
-
await modalArg.destroy();
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
name: 'Close',
|
|
314
|
-
iconName: 'lucide:x',
|
|
315
|
-
action: async (modalArg: any) => await modalArg.destroy(),
|
|
316
|
-
},
|
|
317
|
-
];
|
|
318
|
-
|
|
319
|
-
await DeesModal.createAndShow({
|
|
320
|
-
heading: `Route: ${merged.route.name}`,
|
|
321
|
-
content: html`
|
|
322
|
-
<div style="color: #ccc; padding: 8px 0;">
|
|
323
|
-
<p>Source: <strong style="color: #88f;">hardcoded</strong></p>
|
|
324
|
-
<p>Status: <strong>${merged.enabled ? 'Enabled' : 'Disabled (overridden)'}</strong></p>
|
|
325
|
-
<p style="color: #888; font-size: 13px;">Hardcoded routes cannot be edited or deleted, but they can be disabled via an override.</p>
|
|
326
|
-
</div>
|
|
327
|
-
`,
|
|
328
|
-
menuOptions,
|
|
329
|
-
});
|
|
330
|
-
} else {
|
|
331
|
-
// Programmatic route
|
|
332
|
-
const meta = merged.metadata;
|
|
333
|
-
await DeesModal.createAndShow({
|
|
334
|
-
heading: `Route: ${merged.route.name}`,
|
|
335
|
-
content: html`
|
|
336
|
-
<div style="color: #ccc; padding: 8px 0;">
|
|
337
|
-
<p>Source: <strong style="color: #0af;">programmatic</strong></p>
|
|
338
|
-
<p>Status: <strong>${merged.enabled ? 'Enabled' : 'Disabled'}</strong></p>
|
|
339
|
-
<p>ID: <code style="color: #888;">${merged.storedRouteId}</code></p>
|
|
340
|
-
${meta?.sourceProfileName ? html`<p>Source Profile: <strong style="color: #a78bfa;">${meta.sourceProfileName}</strong></p>` : ''}
|
|
341
|
-
${meta?.networkTargetName ? html`<p>Network Target: <strong style="color: #a78bfa;">${meta.networkTargetName}</strong></p>` : ''}
|
|
342
|
-
</div>
|
|
343
|
-
`,
|
|
344
|
-
menuOptions: [
|
|
345
|
-
{
|
|
346
|
-
name: merged.enabled ? 'Disable' : 'Enable',
|
|
347
|
-
iconName: merged.enabled ? 'lucide:pause' : 'lucide:play',
|
|
348
|
-
action: async (modalArg: any) => {
|
|
349
|
-
await appstate.routeManagementStatePart.dispatchAction(
|
|
350
|
-
appstate.toggleRouteAction,
|
|
351
|
-
{ id: merged.storedRouteId!, enabled: !merged.enabled },
|
|
352
|
-
);
|
|
353
|
-
await modalArg.destroy();
|
|
354
|
-
},
|
|
267
|
+
const meta = merged.metadata;
|
|
268
|
+
await DeesModal.createAndShow({
|
|
269
|
+
heading: `Route: ${merged.route.name}`,
|
|
270
|
+
content: html`
|
|
271
|
+
<div style="color: #ccc; padding: 8px 0;">
|
|
272
|
+
<p>Origin: <strong style="color: #0af;">${merged.origin}</strong></p>
|
|
273
|
+
<p>Status: <strong>${merged.enabled ? 'Enabled' : 'Disabled'}</strong></p>
|
|
274
|
+
<p>ID: <code style="color: #888;">${merged.id}</code></p>
|
|
275
|
+
${meta?.sourceProfileName ? html`<p>Source Profile: <strong style="color: #a78bfa;">${meta.sourceProfileName}</strong></p>` : ''}
|
|
276
|
+
${meta?.networkTargetName ? html`<p>Network Target: <strong style="color: #a78bfa;">${meta.networkTargetName}</strong></p>` : ''}
|
|
277
|
+
</div>
|
|
278
|
+
`,
|
|
279
|
+
menuOptions: [
|
|
280
|
+
{
|
|
281
|
+
name: merged.enabled ? 'Disable' : 'Enable',
|
|
282
|
+
iconName: merged.enabled ? 'lucide:pause' : 'lucide:play',
|
|
283
|
+
action: async (modalArg: any) => {
|
|
284
|
+
await appstate.routeManagementStatePart.dispatchAction(
|
|
285
|
+
appstate.toggleRouteAction,
|
|
286
|
+
{ id: merged.id, enabled: !merged.enabled },
|
|
287
|
+
);
|
|
288
|
+
await modalArg.destroy();
|
|
355
289
|
},
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
);
|
|
364
|
-
await modalArg.destroy();
|
|
365
|
-
},
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: 'Edit',
|
|
293
|
+
iconName: 'lucide:pencil',
|
|
294
|
+
action: async (modalArg: any) => {
|
|
295
|
+
await modalArg.destroy();
|
|
296
|
+
this.showEditRouteDialog(merged);
|
|
366
297
|
},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
name: 'Delete',
|
|
301
|
+
iconName: 'lucide:trash-2',
|
|
302
|
+
action: async (modalArg: any) => {
|
|
303
|
+
await appstate.routeManagementStatePart.dispatchAction(
|
|
304
|
+
appstate.deleteRouteAction,
|
|
305
|
+
merged.id,
|
|
306
|
+
);
|
|
307
|
+
await modalArg.destroy();
|
|
371
308
|
},
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: 'Close',
|
|
312
|
+
iconName: 'lucide:x',
|
|
313
|
+
action: async (modalArg: any) => await modalArg.destroy(),
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
});
|
|
375
317
|
}
|
|
376
318
|
|
|
377
319
|
private async handleRouteEdit(e: CustomEvent) {
|
|
@@ -381,7 +323,7 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
381
323
|
const merged = this.routeState.mergedRoutes.find(
|
|
382
324
|
(mr) => mr.route.name === clickedRoute.name,
|
|
383
325
|
);
|
|
384
|
-
if (!merged
|
|
326
|
+
if (!merged) return;
|
|
385
327
|
|
|
386
328
|
this.showEditRouteDialog(merged);
|
|
387
329
|
}
|
|
@@ -393,7 +335,7 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
393
335
|
const merged = this.routeState.mergedRoutes.find(
|
|
394
336
|
(mr) => mr.route.name === clickedRoute.name,
|
|
395
337
|
);
|
|
396
|
-
if (!merged
|
|
338
|
+
if (!merged) return;
|
|
397
339
|
|
|
398
340
|
const { DeesModal } = await import('@design.estate/dees-catalog');
|
|
399
341
|
await DeesModal.createAndShow({
|
|
@@ -415,7 +357,7 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
415
357
|
action: async (modalArg: any) => {
|
|
416
358
|
await appstate.routeManagementStatePart.dispatchAction(
|
|
417
359
|
appstate.deleteRouteAction,
|
|
418
|
-
merged.
|
|
360
|
+
merged.id,
|
|
419
361
|
);
|
|
420
362
|
await modalArg.destroy();
|
|
421
363
|
},
|
|
@@ -563,7 +505,7 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
563
505
|
await appstate.routeManagementStatePart.dispatchAction(
|
|
564
506
|
appstate.updateRouteAction,
|
|
565
507
|
{
|
|
566
|
-
id: merged.
|
|
508
|
+
id: merged.id,
|
|
567
509
|
route: updatedRoute,
|
|
568
510
|
metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
|
|
569
511
|
},
|
|
@@ -603,7 +545,7 @@ export class OpsViewRoutes extends DeesElement {
|
|
|
603
545
|
];
|
|
604
546
|
|
|
605
547
|
const createModal = await DeesModal.createAndShow({
|
|
606
|
-
heading: 'Add
|
|
548
|
+
heading: 'Add Route',
|
|
607
549
|
content: html`
|
|
608
550
|
<dees-form>
|
|
609
551
|
<dees-input-text .key=${'name'} .label=${'Route Name'} .required=${true}></dees-input-text>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as plugins from '../../plugins.js';
|
|
2
|
-
export declare class RouteOverrideDoc extends plugins.smartdata.SmartDataDbDoc<RouteOverrideDoc, RouteOverrideDoc> {
|
|
3
|
-
routeName: string;
|
|
4
|
-
enabled: boolean;
|
|
5
|
-
updatedAt: number;
|
|
6
|
-
updatedBy: string;
|
|
7
|
-
constructor();
|
|
8
|
-
static findByRouteName(routeName: string): Promise<RouteOverrideDoc | null>;
|
|
9
|
-
static findAll(): Promise<RouteOverrideDoc[]>;
|
|
10
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
-
var _, done = false;
|
|
7
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
-
var context = {};
|
|
9
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
-
if (kind === "accessor") {
|
|
14
|
-
if (result === void 0) continue;
|
|
15
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
-
}
|
|
20
|
-
else if (_ = accept(result)) {
|
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
|
22
|
-
else descriptor[key] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
-
done = true;
|
|
27
|
-
};
|
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
-
var useValue = arguments.length > 2;
|
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
|
-
import * as plugins from '../../plugins.js';
|
|
36
|
-
import { DcRouterDb } from '../classes.dcrouter-db.js';
|
|
37
|
-
const getDb = () => DcRouterDb.getInstance().getDb();
|
|
38
|
-
let RouteOverrideDoc = (() => {
|
|
39
|
-
let _classDecorators = [plugins.smartdata.Collection(() => getDb())];
|
|
40
|
-
let _classDescriptor;
|
|
41
|
-
let _classExtraInitializers = [];
|
|
42
|
-
let _classThis;
|
|
43
|
-
let _classSuper = plugins.smartdata.SmartDataDbDoc;
|
|
44
|
-
let _routeName_decorators;
|
|
45
|
-
let _routeName_initializers = [];
|
|
46
|
-
let _routeName_extraInitializers = [];
|
|
47
|
-
let _enabled_decorators;
|
|
48
|
-
let _enabled_initializers = [];
|
|
49
|
-
let _enabled_extraInitializers = [];
|
|
50
|
-
let _updatedAt_decorators;
|
|
51
|
-
let _updatedAt_initializers = [];
|
|
52
|
-
let _updatedAt_extraInitializers = [];
|
|
53
|
-
let _updatedBy_decorators;
|
|
54
|
-
let _updatedBy_initializers = [];
|
|
55
|
-
let _updatedBy_extraInitializers = [];
|
|
56
|
-
var RouteOverrideDoc = class extends _classSuper {
|
|
57
|
-
static { _classThis = this; }
|
|
58
|
-
static {
|
|
59
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
60
|
-
_routeName_decorators = [plugins.smartdata.unI(), plugins.smartdata.svDb()];
|
|
61
|
-
_enabled_decorators = [plugins.smartdata.svDb()];
|
|
62
|
-
_updatedAt_decorators = [plugins.smartdata.svDb()];
|
|
63
|
-
_updatedBy_decorators = [plugins.smartdata.svDb()];
|
|
64
|
-
__esDecorate(null, null, _routeName_decorators, { kind: "field", name: "routeName", static: false, private: false, access: { has: obj => "routeName" in obj, get: obj => obj.routeName, set: (obj, value) => { obj.routeName = value; } }, metadata: _metadata }, _routeName_initializers, _routeName_extraInitializers);
|
|
65
|
-
__esDecorate(null, null, _enabled_decorators, { kind: "field", name: "enabled", static: false, private: false, access: { has: obj => "enabled" in obj, get: obj => obj.enabled, set: (obj, value) => { obj.enabled = value; } }, metadata: _metadata }, _enabled_initializers, _enabled_extraInitializers);
|
|
66
|
-
__esDecorate(null, null, _updatedAt_decorators, { kind: "field", name: "updatedAt", static: false, private: false, access: { has: obj => "updatedAt" in obj, get: obj => obj.updatedAt, set: (obj, value) => { obj.updatedAt = value; } }, metadata: _metadata }, _updatedAt_initializers, _updatedAt_extraInitializers);
|
|
67
|
-
__esDecorate(null, null, _updatedBy_decorators, { kind: "field", name: "updatedBy", static: false, private: false, access: { has: obj => "updatedBy" in obj, get: obj => obj.updatedBy, set: (obj, value) => { obj.updatedBy = value; } }, metadata: _metadata }, _updatedBy_initializers, _updatedBy_extraInitializers);
|
|
68
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
69
|
-
RouteOverrideDoc = _classThis = _classDescriptor.value;
|
|
70
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
71
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
72
|
-
}
|
|
73
|
-
routeName = __runInitializers(this, _routeName_initializers, void 0);
|
|
74
|
-
enabled = (__runInitializers(this, _routeName_extraInitializers), __runInitializers(this, _enabled_initializers, void 0));
|
|
75
|
-
updatedAt = (__runInitializers(this, _enabled_extraInitializers), __runInitializers(this, _updatedAt_initializers, void 0));
|
|
76
|
-
updatedBy = (__runInitializers(this, _updatedAt_extraInitializers), __runInitializers(this, _updatedBy_initializers, void 0));
|
|
77
|
-
constructor() {
|
|
78
|
-
super();
|
|
79
|
-
__runInitializers(this, _updatedBy_extraInitializers);
|
|
80
|
-
}
|
|
81
|
-
static async findByRouteName(routeName) {
|
|
82
|
-
return await RouteOverrideDoc.getInstance({ routeName });
|
|
83
|
-
}
|
|
84
|
-
static async findAll() {
|
|
85
|
-
return await RouteOverrideDoc.getInstances({});
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
return RouteOverrideDoc = _classThis;
|
|
89
|
-
})();
|
|
90
|
-
export { RouteOverrideDoc };
|
|
91
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xhc3Nlcy5yb3V0ZS1vdmVycmlkZS5kb2MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi90cy9kYi9kb2N1bWVudHMvY2xhc3Nlcy5yb3V0ZS1vdmVycmlkZS5kb2MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sa0JBQWtCLENBQUM7QUFDNUMsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBRXZELE1BQU0sS0FBSyxHQUFHLEdBQUcsRUFBRSxDQUFDLFVBQVUsQ0FBQyxXQUFXLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUd4QyxnQkFBZ0I7NEJBRDVCLE9BQU8sQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDLEdBQUcsRUFBRSxDQUFDLEtBQUssRUFBRSxDQUFDOzs7O3NCQUNOLE9BQU8sQ0FBQyxTQUFTLENBQUMsY0FBYzs7Ozs7Ozs7Ozs7OztnQ0FBeEMsU0FBUSxXQUFvRTs7OztxQ0FDdkcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLEVBQUUsRUFDdkIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLEVBQUU7bUNBR3hCLE9BQU8sQ0FBQyxTQUFTLENBQUMsSUFBSSxFQUFFO3FDQUd4QixPQUFPLENBQUMsU0FBUyxDQUFDLElBQUksRUFBRTtxQ0FHeEIsT0FBTyxDQUFDLFNBQVMsQ0FBQyxJQUFJLEVBQUU7WUFSekIsNktBQU8sU0FBUyw2QkFBVCxTQUFTLDZGQUFVO1lBRzFCLHVLQUFPLE9BQU8sNkJBQVAsT0FBTyx5RkFBVztZQUd6Qiw2S0FBTyxTQUFTLDZCQUFULFNBQVMsNkZBQVU7WUFHMUIsNktBQU8sU0FBUyw2QkFBVCxTQUFTLDZGQUFVO1lBWjVCLDZLQXlCQzs7O1lBekJZLHVEQUFnQjs7UUFHcEIsU0FBUyw0REFBVTtRQUduQixPQUFPLG1IQUFXO1FBR2xCLFNBQVMsbUhBQVU7UUFHbkIsU0FBUyxxSEFBVTtRQUUxQjtZQUNFLEtBQUssRUFBRSxDQUFDOztTQUNUO1FBRU0sTUFBTSxDQUFDLEtBQUssQ0FBQyxlQUFlLENBQUMsU0FBaUI7WUFDbkQsT0FBTyxNQUFNLGdCQUFnQixDQUFDLFdBQVcsQ0FBQyxFQUFFLFNBQVMsRUFBRSxDQUFDLENBQUM7UUFDM0QsQ0FBQztRQUVNLE1BQU0sQ0FBQyxLQUFLLENBQUMsT0FBTztZQUN6QixPQUFPLE1BQU0sZ0JBQWdCLENBQUMsWUFBWSxDQUFDLEVBQUUsQ0FBQyxDQUFDO1FBQ2pELENBQUM7Ozs7U0F4QlUsZ0JBQWdCIn0=
|