Skip to content

Commit

Permalink
Migrate MarkdownDialog API interactions to fetchers.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Feb 3, 2024
1 parent 81f4783 commit 5850d80
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
5 changes: 5 additions & 0 deletions client/src/api/histories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ export const deleteHistories = fetcher.path("/api/histories/batch/delete").metho
export const undeleteHistory = fetcher.path("/api/histories/deleted/{history_id}/undelete").method("post").create();
export const undeleteHistories = fetcher.path("/api/histories/batch/undelete").method("put").create();
export const historiesQuery = fetcher.path("/api/histories/query").method("get").create();

export async function getPublishedHistories() {
const { data } = await historiesFetcher({ view: "details", q: ["published"], qv: ["True"] });
return data;
}
4 changes: 3 additions & 1 deletion client/src/api/invocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import axios from "axios";

import { getAppRoot } from "@/onload";

import { ApiResponse } from "./schema";
import { ApiResponse, fetcher } from "./schema";

export const invocationsFetcher = fetcher.path("/api/invocations").method("get").create();

// TODO: Replace these interfaces with real schema models after https://github.com/galaxyproject/galaxy/pull/16707 is merged
export interface WorkflowInvocation {
Expand Down
2 changes: 2 additions & 0 deletions client/src/api/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export const jobLockStatus = fetcher.path("/api/job_lock").method("get").create(
export const jobLockUpdate = fetcher.path("/api/job_lock").method("put").create();

export const fetchJobDestinationParams = fetcher.path("/api/jobs/{job_id}/destination_params").method("get").create();

export const jobsFetcher = fetcher.path("/api/jobs").method("get").create();
3 changes: 3 additions & 0 deletions client/src/api/workflows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { fetcher } from "@/api/schema";

export const workflowsFetcher = fetcher.path("/api/workflows").method("get").create();
23 changes: 8 additions & 15 deletions client/src/components/Markdown/MarkdownDialog.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<script setup lang="ts">
import axios from "axios";
import BootstrapVue from "bootstrap-vue";
import { storeToRefs } from "pinia";
import Vue, { computed, ref } from "vue";
import { getAppRoot } from "@/onload/loadConfig";
import { getPublishedHistories } from "@/api/histories";
import { invocationsFetcher } from "@/api/invocations";
import { jobsFetcher } from "@/api/jobs";
import { workflowsFetcher } from "@/api/workflows";
import { useHistoryStore } from "@/stores/historyStore";
import MarkdownSelector from "./MarkdownSelector.vue";
Expand Down Expand Up @@ -55,11 +57,6 @@ const selectorConfig = {
},
};
const jobsUrl = `${getAppRoot()}api/jobs`;
const workflowsUrl = `${getAppRoot()}api/workflows`;
const invocationsUrl = `${getAppRoot()}api/invocations`;
const historiesUrl = `${getAppRoot()}api/histories?view=detailed&q=published&qv=True`;
const selectedShow = ref(false);
const visualizationShow = ref(false);
const workflowShow = ref(false);
Expand All @@ -76,19 +73,15 @@ const selectedLabelTitle = computed(() => {
});
function getInvocations() {
return axios.get(invocationsUrl);
return invocationsFetcher({});
}
function getJobs() {
return axios.get(jobsUrl);
return jobsFetcher({});
}
function getWorkflows() {
return axios.get(workflowsUrl);
}
function getHistories() {
return axios.get(historiesUrl);
return workflowsFetcher({});
}
function onData(response: string) {
Expand Down Expand Up @@ -256,7 +249,7 @@ if (props.argumentType == "workflow_id") {
@onCancel="onCancel" />
<BasicSelectionDialog
v-else-if="historyShow"
:get-data="getHistories"
:get-data="getPublishedHistories"
title="History"
label-key="name"
@onOk="onHistory"
Expand Down

0 comments on commit 5850d80

Please sign in to comment.