Skip to content

Commit

Permalink
Added show workflowtemplate in projects page
Browse files Browse the repository at this point in the history
  • Loading branch information
aleenathomas committed Jul 24, 2023
1 parent 74abd09 commit 6d11388
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
3 changes: 3 additions & 0 deletions frontend-dev/src/queries/get_all_projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const allProjectsQuery = gql`
dryRuns {
id
}
workflowTemplates {
argoWorkflowTemplate
}
}
}
`;
Expand Down
1 change: 0 additions & 1 deletion frontend-dev/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<AppRail>
<AppRailTile label="Projects" href="/projects"><BookOpenIcon size="1.5x" /></AppRailTile>
<AppRailTile label="Registry Key Vault" href="/secrets"><LockIcon size="1.5x" /></AppRailTile>
<AppRailTile label="DAG" href="/visualizations/dag"><Share2Icon size="1.5x" /></AppRailTile>
<AppRailTile label="dDAG" href="/visualizations/ddag"><Share2Icon size="1.5x" /></AppRailTile>
</AppRail>
</svelte:fragment>
Expand Down
14 changes: 12 additions & 2 deletions frontend-dev/src/routes/projects/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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);
</script>
Expand Down Expand Up @@ -117,7 +123,8 @@
<th>Name</th>
<th>Created date</th>
<th>Dry runs</th>
<th>Simulation runs</th>
<!-- <th>Simulation runs</th> -->
<th>Template</th>
</tr>
</thead>
<tbody>
Expand All @@ -139,7 +146,10 @@
<td>{project.createdAt}</td>
<td>{dryRunCounts[project.id]}</td>
<!-- TODO: Aleena add number of dry runs and number of simulation runs-->
<td>NaN</td>
<!-- <td>NaN</td> -->
<td on:click={(event) => showTemplate(event, project)}>
<p class="no-underline hover:underline">show</p>
</td>
</tr>
{/each}
</tbody>
Expand Down
4 changes: 4 additions & 0 deletions frontend-dev/src/routes/templates/[template]/+page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export async function load({ params }) {
let { template } = params;
return { template };
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<script lang="ts">
import { ProgressBar } from '@skeletonlabs/skeleton';
import { get } from 'svelte/store';
import { graphQLClient } from '../../../stores/stores';
import { graphQLClient, clickedProjectId } from '../../../stores/stores';
import getWorkflowQuery from '../../../queries/get_workflow_template';
import { CodeBlock } from '@skeletonlabs/skeleton';
import YAML from 'json-to-pretty-yaml';
import initKeycloak from '$lib/keycloak.js';
import { GraphQL_API_URL } from '$lib/config.js';
import { GraphQLClient } from 'graphql-request';
import { goto } from '$app/navigation';
export let data;
//const workflowtemplatename = 'helloworld';
const workflowtemplatename = 'dag-project';
$: language = 'yaml';
const getWorkflowTemplate = async (): Promise<{}> => {
const variables = {
name: workflowtemplatename,
name: data.template,
}
if (!$graphQLClient) {
try {
Expand All @@ -26,7 +27,6 @@
}
}
const response: {} = await get(graphQLClient).request(getWorkflowQuery, variables);
//console.log(response);
return response;
};
Expand All @@ -49,9 +49,19 @@
</script>

<!-- Page Header -->
<div class="container p-5">
<h1>DAG</h1>
<h1><a href="/projects" >Projects</a>
<span STYLE="font-size:14px">/ </span>{data.template}
<!-- <span STYLE="font-size:14px">/ </span> -->
</h1>
<br/>
<h1>
<!-- TODO: adjust position and style -->
<button class="btn variant-filled" on:click={() => goto(`/projects/[project_id]/${$clickedProjectId}`)} >
Dry Runs ->
</button>
</h1>
<div class="table-container p-5">
{#await workflowPromise}
<ProgressBar />
{:then workflow}
Expand All @@ -60,7 +70,8 @@
<span>Switch to {language === 'yaml' ? 'JSON' : 'YAML'}</span>
</button>
</div>
<div class="code">
<br/>
<div class="code overflow-y-auto h-96">
{#if language === 'json'}
<CodeBlock language={language} code={JSON.stringify(workflow, null, 2)} text="text-xs" />
{:else if language === 'yaml'}
Expand All @@ -69,3 +80,4 @@
</div>
{/await}
</div>
</div>

0 comments on commit 6d11388

Please sign in to comment.