Skip to content

Commit bc750b3

Browse files
authored
fix: replace get-last-run status input with dropdown (#52)
* fix: replace get-last-run status input with dropdown * fix: add query param in get-last-run
1 parent 468f711 commit bc750b3

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

nodes/Apify/__tests__/Apify.node.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ describe('Apify Node', () => {
131131

132132
const scope = nock('https://api.apify.com')
133133
.get('/v2/acts/nFJndFXA5zjCTuudP/runs/last')
134+
.query({ status: 'ABORTED' })
134135
.reply(200, mockLastRun);
135136

136137
const getLastRunWorkflow = require('./workflows/actors/get-last-run.workflow.json');

nodes/Apify/__tests__/workflows/actors/get-last-run.workflow.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"mode": "list",
1111
"cachedResultName": "Google Search Results Scraper",
1212
"cachedResultUrl": "https://console.com/actors/nFJndFXA5zjCTuudP/input"
13-
}
13+
},
14+
"status": "ABORTED"
1415
},
1516
"id": "874a4468-0c56-4818-baa0-41967a17550a",
1617
"name": "Get last run",

nodes/Apify/resources/actor-runs/get-user-runs-list/properties.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ descending order. By default, they are sorted in ascending order.`,
4848
{
4949
displayName: 'Status',
5050
name: 'status',
51-
description: `Return only runs with the provided terminal status ([available
52-
statuses](https://docs.apify.com/platform/actors/running/runs-and-builds#lifecycle))`,
51+
description: `Return only runs with the provided terminal status, available
52+
statuses: https://docs.apify.com/platform/actors/running/runs-and-builds#lifecycle`,
5353
default: 'SUCCEEDED',
5454
type: 'options',
5555
options: [

nodes/Apify/resources/actors/get-last-run/execute.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { apiRequest } from '../../../resources/genericFunctions';
88

99
export async function getLastRun(this: IExecuteFunctions, i: number): Promise<INodeExecutionData> {
1010
const actorId = this.getNodeParameter('actorId', i) as { value: string };
11+
const status = this.getNodeParameter('status', i) as string;
1112

1213
if (!actorId) {
1314
throw new NodeOperationError(this.getNode(), 'Actor ID is required');
@@ -17,6 +18,7 @@ export async function getLastRun(this: IExecuteFunctions, i: number): Promise<IN
1718
const apiResult = await apiRequest.call(this, {
1819
method: 'GET',
1920
uri: `/v2/acts/${actorId.value}/runs/last`,
21+
qs: { status },
2022
});
2123

2224
return { json: { ...apiResult.data } };

nodes/Apify/resources/actors/get-last-run/properties.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,20 @@ export const properties: INodeProperties[] = [
3030
{
3131
displayName: 'Status',
3232
name: 'status',
33-
description: 'Filter for the run status',
33+
description:
34+
'Return only runs with the provided status. See the dropdown options or the Apify documentation https://docs.apify.com/platform/actors/running/runs-and-builds#lifecycle.',
3435
default: 'SUCCEEDED',
35-
type: 'string',
36+
type: 'options',
37+
options: [
38+
{ name: 'ABORTED', value: 'ABORTED' },
39+
{ name: 'ABORTING', value: 'ABORTING' },
40+
{ name: 'FAILED', value: 'FAILED' },
41+
{ name: 'READY', value: 'READY' },
42+
{ name: 'RUNNING', value: 'RUNNING' },
43+
{ name: 'SUCCEEDED', value: 'SUCCEEDED' },
44+
{ name: 'TIMED-OUT', value: 'TIMED-OUT' },
45+
{ name: 'TIMING-OUT', value: 'TIMING-OUT' },
46+
],
3647
displayOptions: {
3748
show: {
3849
resource: ['Actors'],

0 commit comments

Comments
 (0)