diff --git a/scripts/workflow_manifest.py b/scripts/workflow_manifest.py index a2b061cc32..b015f8f5fb 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 a4a7b9bb47..c7460f7f7e 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 63458d66c0..9d2418a7e1 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) => {