From 6d113883e052def7d6e02896e8fda38c8371e48a Mon Sep 17 00:00:00 2001 From: AleenaThomas_gh Date: Mon, 24 Jul 2023 11:33:39 +0200 Subject: [PATCH] Added show workflowtemplate in projects page --- frontend-dev/src/queries/get_all_projects.ts | 3 ++ frontend-dev/src/routes/+layout.svelte | 1 - frontend-dev/src/routes/projects/+page.svelte | 14 ++++++++-- .../src/routes/templates/[template]/+page.js | 4 +++ .../dag => templates/[template]}/+page.svelte | 28 +++++++++++++------ 5 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 frontend-dev/src/routes/templates/[template]/+page.js rename frontend-dev/src/routes/{visualizations/dag => templates/[template]}/+page.svelte (74%) diff --git a/frontend-dev/src/queries/get_all_projects.ts b/frontend-dev/src/queries/get_all_projects.ts index 0a959e93..f636f40e 100644 --- a/frontend-dev/src/queries/get_all_projects.ts +++ b/frontend-dev/src/queries/get_all_projects.ts @@ -10,6 +10,9 @@ const allProjectsQuery = gql` dryRuns { id } + workflowTemplates { + argoWorkflowTemplate + } } } `; diff --git a/frontend-dev/src/routes/+layout.svelte b/frontend-dev/src/routes/+layout.svelte index f689312d..163cd82c 100644 --- a/frontend-dev/src/routes/+layout.svelte +++ b/frontend-dev/src/routes/+layout.svelte @@ -61,7 +61,6 @@ - diff --git a/frontend-dev/src/routes/projects/+page.svelte b/frontend-dev/src/routes/projects/+page.svelte index 393513b5..5ca608f5 100644 --- a/frontend-dev/src/routes/projects/+page.svelte +++ b/frontend-dev/src/routes/projects/+page.svelte @@ -81,6 +81,12 @@ goto(`/projects/[project_id]/${dry_run}`); } + function showTemplate(event:any, project:Project) { + $clickedProjectId = project.id; + event.stopPropagation(); + const template = project.workflowTemplates[0].argoWorkflowTemplate?.metadata.name; + goto(`/templates/${template}`); + } $: reactiveProjectsList = $projectsList; $: dryRunCounts = getDryRunCounts(reactiveProjectsList); @@ -117,7 +123,8 @@ Name Created date Dry runs - Simulation runs + + Template @@ -139,7 +146,10 @@ {project.createdAt} {dryRunCounts[project.id]} - NaN + + showTemplate(event, project)}> +

show

+ {/each} diff --git a/frontend-dev/src/routes/templates/[template]/+page.js b/frontend-dev/src/routes/templates/[template]/+page.js new file mode 100644 index 00000000..a6228188 --- /dev/null +++ b/frontend-dev/src/routes/templates/[template]/+page.js @@ -0,0 +1,4 @@ +export async function load({ params }) { + let { template } = params; + return { template }; +} \ No newline at end of file diff --git a/frontend-dev/src/routes/visualizations/dag/+page.svelte b/frontend-dev/src/routes/templates/[template]/+page.svelte similarity index 74% rename from frontend-dev/src/routes/visualizations/dag/+page.svelte rename to frontend-dev/src/routes/templates/[template]/+page.svelte index f0214d6a..6221058b 100644 --- a/frontend-dev/src/routes/visualizations/dag/+page.svelte +++ b/frontend-dev/src/routes/templates/[template]/+page.svelte @@ -1,21 +1,22 @@ -
-

DAG

+

Projects + / {data.template} + +

+
+

+ + +

+
{#await workflowPromise} {:then workflow} @@ -60,7 +70,8 @@ Switch to {language === 'yaml' ? 'JSON' : 'YAML'}
-
+
+
{#if language === 'json'} {:else if language === 'yaml'} @@ -69,3 +80,4 @@
{/await}
+