From 989b769727012d97095c5d344cdee5a71390e3d8 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Mon, 19 Aug 2024 15:57:21 -0500 Subject: [PATCH] export explicit types for content source and type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: David López <46503462+davelopez@users.noreply.github.com> --- client/src/api/datasets.ts | 5 ++++- .../src/components/History/CurrentHistory/HistoryPanel.vue | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/api/datasets.ts b/client/src/api/datasets.ts index 2a568f77130c..4c2a463394d3 100644 --- a/client/src/api/datasets.ts +++ b/client/src/api/datasets.ts @@ -67,7 +67,7 @@ export async function purgeDataset(datasetId: string) { } const datasetCopy = fetcher.path("/api/histories/{history_id}/contents/{type}s").method("post").create(); -export type HistoryContentsArgs = FetchArgType; +type HistoryContentsArgs = FetchArgType; export async function copyDataset( datasetId: HistoryContentsArgs["content"], historyId: HistoryContentsArgs["history_id"], @@ -95,3 +95,6 @@ export async function fetchDatasetAttributes(datasetId: string) { return data; } + +export type HistoryContentType = components["schemas"]["HistoryContentType"]; +export type HistoryContentSource = components["schemas"]["HistoryContentSource"]; diff --git a/client/src/components/History/CurrentHistory/HistoryPanel.vue b/client/src/components/History/CurrentHistory/HistoryPanel.vue index eb2017ef1947..7393243ef45a 100644 --- a/client/src/components/History/CurrentHistory/HistoryPanel.vue +++ b/client/src/components/History/CurrentHistory/HistoryPanel.vue @@ -11,7 +11,7 @@ import { isHistoryItem, userOwnsHistory, } from "@/api"; -import { copyDataset, HistoryContentsArgs } from "@/api/datasets"; +import { copyDataset, type HistoryContentSource, type HistoryContentType } from "@/api/datasets"; import ExpandedItems from "@/components/History/Content/ExpandedItems"; import SelectedItems from "@/components/History/Content/SelectedItems"; import { HistoryFilters } from "@/components/History/HistoryFilters"; @@ -399,8 +399,8 @@ async function onDrop() { try { // iterate over the data array and copy each item to the current history for (const item of data) { - let dataSource: HistoryContentsArgs["source"]; - let type: HistoryContentsArgs["type"]; + let dataSource: HistoryContentSource; + let type: HistoryContentType; let id: string; if (isHistoryItem(item)) { dataSource = item.history_content_type === "dataset" ? "hda" : "hdca";