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 6, 2024
1 parent 8761a3c commit 741650d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions client/src/api/histories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ 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 const publishedHistoriesFetcher = fetcher.path("/api/histories/published").method("get").create();
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();
21 changes: 9 additions & 12 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 { publishedHistoriesFetcher } 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 All @@ -19,7 +21,7 @@ interface MarkdownDialogProps {
argumentName?: string;
argumentType?: string;
argumentPayload?: object;
labels: string[];
labels?: string[];
useLabels: boolean;
}
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,19 @@ 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);
return workflowsFetcher({});
}
function getHistories() {
return axios.get(historiesUrl);
return publishedHistoriesFetcher({});
}
function onData(response: string) {
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Markdown/MarkdownToolBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default {
return {
selectedArgumentName: null,
selectedType: null,
selectedLabels: null,
selectedLabels: undefined,
selectedShow: false,
selectedPayload: null,
visualizationIndex: {},
Expand Down

0 comments on commit 741650d

Please sign in to comment.