diff --git a/src/ui/components/watchlist/CreateWatchlist.vue b/src/ui/components/watchlist/CreateWatchlist.vue index d52aa0d..4096ab7 100644 --- a/src/ui/components/watchlist/CreateWatchlist.vue +++ b/src/ui/components/watchlist/CreateWatchlist.vue @@ -55,6 +55,7 @@ import { MutationTypes } from "@/ui/store/watchlist/mutations"; import { ITargetData } from "@/app/target/domain/Target.types"; import CsvError from "./CsvError.vue"; import GenericError from "../shared/GenericError.vue"; +import { IWatchlistFilter } from "@/app/filter/domain/Filter.types"; const watchlistHelper = createNamespacedHelpers("watchlists"); type CsvTarget = { @@ -62,6 +63,7 @@ type CsvTarget = { ra: number; dec: number; radius: number; + filter: string; }; export default Vue.extend({ @@ -102,6 +104,9 @@ export default Vue.extend({ ra: value.ra, dec: value.dec, radius: value.radius, + filter: JSON.parse( + value.filter.replace(/'/g, '"') + ) as IWatchlistFilter, } as ITargetData) ), }; diff --git a/src/ui/components/watchlist/__tests__/CreateWatchlist.spec.ts b/src/ui/components/watchlist/__tests__/CreateWatchlist.spec.ts index 51f5421..f64b202 100644 --- a/src/ui/components/watchlist/__tests__/CreateWatchlist.spec.ts +++ b/src/ui/components/watchlist/__tests__/CreateWatchlist.spec.ts @@ -43,7 +43,7 @@ describe("CreateWatchlist Component", () => { await wrapper.setData({ title: "title", selectedFile: new File( - ["name,radius,ra,dec\nTarget 0,1.0,1.0,1.0"], + ["name,radius,ra,dec,filter\nTarget 0,1.0,1.0,1.0,{}"], "test.csv", { type: "text/csv" } ), @@ -93,9 +93,13 @@ describe("CreateWatchlist Component", () => { }); await wrapper.setData({ title: "title", - selectedFile: new File(["name,radius,ra,dec\na,b,c,d"], "test.csv", { - type: "text/csv", - }), + selectedFile: new File( + ["name,radius,ra,dec,filter\na,b,c,d,{}"], + "test.csv", + { + type: "text/csv", + } + ), }); const send = wrapper.find("#send"); await send.trigger("click"); @@ -113,7 +117,7 @@ describe("CreateWatchlist Component", () => { }); await wrapper.setData({ title: "title", - selectedFile: new File(["name,radius,ra,dec\n"], "test.csv", { + selectedFile: new File(["name,radius,ra,dec,filter\n"], "test.csv", { type: "text/csv", }), });