Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions components/apify/apify.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,10 @@ export default {
page, actorSource,
}) {
actorSource ??= "recently-used";
const listFn = actorSource === "store"
? this.listActors
: this.listUserActors;
const { items } = await listFn({
offset: LIMIT * page,
limit: LIMIT,
return await this.getActorOptions({
page,
actorSource,
});

return items.map((actor) => ({
label: this.formatActorOrTaskLabel(actor),
value: actor.id,
}));
},
},
taskId: {
Expand Down Expand Up @@ -149,6 +141,23 @@ export default {
],
});
},
async getActorOptions({
page = 0, actorSource = "recently-used",
}) {
const listFn = actorSource === "store"
? this.listActors
: this.listUserActors;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if @MisaFialova report it or not.
The listUserActors should call actors().list() without param my: true. We want to return all Actors including from Store if user pick recently used

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Recent runs should include store actors as well. In this case, we missed it for the apify-run-actor component, where we should also list not only owned actors. I didn't question this part of the logic previously. I'll fix it for both components using the actorId input field.
image


const { items } = await listFn({
offset: LIMIT * page,
limit: LIMIT,
});

return items.map((actor) => ({
label: this.formatActorOrTaskLabel(actor),
value: actor.id,
}));
},
getAuthToken() {
return this.$auth.api_token;
},
Expand Down Expand Up @@ -217,7 +226,6 @@ export default {
listUserActors(opts = {}) {
return this._client().actors()
.list({
my: true,
sortBy: "stats.lastRunStartedAt",
desc: true,
...opts,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,54 @@
import common from "../common/base.mjs";
import sampleEmit from "./test-event.mjs";
import apify from "../../apify.app.mjs";

export default {
...common,
key: "apify-new-finished-actor-run-instant",
name: "New Finished Actor Run (Instant)",
description: "Emit new event when a selected Actor is run and finishes.",
version: "0.0.5",
version: "0.0.6",
type: "source",
dedupe: "unique",
props: {
...common.props,
db: "$.service.db",
actorId: {
propDefinition: [
common.props.apify,
"actorId",
apify,
actorSource: {
type: "string",
label: "Search Actors from",
description: "Where to search for Actors. Valid options are Store and Recently used Actors.",
options: [
{
label: "Apify Store Actors",
value: "store",
},
{
label: "Recently used Actors",
value: "recently-used",
},
],
default: "recently-used",
reloadProps: true,
},
},
additionalProps() {
const props = {};

if (this.actorSource) {
props.actorId = {
...apify.propDefinitions.actorId, // it doesn't contain options() method
options: async ({ page }) => {
return await this.apify.getActorOptions({
page,
actorSource: this.actorSource,
});
},
};
}

return props;
},
methods: {
...common.methods,
getCondition() {
Expand Down
Loading