mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-25 10:24:38 +08:00
Move fetchDatasetDetails to api/datasets
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { FetchArgType } from "openapi-typescript-fetch";
|
||||
|
||||
import { DatasetDetails } from "@/api";
|
||||
import { fetcher } from "@/api/schema";
|
||||
import { withPrefix } from "@/utils/redirect";
|
||||
|
||||
@@ -35,6 +36,15 @@ export async function getDatasets(options: GetDatasetsOptions = {}) {
|
||||
return data;
|
||||
}
|
||||
|
||||
const getDataset = fetcher.path("/api/datasets/{dataset_id}").method("get").create();
|
||||
|
||||
export async function fetchDatasetDetails(params: { id: string }): Promise<DatasetDetails> {
|
||||
const { data } = await getDataset({ dataset_id: params.id, view: "detailed" });
|
||||
// We know that the server will return a DatasetDetails object because of the view parameter
|
||||
// but the type system doesn't, so we have to cast it.
|
||||
return data as unknown as DatasetDetails;
|
||||
}
|
||||
|
||||
const updateHistoryDataset = fetcher.path("/api/histories/{history_id}/contents/{type}s/{id}").method("put").create();
|
||||
|
||||
export async function undeleteHistoryDataset(historyId: string, datasetId: string) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<script>
|
||||
import { mapCacheActions } from "vuex-cache";
|
||||
|
||||
import { fetchDatasetDetails } from "@/stores/services/dataset.service";
|
||||
import { fetchDatasetDetails } from "@/api/datasets";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import axios from "axios";
|
||||
import { getAppRoot } from "onload/loadConfig";
|
||||
|
||||
import { fetchDatasetDetails } from "@/api/datasets";
|
||||
import { SingleQueryProvider } from "@/components/providers/SingleQueryProvider";
|
||||
import { fetchDatasetDetails } from "@/stores/services/dataset.service";
|
||||
import { rethrowSimple } from "@/utils/simple-error";
|
||||
|
||||
import { stateIsTerminal } from "./utils";
|
||||
|
||||
@@ -2,8 +2,7 @@ import { defineStore } from "pinia";
|
||||
import Vue, { computed, ref } from "vue";
|
||||
|
||||
import { DatasetDetails, DatasetEntry, HistoryContentItemBase } from "@/api";
|
||||
|
||||
import { fetchDatasetDetails } from "./services/dataset.service";
|
||||
import { fetchDatasetDetails } from "@/api/datasets";
|
||||
|
||||
export const useDatasetStore = defineStore("datasetStore", () => {
|
||||
const storedDatasets = ref<{ [key: string]: DatasetDetails }>({});
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import { DatasetDetails } from "@/api";
|
||||
import { fetcher } from "@/api/schema";
|
||||
|
||||
const getDataset = fetcher.path("/api/datasets/{dataset_id}").method("get").create();
|
||||
|
||||
export async function fetchDatasetDetails(params: { id: string }): Promise<DatasetDetails> {
|
||||
const { data } = await getDataset({ dataset_id: params.id, view: "detailed" });
|
||||
// We know that the server will return a DatasetDetails object because of the view parameter
|
||||
// but the type system doesn't, so we have to cast it.
|
||||
return data as unknown as DatasetDetails;
|
||||
}
|
||||
Reference in New Issue
Block a user