feat(routes): add route edit and delete actions to the ops routes view

This commit is contained in:
2026-04-02 22:37:49 +00:00
parent 6f4a5f19e7
commit 141f185fbf
9 changed files with 214 additions and 22 deletions

View File

@@ -1441,6 +1441,37 @@ export const createRouteAction = routeManagementStatePart.createAction<{
}
});
export const updateRouteAction = routeManagementStatePart.createAction<{
id: string;
route?: any;
enabled?: boolean;
metadata?: any;
}>(async (statePartArg, dataArg, actionContext): Promise<IRouteManagementState> => {
const context = getActionContext();
const currentState = statePartArg.getState()!;
try {
const request = new plugins.domtools.plugins.typedrequest.TypedRequest<
interfaces.requests.IReq_UpdateRoute
>('/typedrequest', 'updateRoute');
await request.fire({
identity: context.identity!,
id: dataArg.id,
route: dataArg.route,
enabled: dataArg.enabled,
metadata: dataArg.metadata,
});
return await actionContext!.dispatch(fetchMergedRoutesAction, null);
} catch (error: unknown) {
return {
...currentState,
error: error instanceof Error ? error.message : 'Failed to update route',
};
}
});
export const deleteRouteAction = routeManagementStatePart.createAction<string>(
async (statePartArg, routeId, actionContext): Promise<IRouteManagementState> => {
const context = getActionContext();