refactor: improve sheet import UX

This commit is contained in:
Carlos Valente
2026-03-23 19:26:03 +01:00
committed by Carlos Valente
parent 42dcf35f45
commit f53cb687bf
39 changed files with 1739 additions and 910 deletions
+5 -1
View File
@@ -1,5 +1,9 @@
import axios, { AxiosResponse } from 'axios';
import type { SpreadsheetPreviewResponse, SpreadsheetWorksheetMetadata, SpreadsheetWorksheetOptions } from 'ontime-types';
import type {
SpreadsheetPreviewResponse,
SpreadsheetWorksheetMetadata,
SpreadsheetWorksheetOptions,
} from 'ontime-types';
import { ImportMap } from 'ontime-utils';
import { apiEntryUrl } from './constants';
+8 -2
View File
@@ -76,6 +76,9 @@ export const previewRundown = async (
return response.data;
};
/**
* Fetches derived metadata for a single worksheet by reading its rows and detecting headers.
*/
export const getWorksheetMetadata = async (
sheetId: string,
worksheet: string,
@@ -92,12 +95,15 @@ export const getWorksheetMetadata = async (
return response.data;
};
export const getWorksheetNames = async (
/**
* Fetches the available worksheets for a Google Sheet. Metadata is loaded lazily per worksheet.
*/
export const getWorksheetOptions = async (
sheetId: string,
requestOptions?: RequestOptions,
): Promise<SpreadsheetWorksheetOptions> => {
const response: AxiosResponse<SpreadsheetWorksheetOptions> = await axios.post(
`${sheetsPath}/${sheetId}/worksheets`,
`${sheetsPath}/${sheetId}/worksheet-options`,
undefined,
{
signal: requestOptions?.signal,