mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
feat(Rundeck Node): Add support for node filters (#5633)
This commit is contained in:
parent
052d82b220
commit
1f70f49ce5
|
@ -119,6 +119,21 @@ export class Rundeck implements INodeType {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Filter',
|
||||
name: 'filter',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['execute'],
|
||||
resource: ['job'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
placeholder: 'Add Filters',
|
||||
required: false,
|
||||
description: 'Filter Rundeck nodes by name',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// job:getMetadata
|
||||
|
@ -161,7 +176,8 @@ export class Rundeck implements INodeType {
|
|||
const jobid = this.getNodeParameter('jobid', i) as string;
|
||||
const rundeckArguments = (this.getNodeParameter('arguments', i) as IDataObject)
|
||||
.arguments as IDataObject[];
|
||||
const response = await rundeckApi.executeJob(jobid, rundeckArguments);
|
||||
const filter = this.getNodeParameter('filter', i) as string;
|
||||
const response = await rundeckApi.executeJob(jobid, rundeckArguments, filter);
|
||||
|
||||
returnData.push(response);
|
||||
} else if (operation === 'getMetadata') {
|
||||
|
|
|
@ -49,7 +49,7 @@ export class RundeckApi {
|
|||
this.credentials = credentials as unknown as RundeckCredentials;
|
||||
}
|
||||
|
||||
async executeJob(jobId: string, args: IDataObject[]): Promise<IDataObject> {
|
||||
async executeJob(jobId: string, args: IDataObject[], filter?: string): Promise<IDataObject> {
|
||||
let params = '';
|
||||
|
||||
if (args) {
|
||||
|
@ -62,7 +62,12 @@ export class RundeckApi {
|
|||
argString: params,
|
||||
};
|
||||
|
||||
return this.request('POST', `/api/14/job/${jobId}/run`, body, {});
|
||||
const query: IDataObject = {};
|
||||
if (filter) {
|
||||
query.filter = filter;
|
||||
}
|
||||
|
||||
return this.request('POST', `/api/14/job/${jobId}/run`, body, query);
|
||||
}
|
||||
|
||||
async getJobMetadata(jobId: string): Promise<IDataObject> {
|
||||
|
|
Loading…
Reference in a new issue