Skip to content

Commit 255ff11

Browse files
committed
cleanup
1 parent da8cdf1 commit 255ff11

1 file changed

Lines changed: 8 additions & 34 deletions

File tree

plugins/io/__init__.py

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,23 +1751,21 @@ def resolve_output(self, ctx):
17511751

17521752
outputs.str(
17531753
"instructions",
1754-
label=f"Download export from `{export_path}`",
1754+
label="Export location",
1755+
description=export_path,
17551756
view=types.MarkdownView(),
17561757
)
17571758

17581759
download_button = types.Button(
17591760
label="Download file",
17601761
icon="download",
17611762
operator="download_file",
1762-
params={
1763-
"url": export_path,
1764-
"filename": os.path.basename(export_path),
1765-
},
1763+
params={"url": export_path},
17661764
)
17671765
outputs.str("download", view=download_button)
17681766

17691767
return types.Property(
1770-
outputs, view=types.View(label="Download export")
1768+
outputs, view=types.View(label="Export complete")
17711769
)
17721770

17731771

@@ -2842,32 +2840,7 @@ def execute(self, ctx):
28422840
# pylint: disable=no-member
28432841
url = fos.get_url(filepath, hours=hours, method=method)
28442842

2845-
return {
2846-
"filepath": filepath,
2847-
"url": url,
2848-
"method": method,
2849-
"hours": hours,
2850-
}
2851-
2852-
def resolve_output(self, ctx):
2853-
filepath = ctx.results.get("filepath", None)
2854-
url = ctx.results.get("url", None)
2855-
method = ctx.results.get("method", None)
2856-
2857-
outputs = types.Object()
2858-
2859-
outputs.str("url", label="Signed URL", view=types.MarkdownView())
2860-
2861-
if method == "GET":
2862-
download_button = types.Button(
2863-
label="Download file",
2864-
icon="download",
2865-
operator="download_file",
2866-
params={"url": url, "filename": os.path.basename(filepath)},
2867-
)
2868-
outputs.str("download", view=download_button)
2869-
2870-
return types.Property(outputs, view=types.View(label="Get URL"))
2843+
return {"url": url}
28712844

28722845

28732846
def _get_url_inputs(ctx, inputs):
@@ -2937,8 +2910,7 @@ def _get_url_inputs(ctx, inputs):
29372910
"url_header",
29382911
view=types.Header(label="Signed URL", divider=True),
29392912
)
2940-
inputs.view("result", types.Notice(label=f"[{url}]({url})"))
2941-
inputs.invalid = method != "GET"
2913+
inputs.view("result", types.Notice(label=url))
29422914

29432915
if method == "GET":
29442916
download_button = types.Button(
@@ -2949,6 +2921,8 @@ def _get_url_inputs(ctx, inputs):
29492921
)
29502922
inputs.str("download", view=download_button)
29512923

2924+
inputs.invalid = True
2925+
29522926

29532927
def _parse_path(ctx, key):
29542928
value = ctx.params.get(key, None)

0 commit comments

Comments
 (0)