Skip to content

Commit

Permalink
Merge pull request #17566 from jmchilton/invocation_links
Browse files Browse the repository at this point in the history
Links to individual invocations.
  • Loading branch information
martenson authored Mar 2, 2024
2 parents a048f2d + 7f8db0d commit 06eada1
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
9 changes: 9 additions & 0 deletions client/src/api/invocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ export interface WorkflowInvocationStep {
id: string;
}

export async function invocationForJob(params: { jobId: string }): Promise<WorkflowInvocation | null> {
const { data } = await axios.get(`${getAppRoot()}api/invocations?job_id=${params.jobId}`);
if (data.length > 0) {
return data[0] as WorkflowInvocation;
} else {
return null;
}
}

// TODO: Replace these provisional functions with fetchers after https://github.com/galaxyproject/galaxy/pull/16707 is merged
export async function fetchInvocationDetails(params: { id: string }): Promise<ApiResponse<WorkflowInvocation>> {
const { data } = await axios.get(`${getAppRoot()}api/invocations/${params.id}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe("JobInformation/JobInformation.vue", () => {
axiosMock = new MockAdapter(axios);
axiosMock.onGet(new RegExp(`api/configuration/decode/*`)).reply(200, { decoded_id: 123 });
axiosMock.onGet("/api/jobs/test_id?full=True").reply(200, jobResponse);
axiosMock.onGet("/api/invocations?job_id=test_id").reply(200, []);
});

afterEach(() => {
Expand Down
23 changes: 23 additions & 0 deletions client/src/components/JobInformation/JobInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
{{ job.copied_from_job_id }} <DecodedId :id="job.copied_from_job_id" />
</td>
</tr>
<tr v-if="invocationId">
<td>Workflow Invocation</td>
<td>
<router-link :to="routeToInvocation">{{ invocationId }}</router-link>
</td>
</tr>
</tbody>
</table>
</div>
Expand All @@ -103,6 +109,8 @@ import { formatDuration, intervalToDuration } from "date-fns";
import { getAppRoot } from "onload/loadConfig";
import JOB_STATES_MODEL from "utils/job-states-model";
import { invocationForJob } from "@/api/invocations";
import DecodedId from "../DecodedId.vue";
import CodeRow from "./CodeRow.vue";
Expand All @@ -128,6 +136,7 @@ export default {
data() {
return {
job: null,
invocationId: null,
};
},
computed: {
Expand All @@ -139,13 +148,27 @@ export default {
jobIsTerminal() {
return this.job && !JOB_STATES_MODEL.NON_TERMINAL_STATES.includes(this.job.state);
},
routeToInvocation() {
return `/workflows/invocations/${this.invocationId}`;
},
},
methods: {
getAppRoot() {
return getAppRoot();
},
updateJob(job) {
this.job = job;
if (job) {
this.fetchInvocation(job.id);
}
},
async fetchInvocation(jobId) {
if (jobId) {
const invocation = await invocationForJob({ jobId: jobId });
if (invocation) {
this.invocationId = invocation.id;
}
}
},
},
};
Expand Down
6 changes: 5 additions & 1 deletion client/src/components/Workflow/InvocationsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
<small class="float-right" :data-invocation-id="row.item.id">
<b>Last updated: <UtcDate :date="row.item.update_time" mode="elapsed" />;</b>
<b
>Invocation ID: <code>{{ row.item.id }}</code></b
>Invocation ID:
<router-link :to="invocationLink(row.item)">{{ row.item.id }}</router-link></b
>
</small>
<WorkflowInvocationState :invocation-id="row.item.id" @invocation-cancelled="refresh" />
Expand Down Expand Up @@ -222,6 +223,9 @@ export default {
swapRowDetails(row) {
row.toggleDetails();
},
invocationLink(item) {
return `/workflows/invocations/${item.id}`;
},
switchHistory(historyId) {
const Galaxy = getGalaxyInstance();
Galaxy.currHistoryPanel.switchToHistory(historyId);
Expand Down
6 changes: 6 additions & 0 deletions client/src/entry/analysis/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import Sharing from "@/components/Sharing/SharingPage.vue";
import HistoryStorageOverview from "@/components/User/DiskUsage/Visualizations/HistoryStorageOverview.vue";
import UserDatasetPermissions from "@/components/User/UserDatasetPermissions.vue";
import WorkflowPublished from "@/components/Workflow/Published/WorkflowPublished.vue";
import WorkflowInvocationState from "@/components/WorkflowInvocationState/WorkflowInvocationState.vue";

Vue.use(VueRouter);

Expand Down Expand Up @@ -527,6 +528,11 @@ export function getRouter(Galaxy) {
invocationId: route.query.id,
}),
},
{
path: "workflows/invocations/:invocationId",
component: WorkflowInvocationState,
props: true,
},
{
path: "workflows/list",
component: WorkflowList,
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/webapps/galaxy/buildapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ def app_pair(global_conf, load_app_kwds=None, wsgi_preflight=True, **kwargs):
webapp.add_client_route("/workflows/trs_import")
webapp.add_client_route("/workflows/trs_search")
webapp.add_client_route("/workflows/invocations")
webapp.add_client_route("/workflows/invocations/{invocation_id}")
webapp.add_client_route("/workflows/sharing")
webapp.add_client_route("/workflows/{stored_workflow_id}/invocations")
webapp.add_client_route("/workflows/invocations/report")
Expand Down

0 comments on commit 06eada1

Please sign in to comment.