feat: Table in confirm modal to see all workflows using nodes before updating / uninstalling (#17488)

This commit is contained in:
Michael Kret
2025-08-01 09:41:04 +03:00
committed by GitHub
parent d924d82ee2
commit 76230d2640
12 changed files with 564 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
import {
ImportWorkflowFromUrlDto,
ManualRunQueryDto,
ROLE,
TransferWorkflowBodyDto,
} from '@n8n/api-types';
import { Logger } from '@n8n/backend-common';
@@ -559,4 +560,31 @@ export class WorkflowsController {
body.destinationParentFolderId,
);
}
@Post('/with-node-types')
async getWorkflowsWithNodesIncluded(req: AuthenticatedRequest, res: express.Response) {
try {
const hasPermission = req.user.role === ROLE.Owner || req.user.role === ROLE.Admin;
if (!hasPermission) {
res.json({ data: [], count: 0 });
return;
}
const { nodeTypes } = req.body as { nodeTypes: string[] };
const workflows = await this.workflowService.getWorkflowsWithNodesIncluded(
req.user,
nodeTypes,
);
res.json({
data: workflows,
count: workflows.length,
});
} catch (maybeError) {
const error = utils.toError(maybeError);
ResponseHelper.reportError(error);
ResponseHelper.sendErrorResponse(res, error);
}
}
}