From 8c6e4e8d343cc71fd5063d4086868ea651096812 Mon Sep 17 00:00:00 2001 From: charliecarlton Date: Thu, 22 Aug 2024 14:04:14 -0600 Subject: [PATCH 1/2] Generate assertions page with status table and timeout input --- client/screen.css | 5 + client/src/action/createFetchAction.ts | 7 +- .../DefineAudit/GenerateAssertionsPage.tsx | 139 +++++++++++++----- client/src/reducer/root.ts | 12 ++ client/src/types/dos.d.ts | 9 ++ 5 files changed, 134 insertions(+), 38 deletions(-) diff --git a/client/screen.css b/client/screen.css index 0d7a3633..1302ef14 100644 --- a/client/screen.css +++ b/client/screen.css @@ -947,3 +947,8 @@ th.rla-county-contest-info { display: inline-block; } + +.generate-assertions-exports { + float: right; + margin-right: 175px; +} diff --git a/client/src/action/createFetchAction.ts b/client/src/action/createFetchAction.ts index 73913322..7b06a060 100644 --- a/client/src/action/createFetchAction.ts +++ b/client/src/action/createFetchAction.ts @@ -19,7 +19,7 @@ function createFetchAction(config: CreateFetchConfig) { url, } = config; - async function fetchAction() { + async function fetchAction(queryParams: URLSearchParams | null = null) { action(sendType); const init: RequestInit = { @@ -28,7 +28,10 @@ function createFetchAction(config: CreateFetchConfig) { }; try { - const r = await fetch(url, init); + // append query string if provided + const fullUrl = queryParams ? `${url}?${queryParams.toString()}` : url; + + const r = await fetch(fullUrl, init); if (!r.ok) { action(failType); diff --git a/client/src/component/DOS/DefineAudit/GenerateAssertionsPage.tsx b/client/src/component/DOS/DefineAudit/GenerateAssertionsPage.tsx index f654e919..28a5e88d 100644 --- a/client/src/component/DOS/DefineAudit/GenerateAssertionsPage.tsx +++ b/client/src/component/DOS/DefineAudit/GenerateAssertionsPage.tsx @@ -1,11 +1,14 @@ +import counties from 'corla/data/counties'; +import * as _ from 'lodash'; import * as React from 'react'; -import { Breadcrumb, Button, Card, Intent } from '@blueprintjs/core'; +import { Breadcrumb, Button, Card, Intent, Spinner } from '@blueprintjs/core'; +import exportAssertionsAsCsv from 'corla/action/dos/exportAssertionsAsCsv'; +import exportAssertionsAsJson from 'corla/action/dos/exportAssertionsAsJson'; import generateAssertions from 'corla/action/dos/generateAssertions'; import DOSLayout from 'corla/component/DOSLayout'; -import exportAssertionsAsJson from "corla/action/dos/exportAssertionsAsJson"; -import exportAssertionsAsCsv from "corla/action/dos/exportAssertionsAsCsv"; +import AssertionStatus = DOS.AssertionStatus; const Breadcrumbs = () => (