diff --git a/client/src/api/datasets.ts b/client/src/api/datasets.ts index 63b8b5714d9c..47ee27b2b6a7 100644 --- a/client/src/api/datasets.ts +++ b/client/src/api/datasets.ts @@ -6,12 +6,14 @@ import { withPrefix } from "@/utils/redirect"; export const datasetsFetcher = fetcher.path("/api/datasets").method("get").create(); +export type HDASummary = components["schemas"]["HDASummary"]; + type GetDatasetsApiOptions = FetchArgType; type GetDatasetsQuery = Pick; // custom interface for how we use getDatasets interface GetDatasetsOptions extends GetDatasetsQuery { sortBy?: string; - sortDesc?: string; + sortDesc?: boolean; query?: string; } diff --git a/client/src/components/Dataset/DatasetHistory.vue b/client/src/components/Dataset/DatasetHistory.vue index 14fc8ac349dc..20605fac0298 100644 --- a/client/src/components/Dataset/DatasetHistory.vue +++ b/client/src/components/Dataset/DatasetHistory.vue @@ -1,21 +1,24 @@ + + - diff --git a/client/src/components/Dataset/DatasetList.vue b/client/src/components/Dataset/DatasetList.vue index b418d488e914..bc3560ba5793 100644 --- a/client/src/components/Dataset/DatasetList.vue +++ b/client/src/components/Dataset/DatasetList.vue @@ -1,202 +1,211 @@ - - + + diff --git a/client/src/components/Dataset/DatasetName.test.js b/client/src/components/Dataset/DatasetName.test.ts similarity index 71% rename from client/src/components/Dataset/DatasetName.test.js rename to client/src/components/Dataset/DatasetName.test.ts index f56bd1a55e93..2de4470470f3 100644 --- a/client/src/components/Dataset/DatasetName.test.js +++ b/client/src/components/Dataset/DatasetName.test.ts @@ -1,46 +1,57 @@ +import { getLocalVue } from "@tests/jest/helpers"; import { shallowMount } from "@vue/test-utils"; -import { getLocalVue } from "tests/jest/helpers"; -import DatasetName from "./DatasetName"; +import DatasetName from "./DatasetName.vue"; const localVue = getLocalVue(); +async function mountComponent(propsData: { item: { name: string; state: string } }) { + return shallowMount(DatasetName as object, { + propsData, + localVue, + }); +} + describe("Dataset Name", () => { it("test dataset default", async () => { - const wrapper = shallowMount(DatasetName, { - propsData: { item: { name: "name", state: "success" } }, - localVue, - }); + const wrapper = await mountComponent({ item: { name: "name", state: "success" } }); + const state = wrapper.findAll(".name"); expect(state.length).toBe(1); expect(state.at(0).text()).toBe("name"); + const $linkShow = wrapper.find(".dropdown-item:first-child"); + $linkShow.trigger("click"); + expect(Array.isArray(wrapper.emitted().showDataset)).toBe(true); + const $linkCopy = wrapper.find(".dropdown-item:last-child"); + $linkCopy.trigger("click"); + expect(Array.isArray(wrapper.emitted().copyDataset)).toBe(true); }); + it("test dataset error", async () => { - const wrapper = shallowMount(DatasetName, { - propsData: { item: { name: "name", state: "error" } }, - localVue, - }); + const wrapper = await mountComponent({ item: { name: "name", state: "error" } }); + const state = wrapper.findAll(".name"); expect(state.length).toBe(1); expect(state.at(0).text()).toBe("name"); + const errorstate = wrapper.findAll(".error"); expect(errorstate.length).toBe(1); expect(errorstate.at(0).classes()).toEqual(expect.arrayContaining(["text-danger"])); }); + it("test dataset paused", async () => { - const wrapper = shallowMount(DatasetName, { - propsData: { item: { name: "name", state: "paused" } }, - localVue, - }); + const wrapper = await mountComponent({ item: { name: "name", state: "paused" } }); + const state = wrapper.findAll(".name"); expect(state.length).toBe(1); expect(state.at(0).text()).toBe("name"); + const pausestate = wrapper.findAll(".pause"); expect(pausestate.length).toBe(1); expect(pausestate.at(0).classes()).toEqual(expect.arrayContaining(["text-info"])); diff --git a/client/src/components/Dataset/DatasetName.vue b/client/src/components/Dataset/DatasetName.vue index be8e5382a9c3..22fe48c8b883 100644 --- a/client/src/components/Dataset/DatasetName.vue +++ b/client/src/components/Dataset/DatasetName.vue @@ -1,67 +1,84 @@ + + -