Skip to content

Commit

Permalink
WIP: create workflow landing page with test parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek authored and dannon committed Oct 10, 2024
1 parent 8bfafef commit 1176edf
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
8 changes: 8 additions & 0 deletions scripts/workflow_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down
1 change: 1 addition & 0 deletions website/models/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
46 changes: 41 additions & 5 deletions website/pages/workflow/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
Expand Down Expand Up @@ -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" },
Expand Down Expand Up @@ -118,18 +146,26 @@ const onInstanceChange = (value: string) => {
<li><strong>UniqueID:</strong> {{ workflow.definition.uuid }}</li>
</ul>
<UButtonGroup class="mt-4" size="sm" orientation="horizontal">
<USelect
v-model="selectedInstance"
:options="instances"
label="Select Galaxy Instance"
@change="onInstanceChange" />
<UButton
:to="launchUrl"
target="_blank"
icon="i-heroicons-rocket-launch"
color="primary"
variant="solid"
label="Launch at" />
<USelect
v-model="selectedInstance"
:options="instances"
label="Select Galaxy Instance"
@change="onInstanceChange" />
<UButton
class="mt-4"
@click="createLandingPage"
target="_blank"
icon="i-heroicons-rocket-launch"
color="primary"
variant="solid"
label="Run with example data" />
</UButtonGroup>
</div>
</div>
Expand Down

0 comments on commit 1176edf

Please sign in to comment.