From 221ae60e5e1a61566c85b275fd4f5239e078060d Mon Sep 17 00:00:00 2001 From: Jeremy Myers Date: Thu, 8 Oct 2026 12:31:55 -0400 Subject: [PATCH] Tweak download endpoint and enable downloads --- src/api/client.ts | 2 +- src/components/LightcurveDataTable.tsx | 4 +--- src/components/SkyExplorer.tsx | 1 - src/configs/constants.ts | 2 +- src/types/index.ts | 2 +- tests/api/client.test.ts | 2 +- 6 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/api/client.ts b/src/api/client.ts index ca21b3a..b042741 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -295,7 +295,7 @@ export class LightcurveApiClient { } async downloadTableData(sourceId: string, ext: DataFileExtensions) { - const endpoint = `${this.baseUrl}/lightcurves/${sourceId}/all/download?format=${ext}`; + const endpoint = `${this.baseUrl}/lightcurves/${sourceId}.${ext}`; const url = await this.getUrl(endpoint, 'source-data'); const filename = this.makeFileName('source-data', sourceId, null, ext); this.download(url, filename); diff --git a/src/components/LightcurveDataTable.tsx b/src/components/LightcurveDataTable.tsx index 931b3d3..0fdd3a1 100644 --- a/src/components/LightcurveDataTable.tsx +++ b/src/components/LightcurveDataTable.tsx @@ -151,9 +151,7 @@ export function LightcurveDataTable({ type="button" className="download-data-btn" onClick={downloadData} - // title="Download light curve data" - title="This feature is currently unavailable." - disabled + title="Download light curve data" > diff --git a/src/components/SkyExplorer.tsx b/src/components/SkyExplorer.tsx index 7b7607d..61db6c2 100644 --- a/src/components/SkyExplorer.tsx +++ b/src/components/SkyExplorer.tsx @@ -194,7 +194,6 @@ export function SkyExplorer({ dataDownloadExt as DataFileExtensions ) } - disabled > diff --git a/src/configs/constants.ts b/src/configs/constants.ts index d897dd8..80f50dc 100644 --- a/src/configs/constants.ts +++ b/src/configs/constants.ts @@ -25,7 +25,7 @@ export const DEFAULT_SOURCES_PER_PAGE = Number( export const CUTOUT_EXT_OPTIONS = ['png', 'fits', 'hdf5']; -export const DATA_EXT_OPTIONS = ['hdf5', 'csv']; +export const DATA_EXT_OPTIONS = ['parquet', 'hdf5', 'csv']; export const BINNING_STRATEGY_OPTIONS: Exclude[] = [ '1 day', diff --git a/src/types/index.ts b/src/types/index.ts index 3e365a5..4fe005a 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -258,7 +258,7 @@ export type BinnedLightcurveData = { export type CutoutFileExtensions = 'fits' | 'png' | 'hdf5'; /** Literal type of possible light curve data file extensions */ -export type DataFileExtensions = 'csv' | 'hdf5'; +export type DataFileExtensions = 'csv' | 'hdf5' | 'parquet'; export function isFrequencyLightcurveData( obj: unknown diff --git a/tests/api/client.test.ts b/tests/api/client.test.ts index 02a68e4..3ffedb4 100644 --- a/tests/api/client.test.ts +++ b/tests/api/client.test.ts @@ -172,7 +172,7 @@ describe('LightcurveApiClient', () => { await client.downloadTableData('src-1', 'csv'); expect(fetchMock).toHaveBeenCalledWith( - `${BASE_URL}/lightcurves/src-1/all/download?format=csv` + `${BASE_URL}/lightcurves/src-1.csv` ); const anchor = appendChildSpy.mock.calls