Skip to content

Commit

Permalink
add skip prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
ritch committed Oct 25, 2024
1 parent d44e464 commit d2323de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/packages/operators/src/built-in-operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ class PromptUserForOperation extends Operator {
inputs.obj("params", { label: "Params" });
inputs.str("on_success", { label: "On success" });
inputs.str("on_error", { label: "On error" });
inputs.str("skip_prompt", { label: "Skip prompt", default: false });
return new types.Property(inputs);
}
useHooks(ctx: ExecutionContext): {} {
Expand All @@ -1037,11 +1038,12 @@ class PromptUserForOperation extends Operator {
const { params, operator_uri, on_success, on_error } = ctx.params;
const { triggerEvent } = ctx.hooks;
const panelId = ctx.getCurrentPanelId();
const shouldPrompt = !params.skip_prompt;

triggerEvent(panelId, {
operator: operator_uri,
params,
prompt: true,
prompt: shouldPrompt,
callback: (result: OperatorResult) => {
if (result.error) {
triggerEvent(panelId, {
Expand Down
2 changes: 2 additions & 0 deletions fiftyone/operators/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ def prompt(
params=None,
on_success=None,
on_error=None,
skip_prompt=False,
):
"""Prompts the user to execute the operator with the given URI.
Expand All @@ -753,6 +754,7 @@ def prompt(
on_success (None): a callback to invoke if the user successfully
executes the operator
on_error (None): a callback to invoke if the execution fails
skip_prompt (False): whether to skip the prompt
Returns:
a :class:`fiftyone.operators.message.GeneratedMessage` containing
Expand Down

0 comments on commit d2323de

Please sign in to comment.