mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat: Table in confirm modal to see all workflows using nodes before updating / uninstalling (#17488)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user