diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..884d9cb --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,16 @@ +FROM registry.hub.docker.com/library/node:24.1-bookworm@sha256:c332080545f1de96deb1c407e6fbe9a7bc2be3645e127845fdcce57a7af3cf56 as dev + +ENV APP_DIR /app + +# install pre-requisites +RUN apt-get update && \ + apt-get install -y curl && \ + apt-get clean + + +# COPY . ${APP_DIR} +WORKDIR ${APP_DIR} + + +# CMD ["npm", "run", "preview"] +CMD bash \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..1353392 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,61 @@ +{ + "name": "Squid - User Interfaces", + "build": { + // Sets the run context to one level up instead of the .devcontainer folder. + "context": "..", + // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. + "dockerfile": "./Dockerfile", + "target": "dev" + }, + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + // Some default things like git config, zsh and ssh keys + "ghcr.io/devcontainers/features/common-utils:2": { + "upgradePackages": false + } + }, + // "initializeCommand": "bash -c 'for i in $HOME/.inputrc; do [ -f $i ] || touch $i; done'", + "runArgs": [ + "--net=host", + "--security-opt=label=disable", + // Mount the user sockets folder + "-v${localEnv:XDG_RUNTIME_DIR}:${localEnv:XDG_RUNTIME_DIR}", + // add the docker socket environment variable to the container + "-e=DOCKER_HOST=${localEnv:DOCKER_HOST}" + ], + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 8080 + ], + "mounts": [ + "source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind", + "source=${localEnv:HOME}/.inputrc,target=/root/.inputrc,type=bind" + ], + "customizations": { + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "bierner.markdown-mermaid", + "christian-kohler.path-intellisense", + "eamodio.gitlens", + "espenp.prettier-vscode", + "foxundermoon.shell-format", + "hediet.vscode-drawio", + "rvest.vs-code-prettier-eslint", + "rodrigovallades.es7-react-js", + "Vercel.turbo-vsc", + "kamikillerto.vscode-colorize", + "vitest.explorer", + "naumovs.color-highlight" + ] + } + }, + // make the workspace folder the same inside and outside of the container + "workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind", + "workspaceFolder": "${localWorkspaceFolder}", + // for rootless we must not to mess with user ids inside the container + "updateRemoteUserUID": false, + // for rootless we are root inside the container + "remoteUser": "root", + "postStartCommand": "yarn" +} \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..ef58ff9 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "trailingComma": "es5", + "tabWidth": 4, + "semi": false, + "singleQuote": true +} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..7e411ba --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,6 @@ +const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended'); + +module.exports = [ + // Any other config imports go at the top + eslintPluginPrettierRecommended, +]; diff --git a/package.json b/package.json index 8c8a369..2dd9fab 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "scripts": { "start": "react-scripts start", "build": "react-scripts build", + "lint": "yarn prettier \"src/**/*.{js,jsx,ts,tsx}\" --write", "test": "react-scripts test", "eject": "react-scripts eject" }, @@ -53,7 +54,9 @@ ] }, "devDependencies": { + "eslint-config-prettier": "^10.1.5", + "eslint-plugin-prettier": "^5.4.1", "openapi-typescript": "^6.7.2", - "prettier": "3.3.1" + "prettier": "^3.5.3" } -} +} \ No newline at end of file diff --git a/src/components/InstrumentInfoCard.tsx b/src/components/InstrumentInfoCard.tsx new file mode 100644 index 0000000..2078699 --- /dev/null +++ b/src/components/InstrumentInfoCard.tsx @@ -0,0 +1,53 @@ + +import { + Card, + CardBody, + CardHeader, + Image, + Link, + Text +} from '@chakra-ui/react' + +import { Link as LinkRouter } from 'react-router-dom' +import { InstrumentInfo } from 'utils/types' + + +const getUrl = (endpoint: string) => { + return process.env.REACT_APP_HUB_ENDPOINT + endpoint +} + + +type InstrumentInfoCardProps = { + sessionStorageSetup: (ininfo: InstrumentInfo) => void + ini: InstrumentInfo +} + +export function InstrumentInfoCard({ sessionStorageSetup, ini }: InstrumentInfoCardProps) { + const imgUrl = getUrl( + `instrument/${ini.instrument_name}/image` + ) + const linkTarget = process.env.REACT_APP_BACKEND_AUTH_TYPE === + 'cookie' + ? `/home` + : `/login` + + return + sessionStorageSetup(ini)} + > + + + + + {ini.display_name} + + + +} diff --git a/src/components/SessionRow.tsx b/src/components/SessionRow.tsx new file mode 100644 index 0000000..e72af21 --- /dev/null +++ b/src/components/SessionRow.tsx @@ -0,0 +1,208 @@ + +import { + Button, + GridItem, + Heading, + HStack, + IconButton, + Link, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + Stack, + Stat, + StatLabel, + Tooltip, + useDisclosure, + VStack +} from '@chakra-ui/react' + +import { sessionTokenCheck } from 'loaders/jwt' +import { finaliseSession } from 'loaders/rsyncers' +import { deleteSessionData } from 'loaders/session_clients' +import { GiMagicBroom } from 'react-icons/gi' +import { MdDelete } from 'react-icons/md' +import { Link as LinkRouter } from 'react-router-dom' +import { PuffLoader } from 'react-spinners' + +import React, { useEffect } from 'react' +import { Session } from "utils/types" + +export const SessionRow = (session: Session) => { + const { + isOpen: isOpenDelete, + onOpen: onOpenDelete, + onClose: onCloseDelete, + } = useDisclosure() + const { + isOpen: isOpenCleanup, + onOpen: onOpenCleanup, + onClose: onCloseCleanup, + } = useDisclosure() + + const cleanupSession = async (sessid: number) => { + await finaliseSession(sessid) + onCloseCleanup() + } + + const [sessionActive, setSessionActive] = React.useState(false) + + useEffect(() => { + sessionTokenCheck(session.id).then((active) => setSessionActive(active)) + }, []) + + if (!session) { + return + + + + None Found + + + + + + } + + return ( + + + + + + + + Confirm removing session {session.name}{' '} + from list + + + + Are you sure you want to continue? This + action is not reversible + + + + + + + + + + + + Confirm removing files for session{' '} + {session.name} + + + + Are you sure you want to continue? This + action is not reversible + + + + + + + + + + + + + {session.name}: {session.id} + + {sessionActive ? ( + + ) : ( + <> + )} + + + + + + } + onClick={onOpenDelete} + isDisabled={sessionActive} + /> + + + } + onClick={onOpenCleanup} + isDisabled={!sessionActive} + /> + + + + + + ) +} diff --git a/src/components/SpaForm.tsx b/src/components/SpaForm.tsx new file mode 100644 index 0000000..5eb415e --- /dev/null +++ b/src/components/SpaForm.tsx @@ -0,0 +1,166 @@ + +import { + Button, + FormControl, + FormLabel, + HStack, + Input, + NumberDecrementStepper, + NumberIncrementStepper, + NumberInput, + NumberInputField, + NumberInputStepper, + Select, + Switch, + VStack +} from '@chakra-ui/react' +import { ChangeEvent, FormEvent, useState } from 'react' +import { angstromHtmlChar } from 'utils/constants' + + +export const formDataSPA: Record = { + type: 'SPA', + dose_per_frame: 1, + symmetry: 'C1', + particle_diameter: null, + extract_downscale: true, + eer_fractionation: 20, +} + + +function validateData(formData: FormData): Record { + formDataSPA.dose_per_frame = formData.get('dose') + formDataSPA.symmetry = ['T', 'O'].includes( + formData.get('symmetry1') as string + ) + ? (formData.get('symmetry1') as string) + : (((formData.get('symmetry1') as string) + + formData.get('symmetry2')) as string) + formDataSPA.particle_diameter = formData.get('detect-particle-size') + ? null + : formData.get('particle-diameter') + formDataSPA.eer_fractionation = formData.get('eer-grouping') + return formDataSPA +} + +export const SpaForm = (submissionCallback: (arg0: any) => void) => { + const validateInt = (char: string) => { + return /\d/.test(char) + } + // const validateFloat = (char: string) => { + // return /^\d*\.?\d*$/.test(char) + // } + const [symmetryType, setSymmetryType] = useState('C') + const [particleDetection, setParticleDetection] = useState(true) + const handleChange = (event: ChangeEvent) => { + setSymmetryType(event.target.value) + } + const handleSwitchChange = (_: ChangeEvent) => { + setParticleDetection(!particleDetection) + } + + const handleFormSubmission = (e: FormEvent) => { + e.preventDefault() + const formData = new FormData(e.currentTarget) + const data = validateData(formData) + submissionCallback(data) + } + + return ( +
+ + + + + + {`Dose per frame [${angstromHtmlChar} / pixel]`} + + + + + Symmetry + + + + + + + + + + + + + + { + 'EER grouping (number of EER frames in each fraction)' + } + + + + + + + Automatically detect particle size + + + + + {!particleDetection ? ( + + + {`Particle diameter [${angstromHtmlChar}]`} + + + + ) : ( + <> + )} + + + Downscale in extraction + + + + + + + +
+ ) +} \ No newline at end of file diff --git a/src/components/TomoForm.tsx b/src/components/TomoForm.tsx new file mode 100644 index 0000000..10d9ae2 --- /dev/null +++ b/src/components/TomoForm.tsx @@ -0,0 +1,63 @@ + +import { + Button, + FormControl, + FormLabel, + Input, + VStack +} from '@chakra-ui/react' +import { formDataSPA } from './SpaForm' +import { angstromHtmlChar } from 'utils/constants' + + +// NOTE: is this necessary? +const formDataTomo: Record = { + type: 'tomo', + dose_per_frame: 0.5, + eer_fractionation: 20, +} + + +export const TomoForm = (submissionCallback: (arg0: any) => void) => { + const setFormElement = ( + event: React.FormEvent, + callback: (arg0: any) => void + ) => { + event.preventDefault() + const formData = new FormData(event.currentTarget) + // NOTE is this correct? as formDataTomo is unused + formDataSPA.dose_per_frame = formData.get('dose') + formDataSPA.eer_fractionation = formData.get('eer-grouping') + callback(formDataSPA) + } + return ( +
setFormElement(e, submissionCallback)}> + + + + + + {`Dose per frame [${angstromHtmlChar} / pixel]`} + + + + + + { + 'EER grouping (number of EER frames in each fraction)' + } + + + + + + + +
+ ) +} diff --git a/src/components/forms.tsx b/src/components/forms.tsx index 0b30080..2289345 100644 --- a/src/components/forms.tsx +++ b/src/components/forms.tsx @@ -1,184 +1,19 @@ -import { - Button, - Divider, - Text, - FormControl, - FormLabel, - Input, - NumberInput, - NumberInputField, - NumberInputStepper, - NumberIncrementStepper, - NumberDecrementStepper, - RadioGroup, - Radio, - HStack, - VStack, - Select, - Switch, - Link, -} from "@chakra-ui/react"; -import { Link as LinkRouter } from "react-router-dom"; -import React, { ReactElement } from "react"; - -const formDataSPA: {[key: string]: any} = { - "type": "SPA", - "dose_per_frame": 1, - "symmetry": "C1", - "particle_diameter": null, - "extract_downscale": true, - "eer_fractionation": 20, -}; - -const formDataTomo: {[key: string]: any} = { - "type": "tomo", - "dose_per_frame": 0.5, - "eer_fractionation": 20, -} - - -const SpaForm = (submissionCallback: (arg0: any) => void) => { - const validateInt = (char: string) => { - return /\d/.test(char); - }; - const validateFloat = (char: string) => { - return /^\d*\.?\d*$/.test(char); - }; - const [symmetryType, setSymmetryType] = React.useState("C"); - const [particleDetection, setParticleDetection] = React.useState(true); - const handleChange = (event: React.ChangeEvent) => { - setSymmetryType(event.target.value); - }; - const handleSwitchChange = (event: React.ChangeEvent) => { - setParticleDetection(!particleDetection); - }; - const setFormElement = (event: React.FormEvent, callback: (arg0: any) => void) => { - event.preventDefault(); - const formData = new FormData(event.currentTarget); - formDataSPA.dose_per_frame = formData.get("dose"); - formDataSPA.symmetry = (["T", "O"].includes(formData.get("symmetry1") as string)) ? formData.get("symmetry1") as string: formData.get("symmetry1") as string + formData.get("symmetry2") as string; - formDataSPA.particle_diameter = formData.get("detect-particle-size")? null: formData.get("particle-diameter"); - formDataSPA.eer_fractionation = formData.get("eer-grouping"); - callback(formDataSPA); - }; - - return ( -
setFormElement(e, submissionCallback)}> - - - - - {"Dose per frame [\u212B / pixel]"} - - - - Symmetry - - - - - - - - - - - - - {"EER grouping (number of EER frames in each fraction)"} - - - - - Automatically detect particle size - - - - {!particleDetection ? ( - - {"Particle diameter [\u212B]"} - - - ) : ( - <> - )} - - - Downscale in extraction - - - - - - - -
- ); -}; - -const TomoForm = (submissionCallback: (arg0: any) => void) => { - const setFormElement = (event: React.FormEvent, callback: (arg0: any) => void) => { - event.preventDefault(); - const formData = new FormData(event.currentTarget); - formDataSPA.dose_per_frame = formData.get("dose"); - formDataSPA.eer_fractionation = formData.get("eer-grouping"); - callback(formDataSPA); - }; - return ( -
setFormElement(e, submissionCallback)}> - - - - - {"Dose per frame [\u212B / pixel]"} - - - - {"EER grouping (number of EER frames in each fraction)"} - - - - - - -
- ); -}; +import { ReactElement } from 'react' +import { SpaForm } from './SpaForm' +import { TomoForm } from './TomoForm' interface Forms { - [expType: string]: ReactElement; + [expType: string]: ReactElement } -export const getForm = (expType: string, submissionCallback: (arg0: any) => void) => { - let forms = { - spa: SpaForm(submissionCallback), - tomography: TomoForm(submissionCallback), - } as Forms; - return forms[expType]; -}; +export const getForm = ( + expType: string, + submissionCallback: (arg0: any) => void +) => { + let forms = { + spa: SpaForm(submissionCallback), + tomography: TomoForm(submissionCallback), + } as Forms + return forms[expType] +} diff --git a/src/components/getUrlFromSessionStorage.tsx b/src/components/getUrlFromSessionStorage.tsx new file mode 100644 index 0000000..91291b7 --- /dev/null +++ b/src/components/getUrlFromSessionStorage.tsx @@ -0,0 +1,5 @@ +export const getUrlFromSessionStorage = (endpoint: string): string => { + return ( + `${sessionStorage.getItem('murfeyServerURL') ?? process.env.REACT_APP_API_ENDPOINT})${endpoint}` + ); +}; diff --git a/src/components/gridSquareCard.tsx b/src/components/gridSquareCard.tsx index 72dd4c5..3414273 100644 --- a/src/components/gridSquareCard.tsx +++ b/src/components/gridSquareCard.tsx @@ -1,82 +1,153 @@ -import { CardBody, Card, CardHeader, Image, Text, Box, Tooltip, VStack, Slider, SliderTrack, SliderFilledTrack, SliderThumb } from "@chakra-ui/react"; +import { + CardBody, + Card, + CardHeader, + Image, + Text, + Box, + Tooltip, + VStack, + Slider, + SliderTrack, + SliderFilledTrack, + SliderThumb, +} from '@chakra-ui/react' -import { components } from "schema/main"; -import { getFoilHoles, getNumMovies } from "loaders/gridSquares"; +import { components } from 'schema/main' +import { getFoilHoles, getNumMovies } from 'loaders/gridSquares' -import { useState, useEffect } from "react"; +import { useState, useEffect } from 'react' +import { getUrlFromSessionStorage } from './getUrlFromSessionStorage' -type GridSquare = components["schemas"]["GridSquare"]; -type FoilHole = components["schemas"]["FoilHole"]; +type GridSquare = components['schemas']['GridSquare'] +type FoilHole = components['schemas']['FoilHole'] -const getUrl = (endpoint: string) => { - return (sessionStorage.getItem("murfeyServerURL") ?? process.env.REACT_APP_API_ENDPOINT) + endpoint; -}; +const zip = (a: number[], b: number[]) => a.map((k, i) => [k, b[i]]) -const GridSquareCard = (gs: GridSquare, sessid: string | undefined, dcgid: string | undefined) => { - const [numFoilHoles, setNumFoilHoles] = useState(0); - const [numMovies, setNumMovies] = useState(0); - const [foilHoleXPositions, setFoilHoleXPositions] = useState([]); - const [foilHoleYPositions, setFoilHoleYPositions] = useState([]); - const [foilHoleNames, setFoilHoleNames] = useState([]); - const [foilHoleImages, setFoilHoleImages] = useState<(string | null)[]>([]); - const [sliderValue, setSliderValue] = useState(10); - const foilHoleSetup = (foilHoles: FoilHole[]) => { - let xpositions: number[] = []; - let ypositions = []; - let names: number[] = []; - let images: (string | null)[] = []; - for(let i=0; i { + const [numFoilHoles, setNumFoilHoles] = useState(0) + const [numMovies, setNumMovies] = useState(0) + const [foilHoleXPositions, setFoilHoleXPositions] = useState([]) + const [foilHoleYPositions, setFoilHoleYPositions] = useState([]) + const [foilHoleNames, setFoilHoleNames] = useState([]) + const [foilHoleImages, setFoilHoleImages] = useState<(string | null)[]>([]) + const [sliderValue, setSliderValue] = useState(10) + + // TODO ideally this is simplified + const foilHoleSetup = (foilHoles: FoilHole[]) => { + let xpositions: number[] = [] + let ypositions: number[] = [] + let names: number[] = [] + let images: (string | null)[] = [] + for (let i = 0; i < foilHoles.length; i++) { + let x: number | undefined = foilHoles[i].x_location + if (gs.thumbnail_size_x && gs.readout_area_x && x) { + x = x * (gs.thumbnail_size_x / gs.readout_area_x) + } + let y = foilHoles[i].y_location + if (gs.thumbnail_size_y && gs.readout_area_y && y) { + y = y * (gs.thumbnail_size_y / gs.readout_area_y) + } + if (x) xpositions.push(Math.floor(x)) + if (y) ypositions.push(Math.floor(y)) + if (x) names.push(foilHoles[i].name) + const image = foilHoles[i].image + if (x) { + images.push(image ?? null) + } + } + setFoilHoleXPositions(xpositions) + setFoilHoleYPositions(ypositions) + setFoilHoleNames(names) + setFoilHoleImages(images) + setNumFoilHoles(foilHoles.length) + } + + useEffect(() => { + getFoilHoles(sessid ?? '0', dcgid ?? '0', gs.name).then((fhs) => + foilHoleSetup(fhs) + ) + getNumMovies(sessid ?? '0', dcgid ?? '0', gs.name).then((nm) => + setNumMovies(nm) + ) + }, []) + + + const foilHoleTooltip = (fhName: number, fhImage: string | null) => { + const fhImageUrl = getUrlFromSessionStorage( + `display/sessions/${sessid}/data_collection_groups/${dcgid}/grid_squares/${gs.name}/foil_holes/${fhName}/image` + ) + return ( + + {fhName} + {fhImage ? : <>} + + ) } - setFoilHoleXPositions(xpositions); - setFoilHoleYPositions(ypositions); - setFoilHoleNames(names); - setFoilHoleImages(images); - setNumFoilHoles(foilHoles.length); - } - useEffect(() => { - getFoilHoles(sessid ?? "0", dcgid ?? "0", gs.name).then((fhs) => foilHoleSetup(fhs)); - getNumMovies(sessid ?? "0", dcgid ?? "0", gs.name).then((nm) => setNumMovies(nm)); - }, - []); - const zip = (a: number[], b: number[]) => a.map((k, i) => [k, b[i]]); - - const foilHoleTooltip = (fhName: number, fhImage: string | null) => { - const fhImageUrl = getUrl(`display/sessions/${sessid}/data_collection_groups/${dcgid}/grid_squares/${gs.name}/foil_holes/${fhName}/image`); - return - {fhName} - {fhImage ? : <>} - - } + const imgUrl = getUrlFromSessionStorage( + `display/sessions/${sessid}/data_collection_groups/${dcgid}/grid_squares/${gs.name}/image` + ) - return - {gs.name} - - - - - {zip(foilHoleXPositions, foilHoleYPositions).map((pos, index) => )} - - - {numFoilHoles} foil holes - {numMovies} movies - setSliderValue(val)} > - - - - - - - + return ( + + {gs.name} + + + + + {zip(foilHoleXPositions, foilHoleYPositions).map( + (pos, index) => ( + + + + ) + )} + + + {numFoilHoles} foil holes + {numMovies} movies + setSliderValue(val)} + > + + + + + + + + ) } -export { GridSquareCard }; +export { GridSquareCard } diff --git a/src/components/instrumentCard.tsx b/src/components/instrumentCard.tsx index f678795..82cf893 100644 --- a/src/components/instrumentCard.tsx +++ b/src/components/instrumentCard.tsx @@ -1,47 +1,46 @@ -import { - Card, - CardBody, - CardHeader, - Image, - Link, - Text, -} from "@chakra-ui/react"; +import { Card, CardBody, CardHeader, Image, Link, Text } from '@chakra-ui/react' -import { Link as LinkRouter } from "react-router-dom"; -import { getInstrumentName } from "loaders/general"; +import { getInstrumentName } from 'loaders/general' +import { Link as LinkRouter } from 'react-router-dom' + +import { useEffect, useState } from 'react' +import { getUrlFromSessionStorage } from './getUrlFromSessionStorage' -import React, { useEffect } from "react"; -const getUrl = (endpoint: string) => { - return (sessionStorage.getItem("murfeyServerURL") ?? process.env.REACT_APP_API_ENDPOINT) + endpoint; -}; const InstrumentCard = () => { - const [instrumentName, setInstrumentName] = React.useState(""); - - const resolveName = async () => { - const name: string = await getInstrumentName(); - setInstrumentName(name); - }; - useEffect(() => {resolveName()}, []); - - return ( - - - - - - - {instrumentName} - - - - ); -}; - -export { InstrumentCard }; + const [instrumentName, setInstrumentName] = useState('') + + const resolveName = async () => { + const name: string = await getInstrumentName() + setInstrumentName(name) + } + useEffect(() => { + resolveName() + }, []) + + const imgUrl = getUrlFromSessionStorage( + `display/instruments/${sessionStorage.getItem('instrumentName')}/image/` + ) + return ( + + + + + + + {instrumentName} + + + + ) +} + +export { InstrumentCard } diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx index ffc7373..ff3a9f8 100644 --- a/src/components/navbar.tsx +++ b/src/components/navbar.tsx @@ -1,165 +1,173 @@ import { - Box, - Flex, - HStack, - Link, - IconButton, - useDisclosure, - Image, - Tooltip, - VStack, - BoxProps, - Icon, -} from "@chakra-ui/react"; + Box, + Flex, + HStack, + Link, + IconButton, + useDisclosure, + Image, + Tooltip, + VStack, + BoxProps, + Icon, +} from '@chakra-ui/react' import { - MdMenu, - MdClose, - MdSignalWifi4Bar, - MdOutlineSignalWifiBad, -} from "react-icons/md"; -import { TbMicroscope, TbSnowflake } from "react-icons/tb"; -import { getInstrumentConnectionStatus } from "loaders/general"; -import { Link as LinkRouter } from "react-router-dom"; -import React from "react"; + MdMenu, + MdClose, + MdSignalWifi4Bar, + MdOutlineSignalWifiBad, +} from 'react-icons/md' +import { TbMicroscope, TbSnowflake } from 'react-icons/tb' +import { getInstrumentConnectionStatus } from 'loaders/general' +import { Link as LinkRouter } from 'react-router-dom' +import React from 'react' export interface LinkDescriptor { - label: string; - route: string; + label: string + route: string } interface BaseLinkProps { - links?: LinkDescriptor[]; - as?: React.ElementType; + links?: LinkDescriptor[] + as?: React.ElementType } export interface NavbarProps extends BaseLinkProps, BoxProps { - logo?: string | null; - children?: React.ReactElement; + logo?: string | null + children?: React.ReactElement } const NavLinks = ({ links, as }: BaseLinkProps) => ( - <> - {links - ? links.map((link) => ( - - {link.label} - - )) - : null} - -); + <> + {links + ? links.map((link) => ( + + {link.label} + + )) + : null} + +) const Navbar = ({ links, as, children, logo, ...props }: NavbarProps) => { - const { isOpen, onOpen, onClose } = useDisclosure(); - const [instrumentConnectionStatus, setInsrumentConnectionStatus] = - React.useState(false); + const { isOpen, onOpen, onClose } = useDisclosure() + const [instrumentConnectionStatus, setInsrumentConnectionStatus] = + React.useState(false) - const resolveConnectionStatus = async () => { - const status: boolean = await getInstrumentConnectionStatus(); - setInsrumentConnectionStatus(status); - }; - resolveConnectionStatus(); + const resolveConnectionStatus = async () => { + const status: boolean = await getInstrumentConnectionStatus() + setInsrumentConnectionStatus(status) + } + resolveConnectionStatus() - return ( - - - : } - aria-label={"Open Menu"} - display={{ md: "none" }} - bg="transparent" - border="none" - _hover={{ background: "transparent", color: "murfey.500" }} - onClick={isOpen ? onClose : onOpen} - /> - - {logo ? ( - - - Home + + : } + aria-label={'Open Menu'} + display={{ md: 'none' }} + bg="transparent" + border="none" + _hover={{ background: 'transparent', color: 'murfey.500' }} + onClick={isOpen ? onClose : onOpen} /> - - - ) : null} - - - } - aria-label={"Back to the Hub"} - _hover={{ background: "transparent", color: "murfey.500" }} - /> - - - - - - - - - - {children} - - {isOpen && ( - - - - )} - - ); -}; + + {logo ? ( + + + Home + + + ) : null} + + + + + + + } + aria-label={'Back to the Hub'} + _hover={{ + background: 'transparent', + color: 'murfey.500', + }} + /> + + + + + + + + + + {children} + + {isOpen && ( + + + + )} + + ) +} -export { Navbar }; +export { Navbar } diff --git a/src/components/protectedRoutes.tsx b/src/components/protectedRoutes.tsx index d855a09..b856762 100644 --- a/src/components/protectedRoutes.tsx +++ b/src/components/protectedRoutes.tsx @@ -1,19 +1,23 @@ -import { Navigate, Outlet } from "react-router-dom"; -import { Box } from "@chakra-ui/react"; -import { Navbar } from "components/navbar"; +import { Navigate, Outlet } from 'react-router-dom' +import { Box } from '@chakra-ui/react' +import { Navbar } from 'components/navbar' const ProtectedRoutes = () => { - // Read environment variable and demand user login if authenticating with 'password' - const sessionToken = sessionStorage.getItem("token"); - const standard =
- - - - - - -
- return (process.env.REACT_APP_BACKEND_AUTH_TYPE === "cookie") ? standard: sessionToken ? standard : ; -}; + // Read environment variable and demand user login if authenticating with 'password' + const sessionToken = sessionStorage.getItem('token') + // if at least one of those is true, use that as the session + if ([process.env.REACT_APP_BACKEND_AUTH_TYPE === 'cookie', sessionToken !== null].some(v => v === true)) { -export { ProtectedRoutes }; + return
+ + + + + + +
+ } + return +} + +export { ProtectedRoutes } diff --git a/src/components/setupStepper.tsx b/src/components/setupStepper.tsx index 4abffbf..f95648a 100644 --- a/src/components/setupStepper.tsx +++ b/src/components/setupStepper.tsx @@ -1,62 +1,73 @@ import { - Box, - Step, - StepDescription, - StepIcon, - StepIndicator, - StepNumber, - StepSeparator, - StepStatus, - StepTitle, - Stepper, - useSteps, -} from "@chakra-ui/react"; - -import React from "react"; - -const getUrl = (endpoint: string) => { - return (sessionStorage.getItem("murfeyServerURL") ?? process.env.REACT_APP_API_ENDPOINT) + endpoint; -}; + Box, + Step, + StepDescription, + StepIcon, + StepIndicator, + StepNumber, + StepSeparator, + StepStatus, + StepTitle, + Stepper, + useSteps, +} from '@chakra-ui/react' + +import React from 'react' interface StepperStartConditions { - activeStepIndex: number; + activeStepIndex: number } -const SetupStepper = ({ activeStepIndex }: StepperStartConditions) => { - const steps = [ - { title: "Visit", description: "Select visit" }, - { title: "Gain reference", description: "Transfer and transform" }, - { title: "Data location", description: "Start data transfer" }, - { title: "Parameters", description: "For processing" }, - ]; - - const { activeStep } = useSteps({ - index: activeStepIndex, - count: steps.length, - }); - - return ( - - {steps.map((step, index) => ( - - + +interface Step { + title: string, + description: string +} + +const steps: Step[] = [ + { title: 'Visit', description: 'Select visit' }, + { title: 'Gain reference', description: 'Transfer and transform' }, + { title: 'Data location', description: 'Start data transfer' }, + { title: 'Parameters', description: 'For processing' }, +] + +type StepDisplayProps = { + step: Step, + index: number +} + +function StepDisplay({ index, step }: StepDisplayProps) { + return + } - incomplete={} - active={} - /> - + complete={} + incomplete={} + active={} /> + - + {step.title} {step.description} - + + + + +} + - - - ))} - - ); -}; +const SetupStepper = ({ activeStepIndex }: StepperStartConditions) => { + const { activeStep } = useSteps({ + index: activeStepIndex, + count: steps.length, + }) + + return ( + + {steps.map((step, index) => ( + + ))} + + ) +} -export { SetupStepper }; +export { SetupStepper } diff --git a/src/components/upstreamVisitsCard.tsx b/src/components/upstreamVisitsCard.tsx index f834db4..be07724 100644 --- a/src/components/upstreamVisitsCard.tsx +++ b/src/components/upstreamVisitsCard.tsx @@ -1,39 +1,48 @@ -import { - Card, - CardBody, - Button, - CardHeader, - } from "@chakra-ui/react"; - - import { getUpstreamVisits, upstreamDataDownloadRequest } from "loaders/general"; - import { MdFileDownload } from "react-icons/md"; - - import React, { useEffect } from "react"; - - interface SessionId { +import { Card, CardBody, Button, CardHeader } from '@chakra-ui/react' + +import { getUpstreamVisits, upstreamDataDownloadRequest } from 'loaders/general' +import { MdFileDownload } from 'react-icons/md' + +import React, { useEffect } from 'react' + +interface SessionId { sessid: number - } +} - const UpstreamVisitCard = ({ sessid }: SessionId) => { - const [upstreamVisits, setUpstreamVisits] = React.useState({}); +const UpstreamVisitCard = ({ sessid }: SessionId) => { + const [upstreamVisits, setUpstreamVisits] = React.useState>({}) const resolveVisits = async () => { - const visits = await getUpstreamVisits(sessid); - setUpstreamVisits(visits); - console.log(upstreamVisits); - }; - useEffect(() => {resolveVisits()}, []); - - return ((upstreamVisits ? + const visits = await getUpstreamVisits(sessid) + setUpstreamVisits(visits) + console.log(upstreamVisits) + } + useEffect(() => { + resolveVisits() + }, []) + + const keys = Object.keys(upstreamVisits); + + if (keys.length == 0) { + return
No visits available to download data for
+ } + + return Upstream Visit Data Download - {Object.keys(upstreamVisits).map((k) => { - return ( - - - + {keys.map((visitName) => + + + ) - })}: <>)); - }; - - export { UpstreamVisitCard }; - \ No newline at end of file + } +
+} + +export { UpstreamVisitCard } diff --git a/src/index.tsx b/src/index.tsx index b65c8ba..08cdfff 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,147 +1,146 @@ -import React, { Suspense } from "react"; -import { createRoot } from "react-dom/client"; -import { ChakraProvider, createStandaloneToast } from "@chakra-ui/react"; +import React, { Suspense } from 'react' +import { createRoot } from 'react-dom/client' +import { ChakraProvider, createStandaloneToast } from '@chakra-ui/react' +import { createBrowserRouter, Navigate, RouterProvider } from 'react-router-dom' +import { Root } from 'routes/Root' +import { DataCollectionGroups } from 'routes/DataCollectionGroups' +import { GridSquares } from 'routes/GridSquares' +import { Home } from 'routes/Home' +import { Hub } from 'routes/Hub' +import { Session } from 'routes/Session' +import { NewSession } from 'routes/NewSession' +import { SessionLinker } from 'routes/SessionLinker' +import { GainRefTransfer } from 'routes/GainRefTransfer' +import { SessionSetup } from 'routes/SessionSetup' +import { MagTable } from 'routes/MagTable' +import { ProcessingParameters } from 'routes/ProcessingParameters' +import { SessionParameters } from 'routes/SessionParameters' +import { Error } from 'routes/Error' +import { sessionsLoader, sessionLoader } from 'loaders/session_clients' +import { rsyncerLoader } from 'loaders/rsyncers' +import { visitLoader } from 'loaders/visits' +import { gainRefLoader } from 'loaders/possibleGainRefs' +import { instrumentInfoLoader } from 'loaders/hub' +import { magTableLoader } from 'loaders/magTable' import { - createBrowserRouter, - Navigate, - RouterProvider, -} from "react-router-dom"; -import { Root } from "routes/Root"; -import { DataCollectionGroups } from "routes/DataCollectionGroups"; -import { GridSquares } from "routes/GridSquares"; -import { Home } from "routes/Home"; -import { Hub } from "routes/Hub"; -import { Session } from "routes/Session"; -import { NewSession } from "routes/NewSession"; -import { SessionLinker } from "routes/SessionLinker"; -import { GainRefTransfer } from "routes/GainRefTransfer"; -import { SessionSetup } from "routes/SessionSetup"; -import { MagTable } from "routes/MagTable"; -import { ProcessingParameters } from "routes/ProcessingParameters"; -import { SessionParameters } from "routes/SessionParameters"; -import { Error } from "routes/Error"; -import { - sessionsLoader, - sessionLoader, -} from "loaders/session_clients"; -import { rsyncerLoader } from "loaders/rsyncers"; -import { visitLoader } from "loaders/visits"; -import { gainRefLoader } from "loaders/possibleGainRefs"; -import { instrumentInfoLoader } from "loaders/hub"; -import { magTableLoader } from "loaders/magTable"; -import { processingParametersLoader, sessionParametersLoader } from "loaders/processingParameters"; -import { dataCollectionGroupsLoader } from "loaders/dataCollectionGroups"; -import { theme } from "styles/theme"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { ReactQueryDevtools } from "@tanstack/react-query-devtools"; -import { MultigridSetup } from "routes/MultigridSetup"; -import { machineConfigLoader } from "loaders/machineConfig"; -import { ProtectedRoutes } from "components/protectedRoutes"; -import { Login } from "routes/Login"; -import { gridSquaresLoader } from "loaders/gridSquares"; + processingParametersLoader, + sessionParametersLoader, +} from 'loaders/processingParameters' +import { dataCollectionGroupsLoader } from 'loaders/dataCollectionGroups' +import { theme } from 'styles/theme' +import { QueryClient, QueryClientProvider } from '@tanstack/react-query' +import { ReactQueryDevtools } from '@tanstack/react-query-devtools' +import { MultigridSetup } from 'utils/MultigridSetup' +import { machineConfigLoader } from 'loaders/machineConfig' +import { ProtectedRoutes } from 'components/protectedRoutes' +import { Login } from 'routes/Login' +import { gridSquaresLoader } from 'loaders/gridSquares' -const { ToastContainer } = createStandaloneToast(); -const container = document.getElementById("root")!; -const root = createRoot(container); +const { ToastContainer } = createStandaloneToast() +const container = document.getElementById('root')! +const root = createRoot(container) const queryClient = new QueryClient({ - defaultOptions: { queries: { staleTime: 1.08e7 } }, -}); + defaultOptions: { queries: { staleTime: 1.08e7 } }, +}) const router = createBrowserRouter([ - { - path: "/hub", - element: , - errorElement: , - loader: instrumentInfoLoader(queryClient), - }, - { - path: "/login", - element: , - errorElement: , - }, - { - path: "/", - element: , - errorElement: , - children: [ - { - path: "/home", - element: , - errorElement: , - loader: sessionsLoader(queryClient), - }, - { - path: "/sessions/:sessid", - element: , - errorElement: , - loader: ({ params }) => rsyncerLoader(queryClient)(params), - }, - { - path: "/instruments/:instrumentName/new_session", - element: , - errorElement: , - loader: ({ params }) => visitLoader(queryClient)(params), - }, - { - path: "/new_session/setup/:sessid", - element: , - errorElement: , - loader: machineConfigLoader(queryClient), - }, - { - path: "/sessions/:sessid/gain_ref_transfer", - element: , - errorElement: , - loader: ({ params }) => gainRefLoader(queryClient)(params), - }, - { - path: "/new_session/parameters/:sessid", - element: , - errorElement: , - loader: ({ params }) => sessionLoader(queryClient)(params), - }, - { - path: "/sessions/:sessid/session_parameters/extra_parameters", - element: , - errorElement: , - loader: ({ params }) => processingParametersLoader(queryClient)(params), - }, - { - path: "/sessions/:sessid/session_parameters", - element: , - errorElement: , - loader: ({ params }) => sessionParametersLoader(queryClient)(params), - }, - { - path: "/mag_table", - element: , + { + path: '/hub', + element: , errorElement: , - loader: magTableLoader(queryClient), - }, - { - path: "/sessions/:sessid/data_collection_groups", - element: , + loader: instrumentInfoLoader(queryClient), + }, + { + path: '/login', + element: , errorElement: , - loader: ({ params }) => dataCollectionGroupsLoader(queryClient)(params), - }, - { - path: "/sessions/:sessid/data_collection_groups/:dcgid/grid_squares", - element: , + }, + { + path: '/', + element: , errorElement: , - loader: ({ params }) => gridSquaresLoader(queryClient)(params), - }, - ], - }, -]); + children: [ + { + path: '/home', + element: , + errorElement: , + loader: sessionsLoader(queryClient), + }, + { + path: '/sessions/:sessid', + element: , + errorElement: , + loader: ({ params }) => rsyncerLoader(queryClient)(params), + }, + { + path: '/instruments/:instrumentName/new_session', + element: , + errorElement: , + loader: ({ params }) => visitLoader(queryClient)(params), + }, + { + path: '/new_session/setup/:sessid', + element: , + errorElement: , + loader: machineConfigLoader(queryClient), + }, + { + path: '/sessions/:sessid/gain_ref_transfer', + element: , + errorElement: , + loader: ({ params }) => gainRefLoader(queryClient)(params), + }, + { + path: '/new_session/parameters/:sessid', + element: , + errorElement: , + loader: ({ params }) => sessionLoader(queryClient)(params), + }, + { + path: '/sessions/:sessid/session_parameters/extra_parameters', + element: , + errorElement: , + loader: ({ params }) => + processingParametersLoader(queryClient)(params), + }, + { + path: '/sessions/:sessid/session_parameters', + element: , + errorElement: , + loader: ({ params }) => + sessionParametersLoader(queryClient)(params), + }, + { + path: '/mag_table', + element: , + errorElement: , + loader: magTableLoader(queryClient), + }, + { + path: '/sessions/:sessid/data_collection_groups', + element: , + errorElement: , + loader: ({ params }) => + dataCollectionGroupsLoader(queryClient)(params), + }, + { + path: '/sessions/:sessid/data_collection_groups/:dcgid/grid_squares', + element: , + errorElement: , + loader: ({ params }) => gridSquaresLoader(queryClient)(params), + }, + ], + }, +]) root.render( - - - - - {process.env.NODE_ENV === "development" && ( - - )} - - , -); + + + + + {process.env.NODE_ENV === 'development' && ( + + )} + + +) diff --git a/src/loaders/dataCollectionGroups.tsx b/src/loaders/dataCollectionGroups.tsx index e27fc3d..7afcb7e 100644 --- a/src/loaders/dataCollectionGroups.tsx +++ b/src/loaders/dataCollectionGroups.tsx @@ -1,33 +1,33 @@ -import { QueryClient } from "@tanstack/react-query"; -import { client } from "utils/api/client"; -import { Params } from "react-router-dom"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' +import { Params } from 'react-router-dom' -const getDataCollectionGroups = async (sessid: string = "0") => { - console.log("data collection groups gather"); - const response = await client.get( - `session_info/sessions/${sessid}/data_collection_groups`, - ); +const getDataCollectionGroups = async (sessid: string = '0') => { + console.log('data collection groups gather') + const response = await client.get( + `session_info/sessions/${sessid}/data_collection_groups` + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} -const queryBuilder = (sessid: string = "0") => { - return { - queryKey: ["sessionId", sessid], - queryFn: () => getDataCollectionGroups(sessid), - staleTime: 60000, - }; -}; +const queryBuilder = (sessid: string = '0') => { + return { + queryKey: ['sessionId', sessid], + queryFn: () => getDataCollectionGroups(sessid), + staleTime: 60000, + } +} export const dataCollectionGroupsLoader = - (queryClient: QueryClient) => async (params: Params) => { - const singleQuery = queryBuilder(params.sessid); - return ( - (await queryClient.getQueryData(singleQuery.queryKey)) ?? - (await queryClient.fetchQuery(singleQuery)) - ); - }; + (queryClient: QueryClient) => async (params: Params) => { + const singleQuery = queryBuilder(params.sessid) + return ( + (await queryClient.getQueryData(singleQuery.queryKey)) ?? + (await queryClient.fetchQuery(singleQuery)) + ) + } diff --git a/src/loaders/general.tsx b/src/loaders/general.tsx index 1cb5043..f4a9592 100644 --- a/src/loaders/general.tsx +++ b/src/loaders/general.tsx @@ -1,38 +1,51 @@ -import { client } from "utils/api/client"; +import { client } from 'utils/api/client' export const getInstrumentName = async () => { - const response = await client.get(`display/instruments/${sessionStorage.getItem("instrumentName")}/instrument_name`); + const response = await client.get( + `display/instruments/${sessionStorage.getItem('instrumentName')}/instrument_name` + ) - if (response.status !== 200) { - return null; - } - return response.data; -}; + if (response.status !== 200) { + return null + } + return response.data +} export const getInstrumentConnectionStatus = async () => { - const response = await client.get(`instrument_server/instruments/${sessionStorage.getItem("instrumentName")}/instrument_server`, {}, false); + const response = await client.get( + `instrument_server/instruments/${sessionStorage.getItem('instrumentName')}/instrument_server`, + {}, + false + ) - if (response.status !== 200) { - return false; - } + if (response.status !== 200) { + return false + } - return response.data; -}; + return response.data +} export const getUpstreamVisits = async (sessid: number) => { - const response = await client.get(`session_info/correlative/sessions/${sessid}/upstream_visits`); - - if (response.status !== 200) { - return null; - } - return response.data; -}; - -export const upstreamDataDownloadRequest = async (visitName: string, sessid: number) => { - const response = await client.get(`session_info/correlative/visits/${visitName}/${sessid}/upstream_tiff_data_request`); - - if (response.status !== 200) { - return null; - } - return response.data; -}; + const response = await client.get( + `session_info/correlative/sessions/${sessid}/upstream_visits` + ) + + if (response.status !== 200) { + return null + } + return response.data +} + +export const upstreamDataDownloadRequest = async ( + visitName: string, + sessid: number +) => { + const response = await client.get( + `session_info/correlative/visits/${visitName}/${sessid}/upstream_tiff_data_request` + ) + + if (response.status !== 200) { + return null + } + return response.data +} diff --git a/src/loaders/gridSquares.tsx b/src/loaders/gridSquares.tsx index c82d00b..e5fea43 100644 --- a/src/loaders/gridSquares.tsx +++ b/src/loaders/gridSquares.tsx @@ -1,62 +1,80 @@ -import { QueryClient } from "@tanstack/react-query"; -import { client } from "utils/api/client"; -import { Params } from "react-router-dom"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' +import { Params } from 'react-router-dom' -const getGridSquares = async (sessid: string = "0", dataCollectionGroupId: string = "0") => { - console.log("getting grid squares"); - const response = await client.get( - `session_info/spa/sessions/${sessid}/data_collection_groups/${dataCollectionGroupId}/grid_squares`, - ); +const getGridSquares = async ( + sessid: string = '0', + dataCollectionGroupId: string = '0' +) => { + console.log('getting grid squares') + const response = await client.get( + `session_info/spa/sessions/${sessid}/data_collection_groups/${dataCollectionGroupId}/grid_squares` + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} -const getNumMovies = async (sessid: string, dataCollectionGroupId: string, gridSquareId: number) => { - const response = await client.get( - `session_info/spa/sessions/${sessid}/data_collection_groups/${dataCollectionGroupId}/grid_squares/${gridSquareId}/num_movies`, - ); +const getNumMovies = async ( + sessid: string, + dataCollectionGroupId: string, + gridSquareId: number +) => { + const response = await client.get( + `session_info/spa/sessions/${sessid}/data_collection_groups/${dataCollectionGroupId}/grid_squares/${gridSquareId}/num_movies` + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; + return response.data } +const getFoilHoles = async ( + sessid: string, + dataCollectionGroupId: string, + gridSquareId: number +) => { + const response = await client.get( + `session_info/spa/sessions/${sessid}/data_collection_groups/${dataCollectionGroupId}/grid_squares/${gridSquareId}/foil_holes` + ) -const getFoilHoles = async (sessid: string, dataCollectionGroupId: string, gridSquareId: number) => { - const response = await client.get( - `session_info/spa/sessions/${sessid}/data_collection_groups/${dataCollectionGroupId}/grid_squares/${gridSquareId}/foil_holes`, - ); - - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; + return response.data } -const queryBuilder = (sessid: string = "0", dataCollectionGroupId: string = "0") => { - return { - queryKey: ["gridSquares", "sessionId", sessid, "dataCollectionGroup", dataCollectionGroupId], - queryFn: () => getGridSquares(sessid, dataCollectionGroupId), - staleTime: 60000, - }; -}; +const queryBuilder = ( + sessid: string = '0', + dataCollectionGroupId: string = '0' +) => { + return { + queryKey: [ + 'gridSquares', + 'sessionId', + sessid, + 'dataCollectionGroup', + dataCollectionGroupId, + ], + queryFn: () => getGridSquares(sessid, dataCollectionGroupId), + staleTime: 60000, + } +} export const gridSquaresLoader = - (queryClient: QueryClient) => async (params: Params) => { - // const singleQuery = queryBuilder(params.sessid, params.dcgid); - const singleQuery = queryBuilder(params.sessid); - return ( - (await queryClient.getQueryData(singleQuery.queryKey)) ?? - (await queryClient.fetchQuery(singleQuery)) - ); - }; - + (queryClient: QueryClient) => async (params: Params) => { + // const singleQuery = queryBuilder(params.sessid, params.dcgid); + const singleQuery = queryBuilder(params.sessid) + return ( + (await queryClient.getQueryData(singleQuery.queryKey)) ?? + (await queryClient.fetchQuery(singleQuery)) + ) + } -export { getFoilHoles, getNumMovies }; +export { getFoilHoles, getNumMovies } diff --git a/src/loaders/hub.tsx b/src/loaders/hub.tsx index 5f44ef1..8583577 100644 --- a/src/loaders/hub.tsx +++ b/src/loaders/hub.tsx @@ -1,23 +1,22 @@ -import { QueryClient } from "@tanstack/react-query"; -import { client, getPrefix } from "utils/api/client"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' const getInstrumentInfo = async () => { - const response = await client.hub_get(`instruments`); + const response = await client.hub_get(`instruments`) - if (response.status !== 200) { - return null; - } - - return response.data; -}; + if (response.status !== 200) { + return null + } + return response.data +} const query = { - queryKey: ["instrumentInfo"], - queryFn: getInstrumentInfo, - staleTime: 60000, -}; + queryKey: ['instrumentInfo'], + queryFn: getInstrumentInfo, + staleTime: 60000, +} export const instrumentInfoLoader = (queryClient: QueryClient) => async () => - (await queryClient.getQueryData(query.queryKey)) ?? - (await queryClient.fetchQuery(query)); \ No newline at end of file + (await queryClient.getQueryData(query.queryKey)) ?? + (await queryClient.fetchQuery(query)) diff --git a/src/loaders/jwt.tsx b/src/loaders/jwt.tsx index 4585940..ca2449c 100644 --- a/src/loaders/jwt.tsx +++ b/src/loaders/jwt.tsx @@ -1,38 +1,46 @@ -import { client } from "utils/api/client"; +import { client } from 'utils/api/client' type LoginDetails = { - username: string; - password: string; -}; + username: string + password: string +} export const getJWT = async (loginDetails: LoginDetails) => { - const formData = new FormData(); - formData.append("username", loginDetails.username); - formData.append("password", loginDetails.password); + const formData = new FormData() + formData.append('username', loginDetails.username) + formData.append('password', loginDetails.password) - const response = await client.post(`auth/token`, formData); - if (response.status !== 200) { - return null; - } + const response = await client.post(`auth/token`, formData) + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} export const handshake = async () => { - const response = await client.post(`instrument_server/instruments/${sessionStorage.getItem("instrumentName")}/activate_instrument_server`, {}); - if (response.status !== 200) { - return null; - } - - return response.data; + const response = await client.post( + `instrument_server/instruments/${sessionStorage.getItem('instrumentName')}/activate_instrument_server`, + {} + ) + if (response.status !== 200) { + return null + } + + return response.data } export const sessionHandshake = async (sessid: number) => { - const response = await client.post(`instrument_server/instruments/${sessionStorage.getItem("instrumentName")}/sessions/${sessid}/activate_instrument_server`, {}); - return response.data; + const response = await client.post( + `instrument_server/instruments/${sessionStorage.getItem('instrumentName')}/sessions/${sessid}/activate_instrument_server`, + {} + ) + return response.data } export const sessionTokenCheck = async (sessid: number) => { - const response = await client.get(`instrument_server/instruments/${sessionStorage.getItem("instrumentName")}/sessions/${sessid}/active`); - return response.data.active; + const response = await client.get( + `instrument_server/instruments/${sessionStorage.getItem('instrumentName')}/sessions/${sessid}/active` + ) + return response.data.active } diff --git a/src/loaders/machineConfig.tsx b/src/loaders/machineConfig.tsx index e617746..84b46de 100644 --- a/src/loaders/machineConfig.tsx +++ b/src/loaders/machineConfig.tsx @@ -1,25 +1,24 @@ -import { QueryClient } from "@tanstack/react-query"; -import { components } from "schema/main"; -import { client } from "utils/api/client"; -import { Params } from "react-router-dom"; -import { parseDate } from "utils/generic"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' export const getMachineConfigData = async () => { - const response = await client.get(`session_info/instruments/${sessionStorage.getItem("instrumentName")}/machine`); + const response = await client.get( + `session_info/instruments/${sessionStorage.getItem('instrumentName')}/machine` + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} const query = { - queryKey: ["machineConfig"], - queryFn: getMachineConfigData, - staleTime: 60000, -}; + queryKey: ['machineConfig'], + queryFn: getMachineConfigData, + staleTime: 60000, +} export const machineConfigLoader = (queryClient: QueryClient) => async () => - (await queryClient.getQueryData(query.queryKey)) ?? - (await queryClient.fetchQuery(query)); + (await queryClient.getQueryData(query.queryKey)) ?? + (await queryClient.fetchQuery(query)) diff --git a/src/loaders/magTable.tsx b/src/loaders/magTable.tsx index 88209c3..36e4d68 100644 --- a/src/loaders/magTable.tsx +++ b/src/loaders/magTable.tsx @@ -1,47 +1,46 @@ -import { QueryClient } from "@tanstack/react-query"; -import { client } from "utils/api/client"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' const getMagTableData = async () => { - const response = await client.get(`mag_table`); + const response = await client.get(`mag_table`) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} export const addMagTableRow = async ( - magnification: number, - pixelSize: number, + magnification: number, + pixelSize: number ) => { - const response = await client.post(`mag_table/mag_table/`, [{ - magnification: magnification, - pixel_size: pixelSize, - }]); - if (response.status !== 200) { - return null; - } - return response.data; -}; - -export const removeMagTableRow = async ( - magnification: number, -) => { - const response = await client.delete(`mag_table/mag_table/${magnification}`); - if (response.status !== 200) { - return null; - } - return response.data; -}; - + const response = await client.post(`mag_table/mag_table/`, [ + { + magnification: magnification, + pixel_size: pixelSize, + }, + ]) + if (response.status !== 200) { + return null + } + return response.data +} + +export const removeMagTableRow = async (magnification: number) => { + const response = await client.delete(`mag_table/mag_table/${magnification}`) + if (response.status !== 200) { + return null + } + return response.data +} const query = { - queryKey: ["magTable"], - queryFn: getMagTableData, - staleTime: 60000, -}; + queryKey: ['magTable'], + queryFn: getMagTableData, + staleTime: 60000, +} export const magTableLoader = (queryClient: QueryClient) => async () => - (await queryClient.getQueryData(query.queryKey)) ?? - (await queryClient.fetchQuery(query)); + (await queryClient.getQueryData(query.queryKey)) ?? + (await queryClient.fetchQuery(query)) diff --git a/src/loaders/multigridSetup.tsx b/src/loaders/multigridSetup.tsx index 9720cb6..92342f5 100644 --- a/src/loaders/multigridSetup.tsx +++ b/src/loaders/multigridSetup.tsx @@ -1,37 +1,34 @@ -import { QueryClient } from "@tanstack/react-query"; -import { client } from "utils/api/client"; -import { components } from "schema/main"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' +import { components } from 'schema/main' -type MultigridWatcherSpec = components["schemas"]["MultigridWatcherSetup"]; +type MultigridWatcherSpec = components['schemas']['MultigridWatcherSetup'] export const setupMultigridWatcher = async ( - multigridWatcher: MultigridWatcherSpec, - sessionId: number, + multigridWatcher: MultigridWatcherSpec, + sessionId: number ) => { - const response = await client.post( - `instrument_server/sessions/${sessionId}/multigrid_watcher`, - multigridWatcher, - ); - - if (response.status !== 200) { - return null; - } - - return response.data; -}; - -export const startMultigridWatcher = async ( - sessionId: number, -) => { - const response = await client.post( - `instrument_server/sessions/${sessionId}/start_multigrid_watcher`, - {}, - ); - - if (response.status !== 200) { - return null; - } - - return response.data; - -}; + const response = await client.post( + `instrument_server/sessions/${sessionId}/multigrid_watcher`, + multigridWatcher + ) + + if (response.status !== 200) { + return null + } + + return response.data +} + +export const startMultigridWatcher = async (sessionId: number) => { + const response = await client.post( + `instrument_server/sessions/${sessionId}/start_multigrid_watcher`, + {} + ) + + if (response.status !== 200) { + return null + } + + return response.data +} diff --git a/src/loaders/possibleGainRefs.tsx b/src/loaders/possibleGainRefs.tsx index 915bbe0..2ae7e63 100644 --- a/src/loaders/possibleGainRefs.tsx +++ b/src/loaders/possibleGainRefs.tsx @@ -1,73 +1,88 @@ -import { QueryClient } from "@tanstack/react-query"; -import { client } from "utils/api/client"; -import { Params } from "react-router-dom"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' +import { Params } from 'react-router-dom' const getGainRefData = async (sessionId: string) => { - const response = await client.get(`instrument_server/instruments/${sessionStorage.getItem("instrumentName")}/sessions/${sessionId}/possible_gain_references`); + const response = await client.get( + `instrument_server/instruments/${sessionStorage.getItem('instrumentName')}/sessions/${sessionId}/possible_gain_references` + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} export const transferGainReference = async ( - sessionId: number, - gainRef: string, + sessionId: number, + gainRef: string ) => { - const response = await client.post(`instrument_server/sessions/${sessionId}/upload_gain_reference`, { - gain_path: gainRef, - }); - if (response.status !== 200) { - return null; - } - return response.data; -}; + const response = await client.post( + `instrument_server/sessions/${sessionId}/upload_gain_reference`, + { + gain_path: gainRef, + } + ) + if (response.status !== 200) { + return null + } + return response.data +} export const prepareGainReference = async ( - sessionId: number, - gainRef: string, - rescale: boolean = false, - eer: boolean = false, - tag: string = "", + sessionId: number, + gainRef: string, + rescale: boolean = false, + eer: boolean = false, + tag: string = '' ) => { - const response = await client.post(`file_io/frontend/sessions/${sessionId}/process_gain`, { - gain_ref: gainRef, - rescale: rescale, - eer: eer, - tag: tag, - }); - if (response.status !== 200) { - return null; - } - return response.data; -}; + const response = await client.post( + `file_io/frontend/sessions/${sessionId}/process_gain`, + { + gain_ref: gainRef, + rescale: rescale, + eer: eer, + tag: tag, + } + ) + if (response.status !== 200) { + return null + } + return response.data +} export const updateCurrentGainReference = async ( - sessionId: number, - gainRef: string, + sessionId: number, + gainRef: string ) => { - const response = await client.put(`session_info/sessions/${sessionId}/current_gain_ref`, { - path: gainRef, - }); - if (response.status !== 200) { - return null; - } - return response.data; -}; + const response = await client.put( + `session_info/sessions/${sessionId}/current_gain_ref`, + { + path: gainRef, + } + ) + if (response.status !== 200) { + return null + } + return response.data +} const query = (sessid: string) => { - return { - queryKey: ["gainRefs"], - queryFn: () => getGainRefData(sessid), - staleTime: 60000, - } -}; + return { + queryKey: ['gainRefs'], + queryFn: () => getGainRefData(sessid), + staleTime: 60000, + } +} -export const gainRefLoader = (queryClient: QueryClient) => async (params: Params) => { - if(params.sessid){ - const singleQuery = query(params.sessid); - return (await queryClient.getQueryData(singleQuery.queryKey)) ?? - (await queryClient.fetchQuery(singleQuery)); -}} +export const gainRefLoader = + (queryClient: QueryClient) => async (params: Params) => { + if (params.sessid) { + const singleQuery = query(params.sessid) + return ( + (await queryClient.getQueryData(singleQuery.queryKey)) ?? + (await queryClient.fetchQuery(singleQuery)) + ) + } + } diff --git a/src/loaders/processingParameters.tsx b/src/loaders/processingParameters.tsx index c62b6d9..eb3e68b 100644 --- a/src/loaders/processingParameters.tsx +++ b/src/loaders/processingParameters.tsx @@ -1,77 +1,84 @@ -import { QueryClient } from "@tanstack/react-query"; -import { client } from "utils/api/client"; -import { Params } from "react-router-dom"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' +import { Params } from 'react-router-dom' -export const getSessionProcessingParameterData = async (sessid: string = "0") => { - const response = await client.get( - `session_parameters/sessions/${sessid}/session_processing_parameters`, - ); +export const getSessionProcessingParameterData = async ( + sessid: string = '0' +) => { + const response = await client.get( + `session_parameters/sessions/${sessid}/session_processing_parameters` + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} -const getProcessingParameterData = async (sessid: string = "0") => { - const response = await client.get( - `session_info/spa/sessions/${sessid}/spa_processing_parameters`, - ); +const getProcessingParameterData = async (sessid: string = '0') => { + const response = await client.get( + `session_info/spa/sessions/${sessid}/spa_processing_parameters` + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} -export const updateSessionProcessingParameters = async (sessid: string, params: any = {}) => { - const response = await client.post(`session_parameters/sessions/${sessid}/session_processing_parameters`, { - gain_ref: params["gainRef"] ?? "", - dose_per_frame: params["dosePerFrame"] ?? null, - eer_fractionation_file: params["eerFractionationFile"] ?? "", - symmetry: params["symmetry"] ?? "", - }); - if (response.status !== 200) { - return null; - } - return response.data; -}; +export const updateSessionProcessingParameters = async ( + sessid: string, + params: any = {} +) => { + const response = await client.post( + `session_parameters/sessions/${sessid}/session_processing_parameters`, + { + gain_ref: params['gainRef'] ?? '', + dose_per_frame: params['dosePerFrame'] ?? null, + eer_fractionation_file: params['eerFractionationFile'] ?? '', + symmetry: params['symmetry'] ?? '', + } + ) + if (response.status !== 200) { + return null + } + return response.data +} -const queryBuilder = (sessid: string = "0") => { - return { - queryKey: ["sessionId", sessid], - queryFn: () => getProcessingParameterData(sessid), - staleTime: 60000, - }; -}; - -const querySessionParamsBuilder = (sessid: string = "0") => { - return { - queryKey: ["sessionId", sessid], - queryFn: () => getSessionProcessingParameterData(sessid), - staleTime: 60000, - }; -}; +const queryBuilder = (sessid: string = '0') => { + return { + queryKey: ['sessionId', sessid], + queryFn: () => getProcessingParameterData(sessid), + staleTime: 60000, + } +} +const querySessionParamsBuilder = (sessid: string = '0') => { + return { + queryKey: ['sessionId', sessid], + queryFn: () => getSessionProcessingParameterData(sessid), + staleTime: 60000, + } +} export const processingParametersLoader = - (queryClient: QueryClient) => async (params: Params) => { - const singleQuery = queryBuilder(params.sessid); - return ( - (await queryClient.getQueryData(singleQuery.queryKey)) ?? - (await queryClient.fetchQuery(singleQuery)) - ); - }; + (queryClient: QueryClient) => async (params: Params) => { + const singleQuery = queryBuilder(params.sessid) + return ( + (await queryClient.getQueryData(singleQuery.queryKey)) ?? + (await queryClient.fetchQuery(singleQuery)) + ) + } export const sessionParametersLoader = - (queryClient: QueryClient) => async (params: Params) => { - const singleQuery = querySessionParamsBuilder(params.sessid); - return ( - (await queryClient.getQueryData(singleQuery.queryKey)) ?? - (await queryClient.fetchQuery(singleQuery)) - ); - }; + (queryClient: QueryClient) => async (params: Params) => { + const singleQuery = querySessionParamsBuilder(params.sessid) + return ( + (await queryClient.getQueryData(singleQuery.queryKey)) ?? + (await queryClient.fetchQuery(singleQuery)) + ) + } -export { getProcessingParameterData }; +export { getProcessingParameterData } diff --git a/src/loaders/rsyncers.tsx b/src/loaders/rsyncers.tsx index af019c5..a425e35 100644 --- a/src/loaders/rsyncers.tsx +++ b/src/loaders/rsyncers.tsx @@ -1,108 +1,123 @@ -import { QueryClient } from "@tanstack/react-query"; -import { components } from "schema/main"; -import { client } from "utils/api/client"; -import { Params } from "react-router-dom"; -import { parseDate } from "utils/generic"; +import { QueryClient } from '@tanstack/react-query' +import { components } from 'schema/main' +import { client } from 'utils/api/client' +import { Params } from 'react-router-dom' +import { parseDate } from 'utils/generic' const getRsyncerData = async (sessionId: string) => { - const response = await client.get(`instrument_server/instruments/${sessionStorage.getItem("instrumentName")}/sessions/${sessionId}/rsyncer_info`); + const response = await client.get( + `instrument_server/instruments/${sessionStorage.getItem('instrumentName')}/sessions/${sessionId}/rsyncer_info` + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} export const pauseRsyncer = async (sessionId: number, source: string) => { - console.log("stopping rsyncer"); + console.log('stopping rsyncer') - const response = await client.post(`instrument_server/sessions/${sessionId}/stop_rsyncer`, { - source: source, - }); + const response = await client.post( + `instrument_server/sessions/${sessionId}/stop_rsyncer`, + { + source: source, + } + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - console.log(response.data); + console.log(response.data) - return response.data; -}; + return response.data +} export const restartRsyncer = async (sessionId: number, source: string) => { - console.log("stopping rsyncer"); + console.log('stopping rsyncer') - const response = await client.post(`instrument_server/sessions/${sessionId}/restart_rsyncer`, { - source: source, - }); + const response = await client.post( + `instrument_server/sessions/${sessionId}/restart_rsyncer`, + { + source: source, + } + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - console.log(response.data); + console.log(response.data) - return response.data; -}; + return response.data +} export const finaliseRsyncer = async (sessionId: number, source: string) => { + const response = await client.post( + `instrument_server/sessions/${sessionId}/finalise_rsyncer`, + { + source: source, + } + ) - const response = await client.post(`instrument_server/sessions/${sessionId}/finalise_rsyncer`, { - source: source, - }); + if (response.status !== 200) { + return null + } - if (response.status !== 200) { - return null; - } + console.log(response.data) - console.log(response.data); - - return response.data; -}; + return response.data +} export const finaliseSession = async (sessionId: number) => { + const response = await client.post( + `instrument_server/sessions/${sessionId}/finalise_session`, + {} + ) - const response = await client.post(`instrument_server/sessions/${sessionId}/finalise_session`, {}); - - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - console.log(response.data); + console.log(response.data) - return response.data; -}; + return response.data +} export const removeRsyncer = async (sessionId: number, source: string) => { - console.log("removing rsyncer"); + console.log('removing rsyncer') - const response = await client.post(`instrument_server/sessions/${sessionId}/remove_rsyncer`, { - source: source, - }); + const response = await client.post( + `instrument_server/sessions/${sessionId}/remove_rsyncer`, + { + source: source, + } + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - console.log(response.data); + console.log(response.data) - return response.data; -}; + return response.data +} -const queryBuilder = (sessionId: string = "0") => { - return { - queryKey: ["sessid", sessionId], - queryFn: () => getRsyncerData(sessionId), - staleTime: 60000, - }; -}; +const queryBuilder = (sessionId: string = '0') => { + return { + queryKey: ['sessid', sessionId], + queryFn: () => getRsyncerData(sessionId), + staleTime: 60000, + } +} export const rsyncerLoader = - (queryClient: QueryClient) => async (params: Params) => { - const singleQuery = queryBuilder(params.sessid); - return ( - (await queryClient.getQueryData(singleQuery.queryKey)) ?? - (await queryClient.fetchQuery(singleQuery)) - ); - }; + (queryClient: QueryClient) => async (params: Params) => { + const singleQuery = queryBuilder(params.sessid) + return ( + (await queryClient.getQueryData(singleQuery.queryKey)) ?? + (await queryClient.fetchQuery(singleQuery)) + ) + } diff --git a/src/loaders/sessionSetup.tsx b/src/loaders/sessionSetup.tsx index a80e735..5fcc676 100644 --- a/src/loaders/sessionSetup.tsx +++ b/src/loaders/sessionSetup.tsx @@ -1,21 +1,22 @@ -import { QueryClient } from "@tanstack/react-query"; -import { client } from "utils/api/client"; -import { components } from "schema/main"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' +import { components } from 'schema/main' -type ProvidedProcessingParameters = components["schemas"]["ProvidedProcessingParameters"]; +type ProvidedProcessingParameters = + components['schemas']['ProvidedProcessingParameters'] export const registerProcessingParameters = async ( - processingParameters: ProvidedProcessingParameters, - sessionId: number, + processingParameters: ProvidedProcessingParameters, + sessionId: number ) => { - const response = await client.post( - `instrument_server/sessions/${sessionId}/provided_processing_parameters`, - processingParameters, - ); + const response = await client.post( + `instrument_server/sessions/${sessionId}/provided_processing_parameters`, + processingParameters + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} diff --git a/src/loaders/session_clients.tsx b/src/loaders/session_clients.tsx index 4b692e6..b37f7da 100644 --- a/src/loaders/session_clients.tsx +++ b/src/loaders/session_clients.tsx @@ -1,112 +1,132 @@ -import { QueryClient } from "@tanstack/react-query"; -import { components } from "schema/main"; -import { client } from "utils/api/client"; -import { Params } from "react-router-dom"; +import { QueryClient } from '@tanstack/react-query' +import { components } from 'schema/main' +import { client } from 'utils/api/client' +import { Params } from 'react-router-dom' -export const includePage = (endpoint: string, limit: number, page: number) => - `${endpoint}${endpoint.includes("?") ? "&" : "?"}page=${page - 1}&limit=${limit}`; +export const includePage = (endpoint: string, limit: number, page: number): string => { -const getSessionsData = async () => { - const response = await client.get(`session_info/instruments/${sessionStorage.getItem("instrumentName")}/sessions`); + const delimiter = endpoint.includes('?') ? '&' : '?' + const pageNo = page - 1 + return `${endpoint}${delimiter}page=${pageNo}&limit=${limit}` +} - if (response.status !== 200) { - return null; - } +const getSessionsData = async () => { + const response = await client.get( + `session_info/instruments/${sessionStorage.getItem('instrumentName')}/sessions` + ) - return { - current: response.data, - }; -}; + if (response.status !== 200) { + return null + } -export const getSessionDataForVisit = async (visit: string, instrumentName: string) => { - if(visit === "" || instrumentName === "") return []; - const response = await client.get(`session_info/instruments/${instrumentName}/visits/${visit}/sessions`); - if (response.status !== 200) { - return []; - } + return { + current: response.data, + } +} - return response.data; +export const getSessionDataForVisit = async ( + visit: string, + instrumentName: string +) => { + if (visit === '' || instrumentName === '') return [] + const response = await client.get( + `session_info/instruments/${instrumentName}/visits/${visit}/sessions` + ) + if (response.status !== 200) { + return [] + } + + return response.data } -const getSessionData = async (sessid: string = "0") => { - const response = await client.get(`session_info/session/${sessid}`); +const getSessionData = async (sessid: string = '0') => { + const response = await client.get(`session_info/session/${sessid}`) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} export const linkSessionToClient = async ( - client_id: number, - sessionName: string, + client_id: number, + sessionName: string ) => { - const response = await client.post(`session_info/clients/${client_id}/session`, { - session_name: sessionName, - }); - if (response.status !== 200) { - return null; - } - return response.data; -}; - -export const createSession = async (visit: string, sessionName: string, instrumentName: string) => { - const response = await client.post( - `session_info/instruments/${instrumentName}/visits/${visit}/session/${sessionName}`, - {}, - ); - if (response.status !== 200) { - return null; - } - return response.data; -}; - -export const updateSession = async (sessionID: number, process: boolean = true) => { - const response = await client.post( - `session_info/sessions/${sessionID}?process=${process ? 'true': 'false'}`, - {}, - ); - if (response.status !== 200) { - return null; - } - return response.data; + const response = await client.post( + `session_info/clients/${client_id}/session`, + { + session_name: sessionName, + } + ) + if (response.status !== 200) { + return null + } + return response.data +} + +export const createSession = async ( + visit: string, + sessionName: string, + instrumentName: string +) => { + const response = await client.post( + `session_info/instruments/${instrumentName}/visits/${visit}/session/${sessionName}`, + {} + ) + if (response.status !== 200) { + return null + } + return response.data +} + +export const updateSession = async ( + sessionID: number, + process: boolean = true +) => { + const response = await client.post( + `session_info/sessions/${sessionID}?process=${process ? 'true' : 'false'}`, + {} + ) + if (response.status !== 200) { + return null + } + return response.data } export const deleteSessionData = async (sessid: number) => { - const response = await client.delete(`session_info/sessions/${sessid}`); - if (response.status !== 200) { - return null; - } - return response.data; -}; + const response = await client.delete(`session_info/sessions/${sessid}`) + if (response.status !== 200) { + return null + } + return response.data +} const query = { - queryKey: ["homepageSessions", sessionStorage.getItem("instrumentName")], - queryFn: getSessionsData, - staleTime: 60000, -}; + queryKey: ['homepageSessions', sessionStorage.getItem('instrumentName')], + queryFn: getSessionsData, + staleTime: 60000, +} export const sessionsLoader = (queryClient: QueryClient) => async () => - (await queryClient.getQueryData(query.queryKey)) ?? - (await queryClient.fetchQuery(query)); - - -const queryBuilder = (sessid: string = "0") => { - return { - queryKey: ["sessionId", sessid], - queryFn: () => getSessionData(sessid), - staleTime: 60000, - }; -}; + (await queryClient.getQueryData(query.queryKey)) ?? + (await queryClient.fetchQuery(query)) + +const queryBuilder = (sessid: string = '0') => { + return { + queryKey: ['sessionId', sessid], + queryFn: () => getSessionData(sessid), + staleTime: 60000, + } +} export const sessionLoader = - (queryClient: QueryClient) => async (params: Params) => { - const singleQuery = queryBuilder(params.sessid); - return ( - (await queryClient.getQueryData(singleQuery.queryKey)) ?? - (await queryClient.fetchQuery(singleQuery)) - ); - }; - -export { getSessionData }; + (queryClient: QueryClient) => async (params: Params) => { + const singleQuery = queryBuilder(params.sessid) + return ( + (await queryClient.getQueryData(singleQuery.queryKey)) ?? + (await queryClient.fetchQuery(singleQuery)) + ) + } + +export { getSessionData } diff --git a/src/loaders/visits.tsx b/src/loaders/visits.tsx index c56cadc..dc5ec88 100644 --- a/src/loaders/visits.tsx +++ b/src/loaders/visits.tsx @@ -1,30 +1,35 @@ -import { QueryClient } from "@tanstack/react-query"; -import { client } from "utils/api/client"; -import { Params } from "react-router-dom"; +import { QueryClient } from '@tanstack/react-query' +import { client } from 'utils/api/client' +import { Params } from 'react-router-dom' const getVisitData = async (instrumentName: string) => { - const response = await client.get(`session_info/instruments/${instrumentName}/visits_raw`); + const response = await client.get( + `session_info/instruments/${instrumentName}/visits_raw` + ) - if (response.status !== 200) { - return null; - } + if (response.status !== 200) { + return null + } - return response.data; -}; + return response.data +} const query = (instrumentName: string) => { - return { - queryKey: ["visits", instrumentName], - queryFn: () => getVisitData(instrumentName), - staleTime: 60000, - } -}; + return { + queryKey: ['visits', instrumentName], + queryFn: () => getVisitData(instrumentName), + staleTime: 60000, + } +} -export const visitLoader = (queryClient: QueryClient) => async (params: Params) => { - if(params.instrumentName){ - const singleQuery = query(params.instrumentName); - return (await queryClient.getQueryData(singleQuery.queryKey)) ?? - (await queryClient.fetchQuery(singleQuery)); - } - return null; -}; +export const visitLoader = + (queryClient: QueryClient) => async (params: Params) => { + if (params.instrumentName) { + const singleQuery = query(params.instrumentName) + return ( + (await queryClient.getQueryData(singleQuery.queryKey)) ?? + (await queryClient.fetchQuery(singleQuery)) + ) + } + return null + } diff --git a/src/reportWebVitals.js b/src/reportWebVitals.js index 9ecd33f..d829db6 100644 --- a/src/reportWebVitals.js +++ b/src/reportWebVitals.js @@ -1,13 +1,15 @@ const reportWebVitals = (onPerfEntry) => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } -}; + if (onPerfEntry && onPerfEntry instanceof Function) { + import('web-vitals').then( + ({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { + getCLS(onPerfEntry) + getFID(onPerfEntry) + getFCP(onPerfEntry) + getLCP(onPerfEntry) + getTTFB(onPerfEntry) + } + ) + } +} -export default reportWebVitals; +export default reportWebVitals diff --git a/src/routes/DataCollectionGroups.tsx b/src/routes/DataCollectionGroups.tsx index 74cb565..6b43ab8 100644 --- a/src/routes/DataCollectionGroups.tsx +++ b/src/routes/DataCollectionGroups.tsx @@ -1,60 +1,78 @@ -import { Box, Button, Heading, HStack, VStack, Link } from "@chakra-ui/react"; +import { Box, Heading, VStack } from '@chakra-ui/react' -import { useNavigate, useLoaderData, useParams, Link as LinkRouter } from "react-router-dom"; -import { components } from "schema/main"; -import { Table } from "@diamondlightsource/ui-components"; -import { SetupStepper } from "components/setupStepper"; -import { prepareGainReference, transferGainReference, updateCurrentGainReference } from "loaders/possibleGainRefs"; -import { getMachineConfigData } from "loaders/machineConfig"; +import { Table } from '@diamondlightsource/ui-components' +import { + useLoaderData, + useNavigate, + useParams +} from 'react-router-dom' +import { components } from 'schema/main' -import { useState } from "react"; -type DataCollectionGroup = components["schemas"]["DataCollectionGroup"]; +type DataCollectionGroup = components['schemas']['DataCollectionGroup'] const DataCollectionGroups = () => { - const dataCollectionGroups = useLoaderData() as { [key: string]: DataCollectionGroup }; - const { sessid } = useParams(); - const navigate = useNavigate(); + const dataCollectionGroups = useLoaderData() as { + [key: string]: DataCollectionGroup + } + const { sessid } = useParams() + const navigate = useNavigate() - const SelectDataCollectionGroup = async (data: Record, index: number) => { - navigate(`/sessions/${sessid}/data_collection_groups/${data["id"]}/grid_squares`); - }; + const dataCollectionGroupRedirect = async ( + data: Record, + index: number + ) => { + navigate( + `/sessions/${sessid}/data_collection_groups/${data['id']}/grid_squares` + ) + } - return ( -
- - - - - - Data Collection Groups - - - - - - {dataCollectionGroups ? - : <>} - - - - ); -}; + return ( +
+ + + + + + Data Collection Groups + + + + + + {dataCollectionGroups ? ( +
+ ) : ( + <> + )} + + + + ) +} -export { DataCollectionGroups }; +export { DataCollectionGroups } diff --git a/src/routes/Error.tsx b/src/routes/Error.tsx index 61bc625..ff94d8e 100644 --- a/src/routes/Error.tsx +++ b/src/routes/Error.tsx @@ -1,59 +1,59 @@ -import { Heading, Link, VStack, Box, Text, Code } from "@chakra-ui/react"; -import { useEffect, useState } from "react"; -import { useRouteError } from "react-router-dom"; -import { Navbar } from "@diamondlightsource/ui-components"; +import { Heading, Link, VStack, Box, Text, Code } from '@chakra-ui/react' +import { useEffect, useState } from 'react' +import { useRouteError } from 'react-router-dom' +import { Navbar } from '@diamondlightsource/ui-components' interface ErrorType { - status: number; - statusText: string; - data?: string; + status: number + statusText: string + data?: string } const Error = () => { - const [heading, setHeading] = useState(""); - const [message, setMessage] = useState(""); - const [details, setDetails] = useState(""); - const error = useRouteError() as ErrorType; + const [heading, setHeading] = useState('') + const [message, setMessage] = useState('') + const [details, setDetails] = useState('') + const error = useRouteError() as ErrorType - useEffect(() => { - console.error(error); - if (error.status === 404) { - setHeading("Page not found"); - setMessage("This page does not exist."); - } else { - setHeading("An error has occurred"); - setMessage( - "An unexpected error has occurred. If this persists, please contact the developers. Details:", - ); - setDetails(error.toString()); - } - }, [error]); + useEffect(() => { + console.error(error) + if (error.status === 404) { + setHeading('Page not found') + setMessage('This page does not exist.') + } else { + setHeading('An error has occurred') + setMessage( + 'An unexpected error has occurred. If this persists, please contact the developers. Details:' + ) + setDetails(error.toString()) + } + }, [error]) - return ( -
- - - - {heading} - {message} - {details && ( - - {details} - - )} - - Go home - - - -
- ); -}; + return ( +
+ + + + {heading} + {message} + {details && ( + + {details} + + )} + + Go home + + + +
+ ) +} -export { Error }; +export { Error } diff --git a/src/routes/GainRefTransfer.tsx b/src/routes/GainRefTransfer.tsx index f7c2e06..d80d00c 100644 --- a/src/routes/GainRefTransfer.tsx +++ b/src/routes/GainRefTransfer.tsx @@ -1,119 +1,182 @@ -import { Button, Box, Heading, HStack, VStack, Input, Checkbox, Modal, ModalOverlay, ModalContent, ModalBody, ModalHeader, Tooltip, Link, Circle } from "@chakra-ui/react"; +import { + Button, + Box, + Heading, + HStack, + VStack, + Input, + Checkbox, + Modal, + ModalOverlay, + ModalContent, + ModalBody, + ModalHeader, + Tooltip, + Link, + Circle, +} from '@chakra-ui/react' -import { Link as LinkRouter, useNavigate, useLoaderData, useSearchParams } from "react-router-dom"; -import { components } from "schema/main"; -import { Table } from "@diamondlightsource/ui-components"; -import { SetupStepper } from "components/setupStepper"; -import { prepareGainReference, transferGainReference, updateCurrentGainReference } from "loaders/possibleGainRefs"; -import { getMachineConfigData } from "loaders/machineConfig"; -import { CircleLoader } from "react-spinners"; +import { + Link as LinkRouter, + useNavigate, + useLoaderData, + useSearchParams, +} from 'react-router-dom' +import { components } from 'schema/main' +import { Table } from '@diamondlightsource/ui-components' +import { SetupStepper } from 'components/setupStepper' +import { + prepareGainReference, + transferGainReference, + updateCurrentGainReference, +} from 'loaders/possibleGainRefs' +import { getMachineConfigData } from 'loaders/machineConfig' +import { CircleLoader } from 'react-spinners' -import React from "react"; +import React, { useState } from 'react' -type File = components["schemas"]["File"]; +type File = components['schemas']['File'] const GainRefTransfer = () => { - const possibleGainRefs = useLoaderData() as File[] | null; - let [searchParams, setSearchParams] = useSearchParams(); - const navigate = useNavigate(); - const [processing, setProcessing] = React.useState(false); - const [tag, setTag] = React.useState(""); - const [falcon, setFalcon] = React.useState(false); - const [falconPreset, setFalconPreset] = React.useState(false); + const possibleGainRefs = useLoaderData() as File[] | [] + // NOTE why is setSearchParams unused? + let [searchParams, setSearchParams] = useSearchParams() + const navigate = useNavigate() + const [processing, setProcessing] = useState(false) + const [tag, setTag] = useState('') + const [falcon, setFalcon] = useState(false) + const [falconPreset, setFalconPreset] = useState(false) - const SelectGainRef = async (data: Record, index: number) => { - setProcessing(true); - const sessid = searchParams.get("sessid"); - const setup = searchParams.get("setup"); - if (sessid) { - const transferStatus = await transferGainReference(parseInt(sessid), data["full_path"]); - if (true) { - const preparedGainReference = await prepareGainReference(parseInt(sessid), data["full_path"], !falcon, falcon, tag); - await updateCurrentGainReference(parseInt(sessid), preparedGainReference.gain_ref); - } + const SelectGainRef = async (data: Record, index: number) => { + setProcessing(true) + const sessid = searchParams.get('sessid') + if (sessid) { + const transferStatus = await transferGainReference( + parseInt(sessid), + data['full_path'] + ) + // todo why if true? + if (true) { + const preparedGainReference = await prepareGainReference( + parseInt(sessid), + data['full_path'], + !falcon, + falcon, + tag + ) + await updateCurrentGainReference( + parseInt(sessid), + preparedGainReference.gain_ref + ) + } + } + const setup = searchParams.get('setup') + const path = sessid + ? setup + ? `/new_session/setup/${sessid}` + : `/sessions/${sessid}` + : '/' + + navigate(path) + setProcessing(false) } - if (setup) - sessid ? navigate(`/new_session/setup/${sessid}`) : navigate("/"); - else sessid ? navigate(`/sessions/${sessid}`) : navigate("/"); - setProcessing(false); - }; - if(!falconPreset) { - setFalconPreset(true); - getMachineConfigData().then((cfg) => setFalcon(cfg.camera === "FALCON")); - } + if (!falconPreset) { + setFalconPreset(true) + getMachineConfigData().then((cfg) => setFalcon(cfg.camera === 'FALCON')) + } - return ( -
- - - - - - Possible Gain Reference Files - - - - - void(0)}> - - - Processing gain reference - - - - - - - {searchParams.get("setup") ? ( - - ) : null} - - - - - - setTag(e.target.value)}/> - - setFalcon(e.target.checked)}>Falcon -
- - - - - - - - - ); -}; + return ( +
+ + + + + + Possible Gain Reference Files + + + + + void 0}> + + + Processing gain reference + + + + + + + {searchParams.get('setup') ? ( + + ) : null} + + + + + + setTag(e.target.value)} + /> + + setFalcon(e.target.checked)} + > + Falcon + +
+ + + + + + + + + ) +} -export { GainRefTransfer }; +export { GainRefTransfer } diff --git a/src/routes/GridSquares.tsx b/src/routes/GridSquares.tsx index c58eedc..cbaab28 100644 --- a/src/routes/GridSquares.tsx +++ b/src/routes/GridSquares.tsx @@ -1,40 +1,65 @@ -import { Box, Heading, HStack, VStack, CardBody, Card, CardHeader, Image } from "@chakra-ui/react"; +import { + Box, + Heading, + VStack +} from '@chakra-ui/react' -import { useNavigate, useLoaderData, useParams } from "react-router-dom"; -import { components } from "schema/main"; -import { GridSquareCard } from "components/gridSquareCard"; +import { GridSquareCard } from 'components/gridSquareCard' +import { useLoaderData, useParams } from 'react-router-dom' +import { components } from 'schema/main' -type GridSquare = components["schemas"]["GridSquare"]; +type GridSquare = components['schemas']['GridSquare'] const GridSquares = () => { - console.log("gather grid squares"); - const gridSquares = useLoaderData() as GridSquare[]; - console.log("grid squares", gridSquares, typeof gridSquares, gridSquares.length); - const { sessid, dcgid } = useParams(); + console.log('gather grid squares') + const gridSquares = useLoaderData() as GridSquare[] + console.log( + 'grid squares', + gridSquares, + typeof gridSquares, + gridSquares.length + ) + const { sessid, dcgid } = useParams() - const getUrl = (endpoint: string) => { - return (sessionStorage.getItem("murfeyServerURL") ?? process.env.REACT_APP_API_ENDPOINT) + endpoint; - }; + const res = ( +
+ + + + + + Grid Squares + + + + + + {gridSquares && gridSquares.length > 0 ? ( + gridSquares.map((gs) => + + ) + ) : ( + No grid squares available + )} + + +
+ ) + return res +} - const res = -
- - - - - - Grid Squares - - - - - - {(gridSquares && gridSquares.length > 0) ? gridSquares.map((gs) => - GridSquareCard(gs, sessid, dcgid)): <>} - - -
- return res; -}; - -export { GridSquares }; +export { GridSquares } diff --git a/src/routes/Home.tsx b/src/routes/Home.tsx index 7db0135..b055e48 100644 --- a/src/routes/Home.tsx +++ b/src/routes/Home.tsx @@ -1,254 +1,142 @@ import { - Box, - Button, - Divider, - GridItem, - Heading, - HStack, - IconButton, - Link, - Modal, - ModalOverlay, - ModalContent, - ModalHeader, - ModalFooter, - ModalBody, - ModalCloseButton, - Stack, - Stat, - StatLabel, - Tooltip, - VStack, - useDisclosure, -} from "@chakra-ui/react"; + Box, + Button, + Divider, + Heading, + HStack, + Link, + VStack +} from '@chakra-ui/react' -import { v4 as uuid4 } from "uuid"; -import { Link as LinkRouter, useLoaderData } from "react-router-dom"; -import { components } from "schema/main"; -import { MdDelete } from "react-icons/md"; -import { GiMagicBroom } from "react-icons/gi"; -import { deleteSessionData } from "loaders/session_clients"; -import { finaliseSession } from "loaders/rsyncers"; -import { sessionTokenCheck } from "loaders/jwt"; -import { InstrumentCard } from "components/instrumentCard"; -import { PuffLoader } from "react-spinners"; -import useWebSocket from "react-use-websocket"; +import { InstrumentCard } from 'components/instrumentCard' +import { Link as LinkRouter, useLoaderData } from 'react-router-dom' +import useWebSocket, { Options } from 'react-use-websocket' +import { v4 as uuid4 } from 'uuid' -import React, { useEffect } from "react"; - -type Session = components["schemas"]["Session"]; - -const SessionRow = (session: Session) => { - - const { isOpen: isOpenDelete, onOpen: onOpenDelete, onClose: onCloseDelete } = useDisclosure(); - const { isOpen: isOpenCleanup, onOpen: onOpenCleanup, onClose: onCloseCleanup } = useDisclosure(); - - const cleanupSession = async (sessid: number) => { - await finaliseSession(sessid); - onCloseCleanup(); - } - - const [sessionActive, setSessionActive] = React.useState(false); - - useEffect(() => {sessionTokenCheck(session.id).then((active) => setSessionActive(active))}, []); - - return ( - - - {session ? - ( - <> - - - - - Confirm removing session {session.name} from list - - Are you sure you want to continue? This action is not reversible - - - - - - - - - - Confirm removing files for session {session.name} - - Are you sure you want to continue? This action is not reversible - - - - - - - - - - - - {session.name}:{" "} - {session.id} - - {sessionActive ? : <>} - - - - - - } - onClick={onOpenDelete} - isDisabled={sessionActive} - /> - - - } - onClick={onOpenCleanup} - isDisabled={!sessionActive} - /> - - - - ) - : ( - - - None Found - - - ) - } - - - ); -}; +import { useEffect, useState } from 'react' +import { Session } from "utils/types" +import { SessionRow } from 'components/SessionRow' const Home = () => { - const sessions = useLoaderData() as { - current: Session[]; - } | null; - const [ UUID, setUUID ] = React.useState(""); - const baseUrl = sessionStorage.getItem("murfeyServerURL") ?? process.env.REACT_APP_API_ENDPOINT - const url = baseUrl - ? baseUrl.replace("http", "ws") - : "ws://localhost:8000"; - const parseWebsocketMessage = (message: any) => { - let parsedMessage: any = {}; - try { - parsedMessage = JSON.parse(message); - } catch (err) { - return; - } - if (parsedMessage.message === "refresh") { - window.location.reload(); - } - }; + const sessions = useLoaderData() as { + current: Session[] + } | null + const [UUID, setUUID] = useState('') + const baseUrl = + sessionStorage.getItem('murfeyServerURL') ?? + process.env.REACT_APP_API_ENDPOINT + const url = baseUrl ? baseUrl.replace('http', 'ws') : 'ws://localhost:8000' - // Use existing UUID if present; otherwise, generate a new UUID - useEffect(() => { - if (!UUID) { - setUUID(uuid4()); + const parseWebsocketMessage = (message: any) => { + let parsedMessage: any = {} + try { + parsedMessage = JSON.parse(message) + } catch (err) { + return + } + if (parsedMessage.message === 'refresh') { + window.location.reload() + } } - }, [UUID]); - // Establish websocket connection to the backend - useWebSocket( + + // Use existing UUID if present; otherwise, generate a new UUID + useEffect(() => { + if (!UUID) { + setUUID(uuid4()) + } + }, [UUID]) + // 'null' is passed to 'useWebSocket()' if UUID is not yet set to // prevent malformed connections - UUID ? url + `ws/connect/${UUID}` : null, - UUID - ? { - onOpen: () => { - console.log("WebSocket connection established."); - }, - onMessage: (event) => { - parseWebsocketMessage(event.data); - }, + const wsUrl = UUID ? `${url}ws/connect/${UUID}` : null + const wsOptions: Options | undefined = UUID + ? { + onOpen: () => { + console.log('WebSocket connection established.') + }, + onMessage: (event) => { + parseWebsocketMessage(event.data) + }, } - : undefined - ); + : undefined + + // Establish websocket connection to the backend + useWebSocket(wsUrl, wsOptions) - return ( -
- Murfey - - - - - - Murfey Sessions - - - Microscope Data Transfer Control System - - - - - + return ( +
+ Murfey + + + + + + Murfey Sessions + + + Microscope Data Transfer Control System + + + + + - - - - {"Existing Sessions"} - - - {sessions && sessions.current.length > 0 ? sessions.current.map((current) => { - return - {SessionRow(current)} - - }) : ( - - - No sessions found - - - )} - - - - - - -
- ); -}; + + + + {'Existing Sessions'} + + + {sessions && sessions.current.length > 0 ? ( + sessions.current.map((current) => { + return ( + + + + ) + }) + ) : ( + + + No sessions found + + + )} + + + +
+
+
+
+ ) +} -export { Home }; +export { Home } diff --git a/src/routes/Hub.tsx b/src/routes/Hub.tsx index d39e270..6a1012a 100644 --- a/src/routes/Hub.tsx +++ b/src/routes/Hub.tsx @@ -1,68 +1,61 @@ import { - Card, - CardBody, - CardHeader, - Image, - Link, - Text, + Box, HStack, Heading, - VStack, - Box, SimpleGrid, - } from "@chakra-ui/react"; - -import { TbMicroscope, TbSnowflake } from "react-icons/tb"; -import { Link as LinkRouter, useLoaderData } from "react-router-dom"; -import { getInstrumentName } from "loaders/general"; + VStack +} from '@chakra-ui/react' +import { InstrumentInfoCard } from 'components/InstrumentInfoCard' -import React from "react"; +import { TbMicroscope, TbSnowflake } from 'react-icons/tb' +import { useLoaderData } from 'react-router-dom' +import { InstrumentInfo } from 'utils/types' - const getUrl = (endpoint: string) => { - return process.env.REACT_APP_HUB_ENDPOINT + endpoint; - }; - - type InstrumentInfo = { - "instrument_name": string, - "display_name": string, - "instrument_url": string, - } - - const Hub = () => { - const instrumentInfo = useLoaderData() as InstrumentInfo[]; +const Hub = () => { + const instrumentInfo = useLoaderData() as InstrumentInfo[] const sessionStorageSetup = (ininfo: InstrumentInfo) => { - sessionStorage.setItem("murfeyServerURL", ininfo.instrument_url + "/"); - sessionStorage.setItem("instrumentName", ininfo.instrument_name); + sessionStorage.setItem('murfeyServerURL', ininfo.instrument_url + '/') + sessionStorage.setItem('instrumentName', ininfo.instrument_name) } // Direct users to /login only if authenticating with 'password' return ( - - - - Murfey Hub - - - - {instrumentInfo ? (instrumentInfo.map((ini) => {return ( - - sessionStorageSetup(ini)}> - - - - - {ini.display_name} - - - ); - })) : <>} - - - ); - }; - - export { Hub }; + + + + + {' '} + {' '} + {' '} + Murfey Hub + + + + {instrumentInfo.length !== 0 ? ( + instrumentInfo.map((i) => ) + ) : ( + No instrument info available + )} + + + ) +} + +export { Hub } diff --git a/src/routes/Login.tsx b/src/routes/Login.tsx index 4daf18d..3dc611a 100644 --- a/src/routes/Login.tsx +++ b/src/routes/Login.tsx @@ -1,45 +1,85 @@ -import { Button, Input, VStack, Link, FormControl, Card, CardBody, Heading, HStack } from "@chakra-ui/react"; -import { Link as LinkRouter, useNavigate, Navigate } from "react-router-dom"; -import { TbMicroscope, TbSnowflake } from "react-icons/tb"; +import { + Button, + Card, + CardBody, + FormControl, + Heading, + HStack, + Input, + VStack +} from '@chakra-ui/react' +import { TbMicroscope, TbSnowflake } from 'react-icons/tb' +import { Navigate, useNavigate } from 'react-router-dom' -import { getJWT, handshake } from "loaders/jwt"; +import { getJWT } from 'loaders/jwt' -import React from "react"; +import { ChangeEvent, useState } from 'react' const Login = () => { - const [username, setUsername] = React.useState(""); - const handleUsername = (event: React.ChangeEvent) => - setUsername(event.target.value); - const [password, setPassword] = React.useState(""); - const handlePassword = (event: React.ChangeEvent) => - setPassword(event.target.value); + const [username, setUsername] = useState('') + const handleUsername = (event: ChangeEvent) => + setUsername(event.target.value) + const [password, setPassword] = useState('') + const handlePassword = (event: ChangeEvent) => + setPassword(event.target.value) - const navigate = useNavigate(); + const navigate = useNavigate() - return sessionStorage.getItem("murfeyServerURL") ? ( - - - Murfey Login - - - - - - - - - - - - ) : ; -}; + const url = sessionStorage.getItem('murfeyServerURL') + if (!url) { + + + } + const handleLoginButtonClick = () => { + getJWT({ + username: username, + password: password, + }) + .then((jwt) => sessionStorage.setItem( + 'token', + jwt.access_token + ) + ) + .then(() => navigate('/home')) + } -export { Login }; + // todo fix the {' '} setup + return + + + {' '} + {' '} + {' '} + Murfey Login + + + + + + + + + + + +} +export { Login } diff --git a/src/routes/MagTable.tsx b/src/routes/MagTable.tsx index 21be36e..3f54020 100644 --- a/src/routes/MagTable.tsx +++ b/src/routes/MagTable.tsx @@ -1,154 +1,182 @@ import { - Button, - Box, - Heading, - HStack, - IconButton, - Input, - VStack, - TableContainer, - Table, - Thead, - Tbody, - Tfoot, - Tr, - Th, - Td, - Text, - TableCaption, - Modal, - ModalOverlay, - ModalHeader, - ModalFooter, - ModalContent, - ModalBody, - ModalCloseButton, - FormControl, - useDisclosure, -} from "@chakra-ui/react"; + Box, + Button, + FormControl, + Heading, + HStack, + IconButton, + Input, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalHeader, + ModalOverlay, + Table, + TableCaption, + TableContainer, + Tbody, + Td, + Text, + Tfoot, + Th, + Thead, + Tr, + useDisclosure, + VStack +} from '@chakra-ui/react' -import { CheckIcon, EditIcon } from "@chakra-ui/icons"; -import { Link as LinkRouter, useLoaderData } from "react-router-dom"; -import { components } from "schema/main"; -import { MdAdd, MdHorizontalRule } from "react-icons/md"; -import { addMagTableRow, removeMagTableRow } from "loaders/magTable"; +import { addMagTableRow, removeMagTableRow } from 'loaders/magTable' +import { MdAdd, MdHorizontalRule } from 'react-icons/md' +import { useLoaderData } from 'react-router-dom' +import { components } from 'schema/main' -import React from "react"; +import { FormEvent } from 'react' -type MagTableRow = components["schemas"]["MagnificationLookup"]; +type MagTableRow = components['schemas']['MagnificationLookup'] const MagTable = () => { - const magTable = useLoaderData() as MagTableRow[] | null; - const { isOpen, onOpen, onClose } = useDisclosure(); - const [numNewRows, setNumNewRows] = React.useState(0); + const magTable = useLoaderData() as MagTableRow[] | null + const { isOpen, onOpen, onClose } = useDisclosure() + // todo unused variable + // const [numNewRows, setNumNewRows] = useState(0) - const handleRemoveRow = (mag: number) => { - removeMagTableRow(mag); - window.location.reload(); - } + const handleRemoveRow = (mag: number) => { + removeMagTableRow(mag) + window.location.reload() + } - const handleForm = (event: React.FormEvent) => { - event.preventDefault(); - const formData = new FormData(event.currentTarget); - const mag = parseInt(formData.get("magnification") as string); - const pixelSize = parseFloat(formData.get("pixelSize") as string); - addMagTableRow(mag, pixelSize); - window.location.reload(); - } + const handleForm = (event: FormEvent) => { + event.preventDefault() + const formData = new FormData(event.currentTarget) + const mag = parseInt(formData.get('magnification') as string) + const pixelSize = parseFloat(formData.get('pixelSize') as string) + addMagTableRow(mag, pixelSize) + window.location.reload() + } - return ( -
- Murfey - - - - - - Magnification Table - - + return ( +
+ Murfey + + + + + + Magnification Table + + - - -
- Magnification Table - - - - - - - - - - - Add Mag Table Row - - -
- - - - - - - - -
-
-
- - {magTable && magTable.length > 0 ? ( - magTable.map((row) => { - return ( - - - - - - ); - }) - ) : ( - <> - )} - - - - } - size="m" - onClick={onOpen} - > - - -
MagnificationPixel SizeRemove
- {row.magnification} - - {row.pixel_size} - - } - onClick={() => handleRemoveRow(row.magnification)} - > -
- - - -
-
-
- ); -}; + + + + + Magnification Table + + + + + + + + + + + + + Add Mag Table Row + + + +
+ + + + + + + + +
+
+
+ + {magTable && magTable.length > 0 && magTable.map((row) => )} + + + + } + size="m" + onClick={onOpen} + > + + +
MagnificationPixel SizeRemove
+
+
+ + + + + ) +} + +export { MagTable } + +type MagTableRowProps = { + row: { + magnification: number + pixel_size: number + } + handleRemoveRow: (mag: number) => void +} + +function MagTableRow({ row, handleRemoveRow }: MagTableRowProps) { + return + + + {row.magnification} + + + + + {row.pixel_size} + + + + } + onClick={() => handleRemoveRow( + row.magnification + )} + > + + +} -export { MagTable }; diff --git a/src/routes/MultigridSetup.tsx b/src/routes/MultigridSetup.tsx deleted file mode 100644 index 3ed8b83..0000000 --- a/src/routes/MultigridSetup.tsx +++ /dev/null @@ -1,164 +0,0 @@ -import { - Box, - FormControl, - FormLabel, - GridItem, - Heading, - HStack, - IconButton, - Link, - Select, - Stack, - Switch, - VStack, -} from "@chakra-ui/react"; -import { ArrowForwardIcon } from "@chakra-ui/icons"; - -import { Link as LinkRouter, useLoaderData, useParams } from "react-router-dom"; -import { components } from "schema/main"; -import { setupMultigridWatcher, startMultigridWatcher } from "loaders/multigridSetup"; -import { getSessionData } from "loaders/session_clients"; -import { SetupStepper } from "components/setupStepper"; -import React, { useEffect } from "react"; - -type MachineConfig = components["schemas"]["MachineConfig"]; -type MultigridWatcherSpec = components["schemas"]["MultigridWatcherSetup"]; -type Session = components["schemas"]["Session"]; - -const MultigridSetup = () => { - const machineConfig = useLoaderData() as MachineConfig | null; - const { sessid } = useParams(); - let initialDirectory = ""; - if (machineConfig) - machineConfig.data_directories.forEach((value) => { - if (initialDirectory === "") - initialDirectory = value; - }); - const [selectedDirectory, setSelectedDirectory] = - React.useState(initialDirectory); - const processByDefault = machineConfig ? machineConfig.process_by_default: true - const [skipExistingProcessing, setSkipExistingProcessing] = - React.useState(!processByDefault); - const [session, setSession] = React.useState(); - - useEffect(() => { - getSessionData(sessid).then((sess) => setSession(sess.session)); - }, []); - const activeStep = session != null ? (session.started ? 3 : 2) : 2; - - const handleDirectorySelection = (e: React.ChangeEvent) => - setSelectedDirectory(e.target.value); - - const recipesDefined = machineConfig ? machineConfig.recipes ? Object.keys(machineConfig.recipes).length !== 0: false: false; - - const handleSelection = async () => { - if (typeof sessid !== "undefined"){ - await setupMultigridWatcher( - { - source: selectedDirectory, - skip_existing_processing: skipExistingProcessing, - } as MultigridWatcherSpec, - parseInt(sessid), - ); - if(!recipesDefined) await startMultigridWatcher(parseInt(sessid)); - } - }; - - return ( -
- - - - - - Select data directory - - - - - - - - - - - - - - Do not process existing data - { - setSkipExistingProcessing(!skipExistingProcessing); - }} - /> - - - - - } - onClick={handleSelection} - /> - - - - - - - -
- ); -}; - -export { MultigridSetup }; diff --git a/src/routes/NewSession.tsx b/src/routes/NewSession.tsx index 720659b..214977e 100644 --- a/src/routes/NewSession.tsx +++ b/src/routes/NewSession.tsx @@ -1,233 +1,321 @@ import { - Box, - Button, - Divider, - GridItem, - Input, - Heading, - HStack, - Link, - Stack, - Stat, - StatHelpText, - StatLabel, - StatNumber, - Text, - VStack, - Modal, - ModalOverlay, - ModalHeader, - ModalContent, - ModalFooter, - ModalCloseButton, - ModalBody, -} from "@chakra-ui/react"; - -import { useDisclosure } from "@chakra-ui/react"; -import { Link as LinkRouter, useLoaderData, useParams } from "react-router-dom"; -import { components } from "schema/main"; -import { SetupStepper } from "components/setupStepper"; -import { Table } from "@diamondlightsource/ui-components"; -import { createSession, getSessionDataForVisit } from "loaders/session_clients"; -import { sessionTokenCheck, sessionHandshake } from "loaders/jwt"; -import { useNavigate } from "react-router-dom"; -import React, { ChangeEventHandler, useEffect } from "react"; -import { getMachineConfigData } from "loaders/machineConfig"; - - -type Visit = components["schemas"]["Visit"]; -type MachineConfig = components["schemas"]["MachineConfig"]; -type Session = components["schemas"]["Session"]; + Box, + Button, + Heading, + Input, + Link, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + Stack, + VStack +} from '@chakra-ui/react' + +import { useDisclosure } from '@chakra-ui/react' +import { Table } from '@diamondlightsource/ui-components' +import { SetupStepper } from 'components/setupStepper' +import { sessionHandshake, sessionTokenCheck } from 'loaders/jwt' +import { getMachineConfigData } from 'loaders/machineConfig' +import { createSession, getSessionDataForVisit } from 'loaders/session_clients' +import React, { ChangeEvent, useEffect, useState } from 'react' +import { Link as LinkRouter, useLoaderData, useNavigate } from 'react-router-dom' +import { components } from 'schema/main' + +type Visit = components['schemas']['Visit'] +type MachineConfig = components['schemas']['MachineConfig'] +type Session = components['schemas']['Session'] const NewSession = () => { - const currentVisits = useLoaderData() as Visit[] | null; - const { isOpen, onOpen, onClose } = useDisclosure(); - const { isOpen: isOpenVisitCheck, onOpen: onOpenVisitCheck, onClose: onCloseVisitCheck } = useDisclosure(); - const [selectedVisit, setSelectedVisit] = React.useState(""); - const [sessionReference, setSessionReference] = React.useState(""); - const [activeSessionsForVisit, setActiveSessionsForVisit] = React.useState<(Session | null)[]>([]); - const [gainRefDir, setGainRefDir] = React.useState(); - const [acqusitionSoftware, setAcquistionSoftware] = React.useState([]); - const navigate = useNavigate(); - - const handleMachineConfig = (mcfg: MachineConfig) => { - setGainRefDir(mcfg.gain_reference_directory); - setAcquistionSoftware(mcfg.acquisition_software); - } - - const instrumentName = sessionStorage.getItem("instrumentName"); - - const alreadyActiveSessions = async () => { - const sessionsToCheck: Session[] = await getSessionDataForVisit(selectedVisit, instrumentName ?? ""); - return Promise.all(sessionsToCheck.map(async (session) => {return await sessionTokenCheck(session.id) ? session: null})); - } - - useEffect(() => {getMachineConfigData().then((mcfg) => handleMachineConfig(mcfg))}, []); - useEffect(() => {alreadyActiveSessions().then((sessions) => setActiveSessionsForVisit(sessions))}, [selectedVisit]); - - const handleChange = (event: React.ChangeEvent) => - setSessionReference(event.target.value); - - const handleVisitNameChange = (event: React.ChangeEvent) => { - setSelectedVisit(event.target.value); - setSessionReference(event.target.value); - } - - function selectVisit(data: Record, index: number) { - setSelectedVisit(data.name); - setSessionReference(data.name); - } - - const startMurfeySession = async (iName: string) => { - const sid = await createSession(selectedVisit, sessionReference, iName); - await sessionHandshake(sid); - return sid; - } - - const handleCreateSession = async (iName: string) => { - if((!activeSessionsForVisit.length) || (activeSessionsForVisit.every((elem) => {return elem === null}))){ - const sid = await startMurfeySession(iName); - gainRefDir ? navigate(`../sessions/${sid}/gain_ref_transfer?sessid=${sid}&setup=true`): navigate(`/new_session/setup/${sid}`); + const currentVisits = useLoaderData() as Visit[] | [] + const { isOpen, onOpen, onClose } = useDisclosure() + const { + isOpen: isOpenVisitCheck, + onOpen: onOpenVisitCheck, + onClose: onCloseVisitCheck, + } = useDisclosure() + const [selectedVisit, setSelectedVisit] = useState('') + const [sessionReference, setSessionReference] = useState('') + const [activeSessionsForVisit, setActiveSessionsForVisit] = useState< + (Session | null)[] + >([]) + const [gainRefDir, setGainRefDir] = useState() + const [acqusitionSoftwares, setAcquistionSoftwares] = useState< + string[] + >([]) + const navigate = useNavigate() + + const handleMachineConfig = (mcfg: MachineConfig) => { + setGainRefDir(mcfg.gain_reference_directory) + setAcquistionSoftwares(mcfg.acquisition_software) } - else onOpenVisitCheck(); - } - return instrumentName ? ( -
- - - - Create visit - - - { + const sessionsToCheck: Session[] = await getSessionDataForVisit( + selectedVisit, + instrumentName ?? '' + ) + return Promise.all( + sessionsToCheck.map(async (session) => { + return (await sessionTokenCheck(session.id)) ? session : null + }) + ) + } + + useEffect(() => { + getMachineConfigData().then((mcfg) => handleMachineConfig(mcfg)) + }, []) + + useEffect(() => { + alreadyActiveSessions().then((sessions) => + setActiveSessionsForVisit(sessions) + ) + }, [selectedVisit]) + + const handleChange = (event: ChangeEvent) => + setSessionReference(event.target.value) + + const handleVisitNameChange = ( + event: ChangeEvent + ) => { + setSelectedVisit(event.target.value) + setSessionReference(event.target.value) + } + + function selectVisit(data: Record, index: number) { + setSelectedVisit(data.name) + setSessionReference(data.name) + } + + const startMurfeySession = async (iName: string) => { + const sid = await createSession(selectedVisit, sessionReference, iName) + await sessionHandshake(sid) + return sid + } + + const handleCreateSession = async (iName: string) => { + if ( + !activeSessionsForVisit.length || + activeSessionsForVisit.every((elem) => { + return elem === null + }) + ) { + const sid = await startMurfeySession(iName) + const path = gainRefDir ? `../sessions/${sid}/gain_ref_transfer?sessid=${sid}&setup=true` : `/new_session/setup/${sid}` + navigate(path) + } else onOpenVisitCheck() + } + + if (!instrumentName) { + return No instrument name is known + } + + return instrumentName ? ( +
+ - - - - - + + + + + + + Current visits + + + + + + + + + + + + + + + + + + + + ) : ( + <> + ) +} + +export { NewSession } + +type EditSessionModalProps = { + isOpenVisitCheck: boolean + onCloseVisitCheck: () => void + activeSessionsForVisit: (Session | null)[] + selectedVisit: string + startMurfeySession: (iName: string) => Promise + instrumentName: string + gainRefDir: string | null | undefined, + navigateCallback: (url: string) => void +} + +function EditSessionModal({ isOpenVisitCheck, onCloseVisitCheck, activeSessionsForVisit, selectedVisit, instrumentName, startMurfeySession, navigateCallback, gainRefDir }: EditSessionModalProps) { + return + + + + An active session already exists for this visit + + + + You may want to edit one of the following sessions + instead (otherwise you may start multiple transfers for + the same source) + + {activeSessionsForVisit.map((session) => { + return session ? ( + + + + ) : ( + No sessions available + ) + })} + + + + + - - + +} + +type CreateSessionModalProps = { + isOpen: boolean + onClose: () => void + handleVisitNameChange: (event: ChangeEvent) => void + sessionReference: string + handleChange: (event: ChangeEvent) => void + selectedVisit: string + handleCreateSession: (iName: string) => Promise + instrumentName: string +} + +function CreateSessionModal({ isOpen, onClose, handleVisitNameChange, sessionReference, handleChange, handleCreateSession, instrumentName, selectedVisit }: CreateSessionModalProps) { + return - An active session already exists for this visit - - - You may want to edit one of the following sessions instead (otherwise you may start multiple transfers for the same source) - - { - activeSessionsForVisit.map((session) => - { - return session ? - - : <> - } - ) - } - - - - - + Create visit + + + + + + + + - - - - - - - Current visits - - - - - - - - - -
- - - - - - - - - - ): <>; -}; - -export { NewSession }; + +} + diff --git a/src/routes/ProcessingParameters.tsx b/src/routes/ProcessingParameters.tsx index a8a5fa5..4f33aed 100644 --- a/src/routes/ProcessingParameters.tsx +++ b/src/routes/ProcessingParameters.tsx @@ -1,175 +1,172 @@ import { - Accordion, - AccordionButton, - AccordionPanel, - AccordionItem, - AccordionIcon, - Box, - Heading, - IconButton, - HStack, - VStack, - Switch, - Text, -} from "@chakra-ui/react"; + Accordion, + AccordionButton, + AccordionPanel, + AccordionItem, + AccordionIcon, + Box, + Heading, + IconButton, + HStack, + VStack, + Switch, + Text, +} from '@chakra-ui/react' -import { useLoaderData } from "react-router-dom"; -import { components } from "schema/main"; -import { Table } from "@diamondlightsource/ui-components"; -import { MdEditNote } from "react-icons/md"; +import { useLoaderData } from 'react-router-dom' +import { components } from 'schema/main' +import { Table } from '@diamondlightsource/ui-components' +import { MdEditNote } from 'react-icons/md' +import { ChangeEvent, useState } from 'react' +import { nameLabelMap } from './nameLabelMap' +import { ProcessingDetails } from 'utils/types' -import React from "react"; - -type ProcessingDetails = components["schemas"]["ProcessingDetails"]; type ProcessingRow = { - parameterName: string; - parameterValue?: string | number | boolean; -}; + parameterName: string + parameterValue?: string | number | boolean +} + +export type ProcessingTable = { + processingRows: ProcessingRow[] + tag: string +} + +export function getStartExtraRows( + procParams: ProcessingDetails[] | null, + tableRows: ProcessingTable[] +): ProcessingTable[] { + const convertParams = (params: Record | undefined): ProcessingRow[] => + Object.entries(params ?? {}).map(([key, value]) => ({ + parameterName: nameLabelMap.get(key) ?? key, + parameterValue: + value === true ? 'True' : value === false ? 'False' : value, + })) + + const tableRowsExtra: ProcessingTable[] = [] + + procParams?.forEach((p) => { + const relionRows = convertParams(p.relion_params) + const feedbackRows = convertParams(p.feedback_params) + + tableRows.push({ + processingRows: relionRows, + tag: p.relion_params?.pj_id?.toString() ?? '', + }) -type ProcessingTable = { - processingRows: ProcessingRow[]; - tag: string; -}; + tableRowsExtra.push({ + processingRows: feedbackRows, + tag: p.feedback_params?.pj_id?.toString() ?? '', + }) + }) -const nameLabelMap: Map = new Map([ - ["pj_id", "Processing Job ID"], - ["angpix", "Pixel Size [m]"], - ["dose_per_frame", "Dose per frame [e- / \u212B]"], - ["gain_ref", "Gain Reference"], - ["voltage", "Voltage [kV]"], - ["motion_corr_binning", "Motion correction binning factor"], - ["eer_grouping", "EER Grouping"], - ["symmetry", "Symmetry"], - ["particle_diameter", "Particle Diameter [\u212B]"], - ["downscale", "Downscaling During Extraction"], - ["do_icebreaker_jobs", "Perform IceBreaker Jobs"], - ["boxsize", "Box Size"], - ["small_boxsize", "Downscaled Box Size"], - ["mask_diameter", "Mask Diameter for Classification"], - ["estimate_particle_diameter", "Automatically Estimate Particle Diameter"], - ["hold_class2d", "2D Classification Held"], - ["rerun_class2d", "First 2D Classification Batch Needs to be Rerun"], - ["rerun_class3d", "3D Classification Needs to be Rerun"], - ["class_selection_score", "Class Selection Threshold"], - ["star_combination_job", "Job Number for Rebatching Job"], - ["initial_model", "Initial Model"], - ["next_job", "Next Job Number"], - ["picker_murfey_id", "Murfey ID of Picker for Use in ISPyB"], - ["picker_ispyb_id", "ISPyB Particle Picker ID"], -]); + return tableRowsExtra +} const ProcessingParameters = () => { - const procParams = useLoaderData() as ProcessingDetails[] | null; - const [showExtra, setShowExtra] = React.useState(false); - let tableRows = [] as ProcessingTable[]; - let tableRowsExtra = [] as ProcessingTable[]; - procParams?.map((p) => { - let tr: ProcessingTable = { - processingRows: [], - tag: "", - }; - let tre: ProcessingTable = { - processingRows: [], - tag: "", - }; - Object.entries(p?.relion_params ? p?.relion_params : {}).forEach( - ([key, value]) => - tr.processingRows.push({ - parameterName: nameLabelMap.get(key) ?? key, - parameterValue: - value === true ? "True" : value === false ? "False" : value, - }), - ); - tr.tag = p?.relion_params.pj_id.toString(); - tableRows.push(tr); - Object.entries(p?.feedback_params ? p?.feedback_params : {}).forEach( - ([key, value]) => - tre.processingRows.push({ - parameterName: nameLabelMap.get(key) ?? key, - parameterValue: - value === true ? "True" : value === false ? "False" : value, - }), - ); - tre.tag = p?.feedback_params.pj_id.toString(); - tableRowsExtra.push(tre); - }); - const handleToggle = (event: React.ChangeEvent) => { - setShowExtra(!showExtra); - }; - return ( -
- - - - - - Processing Parameters - - - - Show extra processing parameters - - - - - - {tableRows.map((tr) => { - return ( - - - - Main Processing Parameters (Processing Job ID {tr.tag}) - - - - -
- - - ); - })} - {showExtra ? ( - tableRowsExtra.map((tre) => { - return ( - - - - Extra Processing Parameters (Processing Job ID {tre.tag}) - - - - - } - /> -
- - - ); - }) - ) : ( - <> - )} - - - - ); -}; + const procParams = useLoaderData() as ProcessingDetails[] | null + const [showExtra, setShowExtra] = useState(false) + let tableRows = [] as ProcessingTable[] + const tableRowsExtra = getStartExtraRows(procParams, tableRows) + const handleToggle = (event: ChangeEvent) => { + setShowExtra(!showExtra) + } + return ( +
+ + + + + + Processing Parameters + + + + + Show extra processing parameters + + + + + + + {tableRows.map((tr) => + + + + Main Processing Parameters (Processing + Job ID {tr.tag}) + + + + +
+ + + )} + {showExtra && tableRowsExtra.map((tre) => + + + Extra Processing Parameters + (Processing Job ID {tre.tag}) + + + + + } + /> +
+ + + ) + } + + + + ) +} -export { ProcessingParameters }; +export { ProcessingParameters } diff --git a/src/routes/Root.tsx b/src/routes/Root.tsx index 5851499..d5e9c44 100644 --- a/src/routes/Root.tsx +++ b/src/routes/Root.tsx @@ -1,21 +1,20 @@ -import { Box, HStack, Tag, Text, Link, Progress, Icon } from "@chakra-ui/react"; -import { Outlet, useLoaderData, Link as LinkRouter } from "react-router-dom"; -import { Navbar } from "components/navbar"; -import { MdSignalWifi4Bar } from "react-icons/md"; +import { Box } from '@chakra-ui/react' +import { Navbar } from 'components/navbar' +import { Outlet } from 'react-router-dom' -import "styles/main.css"; +import 'styles/main.css' const Root = () => { - return ( -
- - - - - - -
- ); -}; + return ( +
+ + + + + + +
+ ) +} -export { Root }; +export { Root } diff --git a/src/routes/RsyncCard.tsx b/src/routes/RsyncCard.tsx new file mode 100644 index 0000000..95990ad --- /dev/null +++ b/src/routes/RsyncCard.tsx @@ -0,0 +1,214 @@ + +import { + Badge, + Box, + Button, + Card, + CardBody, + CardHeader, + Flex, + Heading, + HStack, + IconButton, + Menu, + MenuButton, + MenuItem, + MenuList, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + Spinner, + Stack, + StackDivider, + Stat, + StatLabel, + StatNumber, + Text +} from '@chakra-ui/react' + +import { useDisclosure } from '@chakra-ui/react' + +import { + finaliseRsyncer, + pauseRsyncer, + removeRsyncer, + restartRsyncer +} from 'loaders/rsyncers' +import { useState } from 'react' +import { + MdDensityMedium +} from 'react-icons/md' +import { RSyncerInfo } from 'utils/types' + +type RsyncCardProps = { + rsyncer: RSyncerInfo +} + +export function RsyncCard({ rsyncer }: RsyncCardProps) { + const { isOpen, onOpen, onClose } = useDisclosure() + const [action, setAction] = useState('finalise') + + const finalise = () => { + setAction('finalise') + onOpen() + } + + const remove = () => { + setAction('remove') + onOpen() + } + + const handleRsyncerAction = async () => { + if (action === 'finalise') + await finaliseRsyncer(rsyncer.session_id, rsyncer.source) + else if (action === 'remove') + await removeRsyncer(rsyncer.session_id, rsyncer.source) + onClose() + } + + const colorScheme = rsyncer.tag === 'fractions' + ? 'green' + : rsyncer.tag === 'metadata' + ? 'purple' + : rsyncer.tag === 'atlas' + ? 'yellow' + : 'red' + return ( + + + + + + Confirm RSyncer {action}: {rsyncer.source} + + + Are you sure you want to continue? + + + + + + + + + + + + RSync Instance + {rsyncer.transferring && } + {rsyncer.tag} + + + + } + /> + + {rsyncer.alive ? ( + <> + + pauseRsyncer( + rsyncer.session_id, + rsyncer.source + ) + } + isDisabled={rsyncer.stopping} + > + Pause + + remove()} + isDisabled={rsyncer.stopping} + > + Stop rsync (cannot be resumed) + + { + finalise() + }} + isDisabled={rsyncer.stopping} + > + Remove all source files and stop + + + ) : ( + <> + + restartRsyncer( + rsyncer.session_id, + rsyncer.source + ) + } + > + Start + + remove()}> + Remove + + + )} + + + + + + } spacing="4"> + + + Source + + + {rsyncer.source} + + + + + Destination + + + {rsyncer.destination ?? ''} + + + + + Transfer progress + + {rsyncer.num_files_transferred} transferred + + + {rsyncer.num_files_in_queue} queued + + {rsyncer.analyser_alive ? ( + + {rsyncer.num_files_to_analyse} to analyse + + ) : ( + <> + )} + + + + + + ) +} + diff --git a/src/routes/Session.tsx b/src/routes/Session.tsx index 3937bf2..03f6bef 100644 --- a/src/routes/Session.tsx +++ b/src/routes/Session.tsx @@ -1,519 +1,420 @@ import { - Badge, - Box, - Button, - Card, - CardBody, - CardHeader, - Divider, - FormControl, - FormLabel, - Flex, - GridItem, - Heading, - HStack, - IconButton, - Image, - Link, - Menu, - MenuButton, - MenuItem, - MenuList, - Modal, - ModalOverlay, - ModalContent, - ModalHeader, - ModalFooter, - ModalBody, - ModalCloseButton, - Select, - Spacer, - Spinner, - Stack, - StackDivider, - Stat, - StatHelpText, - StatLabel, - StatNumber, - Switch, - Text, - Tooltip, - VStack, - useToast, -} from "@chakra-ui/react"; - -import { useDisclosure } from "@chakra-ui/react"; -import { ViewIcon } from "@chakra-ui/icons"; - -import { v4 as uuid4 } from "uuid"; -import { Link as LinkRouter, useLoaderData, useParams, useNavigate } from "react-router-dom"; + Box, + Button, + Flex, + FormControl, + FormLabel, + GridItem, + Heading, + HStack, + IconButton, + Link, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + Select, + Spacer, + Stack, + Switch, + useToast, + VStack +} from '@chakra-ui/react' + +import { ViewIcon } from '@chakra-ui/icons' +import { useDisclosure } from '@chakra-ui/react' + +import { InstrumentCard } from 'components/instrumentCard' +import { UpstreamVisitCard } from 'components/upstreamVisitsCard' +import { getInstrumentName } from 'loaders/general' +import { sessionHandshake, sessionTokenCheck } from 'loaders/jwt' +import { getMachineConfigData } from 'loaders/machineConfig' import { - MdCheck, - MdDensityMedium, - MdFileUpload, - MdOutlineWarning, - MdOutlineGridOn, - MdPause, -} from "react-icons/md"; -import { FiActivity } from "react-icons/fi"; -import { components } from "schema/main"; -import { getInstrumentName } from "loaders/general"; -import { getMachineConfigData } from "loaders/machineConfig"; -import { pauseRsyncer, restartRsyncer, removeRsyncer, finaliseRsyncer, finaliseSession } from "loaders/rsyncers"; -import { getSessionData } from "loaders/session_clients"; -import { getSessionProcessingParameterData } from "loaders/processingParameters"; -import { sessionTokenCheck, sessionHandshake } from "loaders/jwt"; -import { startMultigridWatcher, setupMultigridWatcher } from "loaders/multigridSetup"; -import { InstrumentCard } from "components/instrumentCard"; -import { UpstreamVisitCard } from "components/upstreamVisitsCard"; -import useWebSocket from "react-use-websocket"; - -import React, { useEffect } from "react"; - -type RSyncerInfo = components["schemas"]["RSyncerInfo"]; -type Session = components["schemas"]["Session"]; -type MachineConfig = components["schemas"]["MachineConfig"]; -type MultigridWatcherSpec = components["schemas"]["MultigridWatcherSetup"]; - - -const RsyncCard = (rsyncer: RSyncerInfo) => { - - const { isOpen, onOpen, onClose } = useDisclosure(); - const [action, setAction] = React.useState("finalise"); - - const finalise = () => { - setAction("finalise"); - onOpen(); - } - - const remove = () => { - setAction("remove"); - onOpen(); - } - - const handleRsyncerAction = async () => { - if(action === "finalise") - await finaliseRsyncer(rsyncer.session_id, rsyncer.source); - else if(action === "remove") - await removeRsyncer(rsyncer.session_id, rsyncer.source); - onClose(); - } - - return ( - - - - - - Confirm RSyncer {action}: {rsyncer.source} - - Are you sure you want to continue? - - - - - - - - - - {" "} - - {" "} - - RSync Instance - {rsyncer.transferring && } - - {rsyncer.tag} - - - - - } - /> - - { - rsyncer.alive ? ( - <> - pauseRsyncer(rsyncer.session_id, rsyncer.source)} - isDisabled={rsyncer.stopping} - > - Pause - - remove()} - isDisabled={rsyncer.stopping} - > - Stop rsync (cannot be resumed) - - {finalise()}} - isDisabled={rsyncer.stopping} - > - Remove all source files and stop - - - ): - <> - restartRsyncer(rsyncer.session_id, rsyncer.source)}> - Start - - remove()} - > - Remove - - - } - - - - - - } spacing="4"> - - - Source - - - {rsyncer.source} - - - - - Destination - - - {rsyncer.destination ?? ""} - - - - - Transfer progress - - {rsyncer.num_files_transferred} transferred - - - {rsyncer.num_files_in_queue} queued - - { - rsyncer.analyser_alive ? - - {rsyncer.num_files_to_analyse} to analyse - - : <> - } - - - - - - ); -}; - -const getUrl = (endpoint: string) => { - return (sessionStorage.getItem("murfeyServerURL") ?? process.env.REACT_APP_API_ENDPOINT) + endpoint; -}; - + setupMultigridWatcher, + startMultigridWatcher, +} from 'loaders/multigridSetup' +import { getSessionProcessingParameterData } from 'loaders/processingParameters' +import { + finaliseSession, + pauseRsyncer +} from 'loaders/rsyncers' +import { + MdFileUpload, + MdOutlineGridOn, + MdPause +} from 'react-icons/md' +import { + Link as LinkRouter, + useLoaderData, + useNavigate, + useParams, +} from 'react-router-dom' +import useWebSocket from 'react-use-websocket' +import { v4 as uuid4 } from 'uuid' + +import React, { ChangeEvent, useEffect, useState } from 'react' +import { MachineConfig, MultigridWatcherSpec, RSyncerInfo } from 'utils/types' +import { RsyncCard } from './RsyncCard' const Session = () => { - const { isOpen, onOpen, onClose } = useDisclosure(); - const { isOpen: isOpenReconnect, onOpen: onOpenReconnect, onClose: onCloseReconnect } = useDisclosure(); - const rsync = useLoaderData() as RSyncerInfo[] | null; - const { sessid } = useParams(); - const navigate = useNavigate(); - const [UUID, setUUID] = React.useState(""); - const [instrumentName, setInstrumentName] = React.useState(""); - const [machineConfig, setMachineConfig] = React.useState(); - const [sessionActive, setSessionActive] = React.useState(false); - const [skipExistingProcessing, setSkipExistingProcessing] = React.useState(false); - const [selectedDirectory, setSelectedDirectory] = React.useState(""); - const [rsyncersPaused, setRsyncersPaused] = React.useState(false); - const baseUrl = sessionStorage.getItem("murfeyServerURL") ?? process.env.REACT_APP_API_ENDPOINT - const url = baseUrl - ? baseUrl.replace("http", "ws") - : "ws://localhost:8000"; - const toast = useToast(); - const [session, setSession] = React.useState(); - - const handleMachineConfig = (mcfg: MachineConfig) => { - setMachineConfig(mcfg); - setSelectedDirectory(mcfg["data_directories"][0]); - } - - // Use existing UUID if present; otherwise, generate a new UUID - useEffect(() => { - if (!UUID) { - setUUID(uuid4()); + const { isOpen, onOpen, onClose } = useDisclosure() + const { + isOpen: isOpenReconnect, + onOpen: onOpenReconnect, + onClose: onCloseReconnect, + } = useDisclosure() + const rsync = useLoaderData() as RSyncerInfo[] | null + const { sessid } = useParams() + const navigate = useNavigate() + const [UUID, setUUID] = useState('') + const [instrumentName, setInstrumentName] = useState('') + const [machineConfig, setMachineConfig] = useState() + const [sessionActive, setSessionActive] = useState(false) + const [skipExistingProcessing, setSkipExistingProcessing] = + useState(false) + const [selectedDirectory, setSelectedDirectory] = useState('') + const [rsyncersPaused, setRsyncersPaused] = useState(false) + const baseUrl = + sessionStorage.getItem('murfeyServerURL') ?? + process.env.REACT_APP_API_ENDPOINT + const url = baseUrl ? baseUrl.replace('http', 'ws') : 'ws://localhost:8000' + const toast = useToast() + const [session, setSession] = useState() + + const handleMachineConfig = (mcfg: MachineConfig) => { + setMachineConfig(mcfg) + setSelectedDirectory(mcfg['data_directories'][0]) } - }, [UUID]); - const recipesDefined = machineConfig ? machineConfig.recipes ? Object.keys(machineConfig.recipes).length !== 0: false: false; - - useEffect(() => {getSessionProcessingParameterData(sessid).then((params) => {if(params === null && recipesDefined && session !== undefined && session.process) navigate(`/new_session/parameters/${sessid}`);})}) + // Use existing UUID if present; otherwise, generate a new UUID + useEffect(() => { + if (!UUID) { + setUUID(uuid4()) + } + }, [UUID]) + + const recipesAreDefined: boolean = [machineConfig, machineConfig?.recipes, Object.keys(machineConfig?.recipes!).length !== 0].every(v => v) + + useEffect(() => { + getSessionProcessingParameterData(sessid).then((params) => { + const authIsValid = params === null && + recipesAreDefined && + session !== undefined && + session.process + if (authIsValid) navigate(`/new_session/parameters/${sessid}`) + }) + }) + + useEffect(() => { + getMachineConfigData().then((mcfg) => handleMachineConfig(mcfg)) + }, []) + + const parseWebsocketMessage = (message: any) => { + let parsedMessage: any = {} + try { + parsedMessage = JSON.parse(message) + } catch (err) { + return + } + if (parsedMessage.message === 'refresh') { + window.location.reload() + } + if ( + parsedMessage.message === 'update' && + typeof sessid !== 'undefined' && + parsedMessage.session_id === parseInt(sessid) + ) { + return toast({ + title: 'Update', + description: parsedMessage.payload, + isClosable: true, + duration: parsedMessage.duration ?? null, + status: parsedMessage.status ?? 'info', + }) + } + } - useEffect(() => {getMachineConfigData().then((mcfg) => handleMachineConfig(mcfg))}, []); + // Establish websocket connection to the backend + useWebSocket( + // 'null' is passed to 'useWebSocket()' if UUID is not yet set to + // prevent malformed connections + UUID ? url + `ws/connect/${UUID}` : null, + UUID + ? { + onOpen: () => { + console.log('WebSocket connection established.') + }, + onMessage: (event) => { + parseWebsocketMessage(event.data) + }, + } + : undefined + ) - const parseWebsocketMessage = (message: any) => { - let parsedMessage: any = {}; - try { - parsedMessage = JSON.parse(message); - } catch (err) { - return; - } - if (parsedMessage.message === "refresh") { - window.location.reload(); + const finaliseAll = async () => { + if (sessid) await finaliseSession(parseInt(sessid)) + onClose() } - if ( - parsedMessage.message === "update" && - typeof sessid !== "undefined" && - parsedMessage.session_id === parseInt(sessid) - ) { - return toast({ - title: "Update", - description: parsedMessage.payload, - isClosable: true, - duration: parsedMessage.duration ?? null, - status: parsedMessage.status ?? "info", - }); + + const pauseAll = async () => { + rsync?.map((r) => { + pauseRsyncer(r.session_id, r.source) + }) + setRsyncersPaused(true) } - }; - // Establish websocket connection to the backend - useWebSocket( - // 'null' is passed to 'useWebSocket()' if UUID is not yet set to - // prevent malformed connections - UUID ? url + `ws/connect/${UUID}` : null, - UUID - ? { - onOpen: () => { - console.log("WebSocket connection established."); - }, - onMessage: (event) => { - parseWebsocketMessage(event.data); - }, + const resolveName = async () => { + const name: string = await getInstrumentName() + setInstrumentName(name) + } + useEffect(() => { + resolveName() + }, []) + + const checkSessionActivationState = async () => { + if (sessid !== undefined) { + const activationState = await sessionTokenCheck(parseInt(sessid)) + setSessionActive(activationState) } - : undefined - ); - - const finaliseAll = async () => { - if(sessid) await finaliseSession(parseInt(sessid)); - onClose(); - } - - const pauseAll = async () => { - rsync?.map((r) => { - pauseRsyncer(r.session_id, r.source); - }); - setRsyncersPaused(true); - } - - const resolveName = async () => { - const name: string = await getInstrumentName(); - setInstrumentName(name); - }; - useEffect(() => {resolveName()}, []); - - const checkSessionActivationState = async () => { - if(sessid !== undefined){ - const activationState = await sessionTokenCheck(parseInt(sessid)); - setSessionActive(activationState); } - } - useEffect(() => {checkSessionActivationState()}, []); + useEffect(() => { + checkSessionActivationState() + }, []) - const getTransferring = (r: RSyncerInfo) => {return r.transferring;} - - const checkRsyncStatus = async () => { - setRsyncersPaused(rsync ? !rsync.every(getTransferring): true); - } - - useEffect(() => {checkRsyncStatus()}, []); - - const handleDirectorySelection = (e: React.ChangeEvent) => - setSelectedDirectory(e.target.value); - - const handleReconnect = async () => { - if (typeof sessid !== "undefined"){ - await sessionHandshake(parseInt(sessid)); - await setupMultigridWatcher( - { - source: selectedDirectory, - skip_existing_processing: skipExistingProcessing, - destination_overrides: rsync ? Object.fromEntries(rsync.map((r) => [r.source, r.destination])): {}, - rsync_restarts: rsync ? rsync.map((r) => r.source): [], - } as MultigridWatcherSpec, - parseInt(sessid), - ); - await startMultigridWatcher(parseInt(sessid)); + const getTransferring = (r: RSyncerInfo) => { + return r.transferring } - } - - return ( -
- - - - Confirm Visit Completion - - Are you sure you want to remove all data associated with this visit? + const checkRsyncStatus = async () => { + setRsyncersPaused(rsync ? !rsync.every(getTransferring) : true) + } - - - - - - - - - - Restart Transfers - - - - - - Data directory - - - - Do not process existing data - { - setSkipExistingProcessing(!skipExistingProcessing); - }} - /> - - - - + useEffect(() => { + checkRsyncStatus() + }, []) + + const handleDirectorySelection = ( + e: ChangeEvent + ) => setSelectedDirectory(e.target.value) + + const handleReconnect = async () => { + if (typeof sessid !== 'undefined') { + await sessionHandshake(parseInt(sessid)) + await setupMultigridWatcher( + { + source: selectedDirectory, + skip_existing_processing: skipExistingProcessing, + destination_overrides: rsync + ? Object.fromEntries( + rsync.map((r) => [r.source, r.destination]) + ) + : {}, + rsync_restarts: rsync ? rsync.map((r) => r.source) : [], + } as MultigridWatcherSpec, + parseInt(sessid) + ) + await startMultigridWatcher(parseInt(sessid)) + } + } - - - - - - - - - - - - Session {sessid}: {session ? session.visit : null} - - - - - - pauseAll()} /> - - - - - {!sessionActive ? : <>} - - - - - {/* + + + + + + + + Restart Transfers + + + + + + Data directory + + + + + Do not process existing data + + { + setSkipExistingProcessing( + !skipExistingProcessing + ) + }} + /> + + + + + + + + + + + + + + + + + Session {sessid}: {session ? session.visit : null} + + + + + + pauseAll()} + /> + + + + + {!sessionActive && } + + + + + {/* */} - - - - - - - - {rsync && rsync.length > 0 ? ( - rsync.map((r) => { - return RsyncCard(r); - }) - ) : ( - - - No RSyncers Found - - - )} - - - - - - - - - - - - - - - -
- ); -}; - -export { Session }; + + + + + + + + {rsync && rsync.length > 0 + ? rsync.map((r) => ) + : ( + + + No RSyncers Found + + + )} + + + + + + + + + + + + + + + + + ) +} + +export { Session } diff --git a/src/routes/SessionLinker.tsx b/src/routes/SessionLinker.tsx index 276eccd..35ce562 100644 --- a/src/routes/SessionLinker.tsx +++ b/src/routes/SessionLinker.tsx @@ -1,140 +1,159 @@ import { - Box, - Button, - Divider, - GridItem, - Heading, - HStack, - IconButton, - Link, - Stack, - Stat, - StatHelpText, - StatLabel, - StatNumber, - Text, - VStack, -} from "@chakra-ui/react"; + Box, + Divider, + GridItem, + Heading, + HStack, + IconButton, + Link, + Stack, + Stat, + StatLabel, + VStack +} from '@chakra-ui/react' -import { MdLink } from "react-icons/md"; -import { Link as LinkRouter, useLoaderData, useParams } from "react-router-dom"; -import { components } from "schema/main"; -import { linkSessionToClient } from "loaders/session_clients"; -import { useSearchParams } from "react-router-dom"; -import React from "react"; +import { linkSessionToClient } from 'loaders/session_clients' +import React from 'react' +import { MdLink } from 'react-icons/md' +import { Link as LinkRouter, useLoaderData, useSearchParams } from 'react-router-dom' +import { components } from 'schema/main' -type Client = components["schemas"]["ClientEnvironment"]; +type Client = components['schemas']['ClientEnvironment'] const SessionLinker = () => { - const existingClients = useLoaderData() as Client[] | null; - let [searchParams, setSearchParams] = useSearchParams(); - const [sessionId, setSessionId] = React.useState(0); + const existingClients = useLoaderData() as Client[] | null + let [searchParams, setSearchParams] = useSearchParams() + const [sessionId, setSessionId] = React.useState(0) - return ( -
- - - - - - Connect new session to client - - - - - - - - - - Existing Clients - - - - {existingClients && existingClients.length > 0 ? ( - existingClients.map((client) => { - const client_id = client.client_id!; - return ( - <> - - - - Client {client_id} - - - - } - onClick={() => { - linkSessionToClient( - client_id, - searchParams.get("session_name") ?? - "Client connection", - ).then((sid) => { - console.log(sid); - setSessionId(sid); - console.log(sessionId); - }); - }} - /> - - - - ); - }) - ) : ( - - - No Clients Found - - - )} - - - - - -
- ); -}; + return ( +
+ + + + + + Connect new session to client + + + + + + + + + + Existing Clients + + + + {existingClients && existingClients.length > 0 + ? existingClients.map((client) => + ) + : + + No Clients Found + + + } + + + + + +
+ ) +} + +export { SessionLinker } + +type ClientCardProps = { + clientId: number + sessionId: number + searchParams: URLSearchParams + setSessionId: React.Dispatch> +} + +function ClientCard({ clientId, sessionId, searchParams, setSessionId }: ClientCardProps) { + return <> + + + + Client {clientId} + + + + } + onClick={() => { + const sessionName = searchParams.get('session_name') ?? 'Client connection' + linkSessionToClient(clientId, sessionName + ).then( + (sid) => { + console.log(sid) + setSessionId(sid) + console.log(sessionId) + } + ) + }} /> + + + +} -export { SessionLinker }; diff --git a/src/routes/SessionParameters.tsx b/src/routes/SessionParameters.tsx index 7b1e660..137f21f 100644 --- a/src/routes/SessionParameters.tsx +++ b/src/routes/SessionParameters.tsx @@ -12,124 +12,162 @@ import { ModalBody, ModalCloseButton, VStack, - } from "@chakra-ui/react"; - - import { useDisclosure } from "@chakra-ui/react"; - import { Link as LinkRouter, useLoaderData, useParams } from "react-router-dom"; - import { components } from "schema/main"; - import { Table } from "@diamondlightsource/ui-components"; - import { updateSessionProcessingParameters } from "loaders/processingParameters"; - - import React from "react"; +} from '@chakra-ui/react' - type EditableSessionParameters = components["schemas"]["EditableSessionProcessingParameters"]; - - type ProcessingRow = { - parameterName: string; - parameterValue?: string | number | boolean; - }; - - type ProcessingTable = { - processingRows: ProcessingRow[]; - tag: string; - }; - - const nameLabelMap: Map = new Map([ - ["dose_per_frame", "Dose per frame [e- / \u212B]"], - ["gain_ref", "Gain Reference"], - ["symmetry", "Symmetry"], - ["eer_fractionation_file", "EER fractionation file (for motion correction)"] - ]); - - const SessionParameters = () => { - const { isOpen, onOpen, onClose } = useDisclosure(); - const { sessid } = useParams(); - const sessionParams = useLoaderData() as EditableSessionParameters | null; - let tableRows = [] as ProcessingRow[]; - type EditableParameter = "gain_ref" | "dose_per_frame" | "eer_fractionation_file" | "symmetry" | ""; - const [paramName, setParamName] = React.useState(""); - const [paramValue, setParamValue] = React.useState(""); - const [paramKey, setParamKey] = React.useState(""); - Object.entries(sessionParams ? sessionParams: {}).forEach( - ([key, value]) => +import { useDisclosure } from '@chakra-ui/react' +import { Link as LinkRouter, useLoaderData, useParams } from 'react-router-dom' +import { components } from 'schema/main' +import { Table } from '@diamondlightsource/ui-components' +import { updateSessionProcessingParameters } from 'loaders/processingParameters' + +import React, { useState } from 'react' +import { angstromHtmlChar } from 'utils/constants' + +type EditableSessionParameters = + components['schemas']['EditableSessionProcessingParameters'] + +type ProcessingRow = { + parameterName: string + parameterValue?: string | number | boolean +} + +type ProcessingTable = { + processingRows: ProcessingRow[] + tag: string +} + +const nameLabelMap: Map = new Map([ + ['dose_per_frame', `Dose per frame [e- / ${angstromHtmlChar}]`], + ['gain_ref', 'Gain Reference'], + ['symmetry', 'Symmetry'], + [ + 'eer_fractionation_file', + 'EER fractionation file (for motion correction)', + ], +]) + +// todo possibly derive this from the map keys +type EditableParameter = + | 'gain_ref' + | 'dose_per_frame' + | 'eer_fractionation_file' + | 'symmetry' + | '' + +const SessionParameters = () => { + const { isOpen, onOpen, onClose } = useDisclosure() + const { sessid } = useParams() + const sessionParams = useLoaderData() as EditableSessionParameters | null + let tableRows = [] as ProcessingRow[] + const [paramName, setParamName] = useState('') + const [paramValue, setParamValue] = useState('') + const [paramKey, setParamKey] = useState('') + Object.entries(sessionParams ? sessionParams : {}).forEach(([key, value]) => tableRows.push({ - parameterName: nameLabelMap.get(key) ?? key, - parameterValue: value, - parameterKey: key} as ProcessingRow, - )) - let table = {processingRows: tableRows, tag: "Session"} as ProcessingTable; + parameterName: nameLabelMap.get(key) ?? key, + parameterValue: value, + parameterKey: key, + } as ProcessingRow) + ) + let table = { processingRows: tableRows, tag: 'Session' } as ProcessingTable const handleParameterEdit = () => { - const data = { - gainRef: (paramKey === "gain_ref") ? paramValue: "", - dosePerFrame: (paramKey === "dose_per_frame") ? paramValue: null, - eerFractionationFile: (paramKey === "eer_fractionation_file") ? paramValue: "", - symmetry: (paramKey === "symmetry") ? paramValue: "", - }; - updateSessionProcessingParameters(sessid ?? "0", data); - onClose(); - window.location.reload(); + const data = { + gainRef: paramKey === 'gain_ref' ? paramValue : '', + dosePerFrame: paramKey === 'dose_per_frame' ? paramValue : null, + eerFractionationFile: + paramKey === 'eer_fractionation_file' ? paramValue : '', + symmetry: paramKey === 'symmetry' ? paramValue : '', + } + updateSessionProcessingParameters(sessid ?? '0', data) + onClose() + window.location.reload() + } + + const editParameterDialogue = async ( + data: Record, + index: number + ) => { + setParamName(data['parameterName']) + setParamValue(data['parameterValue']) + console.log(data['parameterKey']) + setParamKey(data['parameterKey']) + onOpen() } - const editParameterDialogue = async (data: Record, index: number) => { - setParamName(data["parameterName"]); - setParamValue(data["parameterValue"]); - console.log(data["parameterKey"]); - setParamKey(data["parameterKey"]); - onOpen(); - }; - return ( -
- - - - Edit processing parameter - - - {paramName} - setParamValue(v.target.value)}/> - - - - - - - - - - - - - Session Processing Parameters - - - - - - - -
- - - ); - }; - - export { SessionParameters }; - \ No newline at end of file +
+ + + + Edit processing parameter + + + {paramName} + setParamValue(v.target.value)} + /> + + + + + + + + + + + + + Session Processing Parameters + + + + + + + +
+ + + ) +} + +export { SessionParameters } diff --git a/src/routes/SessionSetup.tsx b/src/routes/SessionSetup.tsx index 917e75f..31eca72 100644 --- a/src/routes/SessionSetup.tsx +++ b/src/routes/SessionSetup.tsx @@ -1,160 +1,180 @@ import { - Button, - Box, - RadioGroup, - Radio, - Stack, - Link, - VStack, - Heading, -} from "@chakra-ui/react"; -import { getForm } from "components/forms"; -import { Link as LinkRouter, useParams, useLoaderData } from "react-router-dom"; -import { SetupStepper } from "components/setupStepper"; -import { components } from "schema/main"; -import { getProcessingParameterData } from "loaders/processingParameters"; -import { startMultigridWatcher } from "loaders/multigridSetup"; -import { getSessionData, updateSession } from "loaders/session_clients"; -import { registerProcessingParameters } from "loaders/sessionSetup"; + Box, + Button, + Heading, + Link, + Radio, + RadioGroup, + Stack, + VStack, +} from '@chakra-ui/react' +import { getForm } from 'components/forms' +import { SetupStepper } from 'components/setupStepper' +import { startMultigridWatcher } from 'loaders/multigridSetup' +import { getProcessingParameterData } from 'loaders/processingParameters' +import { getSessionData, updateSession } from 'loaders/session_clients' +import { registerProcessingParameters } from 'loaders/sessionSetup' +import { Link as LinkRouter, useLoaderData, useParams } from 'react-router-dom' +import { components } from 'schema/main' -import React, { useEffect } from "react"; - -type SessionClients = components["schemas"]["SessionClients"]; -type ProvidedProcessingParameters = components["schemas"]["ProvidedProcessingParameters"]; -type Session = components["schemas"]["Session"]; +import { useEffect, useState } from 'react' +import { ProcessingDetails } from 'utils/types' +import { ExperimentType, isValidExpType, EXPERIMENT_TYPES } from '../utils/ExperimentType' +type SessionClients = components['schemas']['SessionClients'] +type ProvidedProcessingParameters = + components['schemas']['ProvidedProcessingParameters'] +type Session = components['schemas']['Session'] const SessionSetup = () => { - const session = useLoaderData() as SessionClients | null; - const [expType, setExpType] = React.useState("spa"); - const [procParams, setProcParams] = React.useState(); - const { sessid } = useParams(); - const [paramsSet, setParamsSet] = React.useState(false); + const session = useLoaderData() as SessionClients | null + const [expType, setExpType] = useState("spa") + const [procParams, setProcParams] = useState([]) + const { sessid } = useParams() + const [paramsSet, setParamsSet] = useState(false) - const [_session, setSession] = React.useState(); + const [_session, setSession] = useState() - useEffect(() => { - getSessionData(sessid).then((sess) => setSession(sess.session)); - }, []); + useEffect(() => { + getSessionData(sessid).then((sess) => setSession(sess.session)) + }, []) - const handleSelection = (formData: any) => { - if (typeof sessid !== "undefined"){ - delete formData.type; - registerProcessingParameters( - formData as ProvidedProcessingParameters, - parseInt(sessid), - ); - startMultigridWatcher(parseInt(sessid)); - setParamsSet(true); + const handleSelection = (formData: any) => { + if (typeof sessid !== 'undefined') { + delete formData.type + registerProcessingParameters( + formData as ProvidedProcessingParameters, + parseInt(sessid) + ) + startMultigridWatcher(parseInt(sessid)) + setParamsSet(true) + } } - }; - const handleSkip = async () => { - if (sessid !== undefined){ - await updateSession(parseInt(sessid), false); - startMultigridWatcher(parseInt(sessid)); + const handleSkip = async () => { + if (sessid !== undefined) { + await updateSession(parseInt(sessid), false) + startMultigridWatcher(parseInt(sessid)) + } } - } - if (session) - getProcessingParameterData(session.session.id.toString()).then((params) => - setProcParams(params), - ); - const activeStep = session - ? procParams - ? 4 - : session.session.visit - ? 3 - : 0 - : 3; - return ( -
- - - - - - Processing parameters - - - - - - - - - - - - SPA - Tomography - - - - - {sessid?getForm(expType, handleSelection): <>} - - - - - - - - - - - -
- ); -}; + if (session) + getProcessingParameterData(session.session.id.toString()).then( + (params) => setProcParams(params) + ) + // todo this is duplicated logic, would be better with an enum + const activeStep = session + ? procParams + ? 4 + : session.session.visit + ? 3 + : 0 + : 3 + return ( +
+ + + + + + Processing parameters + + + + + + + + + + { + if (isValidExpType(v)) { + setExpType(v as ExperimentType) + } else { + window.alert("wrong experiment type") + } + } + } + value={expType} + colorScheme="murfey" + isDisabled={activeStep !== 3 ? true : false} + > + + SPA + Tomography + + + + + {sessid ? getForm(expType, handleSelection) : <>} + + + + + + + + + + + +
+ ) +} -export { SessionSetup }; +export { SessionSetup } diff --git a/src/routes/UserParameters.tsx b/src/routes/UserParameters.tsx index 1415a19..4bba43d 100644 --- a/src/routes/UserParameters.tsx +++ b/src/routes/UserParameters.tsx @@ -1,45 +1,52 @@ -import { - Box, - RadioGroup, - Radio, - Stack, -} from "@chakra-ui/react"; -import { getForm } from "components/forms"; +import { Box, Radio, RadioGroup, Stack } from '@chakra-ui/react' +import { getForm } from 'components/forms' -import React from "react"; +import { useState } from 'react' +import { ExperimentType, isValidExpType } from 'utils/ExperimentType' const UserParameters = () => { - const [expType, setExpType] = React.useState("spa"); - const [procParams, setProcParams] = React.useState(); - return ( - - - - - SPA - Tomography - - - - - {getForm(expType, setProcParams)} - - - ); -}; + const [expType, setExpType] = useState('spa') + const [procParams, setProcParams] = useState() + return ( + + + { + if (isValidExpType(v)) { + setExpType(v as ExperimentType) + } else { + window.alert("wrong experiment type") + } + } + } + value={expType} + colorScheme="murfey" + > + + SPA + Tomography + + + + + {getForm(expType, setProcParams)} + + + ) +} -export { UserParameters }; +export { UserParameters } diff --git a/src/routes/nameLabelMap.tsx b/src/routes/nameLabelMap.tsx new file mode 100644 index 0000000..8334965 --- /dev/null +++ b/src/routes/nameLabelMap.tsx @@ -0,0 +1,28 @@ +import { angstromHtmlChar } from 'utils/constants'; + +export const nameLabelMap: Map = new Map([ + ['pj_id', 'Processing Job ID'], + ['angpix', 'Pixel Size [m]'], + ['dose_per_frame', `Dose per frame [e- / ${angstromHtmlChar}]`], + ['gain_ref', 'Gain Reference'], + ['voltage', 'Voltage [kV]'], + ['motion_corr_binning', 'Motion correction binning factor'], + ['eer_grouping', 'EER Grouping'], + ['symmetry', 'Symmetry'], + ['particle_diameter', `Particle Diameter ${angstromHtmlChar}]`], + ['downscale', 'Downscaling During Extraction'], + ['do_icebreaker_jobs', 'Perform IceBreaker Jobs'], + ['boxsize', 'Box Size'], + ['small_boxsize', 'Downscaled Box Size'], + ['mask_diameter', 'Mask Diameter for Classification'], + ['estimate_particle_diameter', 'Automatically Estimate Particle Diameter'], + ['hold_class2d', '2D Classification Held'], + ['rerun_class2d', 'First 2D Classification Batch Needs to be Rerun'], + ['rerun_class3d', '3D Classification Needs to be Rerun'], + ['class_selection_score', 'Class Selection Threshold'], + ['star_combination_job', 'Job Number for Rebatching Job'], + ['initial_model', 'Initial Model'], + ['next_job', 'Next Job Number'], + ['picker_murfey_id', 'Murfey ID of Picker for Use in ISPyB'], + ['picker_ispyb_id', 'ISPyB Particle Picker ID'], +]); diff --git a/src/routes/processingParams.test.tsx b/src/routes/processingParams.test.tsx new file mode 100644 index 0000000..276c985 --- /dev/null +++ b/src/routes/processingParams.test.tsx @@ -0,0 +1,77 @@ + +import { ProcessingDetails } from 'utils/types' +import { nameLabelMap } from './nameLabelMap' +import { ProcessingTable, getStartExtraRows } from './ProcessingParameters' + +describe('getStartExtraRows', () => { + it('should extract relion and feedback rows correctly', () => { + nameLabelMap.set('threshold', 'Threshold') // mock mapping + + const procParams: ProcessingDetails[] = [ + { + relion_params: { + dose_per_frame: 0.5, + pj_id: 123, + angpix: 0, + voltage: 0, + motion_corr_binning: 0, + symmetry: '', + downscale: false + }, + feedback_params: { + estimate_particle_diameter: true, + pj_id: 456, + class_selection_score: 0, + star_combination_job: 0, + initial_model: '', + next_job: 0 + }, + data_collection_group: { + id: 0, + session_id: 0, + tag: '', + atlas_id: undefined, + atlas_pixel_size: undefined, + atlas: undefined, + sample: undefined + }, + data_collections: [], + processing_jobs: [] + }, + ] + + const tableRows: ProcessingTable[] = [] + + const result = getStartExtraRows(procParams, tableRows) + + // todo make tests work + expect(tableRows).toEqual([ + { + tag: '123', + processingRows: [ + { + parameterName: 'Threshold', + parameterValue: 0.5, + }, + ], + }, + ]) + + expect(result).toEqual([ + { + tag: '456', + processingRows: [ + { + parameterName: 'Threshold', + parameterValue: 'True', + }, + ], + }, + ]) + }) + + it('should return empty arrays when procParams is null', () => { + const result = getStartExtraRows(null, []) + expect(result).toEqual([]) + }) +}) diff --git a/src/schema/main.ts b/src/schema/main.ts index 2266d3e..239f2ec 100644 --- a/src/schema/main.ts +++ b/src/schema/main.ts @@ -3,287 +3,3677 @@ * Do not make direct changes to the file. */ - export interface paths { - "/": { + '/': { + /** Root */ + get: operations['root__get'] + } + '/machine': { + /** Machine Info */ + get: operations['machine_info_machine_get'] + } + '/instruments/{instrument_name}/machine': { + /** Machine Info By Name */ + get: operations['machine_info_by_name_instruments__instrument_name__machine_get'] + } + '/microscope_image/': { + /** Get Mic Image */ + get: operations['get_mic_image_microscope_image__get'] + } + '/mag_table/': { + /** Get Mag Table */ + get: operations['get_mag_table_mag_table__get'] + /** Add To Mag Table */ + post: operations['add_to_mag_table_mag_table__post'] + } + '/mag_table/{mag}': { + /** Remove Mag Table Row */ + delete: operations['remove_mag_table_row_mag_table__mag__delete'] + } + '/instruments/{instrument_name}/instrument_name': { + /** Get Instrument Display Name */ + get: operations['get_instrument_display_name_instruments__instrument_name__instrument_name_get'] + } + '/instruments/{instrument_name}/visits/': { + /** All Visit Info */ + get: operations['all_visit_info_instruments__instrument_name__visits__get'] + } + '/visits/{visit_name}': { + /** Visit Info */ + get: operations['visit_info_visits__visit_name__get'] + /** Register Client To Visit */ + post: operations['register_client_to_visit_visits__visit_name__post'] + } + '/num_movies': { + /** Count Number Of Movies */ + get: operations['count_number_of_movies_num_movies_get'] + } + '/sessions/{session_id}/rsyncer': { + /** Register Rsyncer */ + post: operations['register_rsyncer_sessions__session_id__rsyncer_post'] + } + '/sessions/{session_id}/rsyncer/{source}': { + /** Delete Rsyncer */ + delete: operations['delete_rsyncer_sessions__session_id__rsyncer__source__delete'] + } + '/sessions/{session_id}/rsyncer_stopped': { + /** Register Stopped Rsyncer */ + post: operations['register_stopped_rsyncer_sessions__session_id__rsyncer_stopped_post'] + } + '/sessions/{session_id}/rsyncer_started': { + /** Register Restarted Rsyncer */ + post: operations['register_restarted_rsyncer_sessions__session_id__rsyncer_started_post'] + } + '/clients/{client_id}/rsyncers': { + /** Get Rsyncers For Client */ + get: operations['get_rsyncers_for_client_clients__client_id__rsyncers_get'] + } + '/session/{session_id}': { + /** Get Session */ + get: operations['get_session_session__session_id__get'] + } + '/visits/{visit_name}/increment_rsync_file_count': { + /** Increment Rsync File Count */ + post: operations['increment_rsync_file_count_visits__visit_name__increment_rsync_file_count_post'] + } + '/visits/{visit_name}/increment_rsync_transferred_files': { + /** Increment Rsync Transferred Files */ + post: operations['increment_rsync_transferred_files_visits__visit_name__increment_rsync_transferred_files_post'] + } + '/visits/{visit_name}/increment_rsync_transferred_files_prometheus': { + /** Increment Rsync Transferred Files Prometheus */ + post: operations['increment_rsync_transferred_files_prometheus_visits__visit_name__increment_rsync_transferred_files_prometheus_post'] + } + '/sessions/{session_id}/spa_processing_parameters': { + /** Get Spa Proc Param Details */ + get: operations['get_spa_proc_param_details_sessions__session_id__spa_processing_parameters_get'] + /** Register Spa Proc Params */ + post: operations['register_spa_proc_params_sessions__session_id__spa_processing_parameters_post'] + } + '/sessions/{session_id}/tomography_preprocessing_parameters': { + /** Register Tomo Preproc Params */ + post: operations['register_tomo_preproc_params_sessions__session_id__tomography_preprocessing_parameters_post'] + } + '/clients/{client_id}/tomography_processing_parameters': { + /** Register Tomo Proc Params */ + post: operations['register_tomo_proc_params_clients__client_id__tomography_processing_parameters_post'] + } + '/clients/{client_id}/spa_processing_parameters': { + /** Get Spa Proc Params */ + get: operations['get_spa_proc_params_clients__client_id__spa_processing_parameters_get'] + } + '/sessions/{session_id}/grid_squares': { + /** Get Grid Squares */ + get: operations['get_grid_squares_sessions__session_id__grid_squares_get'] + } + '/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares': { + /** Get Grid Squares From Dcg */ + get: operations['get_grid_squares_from_dcg_sessions__session_id__data_collection_groups__dcgid__grid_squares_get'] + } + '/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{gsid}/num_movies': { + /** Get Number Of Movies From Grid Square */ + get: operations['get_number_of_movies_from_grid_square_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__num_movies_get'] + } + '/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{gsid}/foil_holes': { + /** Get Foil Holes From Grid Square */ + get: operations['get_foil_holes_from_grid_square_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__foil_holes_get'] + } + '/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{gsid}/foil_holes/{fhid}/num_movies': { + /** Get Number Of Movies From Foil Hole */ + get: operations['get_number_of_movies_from_foil_hole_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__foil_holes__fhid__num_movies_get'] + } + '/sessions/{session_id}/grid_square/{gsid}': { + /** Register Grid Square */ + post: operations['register_grid_square_sessions__session_id__grid_square__gsid__post'] + } + '/sessions/{session_id}/foil_hole/{fh_name}': { + /** Get Foil Hole */ + get: operations['get_foil_hole_sessions__session_id__foil_hole__fh_name__get'] + } + '/sessions/{session_id}/grid_square/{gs_name}/foil_hole': { + /** Register Foil Hole */ + post: operations['register_foil_hole_sessions__session_id__grid_square__gs_name__foil_hole_post'] + } + '/visits/{visit_name}/tilt_series': { + /** Register Tilt Series */ + post: operations['register_tilt_series_visits__visit_name__tilt_series_post'] + } + '/visits/{visit_name}/{client_id}/completed_tilt_series': { + /** Register Completed Tilt Series */ + post: operations['register_completed_tilt_series_visits__visit_name___client_id__completed_tilt_series_post'] + } + '/clients/{client_id}/tilt_series/{tilt_series_tag}/tilts': { + /** Get Tilts */ + get: operations['get_tilts_clients__client_id__tilt_series__tilt_series_tag__tilts_get'] + } + '/visits/{visit_name}/{client_id}/tilt': { + /** Register Tilt */ + post: operations['register_tilt_visits__visit_name___client_id__tilt_post'] + } + '/instruments/{instrument_name}/visits_raw': { + /** Get Current Visits */ + get: operations['get_current_visits_instruments__instrument_name__visits_raw_get'] + } + '/feedback': { + /** Send Murfey Message */ + post: operations['send_murfey_message_feedback_post'] + } + '/visits/{visit_name}/{session_id}/flush_spa_processing': { + /** Flush Spa Processing */ + post: operations['flush_spa_processing_visits__visit_name___session_id__flush_spa_processing_post'] + } + '/visits/{visit_name}/{session_id}/spa_preprocess': { + /** Request Spa Preprocessing */ + post: operations['request_spa_preprocessing_visits__visit_name___session_id__spa_preprocess_post'] + } + '/visits/{visit_name}/{client_id}/flush_tomography_processing': { + /** Flush Tomography Processing */ + post: operations['flush_tomography_processing_visits__visit_name___client_id__flush_tomography_processing_post'] + } + '/visits/{visit_name}/{client_id}/tomography_preprocess': { + /** Request Tomography Preprocessing */ + post: operations['request_tomography_preprocessing_visits__visit_name___client_id__tomography_preprocess_post'] + } + '/version': { + /** Get Version */ + get: operations['get_version_version_get'] + } + '/visits/{visit_name}/{session_id}/suggested_path': { + /** Suggest Path */ + post: operations['suggest_path_visits__visit_name___session_id__suggested_path_post'] + } + '/sessions/{session_id}/data_collection_groups': { + /** Get Dc Groups */ + get: operations['get_dc_groups_sessions__session_id__data_collection_groups_get'] + } + '/sessions/{session_id}/data_collection_groups/{dcgid}/data_collections': { + /** Get Data Collections */ + get: operations['get_data_collections_sessions__session_id__data_collection_groups__dcgid__data_collections_get'] + } + '/visits/{visit_name}/{session_id}/register_data_collection_group': { + /** Register Dc Group */ + post: operations['register_dc_group_visits__visit_name___session_id__register_data_collection_group_post'] + } + '/visits/{visit_name}/{session_id}/start_data_collection': { + /** Start Dc */ + post: operations['start_dc_visits__visit_name___session_id__start_data_collection_post'] + } + '/visits/{visit_name}/{session_id}/register_processing_job': { + /** Register Proc */ + post: operations['register_proc_visits__visit_name___session_id__register_processing_job_post'] + } + '/sessions/{session_id}/process_gain': { + /** Process Gain */ + post: operations['process_gain_sessions__session_id__process_gain_post'] + } + '/new_client_id/': { + /** New Client Id */ + get: operations['new_client_id_new_client_id__get'] + } + '/clients': { + /** Get Clients */ + get: operations['get_clients_clients_get'] + } + '/sessions': { + /** Get Sessions */ + get: operations['get_sessions_sessions_get'] + } + '/instruments/{instrument_name}/sessions': { + /** Get Sessions By Instrument Name */ + get: operations['get_sessions_by_instrument_name_instruments__instrument_name__sessions_get'] + } + '/instruments/{instrument_name}/clients/{client_id}/session': { + /** Link Client To Session */ + post: operations['link_client_to_session_instruments__instrument_name__clients__client_id__session_post'] + } + '/clients/{client_id}/session': { + /** Remove Session */ + delete: operations['remove_session_clients__client_id__session_delete'] + } + '/sessions/{session_id}/rsyncers': { + /** Get Rsyncers For Session */ + get: operations['get_rsyncers_for_session_sessions__session_id__rsyncers_get'] + } + '/sessions/{session_id}': { + /** Remove Session By Id */ + delete: operations['remove_session_by_id_sessions__session_id__delete'] + } + '/visits/{visit_name}/{session_id}/eer_fractionation_file': { + /** Write Eer Fractionation File */ + post: operations['write_eer_fractionation_file_visits__visit_name___session_id__eer_fractionation_file_post'] + } + '/visits/{visit_name}/monitoring/{on}': { + /** Change Monitoring Status */ + post: operations['change_monitoring_status_visits__visit_name__monitoring__on__post'] + } + '/sessions/{session_id}/upstream_visits': { + /** Find Upstream Visits */ + get: operations['find_upstream_visits_sessions__session_id__upstream_visits_get'] + } + '/visits/{visit_name}/{session_id}/upstream_tiff_paths': { + /** Gather Upstream Tiffs */ + get: operations['gather_upstream_tiffs_visits__visit_name___session_id__upstream_tiff_paths_get'] + } + '/visits/{visit_name}/{session_id}/upstream_tiff/{tiff_path}': { + /** Get Tiff */ + get: operations['get_tiff_visits__visit_name___session_id__upstream_tiff__tiff_path__get'] + } + '/failed_client_post': { + /** Failed Client Post */ + post: operations['failed_client_post_failed_client_post_post'] + } + '/instruments/{instrument_name}/visits/{visit}/session/{name}': { + /** Create Session */ + post: operations['create_session_instruments__instrument_name__visits__visit__session__name__post'] + } + '/sessions/{session_id}/current_gain_ref': { + /** Update Current Gain Ref */ + put: operations['update_current_gain_ref_sessions__session_id__current_gain_ref_put'] + } + '/version/': { + /** Get Version */ + get: operations['get_version_version__get'] + } + '/bootstrap/': { + /** + * Get Bootstrap Instructions + * @description Return a website containing instructions for installing the Murfey client on a + * machine with no internet access. + */ + get: operations['get_bootstrap_instructions_bootstrap__get'] + } + '/bootstrap/pip.whl': { + /** + * Get Pip Wheel + * @description Return a static version of pip. This does not need to be the newest or best, + * but has to be compatible with all supported Python versions. + * This is only used during bootstrapping by the client to identify and then + * download the actually newest appropriate version of pip. + */ + get: operations['get_pip_wheel_bootstrap_pip_whl_get'] + } + '/bootstrap/murfey.whl': { + /** + * Get Murfey Wheel + * @description Return a wheel file containing the latest release version of Murfey. We should + * not have to worry about the exact Python compatibility here, as long as + * murfey.bootstrap is compatible with all relevant versions of Python. + * This also ignores yanked releases, which again should be fine. + */ + get: operations['get_murfey_wheel_bootstrap_murfey_whl_get'] + } + '/cygwin/setup-x86_64.exe': { + /** + * Get Cygwin Setup + * @description Obtain and pass through a Cygwin installer from an official source. + * This is used during client bootstrapping and can download and install the + * Cygwin distribution that then remains on the client machines. + */ + get: operations['get_cygwin_setup_cygwin_setup_x86_64_exe_get'] + } + '/cygwin/{request_path}': { + /** + * Parse Cygwin Request + * @description Forward a Cygwin setup request to an official mirror. + */ + get: operations['parse_cygwin_request_cygwin__request_path__get'] + } + '/msys2/config/pacman.d.zip': { + /** + * Get Pacman Mirrors + * @description Dynamically generates a zip file containing mirrorlist files that have been set + * up to mirror the MSYS2 package database for each environment. + * + * The files in this folder should be pasted into, and overwrite, the 'mirrorlist' + * files present in the %MSYS64%\etc\pacman.d folder. The default path to this + * folder is C:\msys64\etc\pacman.d. + */ + get: operations['get_pacman_mirrors_msys2_config_pacman_d_zip_get'] + } + '/msys2/repo/distrib/{setup_file}': { + /** + * Get Msys2 Setup + * @description Obtain and pass through an MSYS2 installer from an official source. + * This is used during client bootstrapping, and can download and install the + * MSYS2 distribution that then remains on the client machines. + */ + get: operations['get_msys2_setup_msys2_repo_distrib__setup_file__get'] + } + '/msys2/repo/': { + /** + * Get Msys2 Main Index + * @description Returns a simple index displaying valid MSYS2 systems and the latest setup file + * from the main MSYS2 repository. + */ + get: operations['get_msys2_main_index_msys2_repo__get'] + } + '/msys2/repo/{system}/': { + /** + * Get Msys2 Environment Index + * @description Returns a list of all MSYS2 environments for a given system from the main MSYS2 + * repository. + */ + get: operations['get_msys2_environment_index_msys2_repo__system___get'] + } + '/msys2/repo/{system}/{environment}/': { + /** + * Get Msys2 Package Index + * @description Obtain a list of all available MSYS2 packages for a given environment from the main + * MSYS2 repo. + */ + get: operations['get_msys2_package_index_msys2_repo__system___environment___get'] + } + '/msys2/repo/{system}/{environment}/{package}': { + /** + * Get Msys2 Package File + * @description Obtain and pass through a specific download for an MSYS2 package. + */ + get: operations['get_msys2_package_file_msys2_repo__system___environment___package__get'] + } + '/rust/cargo/config.toml': { + /** + * Get Cargo Config + * @description Returns a properly configured Cargo config that sets it to look ONLY at the + * crates.io mirror. + * + * The default path for this config on Linux devices is ~/.cargo/config.toml, + * and its default path on Windows is %USERPROFILE%\.cargo\config.toml. + */ + get: operations['get_cargo_config_rust_cargo_config_toml_get'] + } + '/rust/index/': { + /** + * Get Index Page + * @description Returns a mirror of the https://index.crates.io landing page. + */ + get: operations['get_index_page_rust_index__get'] + } + '/rust/index/config.json': { + /** + * Get Index Config + * @description Download a config.json file used by Cargo to navigate sparse index registries + * with. + * + * The 'dl' key points to our mirror of the static crates.io repository, while + * the 'api' key points to an API version of that same registry. Both will be + * used by Cargo when searching for and downloading packages. + */ + get: operations['get_index_config_rust_index_config_json_get'] + } + '/rust/index/{c1}/{c2}/{package}': { + /** + * Get Index Package Metadata + * @description Download the metadata for a given package from the crates.io sparse index. + * The path to the metadata file on the server side takes the following form: + * /{c1}/{c2}/{package} + * + * c1 and c2 are 2 characters-long strings that are taken from the first 4 + * characters of the package name (a-z, A-Z, 0-9, -, _). For 3-letter packages, + * c1 = 3, and c2 is the first character of the package. + */ + get: operations['get_index_package_metadata_rust_index__c1___c2___package__get'] + } + '/rust/index/{n}/{package}': { + /** + * Get Index Package Metadata For Short Package Names + * @description The Rust sparse index' naming scheme for packages with 1-2 characters is + * different from the standard path convention. They are stored under + * /1/{package} or /2/{package}. + */ + get: operations['get_index_package_metadata_for_short_package_names_rust_index__n___package__get'] + } + '/rust/crates/{package}/{version}/download': { + /** + * Get Rust Package Download + * @description Obtain and pass through a crate download request for a Rust package via the + * sparse index registry. + */ + get: operations['get_rust_package_download_rust_crates__package___version__download_get'] + } + '/rust/api/v1/crates': { + /** + * Get Rust Api Package Index + * @description Displays the Rust API package index, which returns names of available packages + * in a JSON object based on the search query given. + */ + get: operations['get_rust_api_package_index_rust_api_v1_crates_get'] + } + '/rust/api/v1/crates/{package}': { + /** + * Get Rust Api Package Info + * @description Displays general information for a given Rust package, as a JSON object. + * Contains both version information and download information, in addition + * to other types of metadata. + */ + get: operations['get_rust_api_package_info_rust_api_v1_crates__package__get'] + } + '/rust/api/v1/crates/{package}/versions': { + /** + * Get Rust Api Package Versions + * @description Displays all available versions for a particular Rust package, along with download + * links for said versions, as a JSON object. + */ + get: operations['get_rust_api_package_versions_rust_api_v1_crates__package__versions_get'] + } + '/rust/api/v1/crates/{package}/{version}/download': { + /** + * Get Rust Api Package Download + * @description Obtain and pass through a crate download request for a specific Rust package. + */ + get: operations['get_rust_api_package_download_rust_api_v1_crates__package___version__download_get'] + } + '/rust/crates/{package}/{crate}': { + /** + * Get Rust Package Crate + * @description Obtain and pass through a download for a specific Rust crate. The Rust API + * download request actually redirects to the static crate repository, so this + * endpoint covers cases where the static crate download link is requested. + * + * The static Rust package repository has been configured such that only requests + * for a specific crate are accepted and handled. + * (e.g. https://static.crates.io/crates/anyhow/anyhow-1.0.97.crate will pass) + * + * A request for any other part of the URL path will be denied. + * (e.g. https://static.crates.io/crates/anyhow will fail) + */ + get: operations['get_rust_package_crate_rust_crates__package___crate__get'] + } + '/pypi/': { + /** + * Get Pypi Index + * @description Obtain list of all PyPI packages via the simple API (PEP 503). + */ + get: operations['get_pypi_index_pypi__get'] + } + '/pypi/{package}/': { + /** + * Get Pypi Package Downloads List + * @description Obtain list of all package downloads from PyPI via the simple API (PEP 503), and + * rewrite all download URLs to point to this server, under the current directory. + */ + get: operations['get_pypi_package_downloads_list_pypi__package___get'] + } + '/pypi/{package}/{filename}': { + /** + * Get Pypi File + * @description Obtain and pass through a specific download for a PyPI package. + */ + get: operations['get_pypi_file_pypi__package___filename__get'] + } + '/plugins/instruments/{instrument_name}/{package}': { + /** Get Plugin Wheel */ + get: operations['get_plugin_wheel_plugins_instruments__instrument_name___package__get'] + } + '/sessions/{session_id}/clem/lif_files': { + /** Register Lif File */ + post: operations['register_lif_file_sessions__session_id__clem_lif_files_post'] + } + '/sessions/{session_id}/clem/tiff_files': { + /** Register Tiff File */ + post: operations['register_tiff_file_sessions__session_id__clem_tiff_files_post'] + } + '/sessions/{session_id}/clem/metadata_files': { + /** Register Clem Metadata */ + post: operations['register_clem_metadata_sessions__session_id__clem_metadata_files_post'] + } + '/sessions/{session_id}/clem/image_series': { + /** Register Image Series */ + post: operations['register_image_series_sessions__session_id__clem_image_series_post'] + } + '/sessions/{session_id}/clem/image_stacks': { + /** Register Image Stack */ + post: operations['register_image_stack_sessions__session_id__clem_image_stacks_post'] + } + '/sessions/{session_id}/clem/preprocessing/process_raw_lifs': { + /** Process Raw Lifs */ + post: operations['process_raw_lifs_sessions__session_id__clem_preprocessing_process_raw_lifs_post'] + } + '/sessions/{session_id}/clem/preprocessing/process_raw_tiffs': { + /** Process Raw Tiffs */ + post: operations['process_raw_tiffs_sessions__session_id__clem_preprocessing_process_raw_tiffs_post'] + } + '/sessions/{session_id}/clem/processing/align_and_merge_stacks': { + /** Align And Merge Stacks */ + post: operations['align_and_merge_stacks_sessions__session_id__clem_processing_align_and_merge_stacks_post'] + } + '/sessions/{session_id}/cryolo_model': { + /** Get Cryolo Model Path */ + get: operations['get_cryolo_model_path_sessions__session_id__cryolo_model_get'] + } + 'auth/token': { + /** Generate Token */ + post: operations['generate_token_token_post'] + } + 'auth/sessions/{session_id}/token': { + /** Mint Session Token */ + get: operations['mint_session_token_sessions__session_id__token_get'] + } + 'auth/validate_token': { + /** Simple Token Validation */ + get: operations['simple_token_validation_validate_token_get'] + } + '/display/instruments/{instrument_name}/image/': { + /** Get Mic Image */ + get: operations['get_mic_image_display_instruments__instrument_name__image__get'] + } + '/display/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{grid_square_name}/image': { + /** Get Grid Square Img */ + get: operations['get_grid_square_img_display_sessions__session_id__data_collection_groups__dcgid__grid_squares__grid_square_name__image_get'] + } + '/display/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{grid_square_name}/foil_holes/{foil_hole_name}/image': { + /** Get Foil Hole Img */ + get: operations['get_foil_hole_img_display_sessions__session_id__data_collection_groups__dcgid__grid_squares__grid_square_name__foil_holes__foil_hole_name__image_get'] + } + '/instruments/{instrument_name}/sessions/{session_id}/activate_instrument_server': { + /** Activate Instrument Server For Session */ + post: operations['activate_instrument_server_for_session_instruments__instrument_name__sessions__session_id__activate_instrument_server_post'] + } + '/instruments/{instrument_name}/sessions/{session_id}/active': { + /** Check If Session Is Active */ + get: operations['check_if_session_is_active_instruments__instrument_name__sessions__session_id__active_get'] + } + '/sessions/{session_id}/multigrid_watcher': { + /** Setup Multigrid Watcher */ + post: operations['setup_multigrid_watcher_sessions__session_id__multigrid_watcher_post'] + } + '/sessions/{session_id}/start_multigrid_watcher': { + /** Start Multigrid Watcher */ + post: operations['start_multigrid_watcher_sessions__session_id__start_multigrid_watcher_post'] + } + '/sessions/{session_id}/provided_processing_parameters': { + /** Pass Proc Params To Instrument Server */ + post: operations['pass_proc_params_to_instrument_server_sessions__session_id__provided_processing_parameters_post'] + } + '/instruments/{instrument_name}/instrument_server': { + /** Check Instrument Server */ + get: operations['check_instrument_server_instruments__instrument_name__instrument_server_get'] + } + '/instruments/{instrument_name}/sessions/{session_id}/possible_gain_references': { + /** Get Possible Gain References */ + get: operations['get_possible_gain_references_instruments__instrument_name__sessions__session_id__possible_gain_references_get'] + } + '/sessions/{session_id}/upload_gain_reference': { + /** Request Gain Reference Upload */ + post: operations['request_gain_reference_upload_sessions__session_id__upload_gain_reference_post'] + } + '/visits/{visit_name}/{session_id}/upstream_tiff_data_request': { + /** Request Upstream Tiff Data Download */ + post: operations['request_upstream_tiff_data_download_visits__visit_name___session_id__upstream_tiff_data_request_post'] + } + '/sessions/{session_id}/stop_rsyncer': { + /** Stop Rsyncer */ + post: operations['stop_rsyncer_sessions__session_id__stop_rsyncer_post'] + } + '/sessions/{session_id}/finalise_rsyncer': { + /** Finalise Rsyncer */ + post: operations['finalise_rsyncer_sessions__session_id__finalise_rsyncer_post'] + } + '/sessions/{session_id}/finalise_session': { + /** Finalise Session */ + post: operations['finalise_session_sessions__session_id__finalise_session_post'] + } + '/sessions/{session_id}/remove_rsyncer': { + /** Remove Rsyncer */ + post: operations['remove_rsyncer_sessions__session_id__remove_rsyncer_post'] + } + '/sessions/{session_id}/restart_rsyncer': { + /** Restart Rsyncer */ + post: operations['restart_rsyncer_sessions__session_id__restart_rsyncer_post'] + } + '/instruments/{instrument_name}/sessions/{session_id}/rsyncer_info': { + /** Get Rsyncer Info */ + get: operations['get_rsyncer_info_instruments__instrument_name__sessions__session_id__rsyncer_info_get'] + } + '/instruments': { + /** Get Instrument Info */ + get: operations['get_instrument_info_instruments_get'] + } + '/instrument/{instrument_name}/image': { + /** Get Instrument Image */ + get: operations['get_instrument_image_instrument__instrument_name__image_get'] + } + '/sessions/{session_id}/session_processing_parameters': { + /** Get Session Processing Parameters */ + get: operations['get_session_processing_parameters_sessions__session_id__session_processing_parameters_get'] + /** Set Session Processing Parameters */ + post: operations['set_session_processing_parameters_sessions__session_id__session_processing_parameters_post'] + } + '/ws/test/{client_id}': { + /** Close Ws Connection */ + delete: operations['close_ws_connection_ws_test__client_id__delete'] + } + '/ws/connect/{client_id}': { + /** Close Unrecorded Ws Connection */ + delete: operations['close_unrecorded_ws_connection_ws_connect__client_id__delete'] + } + '/instruments/{instrument_name}/visits/{visit_name}/{session_id}/smartem_atlas/': { + /** Request Smartem Atlas Analysis */ + post: operations['request_smartem_atlas_analysis_instruments__instrument_name__visits__visit_name___session_id__smartem_atlas__post'] + } + '/instruments/{instrument_name}/k3_ssd': { + /** Update K3 Ssd Statuses */ + post: operations['update_k3_ssd_statuses_instruments__instrument_name__k3_ssd_post'] + } +} + +export type webhooks = Record + +export interface components { + schemas: { + /** AlignAndMergeParams */ + AlignAndMergeParams: { + /** Series Name */ + series_name: string + /** Images */ + images: string[] + /** + * Metadata + * Format: path + */ + metadata: string + /** Crop To N Frames */ + crop_to_n_frames?: number + /** + * Align Self + * @default + * @enum {string} + */ + align_self?: 'enabled' | '' + /** + * Flatten + * @default + * @enum {string} + */ + flatten?: 'mean' | 'min' | 'max' | '' + /** + * Align Across + * @default + * @enum {string} + */ + align_across?: 'enabled' | '' + } + /** Body_generate_token_token_post */ + Body_generate_token_token_post: { + /** Grant Type */ + grant_type?: string + /** Username */ + username: string + /** Password */ + password: string + /** + * Scope + * @default + */ + scope?: string + /** Client Id */ + client_id?: string + /** Client Secret */ + client_secret?: string + } + /** Body_register_clem_metadata_sessions__session_id__clem_metadata_files_post */ + Body_register_clem_metadata_sessions__session_id__clem_metadata_files_post: { + /** + * Associated Tiffs + * @default [] + */ + associated_tiffs?: string[] + /** + * Associated Stacks + * @default [] + */ + associated_stacks?: string[] + } + /** Body_register_image_series_sessions__session_id__clem_image_series_post */ + Body_register_image_series_sessions__session_id__clem_image_series_post: { + /** + * Parent Tiffs + * @default [] + */ + parent_tiffs?: string[] + /** + * Child Stacks + * @default [] + */ + child_stacks?: string[] + } + /** Body_register_lif_file_sessions__session_id__clem_lif_files_post */ + Body_register_lif_file_sessions__session_id__clem_lif_files_post: { + /** + * Child Metadata + * @default [] + */ + child_metadata?: string[] + /** + * Child Series + * @default [] + */ + child_series?: string[] + /** + * Child Stacks + * @default [] + */ + child_stacks?: string[] + } + /** ClientEnvironment */ + ClientEnvironment: { + /** Client Id */ + client_id?: number + /** + * Visit + * @default + */ + visit?: string + /** Session Id */ + session_id?: number + /** Connected */ + connected: boolean + } + /** ClientInfo */ + ClientInfo: { + /** Id */ + id: number + } + /** CurrentGainRef */ + CurrentGainRef: { + /** Path */ + path: string + } + /** DCGroupParameters */ + DCGroupParameters: { + /** Experiment Type */ + experiment_type: string + /** Experiment Type Id */ + experiment_type_id: number + /** Tag */ + tag: string + /** + * Atlas + * @default + */ + atlas?: string + /** Sample */ + sample?: number + /** + * Atlas Pixel Size + * @default 0 + */ + atlas_pixel_size?: number + } + /** DCParameters */ + DCParameters: { + /** Voltage */ + voltage: number + /** Pixel Size On Image */ + pixel_size_on_image: string + /** Experiment Type */ + experiment_type: string + /** Image Size X */ + image_size_x: number + /** Image Size Y */ + image_size_y: number + /** File Extension */ + file_extension: string + /** Acquisition Software */ + acquisition_software: string + /** Image Directory */ + image_directory: string + /** Tag */ + tag: string + /** Source */ + source: string + /** Magnification */ + magnification: number + /** Total Exposed Dose */ + total_exposed_dose?: number + /** C2Aperture */ + c2aperture?: number + /** Exposure Time */ + exposure_time?: number + /** Slit Width */ + slit_width?: number + /** + * Phase Plate + * @default false + */ + phase_plate?: boolean + /** + * Data Collection Tag + * @default + */ + data_collection_tag?: string + } + /** DataCollection */ + DataCollection: { + /** Id */ + id: number + /** Tag */ + tag: string + /** Dcg Id */ + dcg_id: number + } + /** DataCollectionGroup */ + DataCollectionGroup: { + /** Id */ + id: number + /** Session Id */ + session_id: number + /** Tag */ + tag: string + /** Atlas Id */ + atlas_id?: number + /** Atlas Pixel Size */ + atlas_pixel_size?: number + /** + * Atlas + * @default + */ + atlas?: string + /** Sample */ + sample?: number + } + /** EditableSessionProcessingParameters */ + EditableSessionProcessingParameters: { + /** + * Gain Ref + * @default + */ + gain_ref?: string + /** Dose Per Frame */ + dose_per_frame?: number + /** + * Eer Fractionation File + * @default + */ + eer_fractionation_file?: string + /** + * Symmetry + * @default + */ + symmetry?: string + } + /** File */ + File: { + /** Name */ + name: string + /** Description */ + description: string + /** Size */ + size: number + /** + * Timestamp + * Format: date-time + */ + timestamp: string + /** Full Path */ + full_path: string + } + /** FoilHole */ + FoilHole: { + /** Id */ + id?: number + /** Grid Square Id */ + grid_square_id: number + /** Session Id */ + session_id: number + /** Name */ + name: number + /** X Location */ + x_location?: number + /** Y Location */ + y_location?: number + /** X Stage Position */ + x_stage_position?: number + /** Y Stage Position */ + y_stage_position?: number + /** Readout Area X */ + readout_area_x?: number + /** Readout Area Y */ + readout_area_y?: number + /** Thumbnail Size X */ + thumbnail_size_x?: number + /** Thumbnail Size Y */ + thumbnail_size_y?: number + /** Pixel Size */ + pixel_size?: number + /** + * Image + * @default + */ + image?: string + } + /** FoilHoleParameters */ + FoilHoleParameters: { + /** Tag */ + tag: string + /** Name */ + name: number + /** X Location */ + x_location?: number + /** Y Location */ + y_location?: number + /** X Stage Position */ + x_stage_position?: number + /** Y Stage Position */ + y_stage_position?: number + /** Readout Area X */ + readout_area_x?: number + /** Readout Area Y */ + readout_area_y?: number + /** Thumbnail Size X */ + thumbnail_size_x?: number + /** Thumbnail Size Y */ + thumbnail_size_y?: number + /** Pixel Size */ + pixel_size?: number + /** + * Image + * @default + */ + image?: string + /** Diameter */ + diameter?: number + } + /** FractionationParameters */ + FractionationParameters: { + /** Fractionation */ + fractionation: number + /** Dose Per Frame */ + dose_per_frame: number + /** + * Num Frames + * @default 0 + */ + num_frames?: number + /** Eer Path */ + eer_path?: string + /** + * Fractionation File Name + * @default eer_fractionation.txt + */ + fractionation_file_name?: string + } + /** GainReference */ + GainReference: { + /** + * Gain Ref + * Format: path + */ + gain_ref: string + /** + * Rescale + * @default true + */ + rescale?: boolean + /** + * Eer + * @default false + */ + eer?: boolean + /** + * Tag + * @default + */ + tag?: string + } + /** GainReferenceRequest */ + GainReferenceRequest: { + /** + * Gain Path + * Format: path + */ + gain_path: string + } + /** GridSquare */ + GridSquare: { + /** Id */ + id?: number + /** Session Id */ + session_id: number + /** Name */ + name: number + /** Tag */ + tag: string + /** X Location */ + x_location?: number + /** Y Location */ + y_location?: number + /** X Stage Position */ + x_stage_position?: number + /** Y Stage Position */ + y_stage_position?: number + /** Readout Area X */ + readout_area_x?: number + /** Readout Area Y */ + readout_area_y?: number + /** Thumbnail Size X */ + thumbnail_size_x?: number + /** Thumbnail Size Y */ + thumbnail_size_y?: number + /** Pixel Size */ + pixel_size?: number + /** + * Image + * @default + */ + image?: string + } + /** GridSquareParameters */ + GridSquareParameters: { + /** Tag */ + tag: string + /** X Location */ + x_location?: number + /** Y Location */ + y_location?: number + /** X Stage Position */ + x_stage_position?: number + /** Y Stage Position */ + y_stage_position?: number + /** Readout Area X */ + readout_area_x?: number + /** Readout Area Y */ + readout_area_y?: number + /** Thumbnail Size X */ + thumbnail_size_x?: number + /** Thumbnail Size Y */ + thumbnail_size_y?: number + /** Height */ + height?: number + /** Width */ + width?: number + /** Pixel Size */ + pixel_size?: number + /** + * Image + * @default + */ + image?: string + /** Angle */ + angle?: number + } + /** HTTPValidationError */ + HTTPValidationError: { + /** Detail */ + detail?: components['schemas']['ValidationError'][] + } + /** InstrumentInfo */ + InstrumentInfo: { + /** Instrument Name */ + instrument_name: string + /** Display Name */ + display_name: string + /** Instrument Url */ + instrument_url: string + } + /** MachineConfig */ + MachineConfig: { + /** Acquisition Software */ + acquisition_software: string[] + /** Calibrations */ + calibrations: { + [key: string]: { + [key: string]: Record | number + } + } + /** Data Directories */ + data_directories: string[] + /** + * Rsync Basepath + * Format: path + */ + rsync_basepath: string + /** + * Default Model + * Format: path + */ + default_model: string + /** + * Display Name + * @default + */ + display_name?: string + /** + * Instrument Name + * @default + */ + instrument_name?: string + /** + * Image Path + * Format: path + */ + image_path?: string + /** + * Software Versions + * @default {} + */ + software_versions?: { + [key: string]: string + } + /** + * External Executables + * @default {} + */ + external_executables?: { + [key: string]: string + } + /** + * External Executables Eer + * @default {} + */ + external_executables_eer?: { + [key: string]: string + } + /** + * External Environment + * @default {} + */ + external_environment?: { + [key: string]: string + } + /** + * Rsync Module + * @default + */ + rsync_module?: string + /** + * Create Directories + * @default [ + * "atlas" + * ] + */ + create_directories?: string[] + /** + * Analyse Created Directories + * @default [] + */ + analyse_created_directories?: string[] + /** + * Gain Reference Directory + * Format: path + */ + gain_reference_directory?: string + /** + * Eer Fractionation File Template + * @default + */ + eer_fractionation_file_template?: string + /** + * Processed Directory Name + * @default processed + */ + processed_directory_name?: string + /** + * Gain Directory Name + * @default processing + */ + gain_directory_name?: string + /** + * Node Creator Queue + * @default node_creator + */ + node_creator_queue?: string + /** + * Superres + * @default false + */ + superres?: boolean + /** + * Camera + * @default FALCON + */ + camera?: string + /** + * Data Required Substrings + * @default {} + */ + data_required_substrings?: { + [key: string]: { + [key: string]: string[] + } + } + /** + * Allow Removal + * @default false + */ + allow_removal?: boolean + /** + * Data Transfer Enabled + * @default true + */ + data_transfer_enabled?: boolean + /** + * Processing Enabled + * @default true + */ + processing_enabled?: boolean + /** + * Machine Override + * @default + */ + machine_override?: string + /** + * Processed Extra Directory + * @default + */ + processed_extra_directory?: string + /** + * Plugin Packages + * @default {} + */ + plugin_packages?: { + [key: string]: string + } + /** + * Software Settings Output Directories + * @default {} + */ + software_settings_output_directories?: { + [key: string]: string[] + } + /** + * Process By Default + * @default true + */ + process_by_default?: boolean + /** + * Recipes + * @default { + * "em-spa-bfactor": "em-spa-bfactor", + * "em-spa-class2d": "em-spa-class2d", + * "em-spa-class3d": "em-spa-class3d", + * "em-spa-preprocess": "em-spa-preprocess", + * "em-spa-refine": "em-spa-refine", + * "em-tomo-preprocess": "em-tomo-preprocess", + * "em-tomo-align": "em-tomo-align" + * } + */ + recipes?: { + [key: string]: string + } + /** + * Upstream Data Directories + * @default [] + */ + upstream_data_directories?: string[] + /** + * Upstream Data Download Directory + * Format: path + */ + upstream_data_download_directory?: string + /** + * Upstream Data Tiff Locations + * @default [ + * "processed" + * ] + */ + upstream_data_tiff_locations?: string[] + /** + * Model Search Directory + * @default processing + */ + model_search_directory?: string + /** + * Initial Model Search Directory + * @default processing/initial_model + */ + initial_model_search_directory?: string + /** + * Failure Queue + * @default + */ + failure_queue?: string + /** + * Instrument Server Url + * @default http://localhost:8001 + */ + instrument_server_url?: string + /** + * Frontend Url + * @default http://localhost:3000 + */ + frontend_url?: string + /** + * Murfey Url + * @default http://localhost:8000 + */ + murfey_url?: string + /** + * Rsync Url + * @default + */ + rsync_url?: string + /** + * Security Configuration Path + * Format: path + */ + security_configuration_path?: string + /** + * Auth Url + * @default + */ + auth_url?: string + /** + * Notifications Queue + * @default pato_notification + */ + notifications_queue?: string + } + /** MagnificationLookup */ + MagnificationLookup: { + /** Magnification */ + magnification: number + /** Pixel Size */ + pixel_size: number + } + /** MultigridWatcherSetup */ + MultigridWatcherSetup: { + /** + * Source + * Format: path + */ + source: string + /** + * Skip Existing Processing + * @default false + */ + skip_existing_processing?: boolean + /** + * Destination Overrides + * @default {} + */ + destination_overrides?: { + [key: string]: string + } + /** + * Rsync Restarts + * @default [] + */ + rsync_restarts?: string[] + } + /** PostInfo */ + PostInfo: { + /** Url */ + url: string + /** Data */ + data: Record + } + /** PreprocessingParametersTomo */ + PreprocessingParametersTomo: { + /** Dose Per Frame */ + dose_per_frame?: number + /** Frame Count */ + frame_count: number + /** Tilt Axis */ + tilt_axis: number + /** Gain Ref */ + gain_ref?: string + /** Experiment Type */ + experiment_type: string + /** Voltage */ + voltage: number + /** Image Size X */ + image_size_x: number + /** Image Size Y */ + image_size_y: number + /** Pixel Size On Image */ + pixel_size_on_image: string + /** Motion Corr Binning */ + motion_corr_binning: number + /** Manual Tilt Offset */ + manual_tilt_offset: number + /** File Extension */ + file_extension: string + /** Tag */ + tag: string + /** Tilt Series Tag */ + tilt_series_tag: string + /** Eer Fractionation File */ + eer_fractionation_file?: string + /** Eer Fractionation */ + eer_fractionation: number + } + /** ProcessingDetails */ + ProcessingDetails: { + data_collection_group: components['schemas']['DataCollectionGroup'] + /** Data Collections */ + data_collections: components['schemas']['DataCollection'][] + /** Processing Jobs */ + processing_jobs: components['schemas']['ProcessingJob'][] + relion_params: components['schemas']['SPARelionParameters'] + feedback_params: components['schemas']['SPAFeedbackParameters'] + } + /** ProcessingJob */ + ProcessingJob: { + /** Id */ + id: number + /** Recipe */ + recipe: string + /** Dc Id */ + dc_id: number + } + /** ProcessingJobParameters */ + ProcessingJobParameters: { + /** Tag */ + tag: string + /** Source */ + source: string + /** Recipe */ + recipe: string + /** + * Parameters + * @default {} + */ + parameters?: Record + /** + * Experiment Type + * @default spa + */ + experiment_type?: string + } + /** ProcessingParametersSPA */ + ProcessingParametersSPA: { + /** Tag */ + tag: string + /** Dose Per Frame */ + dose_per_frame: number + /** Gain Ref */ + gain_ref?: string + /** Experiment Type */ + experiment_type: string + /** Voltage */ + voltage: number + /** Image Size X */ + image_size_x: number + /** Image Size Y */ + image_size_y: number + /** Pixel Size On Image */ + pixel_size_on_image: string + /** Motion Corr Binning */ + motion_corr_binning: number + /** File Extension */ + file_extension: string + /** Acquisition Software */ + acquisition_software: string + /** Use Cryolo */ + use_cryolo: boolean + /** Symmetry */ + symmetry: string + /** Mask Diameter */ + mask_diameter?: number + /** Boxsize */ + boxsize?: number + /** Downscale */ + downscale: boolean + /** Small Boxsize */ + small_boxsize?: number + /** + * Eer Fractionation File + * @default + */ + eer_fractionation_file?: string + /** Particle Diameter */ + particle_diameter?: number + /** Magnification */ + magnification?: number + /** Total Exposed Dose */ + total_exposed_dose?: number + /** C2Aperture */ + c2aperture?: number + /** Exposure Time */ + exposure_time?: number + /** Slit Width */ + slit_width?: number + /** + * Phase Plate + * @default false + */ + phase_plate?: boolean + } + /** ProcessingParametersTomo */ + ProcessingParametersTomo: { + /** Manual Tilt Offset */ + manual_tilt_offset: number + /** Tag */ + tag: string + /** Tilt Series Tag */ + tilt_series_tag: string + } + /** ProvidedProcessingParameters */ + ProvidedProcessingParameters: { + /** Dose Per Frame */ + dose_per_frame: number + /** + * Extract Downscale + * @default true + */ + extract_downscale?: boolean + /** Particle Diameter */ + particle_diameter?: number + /** + * Symmetry + * @default C1 + */ + symmetry?: string + /** + * Eer Fractionation + * @default 20 + */ + eer_fractionation?: number + } + /** RSyncerInfo */ + RSyncerInfo: { + /** Source */ + source: string + /** Num Files Transferred */ + num_files_transferred: number + /** Num Files In Queue */ + num_files_in_queue: number + /** Num Files To Analyse */ + num_files_to_analyse: number + /** Alive */ + alive: boolean + /** Stopping */ + stopping: boolean + /** Analyser Alive */ + analyser_alive: boolean + /** Analyser Stopping */ + analyser_stopping: boolean + /** Destination */ + destination: string + /** Tag */ + tag: string + /** Files Transferred */ + files_transferred: number + /** Files Counted */ + files_counted: number + /** Transferring */ + transferring: boolean + /** Session Id */ + session_id: number + } + /** RegistrationMessage */ + RegistrationMessage: { + /** Registration */ + registration: string + /** Params */ + params?: Record + } + /** RsyncInstance */ + RsyncInstance: { + /** Source */ + source: string + /** + * Destination + * @default + */ + destination?: string + /** Session Id */ + session_id: number + /** + * Tag + * @default + */ + tag?: string + /** + * Files Transferred + * @default 0 + */ + files_transferred?: number + /** + * Files Counted + * @default 0 + */ + files_counted?: number + /** + * Transferring + * @default false + */ + transferring?: boolean + } + /** RsyncerInfo */ + RsyncerInfo: { + /** Source */ + source: string + /** Destination */ + destination: string + /** Session Id */ + session_id: number + /** + * Transferring + * @default true + */ + transferring?: boolean + /** + * Increment Count + * @default 1 + */ + increment_count?: number + /** + * Bytes + * @default 0 + */ + bytes?: number + /** + * Increment Data Count + * @default 0 + */ + increment_data_count?: number + /** + * Data Bytes + * @default 0 + */ + data_bytes?: number + /** + * Tag + * @default + */ + tag?: string + } + /** SPAFeedbackParameters */ + SPAFeedbackParameters: { + /** Pj Id */ + pj_id: number + /** + * Estimate Particle Diameter + * @default true + */ + estimate_particle_diameter?: boolean + /** + * Hold Class2D + * @default false + */ + hold_class2d?: boolean + /** + * Rerun Class2D + * @default false + */ + rerun_class2d?: boolean + /** + * Hold Class3D + * @default false + */ + hold_class3d?: boolean + /** + * Hold Refine + * @default false + */ + hold_refine?: boolean + /** Class Selection Score */ + class_selection_score: number + /** Star Combination Job */ + star_combination_job: number + /** Initial Model */ + initial_model: string + /** Next Job */ + next_job: number + /** Picker Murfey Id */ + picker_murfey_id?: number + /** Picker Ispyb Id */ + picker_ispyb_id?: number + } + /** SPAProcessFile */ + SPAProcessFile: { + /** Tag */ + tag: string + /** Path */ + path: string + /** Description */ + description: string + /** Processing Job */ + processing_job?: number + /** Data Collection Id */ + data_collection_id?: number + /** Image Number */ + image_number: number + /** Autoproc Program Id */ + autoproc_program_id?: number + /** Foil Hole Id */ + foil_hole_id?: number + /** Pixel Size */ + pixel_size?: number + /** Dose Per Frame */ + dose_per_frame?: number + /** + * Mc Binning + * @default 1 + */ + mc_binning?: number + /** Gain Ref */ + gain_ref?: string + /** + * Extract Downscale + * @default true + */ + extract_downscale?: boolean + /** Eer Fractionation File */ + eer_fractionation_file?: string + /** + * Source + * @default + */ + source?: string + } + /** SPARelionParameters */ + SPARelionParameters: { + /** Pj Id */ + pj_id: number + /** Angpix */ + angpix: number + /** Dose Per Frame */ + dose_per_frame: number + /** Gain Ref */ + gain_ref?: string + /** Voltage */ + voltage: number + /** Motion Corr Binning */ + motion_corr_binning: number + /** + * Eer Fractionation File + * @default + */ + eer_fractionation_file?: string + /** Symmetry */ + symmetry: string + /** Particle Diameter */ + particle_diameter?: number + /** Downscale */ + downscale: boolean + /** + * Do Icebreaker Jobs + * @default true + */ + do_icebreaker_jobs?: boolean + /** + * Boxsize + * @default 256 + */ + boxsize?: number + /** + * Small Boxsize + * @default 64 + */ + small_boxsize?: number + /** + * Mask Diameter + * @default 190 + */ + mask_diameter?: number + } + /** SSDData */ + SSDData: { + /** Name */ + name: string + /** Health */ + health: number + } + /** Session */ + Session: { + /** Id */ + id: number + /** Name */ + name: string + /** + * Visit + * @default + */ + visit?: string + /** + * Started + * @default false + */ + started?: boolean + /** + * Current Gain Ref + * @default + */ + current_gain_ref?: string + /** + * Instrument Name + * @default + */ + instrument_name?: string + /** + * Process + * @default + */ + process?: boolean + visit_end_time: string + } + /** SessionClients */ + SessionClients: { + session: components['schemas']['Session'] + /** Clients */ + clients: components['schemas']['ClientEnvironment'][] + } + /** SessionInfo */ + SessionInfo: { + /** Session Id */ + session_id?: number + /** + * Session Name + * @default + */ + session_name?: string + /** + * Rescale + * @default true + */ + rescale?: boolean + } + /** SmartEMAtlasRequest */ + SmartEMAtlasRequest: { + /** + * Atlas Path + * Format: path + */ + atlas_path: string + /** + * Output Dir + * Format: path + */ + output_dir: string + /** Tag */ + tag: string + /** + * Num Preds + * @default 15 + */ + num_preds?: number + /** + * Cpus + * @default 4 + */ + cpus?: number + } + /** Source */ + Source: { + /** Rsync Source */ + rsync_source: string + } + /** SuggestedPathParameters */ + SuggestedPathParameters: { + /** + * Base Path + * Format: path + */ + base_path: string + /** + * Touch + * @default false + */ + touch?: boolean + /** + * Extra Directory + * @default + */ + extra_directory?: string + } + /** TIFFSeriesInfo */ + TIFFSeriesInfo: { + /** Series Name */ + series_name: string + /** Tiff Files */ + tiff_files: string[] + /** + * Series Metadata + * Format: path + */ + series_metadata: string + } + /** Tag */ + Tag: { + /** Tag */ + tag: string + } + /** TiltInfo */ + TiltInfo: { + /** Tilt Series Tag */ + tilt_series_tag: string + /** Movie Path */ + movie_path: string + /** Source */ + source: string + } + /** TiltSeriesGroupInfo */ + TiltSeriesGroupInfo: { + /** Tags */ + tags: string[] + /** Source */ + source: string + /** Tilt Series Lengths */ + tilt_series_lengths: number[] + } + /** TiltSeriesInfo */ + TiltSeriesInfo: { + /** Session Id */ + session_id: number + /** Tag */ + tag: string + /** Source */ + source: string + } + /** Token */ + Token: { + /** Access Token */ + access_token: string + /** Token Type */ + token_type: string + } + /** TomoProcessFile */ + TomoProcessFile: { + /** Path */ + path: string + /** Description */ + description: string + /** Tag */ + tag: string + /** Image Number */ + image_number: number + /** Pixel Size */ + pixel_size: number + /** Dose Per Frame */ + dose_per_frame?: number + /** Frame Count */ + frame_count: number + /** Tilt Axis */ + tilt_axis?: number + /** Mc Uuid */ + mc_uuid?: number + /** + * Voltage + * @default 300 + */ + voltage?: number + /** + * Mc Binning + * @default 1 + */ + mc_binning?: number + /** Gain Ref */ + gain_ref?: string + /** + * Extract Downscale + * @default 1 + */ + extract_downscale?: number + /** Eer Fractionation File */ + eer_fractionation_file?: string + /** Group Tag */ + group_tag?: string + } + /** ValidationError */ + ValidationError: { + /** Location */ + loc: (string | number)[] + /** Message */ + msg: string + /** Error Type */ + type: string + } + /** Visit */ + Visit: { + /** + * Start + * Format: date-time + */ + start: string + /** + * End + * Format: date-time + */ + end: string + /** Session Id */ + session_id: number + /** Name */ + name: string + /** Beamline */ + beamline: string + /** Proposal Title */ + proposal_title: string + } + /** RsyncerSource */ + murfey__server__api__instrument__RsyncerSource: { + /** Source */ + source: string + } + /** RsyncerSource */ + murfey__util__models__RsyncerSource: { + /** Source */ + source: string + } + } + responses: never + parameters: never + requestBodies: never + headers: never + pathItems: never +} + +export type $defs = Record + +export type external = Record + +export interface operations { /** Root */ - get: operations["root__get"]; - }; - "/machine": { + root__get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'text/html': string + } + } + } + } /** Machine Info */ - get: operations["machine_info_machine_get"]; - }; - "/instruments/{instrument_name}/machine": { + machine_info_machine_get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['MachineConfig'] + } + } + } + } /** Machine Info By Name */ - get: operations["machine_info_by_name_instruments__instrument_name__machine_get"]; - }; - "/microscope_image/": { + machine_info_by_name_instruments__instrument_name__machine_get: { + parameters: { + path: { + instrument_name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['MachineConfig'] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Mic Image */ - get: operations["get_mic_image_microscope_image__get"]; - }; - "/mag_table/": { + get_mic_image_microscope_image__get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + } + } /** Get Mag Table */ - get: operations["get_mag_table_mag_table__get"]; + get_mag_table_mag_table__get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['MagnificationLookup'][] + } + } + } + } /** Add To Mag Table */ - post: operations["add_to_mag_table_mag_table__post"]; - }; - "/mag_table/{mag}": { + add_to_mag_table_mag_table__post: { + requestBody: { + content: { + 'application/json': components['schemas']['MagnificationLookup'][] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Remove Mag Table Row */ - delete: operations["remove_mag_table_row_mag_table__mag__delete"]; - }; - "/instruments/{instrument_name}/instrument_name": { + remove_mag_table_row_mag_table__mag__delete: { + parameters: { + path: { + mag: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Instrument Display Name */ - get: operations["get_instrument_display_name_instruments__instrument_name__instrument_name_get"]; - }; - "/instruments/{instrument_name}/visits/": { + get_instrument_display_name_instruments__instrument_name__instrument_name_get: { + parameters: { + path: { + instrument_name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': string + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** All Visit Info */ - get: operations["all_visit_info_instruments__instrument_name__visits__get"]; - }; - "/visits/{visit_name}": { + all_visit_info_instruments__instrument_name__visits__get: { + parameters: { + path: { + instrument_name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Visit Info */ - get: operations["visit_info_visits__visit_name__get"]; + visit_info_visits__visit_name__get: { + parameters: { + path: { + visit_name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Client To Visit */ - post: operations["register_client_to_visit_visits__visit_name__post"]; - }; - "/num_movies": { + register_client_to_visit_visits__visit_name__post: { + parameters: { + path: { + visit_name: string + } + } + requestBody: { + content: { + 'application/json': components['schemas']['ClientInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Count Number Of Movies */ - get: operations["count_number_of_movies_num_movies_get"]; - }; - "/sessions/{session_id}/rsyncer": { + count_number_of_movies_num_movies_get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': { + [key: string]: number + } + } + } + } + } /** Register Rsyncer */ - post: operations["register_rsyncer_sessions__session_id__rsyncer_post"]; - }; - "/sessions/{session_id}/rsyncer/{source}": { + register_rsyncer_sessions__session_id__rsyncer_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['RsyncerInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Delete Rsyncer */ - delete: operations["delete_rsyncer_sessions__session_id__rsyncer__source__delete"]; - }; - "/sessions/{session_id}/rsyncer_stopped": { + delete_rsyncer_sessions__session_id__rsyncer__source__delete: { + parameters: { + path: { + session_id: number + source: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Stopped Rsyncer */ - post: operations["register_stopped_rsyncer_sessions__session_id__rsyncer_stopped_post"]; - }; - "/sessions/{session_id}/rsyncer_started": { + register_stopped_rsyncer_sessions__session_id__rsyncer_stopped_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['murfey__util__models__RsyncerSource'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Restarted Rsyncer */ - post: operations["register_restarted_rsyncer_sessions__session_id__rsyncer_started_post"]; - }; - "/clients/{client_id}/rsyncers": { + register_restarted_rsyncer_sessions__session_id__rsyncer_started_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['murfey__util__models__RsyncerSource'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Rsyncers For Client */ - get: operations["get_rsyncers_for_client_clients__client_id__rsyncers_get"]; - }; - "/session/{session_id}": { + get_rsyncers_for_client_clients__client_id__rsyncers_get: { + parameters: { + path: { + client_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Session */ - get: operations["get_session_session__session_id__get"]; - }; - "/visits/{visit_name}/increment_rsync_file_count": { + get_session_session__session_id__get: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['SessionClients'] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Increment Rsync File Count */ - post: operations["increment_rsync_file_count_visits__visit_name__increment_rsync_file_count_post"]; - }; - "/visits/{visit_name}/increment_rsync_transferred_files": { + increment_rsync_file_count_visits__visit_name__increment_rsync_file_count_post: { + parameters: { + path: { + visit_name: string + } + } + requestBody: { + content: { + 'application/json': components['schemas']['RsyncerInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Increment Rsync Transferred Files */ - post: operations["increment_rsync_transferred_files_visits__visit_name__increment_rsync_transferred_files_post"]; - }; - "/visits/{visit_name}/increment_rsync_transferred_files_prometheus": { + increment_rsync_transferred_files_visits__visit_name__increment_rsync_transferred_files_post: { + parameters: { + path: { + visit_name: string + } + } + requestBody: { + content: { + 'application/json': components['schemas']['RsyncerInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Increment Rsync Transferred Files Prometheus */ - post: operations["increment_rsync_transferred_files_prometheus_visits__visit_name__increment_rsync_transferred_files_prometheus_post"]; - }; - "/sessions/{session_id}/spa_processing_parameters": { + increment_rsync_transferred_files_prometheus_visits__visit_name__increment_rsync_transferred_files_prometheus_post: { + parameters: { + path: { + visit_name: string + } + } + requestBody: { + content: { + 'application/json': components['schemas']['RsyncerInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Spa Proc Param Details */ - get: operations["get_spa_proc_param_details_sessions__session_id__spa_processing_parameters_get"]; + get_spa_proc_param_details_sessions__session_id__spa_processing_parameters_get: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['ProcessingDetails'][] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Spa Proc Params */ - post: operations["register_spa_proc_params_sessions__session_id__spa_processing_parameters_post"]; - }; - "/sessions/{session_id}/tomography_preprocessing_parameters": { + register_spa_proc_params_sessions__session_id__spa_processing_parameters_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['ProcessingParametersSPA'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Tomo Preproc Params */ - post: operations["register_tomo_preproc_params_sessions__session_id__tomography_preprocessing_parameters_post"]; - }; - "/clients/{client_id}/tomography_processing_parameters": { + register_tomo_preproc_params_sessions__session_id__tomography_preprocessing_parameters_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['PreprocessingParametersTomo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Tomo Proc Params */ - post: operations["register_tomo_proc_params_clients__client_id__tomography_processing_parameters_post"]; - }; - "/clients/{client_id}/spa_processing_parameters": { + register_tomo_proc_params_clients__client_id__tomography_processing_parameters_post: { + parameters: { + path: { + client_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['ProcessingParametersTomo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Spa Proc Params */ - get: operations["get_spa_proc_params_clients__client_id__spa_processing_parameters_get"]; - }; - "/sessions/{session_id}/grid_squares": { + get_spa_proc_params_clients__client_id__spa_processing_parameters_get: { + parameters: { + path: { + client_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': Record[] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Grid Squares */ - get: operations["get_grid_squares_sessions__session_id__grid_squares_get"]; - }; - "/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares": { + get_grid_squares_sessions__session_id__grid_squares_get: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Grid Squares From Dcg */ - get: operations["get_grid_squares_from_dcg_sessions__session_id__data_collection_groups__dcgid__grid_squares_get"]; - }; - "/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{gsid}/num_movies": { + get_grid_squares_from_dcg_sessions__session_id__data_collection_groups__dcgid__grid_squares_get: { + parameters: { + path: { + session_id: number + dcgid: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['GridSquare'][] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Number Of Movies From Grid Square */ - get: operations["get_number_of_movies_from_grid_square_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__num_movies_get"]; - }; - "/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{gsid}/foil_holes": { + get_number_of_movies_from_grid_square_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__num_movies_get: { + parameters: { + path: { + session_id: number + dcgid: number + gsid: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': number + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Foil Holes From Grid Square */ - get: operations["get_foil_holes_from_grid_square_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__foil_holes_get"]; - }; - "/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{gsid}/foil_holes/{fhid}/num_movies": { + get_foil_holes_from_grid_square_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__foil_holes_get: { + parameters: { + path: { + session_id: number + dcgid: number + gsid: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['FoilHole'][] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Number Of Movies From Foil Hole */ - get: operations["get_number_of_movies_from_foil_hole_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__foil_holes__fhid__num_movies_get"]; - }; - "/sessions/{session_id}/grid_square/{gsid}": { + get_number_of_movies_from_foil_hole_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__foil_holes__fhid__num_movies_get: { + parameters: { + path: { + session_id: number + dcgid: number + gsid: number + fhid: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': number + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Grid Square */ - post: operations["register_grid_square_sessions__session_id__grid_square__gsid__post"]; - }; - "/sessions/{session_id}/foil_hole/{fh_name}": { + register_grid_square_sessions__session_id__grid_square__gsid__post: { + parameters: { + path: { + session_id: number + gsid: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['GridSquareParameters'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Foil Hole */ - get: operations["get_foil_hole_sessions__session_id__foil_hole__fh_name__get"]; - }; - "/sessions/{session_id}/grid_square/{gs_name}/foil_hole": { + get_foil_hole_sessions__session_id__foil_hole__fh_name__get: { + parameters: { + path: { + fh_name: number + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': { + [key: string]: number + } + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Foil Hole */ - post: operations["register_foil_hole_sessions__session_id__grid_square__gs_name__foil_hole_post"]; - }; - "/visits/{visit_name}/tilt_series": { + register_foil_hole_sessions__session_id__grid_square__gs_name__foil_hole_post: { + parameters: { + path: { + gs_name: number + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['FoilHoleParameters'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Tilt Series */ - post: operations["register_tilt_series_visits__visit_name__tilt_series_post"]; - }; - "/visits/{visit_name}/{client_id}/completed_tilt_series": { + register_tilt_series_visits__visit_name__tilt_series_post: { + parameters: { + path: { + visit_name: string + } + } + requestBody: { + content: { + 'application/json': components['schemas']['TiltSeriesInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Completed Tilt Series */ - post: operations["register_completed_tilt_series_visits__visit_name___client_id__completed_tilt_series_post"]; - }; - "/clients/{client_id}/tilt_series/{tilt_series_tag}/tilts": { + register_completed_tilt_series_visits__visit_name___client_id__completed_tilt_series_post: { + parameters: { + path: { + visit_name: string + client_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['TiltSeriesGroupInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Tilts */ - get: operations["get_tilts_clients__client_id__tilt_series__tilt_series_tag__tilts_get"]; - }; - "/visits/{visit_name}/{client_id}/tilt": { + get_tilts_clients__client_id__tilt_series__tilt_series_tag__tilts_get: { + parameters: { + path: { + client_id: number + tilt_series_tag: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Tilt */ - post: operations["register_tilt_visits__visit_name___client_id__tilt_post"]; - }; - "/instruments/{instrument_name}/visits_raw": { + register_tilt_visits__visit_name___client_id__tilt_post: { + parameters: { + path: { + visit_name: string + client_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['TiltInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Current Visits */ - get: operations["get_current_visits_instruments__instrument_name__visits_raw_get"]; - }; - "/feedback": { + get_current_visits_instruments__instrument_name__visits_raw_get: { + parameters: { + path: { + instrument_name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['Visit'][] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Send Murfey Message */ - post: operations["send_murfey_message_feedback_post"]; - }; - "/visits/{visit_name}/{session_id}/flush_spa_processing": { + send_murfey_message_feedback_post: { + requestBody: { + content: { + 'application/json': components['schemas']['RegistrationMessage'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Flush Spa Processing */ - post: operations["flush_spa_processing_visits__visit_name___session_id__flush_spa_processing_post"]; - }; - "/visits/{visit_name}/{session_id}/spa_preprocess": { + flush_spa_processing_visits__visit_name___session_id__flush_spa_processing_post: { + parameters: { + path: { + visit_name: string + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['Tag'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Request Spa Preprocessing */ - post: operations["request_spa_preprocessing_visits__visit_name___session_id__spa_preprocess_post"]; - }; - "/visits/{visit_name}/{client_id}/flush_tomography_processing": { + request_spa_preprocessing_visits__visit_name___session_id__spa_preprocess_post: { + parameters: { + path: { + visit_name: string + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['SPAProcessFile'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Flush Tomography Processing */ - post: operations["flush_tomography_processing_visits__visit_name___client_id__flush_tomography_processing_post"]; - }; - "/visits/{visit_name}/{client_id}/tomography_preprocess": { + flush_tomography_processing_visits__visit_name___client_id__flush_tomography_processing_post: { + parameters: { + path: { + visit_name: string + client_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['Source'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Request Tomography Preprocessing */ - post: operations["request_tomography_preprocessing_visits__visit_name___client_id__tomography_preprocess_post"]; - }; - "/version": { + request_tomography_preprocessing_visits__visit_name___client_id__tomography_preprocess_post: { + parameters: { + path: { + visit_name: string + client_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['TomoProcessFile'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Version */ - get: operations["get_version_version_get"]; - }; - "/visits/{visit_name}/{session_id}/suggested_path": { + get_version_version_get: { + parameters: { + query?: { + client_version?: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Suggest Path */ - post: operations["suggest_path_visits__visit_name___session_id__suggested_path_post"]; - }; - "/sessions/{session_id}/data_collection_groups": { + suggest_path_visits__visit_name___session_id__suggested_path_post: { + parameters: { + path: { + visit_name: string + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['SuggestedPathParameters'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Dc Groups */ - get: operations["get_dc_groups_sessions__session_id__data_collection_groups_get"]; - }; - "/sessions/{session_id}/data_collection_groups/{dcgid}/data_collections": { + get_dc_groups_sessions__session_id__data_collection_groups_get: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': { + [ + key: string + ]: components['schemas']['DataCollectionGroup'] + } + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Data Collections */ - get: operations["get_data_collections_sessions__session_id__data_collection_groups__dcgid__data_collections_get"]; - }; - "/visits/{visit_name}/{session_id}/register_data_collection_group": { + get_data_collections_sessions__session_id__data_collection_groups__dcgid__data_collections_get: { + parameters: { + path: { + dcgid: number + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['DataCollection'][] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Dc Group */ - post: operations["register_dc_group_visits__visit_name___session_id__register_data_collection_group_post"]; - }; - "/visits/{visit_name}/{session_id}/start_data_collection": { + register_dc_group_visits__visit_name___session_id__register_data_collection_group_post: { + parameters: { + path: { + visit_name: string + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['DCGroupParameters'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Start Dc */ - post: operations["start_dc_visits__visit_name___session_id__start_data_collection_post"]; - }; - "/visits/{visit_name}/{session_id}/register_processing_job": { + start_dc_visits__visit_name___session_id__start_data_collection_post: { + parameters: { + path: { + visit_name: string + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['DCParameters'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['DCParameters'] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Proc */ - post: operations["register_proc_visits__visit_name___session_id__register_processing_job_post"]; - }; - "/sessions/{session_id}/process_gain": { + register_proc_visits__visit_name___session_id__register_processing_job_post: { + parameters: { + path: { + visit_name: unknown + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['ProcessingJobParameters'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Process Gain */ - post: operations["process_gain_sessions__session_id__process_gain_post"]; - }; - "/new_client_id/": { + process_gain_sessions__session_id__process_gain_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['GainReference'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** New Client Id */ - get: operations["new_client_id_new_client_id__get"]; - }; - "/clients": { + new_client_id_new_client_id__get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + } + } /** Get Clients */ - get: operations["get_clients_clients_get"]; - }; - "/sessions": { + get_clients_clients_get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + } + } /** Get Sessions */ - get: operations["get_sessions_sessions_get"]; - }; - "/instruments/{instrument_name}/sessions": { + get_sessions_sessions_get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + } + } /** Get Sessions By Instrument Name */ - get: operations["get_sessions_by_instrument_name_instruments__instrument_name__sessions_get"]; - }; - "/instruments/{instrument_name}/clients/{client_id}/session": { + get_sessions_by_instrument_name_instruments__instrument_name__sessions_get: { + parameters: { + path: { + instrument_name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['Session'][] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Link Client To Session */ - post: operations["link_client_to_session_instruments__instrument_name__clients__client_id__session_post"]; - }; - "/clients/{client_id}/session": { + link_client_to_session_instruments__instrument_name__clients__client_id__session_post: { + parameters: { + path: { + instrument_name: string + client_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['SessionInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Remove Session */ - delete: operations["remove_session_clients__client_id__session_delete"]; - }; - "/sessions/{session_id}/rsyncers": { + remove_session_clients__client_id__session_delete: { + parameters: { + path: { + client_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Rsyncers For Session */ - get: operations["get_rsyncers_for_session_sessions__session_id__rsyncers_get"]; - }; - "/sessions/{session_id}": { + get_rsyncers_for_session_sessions__session_id__rsyncers_get: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['RsyncInstance'][] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Remove Session By Id */ - delete: operations["remove_session_by_id_sessions__session_id__delete"]; - }; - "/visits/{visit_name}/{session_id}/eer_fractionation_file": { + remove_session_by_id_sessions__session_id__delete: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Write Eer Fractionation File */ - post: operations["write_eer_fractionation_file_visits__visit_name___session_id__eer_fractionation_file_post"]; - }; - "/visits/{visit_name}/monitoring/{on}": { + write_eer_fractionation_file_visits__visit_name___session_id__eer_fractionation_file_post: { + parameters: { + path: { + visit_name: string + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['FractionationParameters'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': Record + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Change Monitoring Status */ - post: operations["change_monitoring_status_visits__visit_name__monitoring__on__post"]; - }; - "/sessions/{session_id}/upstream_visits": { + change_monitoring_status_visits__visit_name__monitoring__on__post: { + parameters: { + path: { + visit_name: string + on: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Find Upstream Visits */ - get: operations["find_upstream_visits_sessions__session_id__upstream_visits_get"]; - }; - "/visits/{visit_name}/{session_id}/upstream_tiff_paths": { + find_upstream_visits_sessions__session_id__upstream_visits_get: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Gather Upstream Tiffs */ - get: operations["gather_upstream_tiffs_visits__visit_name___session_id__upstream_tiff_paths_get"]; - }; - "/visits/{visit_name}/{session_id}/upstream_tiff/{tiff_path}": { + gather_upstream_tiffs_visits__visit_name___session_id__upstream_tiff_paths_get: { + parameters: { + path: { + visit_name: string + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Tiff */ - get: operations["get_tiff_visits__visit_name___session_id__upstream_tiff__tiff_path__get"]; - }; - "/failed_client_post": { + get_tiff_visits__visit_name___session_id__upstream_tiff__tiff_path__get: { + parameters: { + path: { + visit_name: string + session_id: number + tiff_path: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Failed Client Post */ - post: operations["failed_client_post_failed_client_post_post"]; - }; - "/instruments/{instrument_name}/visits/{visit}/session/{name}": { + failed_client_post_failed_client_post_post: { + requestBody: { + content: { + 'application/json': components['schemas']['PostInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Create Session */ - post: operations["create_session_instruments__instrument_name__visits__visit__session__name__post"]; - }; - "/sessions/{session_id}/current_gain_ref": { + create_session_instruments__instrument_name__visits__visit__session__name__post: { + parameters: { + path: { + instrument_name: string + visit: string + name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': number + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Update Current Gain Ref */ - put: operations["update_current_gain_ref_sessions__session_id__current_gain_ref_put"]; - }; - "/version/": { + update_current_gain_ref_sessions__session_id__current_gain_ref_put: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['CurrentGainRef'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Version */ - get: operations["get_version_version__get"]; - }; - "/bootstrap/": { + get_version_version__get: { + parameters: { + query?: { + client_version?: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Bootstrap Instructions * @description Return a website containing instructions for installing the Murfey client on a * machine with no internet access. */ - get: operations["get_bootstrap_instructions_bootstrap__get"]; - }; - "/bootstrap/pip.whl": { + get_bootstrap_instructions_bootstrap__get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'text/html': string + } + } + } + } /** * Get Pip Wheel * @description Return a static version of pip. This does not need to be the newest or best, @@ -291,9 +3681,14 @@ export interface paths { * This is only used during bootstrapping by the client to identify and then * download the actually newest appropriate version of pip. */ - get: operations["get_pip_wheel_bootstrap_pip_whl_get"]; - }; - "/bootstrap/murfey.whl": { + get_pip_wheel_bootstrap_pip_whl_get: { + responses: { + /** @description Successful Response */ + 200: { + content: never + } + } + } /** * Get Murfey Wheel * @description Return a wheel file containing the latest release version of Murfey. We should @@ -301,25 +3696,51 @@ export interface paths { * murfey.bootstrap is compatible with all relevant versions of Python. * This also ignores yanked releases, which again should be fine. */ - get: operations["get_murfey_wheel_bootstrap_murfey_whl_get"]; - }; - "/cygwin/setup-x86_64.exe": { + get_murfey_wheel_bootstrap_murfey_whl_get: { + responses: { + /** @description Successful Response */ + 200: { + content: never + } + } + } /** * Get Cygwin Setup * @description Obtain and pass through a Cygwin installer from an official source. * This is used during client bootstrapping and can download and install the * Cygwin distribution that then remains on the client machines. */ - get: operations["get_cygwin_setup_cygwin_setup_x86_64_exe_get"]; - }; - "/cygwin/{request_path}": { + get_cygwin_setup_cygwin_setup_x86_64_exe_get: { + responses: { + /** @description Successful Response */ + 200: { + content: never + } + } + } /** * Parse Cygwin Request * @description Forward a Cygwin setup request to an official mirror. */ - get: operations["parse_cygwin_request_cygwin__request_path__get"]; - }; - "/msys2/config/pacman.d.zip": { + parse_cygwin_request_cygwin__request_path__get: { + parameters: { + path: { + request_path: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Pacman Mirrors * @description Dynamically generates a zip file containing mirrorlist files that have been set @@ -329,49 +3750,126 @@ export interface paths { * files present in the %MSYS64%\etc\pacman.d folder. The default path to this * folder is C:\msys64\etc\pacman.d. */ - get: operations["get_pacman_mirrors_msys2_config_pacman_d_zip_get"]; - }; - "/msys2/repo/distrib/{setup_file}": { + get_pacman_mirrors_msys2_config_pacman_d_zip_get: { + responses: { + /** @description Successful Response */ + 200: { + content: never + } + } + } /** * Get Msys2 Setup * @description Obtain and pass through an MSYS2 installer from an official source. * This is used during client bootstrapping, and can download and install the * MSYS2 distribution that then remains on the client machines. */ - get: operations["get_msys2_setup_msys2_repo_distrib__setup_file__get"]; - }; - "/msys2/repo/": { + get_msys2_setup_msys2_repo_distrib__setup_file__get: { + parameters: { + path: { + setup_file: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Msys2 Main Index * @description Returns a simple index displaying valid MSYS2 systems and the latest setup file * from the main MSYS2 repository. */ - get: operations["get_msys2_main_index_msys2_repo__get"]; - }; - "/msys2/repo/{system}/": { + get_msys2_main_index_msys2_repo__get: { + responses: { + /** @description Successful Response */ + 200: { + content: never + } + } + } /** * Get Msys2 Environment Index * @description Returns a list of all MSYS2 environments for a given system from the main MSYS2 * repository. */ - get: operations["get_msys2_environment_index_msys2_repo__system___get"]; - }; - "/msys2/repo/{system}/{environment}/": { + get_msys2_environment_index_msys2_repo__system___get: { + parameters: { + path: { + system: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Msys2 Package Index * @description Obtain a list of all available MSYS2 packages for a given environment from the main * MSYS2 repo. */ - get: operations["get_msys2_package_index_msys2_repo__system___environment___get"]; - }; - "/msys2/repo/{system}/{environment}/{package}": { + get_msys2_package_index_msys2_repo__system___environment___get: { + parameters: { + path: { + system: string + environment: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Msys2 Package File * @description Obtain and pass through a specific download for an MSYS2 package. */ - get: operations["get_msys2_package_file_msys2_repo__system___environment___package__get"]; - }; - "/rust/cargo/config.toml": { + get_msys2_package_file_msys2_repo__system___environment___package__get: { + parameters: { + path: { + system: string + environment: string + package: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Cargo Config * @description Returns a properly configured Cargo config that sets it to look ONLY at the @@ -380,16 +3878,26 @@ export interface paths { * The default path for this config on Linux devices is ~/.cargo/config.toml, * and its default path on Windows is %USERPROFILE%\.cargo\config.toml. */ - get: operations["get_cargo_config_rust_cargo_config_toml_get"]; - }; - "/rust/index/": { + get_cargo_config_rust_cargo_config_toml_get: { + responses: { + /** @description Successful Response */ + 200: { + content: never + } + } + } /** * Get Index Page * @description Returns a mirror of the https://index.crates.io landing page. */ - get: operations["get_index_page_rust_index__get"]; - }; - "/rust/index/config.json": { + get_index_page_rust_index__get: { + responses: { + /** @description Successful Response */ + 200: { + content: never + } + } + } /** * Get Index Config * @description Download a config.json file used by Cargo to navigate sparse index registries @@ -399,9 +3907,14 @@ export interface paths { * the 'api' key points to an API version of that same registry. Both will be * used by Cargo when searching for and downloading packages. */ - get: operations["get_index_config_rust_index_config_json_get"]; - }; - "/rust/index/{c1}/{c2}/{package}": { + get_index_config_rust_index_config_json_get: { + responses: { + /** @description Successful Response */ + 200: { + content: never + } + } + } /** * Get Index Package Metadata * @description Download the metadata for a given package from the crates.io sparse index. @@ -412,58 +3925,183 @@ export interface paths { * characters of the package name (a-z, A-Z, 0-9, -, _). For 3-letter packages, * c1 = 3, and c2 is the first character of the package. */ - get: operations["get_index_package_metadata_rust_index__c1___c2___package__get"]; - }; - "/rust/index/{n}/{package}": { + get_index_package_metadata_rust_index__c1___c2___package__get: { + parameters: { + path: { + c1: string + c2: string + package: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Index Package Metadata For Short Package Names * @description The Rust sparse index' naming scheme for packages with 1-2 characters is * different from the standard path convention. They are stored under * /1/{package} or /2/{package}. */ - get: operations["get_index_package_metadata_for_short_package_names_rust_index__n___package__get"]; - }; - "/rust/crates/{package}/{version}/download": { + get_index_package_metadata_for_short_package_names_rust_index__n___package__get: { + parameters: { + path: { + n: string + package: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Rust Package Download * @description Obtain and pass through a crate download request for a Rust package via the * sparse index registry. */ - get: operations["get_rust_package_download_rust_crates__package___version__download_get"]; - }; - "/rust/api/v1/crates": { + get_rust_package_download_rust_crates__package___version__download_get: { + parameters: { + path: { + package: string + version: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Rust Api Package Index * @description Displays the Rust API package index, which returns names of available packages * in a JSON object based on the search query given. */ - get: operations["get_rust_api_package_index_rust_api_v1_crates_get"]; - }; - "/rust/api/v1/crates/{package}": { + get_rust_api_package_index_rust_api_v1_crates_get: { + parameters: { + query?: { + q?: string + per_page?: number + seek?: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Rust Api Package Info * @description Displays general information for a given Rust package, as a JSON object. * Contains both version information and download information, in addition * to other types of metadata. */ - get: operations["get_rust_api_package_info_rust_api_v1_crates__package__get"]; - }; - "/rust/api/v1/crates/{package}/versions": { + get_rust_api_package_info_rust_api_v1_crates__package__get: { + parameters: { + path: { + package: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Rust Api Package Versions * @description Displays all available versions for a particular Rust package, along with download * links for said versions, as a JSON object. */ - get: operations["get_rust_api_package_versions_rust_api_v1_crates__package__versions_get"]; - }; - "/rust/api/v1/crates/{package}/{version}/download": { + get_rust_api_package_versions_rust_api_v1_crates__package__versions_get: { + parameters: { + path: { + package: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Rust Api Package Download * @description Obtain and pass through a crate download request for a specific Rust package. */ - get: operations["get_rust_api_package_download_rust_api_v1_crates__package___version__download_get"]; - }; - "/rust/crates/{package}/{crate}": { + get_rust_api_package_download_rust_api_v1_crates__package___version__download_get: { + parameters: { + path: { + package: string + version: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Rust Package Crate * @description Obtain and pass through a download for a specific Rust crate. The Rust API @@ -477,4679 +4115,1041 @@ export interface paths { * A request for any other part of the URL path will be denied. * (e.g. https://static.crates.io/crates/anyhow will fail) */ - get: operations["get_rust_package_crate_rust_crates__package___crate__get"]; - }; - "/pypi/": { + get_rust_package_crate_rust_crates__package___crate__get: { + parameters: { + path: { + package: string + crate: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Pypi Index * @description Obtain list of all PyPI packages via the simple API (PEP 503). */ - get: operations["get_pypi_index_pypi__get"]; - }; - "/pypi/{package}/": { + get_pypi_index_pypi__get: { + responses: { + /** @description Successful Response */ + 200: { + content: never + } + } + } /** * Get Pypi Package Downloads List * @description Obtain list of all package downloads from PyPI via the simple API (PEP 503), and * rewrite all download URLs to point to this server, under the current directory. */ - get: operations["get_pypi_package_downloads_list_pypi__package___get"]; - }; - "/pypi/{package}/{filename}": { + get_pypi_package_downloads_list_pypi__package___get: { + parameters: { + path: { + package: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** * Get Pypi File * @description Obtain and pass through a specific download for a PyPI package. */ - get: operations["get_pypi_file_pypi__package___filename__get"]; - }; - "/plugins/instruments/{instrument_name}/{package}": { + get_pypi_file_pypi__package___filename__get: { + parameters: { + path: { + package: string + filename: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Plugin Wheel */ - get: operations["get_plugin_wheel_plugins_instruments__instrument_name___package__get"]; - }; - "/sessions/{session_id}/clem/lif_files": { + get_plugin_wheel_plugins_instruments__instrument_name___package__get: { + parameters: { + path: { + instrument_name: string + package: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: never + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Lif File */ - post: operations["register_lif_file_sessions__session_id__clem_lif_files_post"]; - }; - "/sessions/{session_id}/clem/tiff_files": { + register_lif_file_sessions__session_id__clem_lif_files_post: { + parameters: { + query: { + lif_file: string + master_metadata?: string + } + path: { + session_id: number + } + } + requestBody?: { + content: { + 'application/json': components['schemas']['Body_register_lif_file_sessions__session_id__clem_lif_files_post'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Tiff File */ - post: operations["register_tiff_file_sessions__session_id__clem_tiff_files_post"]; - }; - "/sessions/{session_id}/clem/metadata_files": { + register_tiff_file_sessions__session_id__clem_tiff_files_post: { + parameters: { + query: { + tiff_file: string + associated_metadata?: string + associated_series?: string + associated_stack?: string + } + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Clem Metadata */ - post: operations["register_clem_metadata_sessions__session_id__clem_metadata_files_post"]; - }; - "/sessions/{session_id}/clem/image_series": { + register_clem_metadata_sessions__session_id__clem_metadata_files_post: { + parameters: { + query: { + metadata_file: string + parent_lif?: string + associated_series?: string + } + path: { + session_id: number + } + } + requestBody?: { + content: { + 'application/json': components['schemas']['Body_register_clem_metadata_sessions__session_id__clem_metadata_files_post'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Image Series */ - post: operations["register_image_series_sessions__session_id__clem_image_series_post"]; - }; - "/sessions/{session_id}/clem/image_stacks": { + register_image_series_sessions__session_id__clem_image_series_post: { + parameters: { + query: { + series_name: string + parent_lif?: string + associated_metadata?: string + } + path: { + session_id: number + } + } + requestBody?: { + content: { + 'application/json': components['schemas']['Body_register_image_series_sessions__session_id__clem_image_series_post'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Register Image Stack */ - post: operations["register_image_stack_sessions__session_id__clem_image_stacks_post"]; - }; - "/sessions/{session_id}/clem/preprocessing/process_raw_lifs": { + register_image_stack_sessions__session_id__clem_image_stacks_post: { + parameters: { + query: { + image_stack: string + channel?: string + parent_lif?: string + associated_metadata?: string + parent_series?: string + } + path: { + session_id: number + } + } + requestBody?: { + content: { + 'application/json': string[] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Process Raw Lifs */ - post: operations["process_raw_lifs_sessions__session_id__clem_preprocessing_process_raw_lifs_post"]; - }; - "/sessions/{session_id}/clem/preprocessing/process_raw_tiffs": { + process_raw_lifs_sessions__session_id__clem_preprocessing_process_raw_lifs_post: { + parameters: { + query: { + lif_file: string + } + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Process Raw Tiffs */ - post: operations["process_raw_tiffs_sessions__session_id__clem_preprocessing_process_raw_tiffs_post"]; - }; - "/sessions/{session_id}/clem/processing/align_and_merge_stacks": { + process_raw_tiffs_sessions__session_id__clem_preprocessing_process_raw_tiffs_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['TIFFSeriesInfo'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Align And Merge Stacks */ - post: operations["align_and_merge_stacks_sessions__session_id__clem_processing_align_and_merge_stacks_post"]; - }; - "/sessions/{session_id}/cryolo_model": { + align_and_merge_stacks_sessions__session_id__clem_processing_align_and_merge_stacks_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['AlignAndMergeParams'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Cryolo Model Path */ - get: operations["get_cryolo_model_path_sessions__session_id__cryolo_model_get"]; - }; - "auth/token": { + get_cryolo_model_path_sessions__session_id__cryolo_model_get: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Generate Token */ - post: operations["generate_token_token_post"]; - }; - "auth/sessions/{session_id}/token": { + generate_token_token_post: { + requestBody: { + content: { + 'application/x-www-form-urlencoded': components['schemas']['Body_generate_token_token_post'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['Token'] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Mint Session Token */ - get: operations["mint_session_token_sessions__session_id__token_get"]; - }; - "auth/validate_token": { + mint_session_token_sessions__session_id__token_get: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Simple Token Validation */ - get: operations["simple_token_validation_validate_token_get"]; - }; - "/display/instruments/{instrument_name}/image/": { + simple_token_validation_validate_token_get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + } + } /** Get Mic Image */ - get: operations["get_mic_image_display_instruments__instrument_name__image__get"]; - }; - "/display/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{grid_square_name}/image": { + get_mic_image_display_instruments__instrument_name__image__get: { + parameters: { + path: { + instrument_name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Grid Square Img */ - get: operations["get_grid_square_img_display_sessions__session_id__data_collection_groups__dcgid__grid_squares__grid_square_name__image_get"]; - }; - "/display/sessions/{session_id}/data_collection_groups/{dcgid}/grid_squares/{grid_square_name}/foil_holes/{foil_hole_name}/image": { + get_grid_square_img_display_sessions__session_id__data_collection_groups__dcgid__grid_squares__grid_square_name__image_get: { + parameters: { + path: { + session_id: number + dcgid: number + grid_square_name: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Foil Hole Img */ - get: operations["get_foil_hole_img_display_sessions__session_id__data_collection_groups__dcgid__grid_squares__grid_square_name__foil_holes__foil_hole_name__image_get"]; - }; - "/instruments/{instrument_name}/sessions/{session_id}/activate_instrument_server": { + get_foil_hole_img_display_sessions__session_id__data_collection_groups__dcgid__grid_squares__grid_square_name__foil_holes__foil_hole_name__image_get: { + parameters: { + path: { + session_id: number + dcgid: number + grid_square_name: number + foil_hole_name: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Activate Instrument Server For Session */ - post: operations["activate_instrument_server_for_session_instruments__instrument_name__sessions__session_id__activate_instrument_server_post"]; - }; - "/instruments/{instrument_name}/sessions/{session_id}/active": { + activate_instrument_server_for_session_instruments__instrument_name__sessions__session_id__activate_instrument_server_post: { + parameters: { + path: { + instrument_name: string + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Check If Session Is Active */ - get: operations["check_if_session_is_active_instruments__instrument_name__sessions__session_id__active_get"]; - }; - "/sessions/{session_id}/multigrid_watcher": { + check_if_session_is_active_instruments__instrument_name__sessions__session_id__active_get: { + parameters: { + path: { + instrument_name: string + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Setup Multigrid Watcher */ - post: operations["setup_multigrid_watcher_sessions__session_id__multigrid_watcher_post"]; - }; - "/sessions/{session_id}/start_multigrid_watcher": { + setup_multigrid_watcher_sessions__session_id__multigrid_watcher_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['MultigridWatcherSetup'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Start Multigrid Watcher */ - post: operations["start_multigrid_watcher_sessions__session_id__start_multigrid_watcher_post"]; - }; - "/sessions/{session_id}/provided_processing_parameters": { + start_multigrid_watcher_sessions__session_id__start_multigrid_watcher_post: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Pass Proc Params To Instrument Server */ - post: operations["pass_proc_params_to_instrument_server_sessions__session_id__provided_processing_parameters_post"]; - }; - "/instruments/{instrument_name}/instrument_server": { + pass_proc_params_to_instrument_server_sessions__session_id__provided_processing_parameters_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['ProvidedProcessingParameters'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Check Instrument Server */ - get: operations["check_instrument_server_instruments__instrument_name__instrument_server_get"]; - }; - "/instruments/{instrument_name}/sessions/{session_id}/possible_gain_references": { + check_instrument_server_instruments__instrument_name__instrument_server_get: { + parameters: { + path: { + instrument_name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Possible Gain References */ - get: operations["get_possible_gain_references_instruments__instrument_name__sessions__session_id__possible_gain_references_get"]; - }; - "/sessions/{session_id}/upload_gain_reference": { + get_possible_gain_references_instruments__instrument_name__sessions__session_id__possible_gain_references_get: { + parameters: { + path: { + instrument_name: string + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['File'][] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Request Gain Reference Upload */ - post: operations["request_gain_reference_upload_sessions__session_id__upload_gain_reference_post"]; - }; - "/visits/{visit_name}/{session_id}/upstream_tiff_data_request": { + request_gain_reference_upload_sessions__session_id__upload_gain_reference_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['GainReferenceRequest'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Request Upstream Tiff Data Download */ - post: operations["request_upstream_tiff_data_download_visits__visit_name___session_id__upstream_tiff_data_request_post"]; - }; - "/sessions/{session_id}/stop_rsyncer": { + request_upstream_tiff_data_download_visits__visit_name___session_id__upstream_tiff_data_request_post: { + parameters: { + path: { + visit_name: string + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Stop Rsyncer */ - post: operations["stop_rsyncer_sessions__session_id__stop_rsyncer_post"]; - }; - "/sessions/{session_id}/finalise_rsyncer": { + stop_rsyncer_sessions__session_id__stop_rsyncer_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['murfey__server__api__instrument__RsyncerSource'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Finalise Rsyncer */ - post: operations["finalise_rsyncer_sessions__session_id__finalise_rsyncer_post"]; - }; - "/sessions/{session_id}/finalise_session": { + finalise_rsyncer_sessions__session_id__finalise_rsyncer_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['murfey__server__api__instrument__RsyncerSource'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Finalise Session */ - post: operations["finalise_session_sessions__session_id__finalise_session_post"]; - }; - "/sessions/{session_id}/remove_rsyncer": { + finalise_session_sessions__session_id__finalise_session_post: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Remove Rsyncer */ - post: operations["remove_rsyncer_sessions__session_id__remove_rsyncer_post"]; - }; - "/sessions/{session_id}/restart_rsyncer": { + remove_rsyncer_sessions__session_id__remove_rsyncer_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['murfey__server__api__instrument__RsyncerSource'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Restart Rsyncer */ - post: operations["restart_rsyncer_sessions__session_id__restart_rsyncer_post"]; - }; - "/instruments/{instrument_name}/sessions/{session_id}/rsyncer_info": { + restart_rsyncer_sessions__session_id__restart_rsyncer_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['murfey__server__api__instrument__RsyncerSource'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Rsyncer Info */ - get: operations["get_rsyncer_info_instruments__instrument_name__sessions__session_id__rsyncer_info_get"]; - }; - "/instruments": { + get_rsyncer_info_instruments__instrument_name__sessions__session_id__rsyncer_info_get: { + parameters: { + path: { + instrument_name: string + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['RSyncerInfo'][] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Instrument Info */ - get: operations["get_instrument_info_instruments_get"]; - }; - "/instrument/{instrument_name}/image": { + get_instrument_info_instruments_get: { + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['InstrumentInfo'][] + } + } + } + } /** Get Instrument Image */ - get: operations["get_instrument_image_instrument__instrument_name__image_get"]; - }; - "/sessions/{session_id}/session_processing_parameters": { + get_instrument_image_instrument__instrument_name__image_get: { + parameters: { + path: { + instrument_name: string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Get Session Processing Parameters */ - get: operations["get_session_processing_parameters_sessions__session_id__session_processing_parameters_get"]; + get_session_processing_parameters_sessions__session_id__session_processing_parameters_get: { + parameters: { + path: { + session_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['EditableSessionProcessingParameters'] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Set Session Processing Parameters */ - post: operations["set_session_processing_parameters_sessions__session_id__session_processing_parameters_post"]; - }; - "/ws/test/{client_id}": { + set_session_processing_parameters_sessions__session_id__session_processing_parameters_post: { + parameters: { + path: { + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['EditableSessionProcessingParameters'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': components['schemas']['EditableSessionProcessingParameters'] + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Close Ws Connection */ - delete: operations["close_ws_connection_ws_test__client_id__delete"]; - }; - "/ws/connect/{client_id}": { + close_ws_connection_ws_test__client_id__delete: { + parameters: { + path: { + client_id: number + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Close Unrecorded Ws Connection */ - delete: operations["close_unrecorded_ws_connection_ws_connect__client_id__delete"]; - }; - "/instruments/{instrument_name}/visits/{visit_name}/{session_id}/smartem_atlas/": { + close_unrecorded_ws_connection_ws_connect__client_id__delete: { + parameters: { + path: { + client_id: number | string + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Request Smartem Atlas Analysis */ - post: operations["request_smartem_atlas_analysis_instruments__instrument_name__visits__visit_name___session_id__smartem_atlas__post"]; - }; - "/instruments/{instrument_name}/k3_ssd": { + request_smartem_atlas_analysis_instruments__instrument_name__visits__visit_name___session_id__smartem_atlas__post: { + parameters: { + path: { + instrument_name: string + visit_name: string + session_id: number + } + } + requestBody: { + content: { + 'application/json': components['schemas']['SmartEMAtlasRequest'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } /** Update K3 Ssd Statuses */ - post: operations["update_k3_ssd_statuses_instruments__instrument_name__k3_ssd_post"]; - }; -} - -export type webhooks = Record; - -export interface components { - schemas: { - /** AlignAndMergeParams */ - AlignAndMergeParams: { - /** Series Name */ - series_name: string; - /** Images */ - images: string[]; - /** - * Metadata - * Format: path - */ - metadata: string; - /** Crop To N Frames */ - crop_to_n_frames?: number; - /** - * Align Self - * @default - * @enum {string} - */ - align_self?: "enabled" | ""; - /** - * Flatten - * @default - * @enum {string} - */ - flatten?: "mean" | "min" | "max" | ""; - /** - * Align Across - * @default - * @enum {string} - */ - align_across?: "enabled" | ""; - }; - /** Body_generate_token_token_post */ - Body_generate_token_token_post: { - /** Grant Type */ - grant_type?: string; - /** Username */ - username: string; - /** Password */ - password: string; - /** - * Scope - * @default - */ - scope?: string; - /** Client Id */ - client_id?: string; - /** Client Secret */ - client_secret?: string; - }; - /** Body_register_clem_metadata_sessions__session_id__clem_metadata_files_post */ - Body_register_clem_metadata_sessions__session_id__clem_metadata_files_post: { - /** - * Associated Tiffs - * @default [] - */ - associated_tiffs?: string[]; - /** - * Associated Stacks - * @default [] - */ - associated_stacks?: string[]; - }; - /** Body_register_image_series_sessions__session_id__clem_image_series_post */ - Body_register_image_series_sessions__session_id__clem_image_series_post: { - /** - * Parent Tiffs - * @default [] - */ - parent_tiffs?: string[]; - /** - * Child Stacks - * @default [] - */ - child_stacks?: string[]; - }; - /** Body_register_lif_file_sessions__session_id__clem_lif_files_post */ - Body_register_lif_file_sessions__session_id__clem_lif_files_post: { - /** - * Child Metadata - * @default [] - */ - child_metadata?: string[]; - /** - * Child Series - * @default [] - */ - child_series?: string[]; - /** - * Child Stacks - * @default [] - */ - child_stacks?: string[]; - }; - /** ClientEnvironment */ - ClientEnvironment: { - /** Client Id */ - client_id?: number; - /** - * Visit - * @default - */ - visit?: string; - /** Session Id */ - session_id?: number; - /** Connected */ - connected: boolean; - }; - /** ClientInfo */ - ClientInfo: { - /** Id */ - id: number; - }; - /** CurrentGainRef */ - CurrentGainRef: { - /** Path */ - path: string; - }; - /** DCGroupParameters */ - DCGroupParameters: { - /** Experiment Type */ - experiment_type: string; - /** Experiment Type Id */ - experiment_type_id: number; - /** Tag */ - tag: string; - /** - * Atlas - * @default - */ - atlas?: string; - /** Sample */ - sample?: number; - /** - * Atlas Pixel Size - * @default 0 - */ - atlas_pixel_size?: number; - }; - /** DCParameters */ - DCParameters: { - /** Voltage */ - voltage: number; - /** Pixel Size On Image */ - pixel_size_on_image: string; - /** Experiment Type */ - experiment_type: string; - /** Image Size X */ - image_size_x: number; - /** Image Size Y */ - image_size_y: number; - /** File Extension */ - file_extension: string; - /** Acquisition Software */ - acquisition_software: string; - /** Image Directory */ - image_directory: string; - /** Tag */ - tag: string; - /** Source */ - source: string; - /** Magnification */ - magnification: number; - /** Total Exposed Dose */ - total_exposed_dose?: number; - /** C2Aperture */ - c2aperture?: number; - /** Exposure Time */ - exposure_time?: number; - /** Slit Width */ - slit_width?: number; - /** - * Phase Plate - * @default false - */ - phase_plate?: boolean; - /** - * Data Collection Tag - * @default - */ - data_collection_tag?: string; - }; - /** DataCollection */ - DataCollection: { - /** Id */ - id: number; - /** Tag */ - tag: string; - /** Dcg Id */ - dcg_id: number; - }; - /** DataCollectionGroup */ - DataCollectionGroup: { - /** Id */ - id: number; - /** Session Id */ - session_id: number; - /** Tag */ - tag: string; - /** Atlas Id */ - atlas_id?: number; - /** Atlas Pixel Size */ - atlas_pixel_size?: number; - /** - * Atlas - * @default - */ - atlas?: string; - /** Sample */ - sample?: number; - }; - /** EditableSessionProcessingParameters */ - EditableSessionProcessingParameters: { - /** - * Gain Ref - * @default - */ - gain_ref?: string; - /** Dose Per Frame */ - dose_per_frame?: number; - /** - * Eer Fractionation File - * @default - */ - eer_fractionation_file?: string; - /** - * Symmetry - * @default - */ - symmetry?: string; - }; - /** File */ - File: { - /** Name */ - name: string; - /** Description */ - description: string; - /** Size */ - size: number; - /** - * Timestamp - * Format: date-time - */ - timestamp: string; - /** Full Path */ - full_path: string; - }; - /** FoilHole */ - FoilHole: { - /** Id */ - id?: number; - /** Grid Square Id */ - grid_square_id: number; - /** Session Id */ - session_id: number; - /** Name */ - name: number; - /** X Location */ - x_location?: number; - /** Y Location */ - y_location?: number; - /** X Stage Position */ - x_stage_position?: number; - /** Y Stage Position */ - y_stage_position?: number; - /** Readout Area X */ - readout_area_x?: number; - /** Readout Area Y */ - readout_area_y?: number; - /** Thumbnail Size X */ - thumbnail_size_x?: number; - /** Thumbnail Size Y */ - thumbnail_size_y?: number; - /** Pixel Size */ - pixel_size?: number; - /** - * Image - * @default - */ - image?: string; - }; - /** FoilHoleParameters */ - FoilHoleParameters: { - /** Tag */ - tag: string; - /** Name */ - name: number; - /** X Location */ - x_location?: number; - /** Y Location */ - y_location?: number; - /** X Stage Position */ - x_stage_position?: number; - /** Y Stage Position */ - y_stage_position?: number; - /** Readout Area X */ - readout_area_x?: number; - /** Readout Area Y */ - readout_area_y?: number; - /** Thumbnail Size X */ - thumbnail_size_x?: number; - /** Thumbnail Size Y */ - thumbnail_size_y?: number; - /** Pixel Size */ - pixel_size?: number; - /** - * Image - * @default - */ - image?: string; - /** Diameter */ - diameter?: number; - }; - /** FractionationParameters */ - FractionationParameters: { - /** Fractionation */ - fractionation: number; - /** Dose Per Frame */ - dose_per_frame: number; - /** - * Num Frames - * @default 0 - */ - num_frames?: number; - /** Eer Path */ - eer_path?: string; - /** - * Fractionation File Name - * @default eer_fractionation.txt - */ - fractionation_file_name?: string; - }; - /** GainReference */ - GainReference: { - /** - * Gain Ref - * Format: path - */ - gain_ref: string; - /** - * Rescale - * @default true - */ - rescale?: boolean; - /** - * Eer - * @default false - */ - eer?: boolean; - /** - * Tag - * @default - */ - tag?: string; - }; - /** GainReferenceRequest */ - GainReferenceRequest: { - /** - * Gain Path - * Format: path - */ - gain_path: string; - }; - /** GridSquare */ - GridSquare: { - /** Id */ - id?: number; - /** Session Id */ - session_id: number; - /** Name */ - name: number; - /** Tag */ - tag: string; - /** X Location */ - x_location?: number; - /** Y Location */ - y_location?: number; - /** X Stage Position */ - x_stage_position?: number; - /** Y Stage Position */ - y_stage_position?: number; - /** Readout Area X */ - readout_area_x?: number; - /** Readout Area Y */ - readout_area_y?: number; - /** Thumbnail Size X */ - thumbnail_size_x?: number; - /** Thumbnail Size Y */ - thumbnail_size_y?: number; - /** Pixel Size */ - pixel_size?: number; - /** - * Image - * @default - */ - image?: string; - }; - /** GridSquareParameters */ - GridSquareParameters: { - /** Tag */ - tag: string; - /** X Location */ - x_location?: number; - /** Y Location */ - y_location?: number; - /** X Stage Position */ - x_stage_position?: number; - /** Y Stage Position */ - y_stage_position?: number; - /** Readout Area X */ - readout_area_x?: number; - /** Readout Area Y */ - readout_area_y?: number; - /** Thumbnail Size X */ - thumbnail_size_x?: number; - /** Thumbnail Size Y */ - thumbnail_size_y?: number; - /** Height */ - height?: number; - /** Width */ - width?: number; - /** Pixel Size */ - pixel_size?: number; - /** - * Image - * @default - */ - image?: string; - /** Angle */ - angle?: number; - }; - /** HTTPValidationError */ - HTTPValidationError: { - /** Detail */ - detail?: components["schemas"]["ValidationError"][]; - }; - /** InstrumentInfo */ - InstrumentInfo: { - /** Instrument Name */ - instrument_name: string; - /** Display Name */ - display_name: string; - /** Instrument Url */ - instrument_url: string; - }; - /** MachineConfig */ - MachineConfig: { - /** Acquisition Software */ - acquisition_software: string[]; - /** Calibrations */ - calibrations: { - [key: string]: { - [key: string]: Record | number; - }; - }; - /** Data Directories */ - data_directories: string[]; - /** - * Rsync Basepath - * Format: path - */ - rsync_basepath: string; - /** - * Default Model - * Format: path - */ - default_model: string; - /** - * Display Name - * @default - */ - display_name?: string; - /** - * Instrument Name - * @default - */ - instrument_name?: string; - /** - * Image Path - * Format: path - */ - image_path?: string; - /** - * Software Versions - * @default {} - */ - software_versions?: { - [key: string]: string; - }; - /** - * External Executables - * @default {} - */ - external_executables?: { - [key: string]: string; - }; - /** - * External Executables Eer - * @default {} - */ - external_executables_eer?: { - [key: string]: string; - }; - /** - * External Environment - * @default {} - */ - external_environment?: { - [key: string]: string; - }; - /** - * Rsync Module - * @default - */ - rsync_module?: string; - /** - * Create Directories - * @default [ - * "atlas" - * ] - */ - create_directories?: string[]; - /** - * Analyse Created Directories - * @default [] - */ - analyse_created_directories?: string[]; - /** - * Gain Reference Directory - * Format: path - */ - gain_reference_directory?: string; - /** - * Eer Fractionation File Template - * @default - */ - eer_fractionation_file_template?: string; - /** - * Processed Directory Name - * @default processed - */ - processed_directory_name?: string; - /** - * Gain Directory Name - * @default processing - */ - gain_directory_name?: string; - /** - * Node Creator Queue - * @default node_creator - */ - node_creator_queue?: string; - /** - * Superres - * @default false - */ - superres?: boolean; - /** - * Camera - * @default FALCON - */ - camera?: string; - /** - * Data Required Substrings - * @default {} - */ - data_required_substrings?: { - [key: string]: { - [key: string]: string[]; - }; - }; - /** - * Allow Removal - * @default false - */ - allow_removal?: boolean; - /** - * Data Transfer Enabled - * @default true - */ - data_transfer_enabled?: boolean; - /** - * Processing Enabled - * @default true - */ - processing_enabled?: boolean; - /** - * Machine Override - * @default - */ - machine_override?: string; - /** - * Processed Extra Directory - * @default - */ - processed_extra_directory?: string; - /** - * Plugin Packages - * @default {} - */ - plugin_packages?: { - [key: string]: string; - }; - /** - * Software Settings Output Directories - * @default {} - */ - software_settings_output_directories?: { - [key: string]: string[]; - }; - /** - * Process By Default - * @default true - */ - process_by_default?: boolean; - /** - * Recipes - * @default { - * "em-spa-bfactor": "em-spa-bfactor", - * "em-spa-class2d": "em-spa-class2d", - * "em-spa-class3d": "em-spa-class3d", - * "em-spa-preprocess": "em-spa-preprocess", - * "em-spa-refine": "em-spa-refine", - * "em-tomo-preprocess": "em-tomo-preprocess", - * "em-tomo-align": "em-tomo-align" - * } - */ - recipes?: { - [key: string]: string; - }; - /** - * Upstream Data Directories - * @default [] - */ - upstream_data_directories?: string[]; - /** - * Upstream Data Download Directory - * Format: path - */ - upstream_data_download_directory?: string; - /** - * Upstream Data Tiff Locations - * @default [ - * "processed" - * ] - */ - upstream_data_tiff_locations?: string[]; - /** - * Model Search Directory - * @default processing - */ - model_search_directory?: string; - /** - * Initial Model Search Directory - * @default processing/initial_model - */ - initial_model_search_directory?: string; - /** - * Failure Queue - * @default - */ - failure_queue?: string; - /** - * Instrument Server Url - * @default http://localhost:8001 - */ - instrument_server_url?: string; - /** - * Frontend Url - * @default http://localhost:3000 - */ - frontend_url?: string; - /** - * Murfey Url - * @default http://localhost:8000 - */ - murfey_url?: string; - /** - * Rsync Url - * @default - */ - rsync_url?: string; - /** - * Security Configuration Path - * Format: path - */ - security_configuration_path?: string; - /** - * Auth Url - * @default - */ - auth_url?: string; - /** - * Notifications Queue - * @default pato_notification - */ - notifications_queue?: string; - }; - /** MagnificationLookup */ - MagnificationLookup: { - /** Magnification */ - magnification: number; - /** Pixel Size */ - pixel_size: number; - }; - /** MultigridWatcherSetup */ - MultigridWatcherSetup: { - /** - * Source - * Format: path - */ - source: string; - /** - * Skip Existing Processing - * @default false - */ - skip_existing_processing?: boolean; - /** - * Destination Overrides - * @default {} - */ - destination_overrides?: { - [key: string]: string; - }; - /** - * Rsync Restarts - * @default [] - */ - rsync_restarts?: string[]; - }; - /** PostInfo */ - PostInfo: { - /** Url */ - url: string; - /** Data */ - data: Record; - }; - /** PreprocessingParametersTomo */ - PreprocessingParametersTomo: { - /** Dose Per Frame */ - dose_per_frame?: number; - /** Frame Count */ - frame_count: number; - /** Tilt Axis */ - tilt_axis: number; - /** Gain Ref */ - gain_ref?: string; - /** Experiment Type */ - experiment_type: string; - /** Voltage */ - voltage: number; - /** Image Size X */ - image_size_x: number; - /** Image Size Y */ - image_size_y: number; - /** Pixel Size On Image */ - pixel_size_on_image: string; - /** Motion Corr Binning */ - motion_corr_binning: number; - /** Manual Tilt Offset */ - manual_tilt_offset: number; - /** File Extension */ - file_extension: string; - /** Tag */ - tag: string; - /** Tilt Series Tag */ - tilt_series_tag: string; - /** Eer Fractionation File */ - eer_fractionation_file?: string; - /** Eer Fractionation */ - eer_fractionation: number; - }; - /** ProcessingDetails */ - ProcessingDetails: { - data_collection_group: components["schemas"]["DataCollectionGroup"]; - /** Data Collections */ - data_collections: components["schemas"]["DataCollection"][]; - /** Processing Jobs */ - processing_jobs: components["schemas"]["ProcessingJob"][]; - relion_params: components["schemas"]["SPARelionParameters"]; - feedback_params: components["schemas"]["SPAFeedbackParameters"]; - }; - /** ProcessingJob */ - ProcessingJob: { - /** Id */ - id: number; - /** Recipe */ - recipe: string; - /** Dc Id */ - dc_id: number; - }; - /** ProcessingJobParameters */ - ProcessingJobParameters: { - /** Tag */ - tag: string; - /** Source */ - source: string; - /** Recipe */ - recipe: string; - /** - * Parameters - * @default {} - */ - parameters?: Record; - /** - * Experiment Type - * @default spa - */ - experiment_type?: string; - }; - /** ProcessingParametersSPA */ - ProcessingParametersSPA: { - /** Tag */ - tag: string; - /** Dose Per Frame */ - dose_per_frame: number; - /** Gain Ref */ - gain_ref?: string; - /** Experiment Type */ - experiment_type: string; - /** Voltage */ - voltage: number; - /** Image Size X */ - image_size_x: number; - /** Image Size Y */ - image_size_y: number; - /** Pixel Size On Image */ - pixel_size_on_image: string; - /** Motion Corr Binning */ - motion_corr_binning: number; - /** File Extension */ - file_extension: string; - /** Acquisition Software */ - acquisition_software: string; - /** Use Cryolo */ - use_cryolo: boolean; - /** Symmetry */ - symmetry: string; - /** Mask Diameter */ - mask_diameter?: number; - /** Boxsize */ - boxsize?: number; - /** Downscale */ - downscale: boolean; - /** Small Boxsize */ - small_boxsize?: number; - /** - * Eer Fractionation File - * @default - */ - eer_fractionation_file?: string; - /** Particle Diameter */ - particle_diameter?: number; - /** Magnification */ - magnification?: number; - /** Total Exposed Dose */ - total_exposed_dose?: number; - /** C2Aperture */ - c2aperture?: number; - /** Exposure Time */ - exposure_time?: number; - /** Slit Width */ - slit_width?: number; - /** - * Phase Plate - * @default false - */ - phase_plate?: boolean; - }; - /** ProcessingParametersTomo */ - ProcessingParametersTomo: { - /** Manual Tilt Offset */ - manual_tilt_offset: number; - /** Tag */ - tag: string; - /** Tilt Series Tag */ - tilt_series_tag: string; - }; - /** ProvidedProcessingParameters */ - ProvidedProcessingParameters: { - /** Dose Per Frame */ - dose_per_frame: number; - /** - * Extract Downscale - * @default true - */ - extract_downscale?: boolean; - /** Particle Diameter */ - particle_diameter?: number; - /** - * Symmetry - * @default C1 - */ - symmetry?: string; - /** - * Eer Fractionation - * @default 20 - */ - eer_fractionation?: number; - }; - /** RSyncerInfo */ - RSyncerInfo: { - /** Source */ - source: string; - /** Num Files Transferred */ - num_files_transferred: number; - /** Num Files In Queue */ - num_files_in_queue: number; - /** Num Files To Analyse */ - num_files_to_analyse: number; - /** Alive */ - alive: boolean; - /** Stopping */ - stopping: boolean; - /** Analyser Alive */ - analyser_alive: boolean; - /** Analyser Stopping */ - analyser_stopping: boolean; - /** Destination */ - destination: string; - /** Tag */ - tag: string; - /** Files Transferred */ - files_transferred: number; - /** Files Counted */ - files_counted: number; - /** Transferring */ - transferring: boolean; - /** Session Id */ - session_id: number; - }; - /** RegistrationMessage */ - RegistrationMessage: { - /** Registration */ - registration: string; - /** Params */ - params?: Record; - }; - /** RsyncInstance */ - RsyncInstance: { - /** Source */ - source: string; - /** - * Destination - * @default - */ - destination?: string; - /** Session Id */ - session_id: number; - /** - * Tag - * @default - */ - tag?: string; - /** - * Files Transferred - * @default 0 - */ - files_transferred?: number; - /** - * Files Counted - * @default 0 - */ - files_counted?: number; - /** - * Transferring - * @default false - */ - transferring?: boolean; - }; - /** RsyncerInfo */ - RsyncerInfo: { - /** Source */ - source: string; - /** Destination */ - destination: string; - /** Session Id */ - session_id: number; - /** - * Transferring - * @default true - */ - transferring?: boolean; - /** - * Increment Count - * @default 1 - */ - increment_count?: number; - /** - * Bytes - * @default 0 - */ - bytes?: number; - /** - * Increment Data Count - * @default 0 - */ - increment_data_count?: number; - /** - * Data Bytes - * @default 0 - */ - data_bytes?: number; - /** - * Tag - * @default - */ - tag?: string; - }; - /** SPAFeedbackParameters */ - SPAFeedbackParameters: { - /** Pj Id */ - pj_id: number; - /** - * Estimate Particle Diameter - * @default true - */ - estimate_particle_diameter?: boolean; - /** - * Hold Class2D - * @default false - */ - hold_class2d?: boolean; - /** - * Rerun Class2D - * @default false - */ - rerun_class2d?: boolean; - /** - * Hold Class3D - * @default false - */ - hold_class3d?: boolean; - /** - * Hold Refine - * @default false - */ - hold_refine?: boolean; - /** Class Selection Score */ - class_selection_score: number; - /** Star Combination Job */ - star_combination_job: number; - /** Initial Model */ - initial_model: string; - /** Next Job */ - next_job: number; - /** Picker Murfey Id */ - picker_murfey_id?: number; - /** Picker Ispyb Id */ - picker_ispyb_id?: number; - }; - /** SPAProcessFile */ - SPAProcessFile: { - /** Tag */ - tag: string; - /** Path */ - path: string; - /** Description */ - description: string; - /** Processing Job */ - processing_job?: number; - /** Data Collection Id */ - data_collection_id?: number; - /** Image Number */ - image_number: number; - /** Autoproc Program Id */ - autoproc_program_id?: number; - /** Foil Hole Id */ - foil_hole_id?: number; - /** Pixel Size */ - pixel_size?: number; - /** Dose Per Frame */ - dose_per_frame?: number; - /** - * Mc Binning - * @default 1 - */ - mc_binning?: number; - /** Gain Ref */ - gain_ref?: string; - /** - * Extract Downscale - * @default true - */ - extract_downscale?: boolean; - /** Eer Fractionation File */ - eer_fractionation_file?: string; - /** - * Source - * @default - */ - source?: string; - }; - /** SPARelionParameters */ - SPARelionParameters: { - /** Pj Id */ - pj_id: number; - /** Angpix */ - angpix: number; - /** Dose Per Frame */ - dose_per_frame: number; - /** Gain Ref */ - gain_ref?: string; - /** Voltage */ - voltage: number; - /** Motion Corr Binning */ - motion_corr_binning: number; - /** - * Eer Fractionation File - * @default - */ - eer_fractionation_file?: string; - /** Symmetry */ - symmetry: string; - /** Particle Diameter */ - particle_diameter?: number; - /** Downscale */ - downscale: boolean; - /** - * Do Icebreaker Jobs - * @default true - */ - do_icebreaker_jobs?: boolean; - /** - * Boxsize - * @default 256 - */ - boxsize?: number; - /** - * Small Boxsize - * @default 64 - */ - small_boxsize?: number; - /** - * Mask Diameter - * @default 190 - */ - mask_diameter?: number; - }; - /** SSDData */ - SSDData: { - /** Name */ - name: string; - /** Health */ - health: number; - }; - /** Session */ - Session: { - /** Id */ - id: number; - /** Name */ - name: string; - /** - * Visit - * @default - */ - visit?: string; - /** - * Started - * @default false - */ - started?: boolean; - /** - * Current Gain Ref - * @default - */ - current_gain_ref?: string; - /** - * Instrument Name - * @default - */ - instrument_name?: string; - /** - * Process - * @default - */ - process?: boolean; - visit_end_time: string; - }; - /** SessionClients */ - SessionClients: { - session: components["schemas"]["Session"]; - /** Clients */ - clients: components["schemas"]["ClientEnvironment"][]; - }; - /** SessionInfo */ - SessionInfo: { - /** Session Id */ - session_id?: number; - /** - * Session Name - * @default - */ - session_name?: string; - /** - * Rescale - * @default true - */ - rescale?: boolean; - }; - /** SmartEMAtlasRequest */ - SmartEMAtlasRequest: { - /** - * Atlas Path - * Format: path - */ - atlas_path: string; - /** - * Output Dir - * Format: path - */ - output_dir: string; - /** Tag */ - tag: string; - /** - * Num Preds - * @default 15 - */ - num_preds?: number; - /** - * Cpus - * @default 4 - */ - cpus?: number; - }; - /** Source */ - Source: { - /** Rsync Source */ - rsync_source: string; - }; - /** SuggestedPathParameters */ - SuggestedPathParameters: { - /** - * Base Path - * Format: path - */ - base_path: string; - /** - * Touch - * @default false - */ - touch?: boolean; - /** - * Extra Directory - * @default - */ - extra_directory?: string; - }; - /** TIFFSeriesInfo */ - TIFFSeriesInfo: { - /** Series Name */ - series_name: string; - /** Tiff Files */ - tiff_files: string[]; - /** - * Series Metadata - * Format: path - */ - series_metadata: string; - }; - /** Tag */ - Tag: { - /** Tag */ - tag: string; - }; - /** TiltInfo */ - TiltInfo: { - /** Tilt Series Tag */ - tilt_series_tag: string; - /** Movie Path */ - movie_path: string; - /** Source */ - source: string; - }; - /** TiltSeriesGroupInfo */ - TiltSeriesGroupInfo: { - /** Tags */ - tags: string[]; - /** Source */ - source: string; - /** Tilt Series Lengths */ - tilt_series_lengths: number[]; - }; - /** TiltSeriesInfo */ - TiltSeriesInfo: { - /** Session Id */ - session_id: number; - /** Tag */ - tag: string; - /** Source */ - source: string; - }; - /** Token */ - Token: { - /** Access Token */ - access_token: string; - /** Token Type */ - token_type: string; - }; - /** TomoProcessFile */ - TomoProcessFile: { - /** Path */ - path: string; - /** Description */ - description: string; - /** Tag */ - tag: string; - /** Image Number */ - image_number: number; - /** Pixel Size */ - pixel_size: number; - /** Dose Per Frame */ - dose_per_frame?: number; - /** Frame Count */ - frame_count: number; - /** Tilt Axis */ - tilt_axis?: number; - /** Mc Uuid */ - mc_uuid?: number; - /** - * Voltage - * @default 300 - */ - voltage?: number; - /** - * Mc Binning - * @default 1 - */ - mc_binning?: number; - /** Gain Ref */ - gain_ref?: string; - /** - * Extract Downscale - * @default 1 - */ - extract_downscale?: number; - /** Eer Fractionation File */ - eer_fractionation_file?: string; - /** Group Tag */ - group_tag?: string; - }; - /** ValidationError */ - ValidationError: { - /** Location */ - loc: (string | number)[]; - /** Message */ - msg: string; - /** Error Type */ - type: string; - }; - /** Visit */ - Visit: { - /** - * Start - * Format: date-time - */ - start: string; - /** - * End - * Format: date-time - */ - end: string; - /** Session Id */ - session_id: number; - /** Name */ - name: string; - /** Beamline */ - beamline: string; - /** Proposal Title */ - proposal_title: string; - }; - /** RsyncerSource */ - murfey__server__api__instrument__RsyncerSource: { - /** Source */ - source: string; - }; - /** RsyncerSource */ - murfey__util__models__RsyncerSource: { - /** Source */ - source: string; - }; - }; - responses: never; - parameters: never; - requestBodies: never; - headers: never; - pathItems: never; -} - -export type $defs = Record; - -export type external = Record; - -export interface operations { - - /** Root */ - root__get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "text/html": string; - }; - }; - }; - }; - /** Machine Info */ - machine_info_machine_get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["MachineConfig"]; - }; - }; - }; - }; - /** Machine Info By Name */ - machine_info_by_name_instruments__instrument_name__machine_get: { - parameters: { - path: { - instrument_name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["MachineConfig"]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Mic Image */ - get_mic_image_microscope_image__get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - }; - }; - /** Get Mag Table */ - get_mag_table_mag_table__get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["MagnificationLookup"][]; - }; - }; - }; - }; - /** Add To Mag Table */ - add_to_mag_table_mag_table__post: { - requestBody: { - content: { - "application/json": components["schemas"]["MagnificationLookup"][]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Remove Mag Table Row */ - remove_mag_table_row_mag_table__mag__delete: { - parameters: { - path: { - mag: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Instrument Display Name */ - get_instrument_display_name_instruments__instrument_name__instrument_name_get: { - parameters: { - path: { - instrument_name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": string; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** All Visit Info */ - all_visit_info_instruments__instrument_name__visits__get: { - parameters: { - path: { - instrument_name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Visit Info */ - visit_info_visits__visit_name__get: { - parameters: { - path: { - visit_name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Client To Visit */ - register_client_to_visit_visits__visit_name__post: { - parameters: { - path: { - visit_name: string; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["ClientInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Count Number Of Movies */ - count_number_of_movies_num_movies_get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": { - [key: string]: number; - }; - }; - }; - }; - }; - /** Register Rsyncer */ - register_rsyncer_sessions__session_id__rsyncer_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["RsyncerInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Delete Rsyncer */ - delete_rsyncer_sessions__session_id__rsyncer__source__delete: { - parameters: { - path: { - session_id: number; - source: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Stopped Rsyncer */ - register_stopped_rsyncer_sessions__session_id__rsyncer_stopped_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["murfey__util__models__RsyncerSource"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Restarted Rsyncer */ - register_restarted_rsyncer_sessions__session_id__rsyncer_started_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["murfey__util__models__RsyncerSource"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Rsyncers For Client */ - get_rsyncers_for_client_clients__client_id__rsyncers_get: { - parameters: { - path: { - client_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Session */ - get_session_session__session_id__get: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["SessionClients"]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Increment Rsync File Count */ - increment_rsync_file_count_visits__visit_name__increment_rsync_file_count_post: { - parameters: { - path: { - visit_name: string; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["RsyncerInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Increment Rsync Transferred Files */ - increment_rsync_transferred_files_visits__visit_name__increment_rsync_transferred_files_post: { - parameters: { - path: { - visit_name: string; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["RsyncerInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Increment Rsync Transferred Files Prometheus */ - increment_rsync_transferred_files_prometheus_visits__visit_name__increment_rsync_transferred_files_prometheus_post: { - parameters: { - path: { - visit_name: string; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["RsyncerInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Spa Proc Param Details */ - get_spa_proc_param_details_sessions__session_id__spa_processing_parameters_get: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["ProcessingDetails"][]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Spa Proc Params */ - register_spa_proc_params_sessions__session_id__spa_processing_parameters_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["ProcessingParametersSPA"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Tomo Preproc Params */ - register_tomo_preproc_params_sessions__session_id__tomography_preprocessing_parameters_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["PreprocessingParametersTomo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Tomo Proc Params */ - register_tomo_proc_params_clients__client_id__tomography_processing_parameters_post: { - parameters: { - path: { - client_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["ProcessingParametersTomo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Spa Proc Params */ - get_spa_proc_params_clients__client_id__spa_processing_parameters_get: { - parameters: { - path: { - client_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": Record[]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Grid Squares */ - get_grid_squares_sessions__session_id__grid_squares_get: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Grid Squares From Dcg */ - get_grid_squares_from_dcg_sessions__session_id__data_collection_groups__dcgid__grid_squares_get: { - parameters: { - path: { - session_id: number; - dcgid: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["GridSquare"][]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Number Of Movies From Grid Square */ - get_number_of_movies_from_grid_square_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__num_movies_get: { - parameters: { - path: { - session_id: number; - dcgid: number; - gsid: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": number; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Foil Holes From Grid Square */ - get_foil_holes_from_grid_square_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__foil_holes_get: { - parameters: { - path: { - session_id: number; - dcgid: number; - gsid: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["FoilHole"][]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Number Of Movies From Foil Hole */ - get_number_of_movies_from_foil_hole_sessions__session_id__data_collection_groups__dcgid__grid_squares__gsid__foil_holes__fhid__num_movies_get: { - parameters: { - path: { - session_id: number; - dcgid: number; - gsid: number; - fhid: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": number; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Grid Square */ - register_grid_square_sessions__session_id__grid_square__gsid__post: { - parameters: { - path: { - session_id: number; - gsid: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["GridSquareParameters"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Foil Hole */ - get_foil_hole_sessions__session_id__foil_hole__fh_name__get: { - parameters: { - path: { - fh_name: number; - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": { - [key: string]: number; - }; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Foil Hole */ - register_foil_hole_sessions__session_id__grid_square__gs_name__foil_hole_post: { - parameters: { - path: { - gs_name: number; - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["FoilHoleParameters"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Tilt Series */ - register_tilt_series_visits__visit_name__tilt_series_post: { - parameters: { - path: { - visit_name: string; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["TiltSeriesInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Completed Tilt Series */ - register_completed_tilt_series_visits__visit_name___client_id__completed_tilt_series_post: { - parameters: { - path: { - visit_name: string; - client_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["TiltSeriesGroupInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Tilts */ - get_tilts_clients__client_id__tilt_series__tilt_series_tag__tilts_get: { - parameters: { - path: { - client_id: number; - tilt_series_tag: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Tilt */ - register_tilt_visits__visit_name___client_id__tilt_post: { - parameters: { - path: { - visit_name: string; - client_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["TiltInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Current Visits */ - get_current_visits_instruments__instrument_name__visits_raw_get: { - parameters: { - path: { - instrument_name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["Visit"][]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Send Murfey Message */ - send_murfey_message_feedback_post: { - requestBody: { - content: { - "application/json": components["schemas"]["RegistrationMessage"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Flush Spa Processing */ - flush_spa_processing_visits__visit_name___session_id__flush_spa_processing_post: { - parameters: { - path: { - visit_name: string; - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["Tag"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Request Spa Preprocessing */ - request_spa_preprocessing_visits__visit_name___session_id__spa_preprocess_post: { - parameters: { - path: { - visit_name: string; - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["SPAProcessFile"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Flush Tomography Processing */ - flush_tomography_processing_visits__visit_name___client_id__flush_tomography_processing_post: { - parameters: { - path: { - visit_name: string; - client_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["Source"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Request Tomography Preprocessing */ - request_tomography_preprocessing_visits__visit_name___client_id__tomography_preprocess_post: { - parameters: { - path: { - visit_name: string; - client_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["TomoProcessFile"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Version */ - get_version_version_get: { - parameters: { - query?: { - client_version?: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Suggest Path */ - suggest_path_visits__visit_name___session_id__suggested_path_post: { - parameters: { - path: { - visit_name: string; - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["SuggestedPathParameters"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Dc Groups */ - get_dc_groups_sessions__session_id__data_collection_groups_get: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": { - [key: string]: components["schemas"]["DataCollectionGroup"]; - }; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Data Collections */ - get_data_collections_sessions__session_id__data_collection_groups__dcgid__data_collections_get: { - parameters: { - path: { - dcgid: number; - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["DataCollection"][]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Dc Group */ - register_dc_group_visits__visit_name___session_id__register_data_collection_group_post: { - parameters: { - path: { - visit_name: string; - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["DCGroupParameters"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Start Dc */ - start_dc_visits__visit_name___session_id__start_data_collection_post: { - parameters: { - path: { - visit_name: string; - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["DCParameters"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["DCParameters"]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Proc */ - register_proc_visits__visit_name___session_id__register_processing_job_post: { - parameters: { - path: { - visit_name: unknown; - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["ProcessingJobParameters"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Process Gain */ - process_gain_sessions__session_id__process_gain_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["GainReference"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** New Client Id */ - new_client_id_new_client_id__get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - }; - }; - /** Get Clients */ - get_clients_clients_get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - }; - }; - /** Get Sessions */ - get_sessions_sessions_get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - }; - }; - /** Get Sessions By Instrument Name */ - get_sessions_by_instrument_name_instruments__instrument_name__sessions_get: { - parameters: { - path: { - instrument_name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["Session"][]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Link Client To Session */ - link_client_to_session_instruments__instrument_name__clients__client_id__session_post: { - parameters: { - path: { - instrument_name: string; - client_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["SessionInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Remove Session */ - remove_session_clients__client_id__session_delete: { - parameters: { - path: { - client_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Rsyncers For Session */ - get_rsyncers_for_session_sessions__session_id__rsyncers_get: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["RsyncInstance"][]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Remove Session By Id */ - remove_session_by_id_sessions__session_id__delete: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Write Eer Fractionation File */ - write_eer_fractionation_file_visits__visit_name___session_id__eer_fractionation_file_post: { - parameters: { - path: { - visit_name: string; - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["FractionationParameters"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": Record; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Change Monitoring Status */ - change_monitoring_status_visits__visit_name__monitoring__on__post: { - parameters: { - path: { - visit_name: string; - on: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Find Upstream Visits */ - find_upstream_visits_sessions__session_id__upstream_visits_get: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Gather Upstream Tiffs */ - gather_upstream_tiffs_visits__visit_name___session_id__upstream_tiff_paths_get: { - parameters: { - path: { - visit_name: string; - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Tiff */ - get_tiff_visits__visit_name___session_id__upstream_tiff__tiff_path__get: { - parameters: { - path: { - visit_name: string; - session_id: number; - tiff_path: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Failed Client Post */ - failed_client_post_failed_client_post_post: { - requestBody: { - content: { - "application/json": components["schemas"]["PostInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Create Session */ - create_session_instruments__instrument_name__visits__visit__session__name__post: { - parameters: { - path: { - instrument_name: string; - visit: string; - name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": number; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Update Current Gain Ref */ - update_current_gain_ref_sessions__session_id__current_gain_ref_put: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["CurrentGainRef"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Version */ - get_version_version__get: { - parameters: { - query?: { - client_version?: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Bootstrap Instructions - * @description Return a website containing instructions for installing the Murfey client on a - * machine with no internet access. - */ - get_bootstrap_instructions_bootstrap__get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "text/html": string; - }; - }; - }; - }; - /** - * Get Pip Wheel - * @description Return a static version of pip. This does not need to be the newest or best, - * but has to be compatible with all supported Python versions. - * This is only used during bootstrapping by the client to identify and then - * download the actually newest appropriate version of pip. - */ - get_pip_wheel_bootstrap_pip_whl_get: { - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - }; - }; - /** - * Get Murfey Wheel - * @description Return a wheel file containing the latest release version of Murfey. We should - * not have to worry about the exact Python compatibility here, as long as - * murfey.bootstrap is compatible with all relevant versions of Python. - * This also ignores yanked releases, which again should be fine. - */ - get_murfey_wheel_bootstrap_murfey_whl_get: { - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - }; - }; - /** - * Get Cygwin Setup - * @description Obtain and pass through a Cygwin installer from an official source. - * This is used during client bootstrapping and can download and install the - * Cygwin distribution that then remains on the client machines. - */ - get_cygwin_setup_cygwin_setup_x86_64_exe_get: { - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - }; - }; - /** - * Parse Cygwin Request - * @description Forward a Cygwin setup request to an official mirror. - */ - parse_cygwin_request_cygwin__request_path__get: { - parameters: { - path: { - request_path: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Pacman Mirrors - * @description Dynamically generates a zip file containing mirrorlist files that have been set - * up to mirror the MSYS2 package database for each environment. - * - * The files in this folder should be pasted into, and overwrite, the 'mirrorlist' - * files present in the %MSYS64%\etc\pacman.d folder. The default path to this - * folder is C:\msys64\etc\pacman.d. - */ - get_pacman_mirrors_msys2_config_pacman_d_zip_get: { - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - }; - }; - /** - * Get Msys2 Setup - * @description Obtain and pass through an MSYS2 installer from an official source. - * This is used during client bootstrapping, and can download and install the - * MSYS2 distribution that then remains on the client machines. - */ - get_msys2_setup_msys2_repo_distrib__setup_file__get: { - parameters: { - path: { - setup_file: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Msys2 Main Index - * @description Returns a simple index displaying valid MSYS2 systems and the latest setup file - * from the main MSYS2 repository. - */ - get_msys2_main_index_msys2_repo__get: { - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - }; - }; - /** - * Get Msys2 Environment Index - * @description Returns a list of all MSYS2 environments for a given system from the main MSYS2 - * repository. - */ - get_msys2_environment_index_msys2_repo__system___get: { - parameters: { - path: { - system: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Msys2 Package Index - * @description Obtain a list of all available MSYS2 packages for a given environment from the main - * MSYS2 repo. - */ - get_msys2_package_index_msys2_repo__system___environment___get: { - parameters: { - path: { - system: string; - environment: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Msys2 Package File - * @description Obtain and pass through a specific download for an MSYS2 package. - */ - get_msys2_package_file_msys2_repo__system___environment___package__get: { - parameters: { - path: { - system: string; - environment: string; - package: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Cargo Config - * @description Returns a properly configured Cargo config that sets it to look ONLY at the - * crates.io mirror. - * - * The default path for this config on Linux devices is ~/.cargo/config.toml, - * and its default path on Windows is %USERPROFILE%\.cargo\config.toml. - */ - get_cargo_config_rust_cargo_config_toml_get: { - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - }; - }; - /** - * Get Index Page - * @description Returns a mirror of the https://index.crates.io landing page. - */ - get_index_page_rust_index__get: { - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - }; - }; - /** - * Get Index Config - * @description Download a config.json file used by Cargo to navigate sparse index registries - * with. - * - * The 'dl' key points to our mirror of the static crates.io repository, while - * the 'api' key points to an API version of that same registry. Both will be - * used by Cargo when searching for and downloading packages. - */ - get_index_config_rust_index_config_json_get: { - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - }; - }; - /** - * Get Index Package Metadata - * @description Download the metadata for a given package from the crates.io sparse index. - * The path to the metadata file on the server side takes the following form: - * /{c1}/{c2}/{package} - * - * c1 and c2 are 2 characters-long strings that are taken from the first 4 - * characters of the package name (a-z, A-Z, 0-9, -, _). For 3-letter packages, - * c1 = 3, and c2 is the first character of the package. - */ - get_index_package_metadata_rust_index__c1___c2___package__get: { - parameters: { - path: { - c1: string; - c2: string; - package: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Index Package Metadata For Short Package Names - * @description The Rust sparse index' naming scheme for packages with 1-2 characters is - * different from the standard path convention. They are stored under - * /1/{package} or /2/{package}. - */ - get_index_package_metadata_for_short_package_names_rust_index__n___package__get: { - parameters: { - path: { - n: string; - package: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Rust Package Download - * @description Obtain and pass through a crate download request for a Rust package via the - * sparse index registry. - */ - get_rust_package_download_rust_crates__package___version__download_get: { - parameters: { - path: { - package: string; - version: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Rust Api Package Index - * @description Displays the Rust API package index, which returns names of available packages - * in a JSON object based on the search query given. - */ - get_rust_api_package_index_rust_api_v1_crates_get: { - parameters: { - query?: { - q?: string; - per_page?: number; - seek?: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Rust Api Package Info - * @description Displays general information for a given Rust package, as a JSON object. - * Contains both version information and download information, in addition - * to other types of metadata. - */ - get_rust_api_package_info_rust_api_v1_crates__package__get: { - parameters: { - path: { - package: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Rust Api Package Versions - * @description Displays all available versions for a particular Rust package, along with download - * links for said versions, as a JSON object. - */ - get_rust_api_package_versions_rust_api_v1_crates__package__versions_get: { - parameters: { - path: { - package: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Rust Api Package Download - * @description Obtain and pass through a crate download request for a specific Rust package. - */ - get_rust_api_package_download_rust_api_v1_crates__package___version__download_get: { - parameters: { - path: { - package: string; - version: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Rust Package Crate - * @description Obtain and pass through a download for a specific Rust crate. The Rust API - * download request actually redirects to the static crate repository, so this - * endpoint covers cases where the static crate download link is requested. - * - * The static Rust package repository has been configured such that only requests - * for a specific crate are accepted and handled. - * (e.g. https://static.crates.io/crates/anyhow/anyhow-1.0.97.crate will pass) - * - * A request for any other part of the URL path will be denied. - * (e.g. https://static.crates.io/crates/anyhow will fail) - */ - get_rust_package_crate_rust_crates__package___crate__get: { - parameters: { - path: { - package: string; - crate: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Pypi Index - * @description Obtain list of all PyPI packages via the simple API (PEP 503). - */ - get_pypi_index_pypi__get: { - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - }; - }; - /** - * Get Pypi Package Downloads List - * @description Obtain list of all package downloads from PyPI via the simple API (PEP 503), and - * rewrite all download URLs to point to this server, under the current directory. - */ - get_pypi_package_downloads_list_pypi__package___get: { - parameters: { - path: { - package: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** - * Get Pypi File - * @description Obtain and pass through a specific download for a PyPI package. - */ - get_pypi_file_pypi__package___filename__get: { - parameters: { - path: { - package: string; - filename: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Plugin Wheel */ - get_plugin_wheel_plugins_instruments__instrument_name___package__get: { - parameters: { - path: { - instrument_name: string; - package: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: never; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Lif File */ - register_lif_file_sessions__session_id__clem_lif_files_post: { - parameters: { - query: { - lif_file: string; - master_metadata?: string; - }; - path: { - session_id: number; - }; - }; - requestBody?: { - content: { - "application/json": components["schemas"]["Body_register_lif_file_sessions__session_id__clem_lif_files_post"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Tiff File */ - register_tiff_file_sessions__session_id__clem_tiff_files_post: { - parameters: { - query: { - tiff_file: string; - associated_metadata?: string; - associated_series?: string; - associated_stack?: string; - }; - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Clem Metadata */ - register_clem_metadata_sessions__session_id__clem_metadata_files_post: { - parameters: { - query: { - metadata_file: string; - parent_lif?: string; - associated_series?: string; - }; - path: { - session_id: number; - }; - }; - requestBody?: { - content: { - "application/json": components["schemas"]["Body_register_clem_metadata_sessions__session_id__clem_metadata_files_post"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Image Series */ - register_image_series_sessions__session_id__clem_image_series_post: { - parameters: { - query: { - series_name: string; - parent_lif?: string; - associated_metadata?: string; - }; - path: { - session_id: number; - }; - }; - requestBody?: { - content: { - "application/json": components["schemas"]["Body_register_image_series_sessions__session_id__clem_image_series_post"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Register Image Stack */ - register_image_stack_sessions__session_id__clem_image_stacks_post: { - parameters: { - query: { - image_stack: string; - channel?: string; - parent_lif?: string; - associated_metadata?: string; - parent_series?: string; - }; - path: { - session_id: number; - }; - }; - requestBody?: { - content: { - "application/json": string[]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Process Raw Lifs */ - process_raw_lifs_sessions__session_id__clem_preprocessing_process_raw_lifs_post: { - parameters: { - query: { - lif_file: string; - }; - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Process Raw Tiffs */ - process_raw_tiffs_sessions__session_id__clem_preprocessing_process_raw_tiffs_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["TIFFSeriesInfo"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Align And Merge Stacks */ - align_and_merge_stacks_sessions__session_id__clem_processing_align_and_merge_stacks_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["AlignAndMergeParams"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Cryolo Model Path */ - get_cryolo_model_path_sessions__session_id__cryolo_model_get: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Generate Token */ - generate_token_token_post: { - requestBody: { - content: { - "application/x-www-form-urlencoded": components["schemas"]["Body_generate_token_token_post"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["Token"]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Mint Session Token */ - mint_session_token_sessions__session_id__token_get: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Simple Token Validation */ - simple_token_validation_validate_token_get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - }; - }; - /** Get Mic Image */ - get_mic_image_display_instruments__instrument_name__image__get: { - parameters: { - path: { - instrument_name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Grid Square Img */ - get_grid_square_img_display_sessions__session_id__data_collection_groups__dcgid__grid_squares__grid_square_name__image_get: { - parameters: { - path: { - session_id: number; - dcgid: number; - grid_square_name: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Foil Hole Img */ - get_foil_hole_img_display_sessions__session_id__data_collection_groups__dcgid__grid_squares__grid_square_name__foil_holes__foil_hole_name__image_get: { - parameters: { - path: { - session_id: number; - dcgid: number; - grid_square_name: number; - foil_hole_name: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Activate Instrument Server For Session */ - activate_instrument_server_for_session_instruments__instrument_name__sessions__session_id__activate_instrument_server_post: { - parameters: { - path: { - instrument_name: string; - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Check If Session Is Active */ - check_if_session_is_active_instruments__instrument_name__sessions__session_id__active_get: { - parameters: { - path: { - instrument_name: string; - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Setup Multigrid Watcher */ - setup_multigrid_watcher_sessions__session_id__multigrid_watcher_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["MultigridWatcherSetup"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Start Multigrid Watcher */ - start_multigrid_watcher_sessions__session_id__start_multigrid_watcher_post: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Pass Proc Params To Instrument Server */ - pass_proc_params_to_instrument_server_sessions__session_id__provided_processing_parameters_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["ProvidedProcessingParameters"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Check Instrument Server */ - check_instrument_server_instruments__instrument_name__instrument_server_get: { - parameters: { - path: { - instrument_name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Possible Gain References */ - get_possible_gain_references_instruments__instrument_name__sessions__session_id__possible_gain_references_get: { - parameters: { - path: { - instrument_name: string; - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["File"][]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Request Gain Reference Upload */ - request_gain_reference_upload_sessions__session_id__upload_gain_reference_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["GainReferenceRequest"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Request Upstream Tiff Data Download */ - request_upstream_tiff_data_download_visits__visit_name___session_id__upstream_tiff_data_request_post: { - parameters: { - path: { - visit_name: string; - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Stop Rsyncer */ - stop_rsyncer_sessions__session_id__stop_rsyncer_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["murfey__server__api__instrument__RsyncerSource"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Finalise Rsyncer */ - finalise_rsyncer_sessions__session_id__finalise_rsyncer_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["murfey__server__api__instrument__RsyncerSource"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Finalise Session */ - finalise_session_sessions__session_id__finalise_session_post: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Remove Rsyncer */ - remove_rsyncer_sessions__session_id__remove_rsyncer_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["murfey__server__api__instrument__RsyncerSource"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Restart Rsyncer */ - restart_rsyncer_sessions__session_id__restart_rsyncer_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["murfey__server__api__instrument__RsyncerSource"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Rsyncer Info */ - get_rsyncer_info_instruments__instrument_name__sessions__session_id__rsyncer_info_get: { - parameters: { - path: { - instrument_name: string; - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["RSyncerInfo"][]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Instrument Info */ - get_instrument_info_instruments_get: { - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["InstrumentInfo"][]; - }; - }; - }; - }; - /** Get Instrument Image */ - get_instrument_image_instrument__instrument_name__image_get: { - parameters: { - path: { - instrument_name: string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Get Session Processing Parameters */ - get_session_processing_parameters_sessions__session_id__session_processing_parameters_get: { - parameters: { - path: { - session_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["EditableSessionProcessingParameters"]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Set Session Processing Parameters */ - set_session_processing_parameters_sessions__session_id__session_processing_parameters_post: { - parameters: { - path: { - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["EditableSessionProcessingParameters"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": components["schemas"]["EditableSessionProcessingParameters"]; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Close Ws Connection */ - close_ws_connection_ws_test__client_id__delete: { - parameters: { - path: { - client_id: number; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Close Unrecorded Ws Connection */ - close_unrecorded_ws_connection_ws_connect__client_id__delete: { - parameters: { - path: { - client_id: number | string; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Request Smartem Atlas Analysis */ - request_smartem_atlas_analysis_instruments__instrument_name__visits__visit_name___session_id__smartem_atlas__post: { - parameters: { - path: { - instrument_name: string; - visit_name: string; - session_id: number; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["SmartEMAtlasRequest"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; - /** Update K3 Ssd Statuses */ - update_k3_ssd_statuses_instruments__instrument_name__k3_ssd_post: { - parameters: { - path: { - instrument_name: string; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["SSDData"]; - }; - }; - responses: { - /** @description Successful Response */ - 200: { - content: { - "application/json": unknown; - }; - }; - /** @description Validation Error */ - 422: { - content: { - "application/json": components["schemas"]["HTTPValidationError"]; - }; - }; - }; - }; + update_k3_ssd_statuses_instruments__instrument_name__k3_ssd_post: { + parameters: { + path: { + instrument_name: string + } + } + requestBody: { + content: { + 'application/json': components['schemas']['SSDData'] + } + } + responses: { + /** @description Successful Response */ + 200: { + content: { + 'application/json': unknown + } + } + /** @description Validation Error */ + 422: { + content: { + 'application/json': components['schemas']['HTTPValidationError'] + } + } + } + } } diff --git a/src/setupTests.js b/src/setupTests.js index 1dd407a..52aaef1 100644 --- a/src/setupTests.js +++ b/src/setupTests.js @@ -2,4 +2,4 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import "@testing-library/jest-dom"; +import '@testing-library/jest-dom' diff --git a/src/styles/colours.ts b/src/styles/colours.ts new file mode 100644 index 0000000..3ee6333 --- /dev/null +++ b/src/styles/colours.ts @@ -0,0 +1,16 @@ +const colours = { + murfey: { + 50: { default: '#FBFBFB', _dark: '#525151' }, + 75: { derfault: '#F7F7F7', _dark: '#080808' }, + 100: { default: '#E7ECEF', _dark: '#383838' }, + 200: { default: '#CBD5E0', _dark: '#030303' }, + 300: { default: '#39435E', _dark: '#5f709e' }, + 400: { default: '#ACACF9', _dark: '#030405' }, + 500: { default: '#FC6321', _dark: '#050401' }, + 600: { default: '#5738BD', _dark: '#101a36' }, + 700: { default: '#2910A1', _dark: '#071d4a' }, + 800: { default: '#0E0055', _dark: '#023496' }, + }, +} + +export { colours } diff --git a/src/styles/colours.tsx b/src/styles/colours.tsx deleted file mode 100644 index 1cc89cc..0000000 --- a/src/styles/colours.tsx +++ /dev/null @@ -1,16 +0,0 @@ -const colours = { - murfey: { - 50: { default: "#FBFBFB", _dark: "#525151" }, - 75: { derfault: "#F7F7F7", _dark: "#080808" }, - 100: { default: "#E7ECEF", _dark: "#383838" }, - 200: { default: "#CBD5E0", _dark: "#030303" }, - 300: { default: "#39435E", _dark: "#5f709e" }, - 400: { default: "#ACACF9", _dark: "#030405" }, - 500: { default: "#FC6321", _dark: "#050401" }, - 600: { default: "#5738BD", _dark: "#101a36" }, - 700: { default: "#2910A1", _dark: "#071d4a" }, - 800: { default: "#0E0055", _dark: "#023496" }, - }, -}; - -export { colours }; diff --git a/src/styles/components.ts b/src/styles/components.ts index daf1da1..912f0b3 100644 --- a/src/styles/components.ts +++ b/src/styles/components.ts @@ -1,325 +1,325 @@ import { - defineStyleConfig, - defineStyle, - createMultiStyleConfigHelpers, - UseToastOptions, -} from "@chakra-ui/react"; + defineStyleConfig, + defineStyle, + createMultiStyleConfigHelpers, + UseToastOptions, +} from '@chakra-ui/react' import { - cardAnatomy, - tabsAnatomy, - inputAnatomy, - numberInputAnatomy, - selectAnatomy, -} from "@chakra-ui/anatomy"; + cardAnatomy, + tabsAnatomy, + inputAnatomy, + numberInputAnatomy, + selectAnatomy, +} from '@chakra-ui/anatomy' const baseToast: UseToastOptions = { - id: "main-toast", - status: "success", - duration: 6000, - isClosable: true, -}; + id: 'main-toast', + status: 'success', + duration: 6000, + isClosable: true, +} const baseInput = { - field: { - bg: "white", - border: "solid 1px", - borderColor: "murfey.200", - borderRadius: 0, - }, -}; + field: { + bg: 'white', + border: 'solid 1px', + borderColor: 'murfey.200', + borderRadius: 0, + }, +} const Accordion = defineStyleConfig({ - baseStyle: { - container: { - border: "1px solid var(--chakra-colors-murfey-100)", + baseStyle: { + container: { + border: '1px solid var(--chakra-colors-murfey-100)', + }, }, - }, -}); +}) const Text = defineStyleConfig({ - variants: { - infoGroupText: { - wordBreak: "break-all", - display: "inline", - fontSize: "xs", + variants: { + infoGroupText: { + wordBreak: 'break-all', + display: 'inline', + fontSize: 'xs', + }, }, - }, -}); +}) const Checkbox = defineStyleConfig({ - sizes: { - sm: { - control: { - height: "16px", - width: "16px", - }, - icon: { - height: "16px", - fontSize: "10px", - }, - label: { - fontSize: "14px", - height: "16px", - }, + sizes: { + sm: { + control: { + height: '16px', + width: '16px', + }, + icon: { + height: '16px', + fontSize: '10px', + }, + label: { + fontSize: '14px', + height: '16px', + }, + }, }, - }, - baseStyle: { - control: { - borderColor: "murfey.600", - backgroundColor: "#FFF", - _checked: { - backgroundColor: "murfey.600", - borderColor: "murfey.600", - }, + baseStyle: { + control: { + borderColor: 'murfey.600', + backgroundColor: '#FFF', + _checked: { + backgroundColor: 'murfey.600', + borderColor: 'murfey.600', + }, + }, }, - }, -}); +}) const Table = defineStyleConfig({ - variants: { - diamondStriped: { - tbody: { - tr: { - _odd: { - bg: "murfey.100", - }, - _even: { - bg: "murfey.50", - }, - _hover: { - bg: "murfey.200", - }, + variants: { + diamondStriped: { + tbody: { + tr: { + _odd: { + bg: 'murfey.100', + }, + _even: { + bg: 'murfey.50', + }, + _hover: { + bg: 'murfey.200', + }, + }, + }, }, - }, }, - }, -}); +}) const CardHeader = defineStyleConfig({ - baseStyle: { - p: "10px !important", - h: "10%", - }, -}); + baseStyle: { + p: '10px !important', + h: '10%', + }, +}) const CardBody = defineStyleConfig({ - baseStyle: { - p: 2, - h: "90%", - }, -}); + baseStyle: { + p: 2, + h: '90%', + }, +}) const { definePartsStyle, defineMultiStyleConfig } = - createMultiStyleConfigHelpers(cardAnatomy.keys); + createMultiStyleConfigHelpers(cardAnatomy.keys) const baseCardStyle = definePartsStyle({ - container: { - p: 1, - borderWidth: "1px", - borderRadius: "lg", - borderColor: "murfey.200", - _hover: { - borderColor: "murfey.400", - cursor: "pointer", + container: { + p: 1, + borderWidth: '1px', + borderRadius: 'lg', + borderColor: 'murfey.200', + _hover: { + borderColor: 'murfey.400', + cursor: 'pointer', + }, + _selected: { + bg: 'murfey.100', + fontWeight: '600', + borderBottomWidth: '3px', + }, }, - _selected: { - bg: "murfey.100", - fontWeight: "600", - borderBottomWidth: "3px", + header: { + p: 2, + cursor: 'pointer', + _hover: { + color: 'murfey.300', + }, }, - }, - header: { - p: 2, - cursor: "pointer", - _hover: { - color: "murfey.300", + body: { + px: 2, + height: '90%', }, - }, - body: { - px: 2, - height: "90%", - }, -}); +}) const Card = defineMultiStyleConfig({ - baseStyle: baseCardStyle, - defaultProps: { variant: "outline" }, -}); + baseStyle: baseCardStyle, + defaultProps: { variant: 'outline' }, +}) const Button = defineStyleConfig({ - defaultProps: { - variant: "default", - }, - baseStyle: { - borderBottom: "2px solid rgba(0,0,0,0.2)", - }, - variants: { - default: { - color: "murfey.50", - bg: "murfey.600", - _hover: { - bgImage: "linear-gradient(rgb(0 0 0/30%) 0 0)", - _disabled: { - bg: "murfey.600", - }, - }, - }, - pgSelected: { - bg: "murfey.600", - color: "murfey.50", - cursor: "default", + defaultProps: { + variant: 'default', }, - pgNotSelected: { - bg: "gray.200", - color: "charcoal", - fontSize: "sm", - _hover: { - bg: "murfey.200", - }, + baseStyle: { + borderBottom: '2px solid rgba(0,0,0,0.2)', }, - onBlue: { - color: "murfey.500", - borderColor: "murfey.500", - border: "1px solid", - fontSize: "sm", - _hover: { - color: "murfey.300", - bg: "murfey.500", - }, + variants: { + default: { + color: 'murfey.50', + bg: 'murfey.600', + _hover: { + bgImage: 'linear-gradient(rgb(0 0 0/30%) 0 0)', + _disabled: { + bg: 'murfey.600', + }, + }, + }, + pgSelected: { + bg: 'murfey.600', + color: 'murfey.50', + cursor: 'default', + }, + pgNotSelected: { + bg: 'gray.200', + color: 'charcoal', + fontSize: 'sm', + _hover: { + bg: 'murfey.200', + }, + }, + onBlue: { + color: 'murfey.500', + borderColor: 'murfey.500', + border: '1px solid', + fontSize: 'sm', + _hover: { + color: 'murfey.300', + bg: 'murfey.500', + }, + }, }, - }, -}); +}) const notFound = defineStyle({ - textAlign: "center", - color: "murfey.300", -}); + textAlign: 'center', + color: 'murfey.300', +}) const Heading = defineStyleConfig({ - variants: { - collection: { - fontSize: 20, - py: "4px", - }, - notFound, - notFoundSubtitle: { - ...notFound, - fontWeight: 200, - fontSize: 20, - paddingBottom: 10, + variants: { + collection: { + fontSize: 20, + py: '4px', + }, + notFound, + notFoundSubtitle: { + ...notFound, + fontWeight: 200, + fontSize: 20, + paddingBottom: 10, + }, }, - }, -}); +}) const { - definePartsStyle: defineInputStyle, - defineMultiStyleConfig: defineInputConfig, -} = createMultiStyleConfigHelpers(inputAnatomy.keys); + definePartsStyle: defineInputStyle, + defineMultiStyleConfig: defineInputConfig, +} = createMultiStyleConfigHelpers(inputAnatomy.keys) const hiContrastInput = defineInputStyle({ - field: { - borderWidth: "1px", - borderColor: "murfey.800", - borderRadius: 0, - _invalid: { - borderColor: "red.500", + field: { + borderWidth: '1px', + borderColor: 'murfey.800', + borderRadius: 0, + _invalid: { + borderColor: 'red.500', + }, }, - }, -}); +}) const baseInputStyle = defineInputStyle({ - ...baseInput, - addon: { - border: "solid 1px", - borderColor: "murfey.200", - background: "murfey.100", - }, -}); + ...baseInput, + addon: { + border: 'solid 1px', + borderColor: 'murfey.200', + background: 'murfey.100', + }, +}) const Input = defineInputConfig({ - baseStyle: baseInputStyle, - variants: { "hi-contrast": hiContrastInput, default: baseInputStyle }, - defaultProps: { variant: "default" }, -}); + baseStyle: baseInputStyle, + variants: { 'hi-contrast': hiContrastInput, default: baseInputStyle }, + defaultProps: { variant: 'default' }, +}) const { defineMultiStyleConfig: defineNumberInputConfig } = - createMultiStyleConfigHelpers(numberInputAnatomy.keys); + createMultiStyleConfigHelpers(numberInputAnatomy.keys) const NumberInput = defineNumberInputConfig({ - defaultProps: { variant: "default" }, - variants: { default: baseInput }, -}); + defaultProps: { variant: 'default' }, + variants: { default: baseInput }, +}) const { defineMultiStyleConfig: defineSelectConfig } = - createMultiStyleConfigHelpers(selectAnatomy.keys); + createMultiStyleConfigHelpers(selectAnatomy.keys) const Select = defineSelectConfig({ - defaultProps: { variant: "default" }, - variants: { default: baseInput, "hi-contrast": hiContrastInput }, -}); + defaultProps: { variant: 'default' }, + variants: { default: baseInput, 'hi-contrast': hiContrastInput }, +}) const { - definePartsStyle: defineTabsStyle, - defineMultiStyleConfig: defineTabsConfig, -} = createMultiStyleConfigHelpers(tabsAnatomy.keys); + definePartsStyle: defineTabsStyle, + defineMultiStyleConfig: defineTabsConfig, +} = createMultiStyleConfigHelpers(tabsAnatomy.keys) const baseTabsStyle = defineTabsStyle({ - tab: { - border: "1px solid", - borderColor: "murfey.200", - bg: "murfey.75", - borderBottom: "none", - _selected: { - bg: "murfey.50", - color: "murfey.700", - borderColor: "inherit", - borderBottom: "none", - borderTopColor: "murfey.700", - mb: "-2px", + tab: { + border: '1px solid', + borderColor: 'murfey.200', + bg: 'murfey.75', + borderBottom: 'none', + _selected: { + bg: 'murfey.50', + color: 'murfey.700', + borderColor: 'inherit', + borderBottom: 'none', + borderTopColor: 'murfey.700', + mb: '-2px', + }, }, - }, - tablist: { - borderBottom: "none", - }, - tabpanel: { - p: "2", - bg: "murfey.50", - border: "1px solid", - borderColor: "inherit", - }, -}); + tablist: { + borderBottom: 'none', + }, + tabpanel: { + p: '2', + bg: 'murfey.50', + border: '1px solid', + borderColor: 'inherit', + }, +}) const Tabs = defineTabsConfig({ - baseStyle: baseTabsStyle, - defaultProps: { variant: "none" }, -}); + baseStyle: baseTabsStyle, + defaultProps: { variant: 'none' }, +}) const Code = defineStyleConfig({ - baseStyle: { - backgroundColor: "murfey.100", - color: "murfey.800", - }, -}); + baseStyle: { + backgroundColor: 'murfey.100', + color: 'murfey.800', + }, +}) const Textarea = defineStyleConfig({ - variants: { "hi-contrast": hiContrastInput.field }, -}); + variants: { 'hi-contrast': hiContrastInput.field }, +}) export { - Accordion, - Button, - Table, - Text, - Heading, - Card, - CardHeader, - CardBody, - Tabs, - baseToast, - Checkbox, - Code, - Input, - Textarea, - NumberInput, - Select, -}; + Accordion, + Button, + Table, + Text, + Heading, + Card, + CardHeader, + CardBody, + Tabs, + baseToast, + Checkbox, + Code, + Input, + Textarea, + NumberInput, + Select, +} diff --git a/src/styles/theme.tsx b/src/styles/theme.tsx index 5002470..c9a6c60 100644 --- a/src/styles/theme.tsx +++ b/src/styles/theme.tsx @@ -1,49 +1,49 @@ -import { ThemeConfig, extendTheme } from "@chakra-ui/react"; -import { colours } from "styles/colours"; +import { ThemeConfig, extendTheme } from '@chakra-ui/react' +import { colours } from 'styles/colours' import { - Accordion, - Button, - Checkbox, - Heading, - Table, - Card, - Tabs, - Code, - Text, - Input, - Textarea, - NumberInput, - Select, -} from "./components"; - -const config: ThemeConfig = { - initialColorMode: "light", - useSystemColorMode: false, -}; - -export const theme = extendTheme({ - semanticTokens: { colors: colours }, - components: { Accordion, - Checkbox, Button, - Text, + Checkbox, Heading, Table, Card, Tabs, Code, + Text, Input, Textarea, NumberInput, Select, - }, - breakpoints: { - sm: "30em", - md: "48em", - lg: "62em", - xl: "80em", - "2xl": "150em", - }, - config, -}); +} from './components' + +const config: ThemeConfig = { + initialColorMode: 'light', + useSystemColorMode: false, +} + +export const theme = extendTheme({ + semanticTokens: { colors: colours }, + components: { + Accordion, + Checkbox, + Button, + Text, + Heading, + Table, + Card, + Tabs, + Code, + Input, + Textarea, + NumberInput, + Select, + }, + breakpoints: { + sm: '30em', + md: '48em', + lg: '62em', + xl: '80em', + '2xl': '150em', + }, + config, +}) diff --git a/src/utils/ExperimentType.ts b/src/utils/ExperimentType.ts new file mode 100644 index 0000000..1b8a6b0 --- /dev/null +++ b/src/utils/ExperimentType.ts @@ -0,0 +1,4 @@ + +export const EXPERIMENT_TYPES = ['spa', 'tomography'] as const; +export type ExperimentType = (typeof EXPERIMENT_TYPES)[number]; +export const isValidExpType = (val: string): val is ExperimentType => EXPERIMENT_TYPES.includes(val as ExperimentType); diff --git a/src/utils/MultigridSetup.tsx b/src/utils/MultigridSetup.tsx new file mode 100644 index 0000000..1b51295 --- /dev/null +++ b/src/utils/MultigridSetup.tsx @@ -0,0 +1,191 @@ +import { ArrowForwardIcon } from '@chakra-ui/icons' +import { + Box, + FormControl, + FormLabel, + GridItem, + Heading, + HStack, + IconButton, + Link, + Select, + Stack, + Switch, + VStack, +} from '@chakra-ui/react' + +import { SetupStepper } from 'components/setupStepper' +import { + setupMultigridWatcher, + startMultigridWatcher, +} from 'loaders/multigridSetup' +import { getSessionData } from 'loaders/session_clients' +import { ChangeEvent, useEffect, useState } from 'react' +import { Link as LinkRouter, useLoaderData, useParams } from 'react-router-dom' +import { components } from 'schema/main' + +type MachineConfig = components['schemas']['MachineConfig'] +type MultigridWatcherSpec = components['schemas']['MultigridWatcherSetup'] +type Session = components['schemas']['Session'] + +function getInitialDirectory(machineConfig: MachineConfig | null) { + return machineConfig?.data_directories.find(Boolean) ?? '' +} + +const MultigridSetup = () => { + const machineConfig = useLoaderData() as MachineConfig | null + const { sessid } = useParams() + const initialDirectory = getInitialDirectory(machineConfig) + const [selectedDirectory, setSelectedDirectory] = + useState(initialDirectory) + + const processByDefault: boolean | undefined = machineConfig + ? machineConfig.process_by_default + : true + + const [skipExistingProcessing, setSkipExistingProcessing] = + useState(!processByDefault) + const [session, setSession] = useState() + + useEffect(() => { + getSessionData(sessid).then((sessionData) => setSession(sessionData.session)) + }, []) + + // todo better to have the step as enum, not hardcoded int + const activeStep = session != null ? (session.started ? 3 : 2) : 2 + + const handleDirectorySelection = ( + e: ChangeEvent + ) => setSelectedDirectory(e.target.value) + + const recipesAreDefined: boolean = [machineConfig, machineConfig?.recipes, Object.keys(machineConfig?.recipes!).length !== 0].every(v => v) + + const handleSelection = async () => { + if (typeof sessid !== 'undefined') { + await setupMultigridWatcher( + { + source: selectedDirectory, + skip_existing_processing: skipExistingProcessing, + } as MultigridWatcherSpec, + parseInt(sessid) + ) + if (!recipesAreDefined) await startMultigridWatcher(parseInt(sessid)) + } + } + + const targetLink = recipesAreDefined + ? `../new_session/parameters/${sessid}` + : `../sessions/${sessid}` + + return ( +
+ + + + + + Select data directory + + + + + + + + + + + + + + + Do not process existing data + + { + setSkipExistingProcessing( + !skipExistingProcessing + ) + }} + /> + + + + + } + onClick={handleSelection} + /> + + + + + + + +
+ ) +} + +export { MultigridSetup } + diff --git a/src/utils/api/client.tsx b/src/utils/api/client.tsx index 8e8edec..6f30142 100644 --- a/src/utils/api/client.tsx +++ b/src/utils/api/client.tsx @@ -1,159 +1,159 @@ -import { createStandaloneToast } from "@chakra-ui/toast"; -import { baseToast } from "@diamondlightsource/ui-components"; -const { toast } = createStandaloneToast(); +import { createStandaloneToast } from '@chakra-ui/toast' +import { baseToast } from '@diamondlightsource/ui-components' +const { toast } = createStandaloneToast() -const controller = new AbortController(); +const controller = new AbortController() const defaultSettings: Partial = { - credentials: - process.env.NODE_ENV === "development" ? "include" : "same-origin", -}; + credentials: + process.env.NODE_ENV === 'development' ? 'include' : 'same-origin', +} interface RequestConfig { - method: string; - headers: Record; - body?: string | FormData; - [k: string]: any; + method: string + headers: Record + body?: string | FormData + [k: string]: any } export interface Response { - status: number; - data: any; - headers: Record; - url: string; + status: number + data: any + headers: Record + url: string } -export const getPrefix = (prefix: string = "/api/") => { - if (prefix.substring(0, 1) === "/") { - return window.location.origin + prefix; - } +export const getPrefix = (prefix: string = '/api/') => { + if (prefix.substring(0, 1) === '/') { + return window.location.origin + prefix + } - return prefix; -}; + return prefix +} export const client = async ( - endpoint: string, - customConfig: Record = {}, - body?: Record | FormData | null, - method: string | null = null, - errToast: boolean = true, - prefix: string = getPrefix(sessionStorage.getItem("murfeyServerURL") ?? process.env.REACT_APP_API_ENDPOINT), + endpoint: string, + customConfig: Record = {}, + body?: Record | FormData | null, + method: string | null = null, + errToast: boolean = true, + prefix: string = getPrefix( + sessionStorage.getItem('murfeyServerURL') ?? + process.env.REACT_APP_API_ENDPOINT + ) ): Promise => { - const config: RequestConfig = { - method: method ? method : body != null ? "POST" : "GET", - ...customConfig, - headers: { - ...customConfig.headers, - }, - signal: controller.signal, - body: undefined, - ...defaultSettings, - }; - console.log(endpoint); - - if (body != null) { - if (!(body instanceof FormData)) { - config.body = JSON.stringify(body); - config.headers = { - ...config.headers, - Accept: "application/json", - "Content-Type": "application/json", - }; - } else { - config.body = body; + const config: RequestConfig = { + method: method ? method : body != null ? 'POST' : 'GET', + ...customConfig, + headers: { + ...customConfig.headers, + }, + signal: controller.signal, + body: undefined, + ...defaultSettings, } - } - - try { - const token = sessionStorage.getItem("token"); - config.headers = { ...config.headers, Authorization: `Bearer ${token}` }; - const response = await fetch(prefix + endpoint, config); - const isJson = response.headers.get("content-type") === "application/json"; - - if(!isJson) console.log(endpoint); - - return { - status: response.status, - data: isJson ? await response.json() : await response.arrayBuffer(), - headers: response.headers, - url: response.url, - }; - } catch (err) { - if (!toast.isActive("main-toast") && errToast) { - toast({ - ...baseToast, - title: - "An error has occurred while fetching data, please try again later.", - status: "error", - }); + console.log(endpoint) + + if (body != null) { + if (!(body instanceof FormData)) { + config.body = JSON.stringify(body) + config.headers = { + ...config.headers, + Accept: 'application/json', + 'Content-Type': 'application/json', + } + } else { + config.body = body + } } - throw err; - } -}; + try { + const token = sessionStorage.getItem('token') + config.headers = { ...config.headers, Authorization: `Bearer ${token}` } + const response = await fetch(prefix + endpoint, config) + const isJson = + response.headers.get('content-type') === 'application/json' + + if (!isJson) console.log(endpoint) + + return { + status: response.status, + data: isJson ? await response.json() : await response.arrayBuffer(), + headers: response.headers, + url: response.url, + } + } catch (err) { + if (!toast.isActive('main-toast') && errToast) { + toast({ + ...baseToast, + title: 'An error has occurred while fetching data, please try again later.', + status: 'error', + }) + } + + throw err + } +} client.get = async ( - endpoint: string, - customConfig = {}, - errToast: boolean = true, + endpoint: string, + customConfig = {}, + errToast: boolean = true ) => { - return await client( - endpoint, - (customConfig = { - ...customConfig, - }), - null, - "GET", - (errToast = errToast), - ); -}; + return await client( + endpoint, + (customConfig = { + ...customConfig, + }), + null, + 'GET', + (errToast = errToast) + ) +} client.hub_get = async ( - endpoint: string, - customConfig = {}, - errToast: boolean = true, + endpoint: string, + customConfig = {}, + errToast: boolean = true ) => { - return await client( - endpoint, - (customConfig = { - ...customConfig, - }), - null, - "GET", - (errToast = errToast), - getPrefix(process.env.REACT_APP_HUB_ENDPOINT), - ); -}; - + return await client( + endpoint, + (customConfig = { + ...customConfig, + }), + null, + 'GET', + (errToast = errToast), + getPrefix(process.env.REACT_APP_HUB_ENDPOINT) + ) +} client.delete = async (endpoint: string, customConfig = {}) => { - return await client( - endpoint, - (customConfig = { - ...customConfig, - }), - null, - "DELETE", - ); -}; + return await client( + endpoint, + (customConfig = { + ...customConfig, + }), + null, + 'DELETE' + ) +} client.post = async ( - endpoint: string, - body: Record | FormData, - customConfig = {}, + endpoint: string, + body: Record | FormData, + customConfig = {} ) => { - return await client(endpoint, { ...customConfig }, body); -}; + return await client(endpoint, { ...customConfig }, body) +} client.put = async ( - endpoint: string, - body: Record | FormData, - customConfig = {}, + endpoint: string, + body: Record | FormData, + customConfig = {} ) => { - return await client(endpoint, { ...customConfig }, body, "PUT"); -}; + return await client(endpoint, { ...customConfig }, body, 'PUT') +} export const prependApiUrl = (url: string) => - `${getPrefix((sessionStorage.getItem("murfeyServerURL") ?? process.env.REACT_APP_API_ENDPOINT))}${url}`; - - + `${getPrefix(sessionStorage.getItem('murfeyServerURL') ?? process.env.REACT_APP_API_ENDPOINT)}${url}` diff --git a/src/utils/constants.ts b/src/utils/constants.ts new file mode 100644 index 0000000..4eb1662 --- /dev/null +++ b/src/utils/constants.ts @@ -0,0 +1,3 @@ + +export const angstromHtmlChar = "\u212B"; + diff --git a/src/utils/generic.ts b/src/utils/generic.ts new file mode 100644 index 0000000..f3d34a3 --- /dev/null +++ b/src/utils/generic.ts @@ -0,0 +1,15 @@ +const timeFormatter = new Intl.DateTimeFormat('en-GB', { + dateStyle: 'short', + timeStyle: 'short', +}) + +export const parseDate = (dateString: string | undefined) => { + const safeDate = dateString ?? '' + const date = Date.parse(safeDate) + + if (isNaN(date)) { + return safeDate + } + + return timeFormatter.format(date) +} diff --git a/src/utils/generic.tsx b/src/utils/generic.tsx deleted file mode 100644 index dd06c16..0000000 --- a/src/utils/generic.tsx +++ /dev/null @@ -1,15 +0,0 @@ -const timeFormatter = new Intl.DateTimeFormat("en-GB", { - dateStyle: "short", - timeStyle: "short", -}); - -export const parseDate = (dateString: string | undefined) => { - const safeDate = dateString ?? ""; - const date = Date.parse(safeDate); - - if (isNaN(date)) { - return safeDate; - } - - return timeFormatter.format(date); -}; diff --git a/src/utils/types.ts b/src/utils/types.ts new file mode 100644 index 0000000..bc57c09 --- /dev/null +++ b/src/utils/types.ts @@ -0,0 +1,13 @@ +import { components } from "schema/main"; + +export type Session = components['schemas']['Session']; +export type InstrumentInfo = { + instrument_name: string; + display_name: string; + instrument_url: string; +}; + +export type ProcessingDetails = components['schemas']['ProcessingDetails'] +export type RSyncerInfo = components['schemas']['RSyncerInfo'] +export type MachineConfig = components['schemas']['MachineConfig'] +export type MultigridWatcherSpec = components['schemas']['MultigridWatcherSetup'] \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index e0b9ce3..d410289 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2611,6 +2611,11 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@pkgr/core@^0.2.4": + version "0.2.7" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.7.tgz#eb5014dfd0b03e7f3ba2eeeff506eed89b028058" + integrity sha512-YLT9Zo3oNPJoBjBc4q8G2mjU4tqIbf5CEOORbUUr48dCD9q3umJ3IPlVqOqDakPfd2HuwccBaqlGhN4Gmr5OWg== + "@pmmmwh/react-refresh-webpack-plugin@^0.5.3": version "0.5.15" resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.15.tgz#f126be97c30b83ed777e2aeabd518bc592e6e7c4" @@ -5700,6 +5705,11 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" +eslint-config-prettier@^10.1.5: + version "10.1.5" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-10.1.5.tgz#00c18d7225043b6fbce6a665697377998d453782" + integrity sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw== + eslint-config-react-app@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz#73ba3929978001c5c86274c017ea57eb5fa644b4" @@ -5796,6 +5806,14 @@ eslint-plugin-jsx-a11y@^6.5.1: safe-regex-test "^1.0.3" string.prototype.includes "^2.0.0" +eslint-plugin-prettier@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.4.1.tgz#99b55d7dd70047886b2222fdd853665f180b36af" + integrity sha512-9dF+KuU/Ilkq27A8idRP7N2DH8iUR6qXcjF3FR2wETY21PZdBrIjwCau8oboyGj9b7etWmTGEeM8e7oOed6ZWg== + dependencies: + prettier-linter-helpers "^1.0.0" + synckit "^0.11.7" + eslint-plugin-react-hooks@^4.3.0: version "4.6.2" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.2.tgz#c829eb06c0e6f484b3fbb85a97e57784f328c596" @@ -6064,6 +6082,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== + fast-glob@^3.2.9, fast-glob@^3.3.0, fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -9282,10 +9305,17 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== -prettier@3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.1.tgz#e68935518dd90bb7ec4821ba970e68f8de16e1ac" - integrity sha512-7CAwy5dRsxs8PHXT3twixW9/OEll8MLE0VRPCJyl7CkS6VHGPSlsVaWTiASPTyGyYRyApxlaWTzwUxVNrhcwDg== +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@^3.5.3: + version "3.5.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.3.tgz#4fc2ce0d657e7a02e602549f053b239cb7dfe1b5" + integrity sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw== pretty-bytes@^5.3.0, pretty-bytes@^5.4.1: version "5.6.0" @@ -10373,7 +10403,16 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -10476,7 +10515,14 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -10634,6 +10680,13 @@ symbol-tree@^3.2.4: resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== +synckit@^0.11.7: + version "0.11.8" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.8.tgz#b2aaae998a4ef47ded60773ad06e7cb821f55457" + integrity sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A== + dependencies: + "@pkgr/core" "^0.2.4" + tailwindcss@^3.0.2: version "3.4.7" resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.7.tgz#6092f18767f5933f59375b9afe558e592fc77201" @@ -11576,7 +11629,16 @@ workbox-window@6.6.1: "@types/trusted-types" "^2.0.2" workbox-core "6.6.1" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==