Improve spreadsheet import flow (#839)

* feat: add dropdown to worksheet selection

* feat: move revoke to separate button

* refactor: extract excel flow to separate controller and service

* chore: show spinner when uploading sheet and disable the other option

* chore: don't show "success" when canceling the import

* chore: export boolean types properly to sheets
This commit is contained in:
Alex Christoffer Rasmussen
2024-03-22 21:33:11 +01:00
committed by GitHub
parent f4692db021
commit f5e9a2549e
33 changed files with 528 additions and 235 deletions
@@ -12,7 +12,7 @@ import got from 'got';
import { resolveSheetsDirectory } from '../../setup/index.js';
import { ensureDirectory } from '../../utils/fileManagement.js';
import { type ClientSecret, cellRequestFromEvent, getA1Notation, validateClientSecret } from './sheetUtils.js';
import { cellRequestFromEvent, type ClientSecret, getA1Notation, validateClientSecret } from './sheetUtils.js';
import { ImportMap } from 'ontime-utils';
import { parseExcel } from '../../utils/parser.js';
import { logger } from '../../classes/Logger.js';
@@ -190,11 +190,11 @@ function verifyConnection(
}
}
export function hasAuth(): { authenticated: AuthenticationStatus } {
export function hasAuth(): { authenticated: AuthenticationStatus; sheetId: string } {
if (cleanupTimeout) {
return { authenticated: 'pending' };
return { authenticated: 'pending', sheetId: currentSheetId };
}
return { authenticated: currentAuthClient ? 'authenticated' : 'not_authenticated' };
return { authenticated: currentAuthClient ? 'authenticated' : 'not_authenticated', sheetId: currentSheetId };
}
async function verifySheet(