From 1176edf822ca983698a9a2dad924f62cc4c10fa2 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 8 Oct 2024 18:24:16 +0200 Subject: [PATCH] WIP: create workflow landing page with test parameters --- scripts/workflow_manifest.py | 8 ++++++ website/models/workflow.ts | 1 + website/pages/workflow/[id].vue | 46 +++++++++++++++++++++++++++++---- 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/scripts/workflow_manifest.py b/scripts/workflow_manifest.py index a2b061cc3..b015f8f5f 100644 --- a/scripts/workflow_manifest.py +++ b/scripts/workflow_manifest.py @@ -82,6 +82,14 @@ def find_and_load_compliant_workflows(directory): dirname = os.path.dirname(workflow_path).split("/")[-1] workflow["trsID"] = f"#workflow/github.com/iwc-workflows/{dirname}/{workflow['name'] or 'main'}" + workflow_test_path = f"{workflow_path.rsplit('.ga', 1)[0]}-tests.yml" + if os.path.exists(workflow_test_path): + with open(workflow_test_path) as f: + tests = yaml.safe_load(f) + workflow["tests"] = tests + else: + print(f"no test for {workflow_test_path}") + except Exception as e: print(f"Error reading file {os.path.join(root, '.dockstore.yml')}: {e}") diff --git a/website/models/workflow.ts b/website/models/workflow.ts index a4a7b9bb4..c7460f7f7 100644 --- a/website/models/workflow.ts +++ b/website/models/workflow.ts @@ -11,6 +11,7 @@ export interface Workflow { publish: boolean; primaryDescriptorPath: string; testParameterFiles: string[]; + tests: any[]; // replace with actual interface from openapi schema authors: Author[]; definition: WorkflowDefinition; readme: string; diff --git a/website/pages/workflow/[id].vue b/website/pages/workflow/[id].vue index 63458d66c..9d2418a7e 100644 --- a/website/pages/workflow/[id].vue +++ b/website/pages/workflow/[id].vue @@ -46,6 +46,33 @@ const launchUrl = computed(() => { return `${selectedInstance.value}/workflows/trs_import?trs_server=dockstore.org&trs_id=${encodeURIComponent(workflow.value.trsID)}&trs_version=v${workflow.value.definition.release}&run_form=true`; }); +function testToRequestState() { + const tests = workflow.value?.tests + if (tests && tests.length) { + return tests[0].job; + } +} + +async function createLandingPage() { + const job = testToRequestState() + console.log(job); + console.log("creating landing page"); + const response = await fetch("http://localhost:8081/api/workflow_landings", { + headers: {"Content-Type": "application/json"}, + method: "POST", + body: JSON.stringify({ + workflow_id: workflow.value?.trsID, + workflow_target_type: "trs_id", + trs_version: workflow.value?.definition.release, + request_state: job + }) + }) + const json = await response.json(); + const landingPage = `http://localhost:8080/workflow_landings/${json['uuid']}`; + console.log("Landing page url:", landingPage); + // window.open(landingPage, "_blank"); +} + const tools = computed(() => { if (!workflow.value || !workflow.value.definition || !workflow.value.definition.steps) { return []; @@ -78,6 +105,7 @@ const tabs = computed(() => [ /* Instance SElector -- factor out to a component */ const selectedInstance = ref(""); const instances = reactive([ + { value: "http://localhost:8081", label: "local dev instance"}, { value: "http://usegalaxy.org", label: "usegalaxy.org" }, { value: "https://test.galaxyproject.org", label: "test.galaxyproject.org" }, { value: "https://usegalaxy.eu", label: "usegalaxy.eu" }, @@ -118,6 +146,11 @@ const onInstanceChange = (value: string) => {
  • UniqueID: {{ workflow.definition.uuid }}
  • + { color="primary" variant="solid" label="Launch at" /> - +