Build Packages / Unit tests (push) Successful in 1h31m59s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 8m43s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 10m5s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 9m27s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 8m56s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 9m24s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 10m27s
Build Packages / build:rpm (rocky8) (push) Successful in 9m20s
Build Packages / build:rpm (rocky9) (push) Successful in 10m50s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 9m54s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 8m38s
Build Packages / DIALS test (push) Successful in 12m13s
Build Packages / XDS test (durin plugin) (push) Successful in 7m8s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 7m8s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m50s
Build Packages / Generate python client (push) Successful in 16s
Build Packages / Build documentation (push) Successful in 50s
Build Packages / Create release (push) Skipped
This is an UNSTABLE release. It includes many experimental features, as well as many AI generated fixes. We recommend using rc.152 for production use. * jfjoch_broker: Add EXPERIMENTAL pixelrefine mode for image processing * jfjoch_broker: Allow to load user mask from 8-bit and 16-bit TIFF files * jfjoch_broker: Add ROI calculation in non-FPGA workflow * jfjoch_broker: Fixes to TCP image pusher * jfjoch_broker: Remove NUMA bindings * jfjoch_broker: Improvements to indexing * jfjoch_broker: For PSI EIGER, trimming energies are taken from the detector configuration (now compulsory) instead of hardcoded values * jfjoch_writer: Save ROI definitions and the per-pixel ROI bitmap in the master file; azimuthal ROIs support phi (angular) sectors * jfjoch_viewer: Major redesign with dockable panels and saved layouts, plus on-canvas creation/move/resize of box, circle and azimuthal ROIs * jfjoch_viewer: Run jfjoch_process reprocessing jobs from inside the GUI and overlay per-run results Reviewed-on: #63
108 lines
4.3 KiB
TypeScript
108 lines
4.3 KiB
TypeScript
import {ChangeEvent, memo, useEffect, useState} from 'react';
|
|
|
|
import {
|
|
Autocomplete,
|
|
Checkbox,
|
|
FormControlLabel, FormGroup,
|
|
TextField
|
|
} from "@mui/material";
|
|
import {instrument_metadata} from "../client";
|
|
import {putConfigInstrumentMutation} from "../client/@tanstack/react-query.gen";
|
|
import _ from "lodash";
|
|
import SettingsPanel from "./SettingsPanel";
|
|
import {useUpload} from "./useUpload";
|
|
|
|
type MyProps = {
|
|
s?: instrument_metadata
|
|
}
|
|
|
|
const default_instrument_metadata: instrument_metadata = {
|
|
source_name: "Swiss Light Source",
|
|
instrument_name: "X06SA",
|
|
source_type: "Synchrotron X-ray Source",
|
|
pulsed_source: false,
|
|
electron_source: false
|
|
}
|
|
|
|
const source_types : string[] = [
|
|
"Synchrotron X-ray Source",
|
|
"Free-Electron Laser",
|
|
"Rotating Anode X-ray",
|
|
"Fixed Tube X-ray",
|
|
"Electron microscope",
|
|
"X-ray Plasma Source",
|
|
"Metal Jet X-ray"
|
|
];
|
|
|
|
function InstrumentMetadata({s: serverS}: MyProps) {
|
|
const [s, setS] = useState<instrument_metadata>(default_instrument_metadata);
|
|
const [lastDownloadedS, setLastDownloadedS] = useState<instrument_metadata>(default_instrument_metadata);
|
|
const { submit, pending, snackbar } = useUpload(putConfigInstrumentMutation());
|
|
|
|
useEffect(() => {
|
|
if ((serverS !== undefined) && !_.isEqual(serverS, lastDownloadedS)) {
|
|
setS(serverS);
|
|
setLastDownloadedS(serverS);
|
|
}
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [serverS]);
|
|
|
|
const dirty = !_.isEqual(s, lastDownloadedS);
|
|
|
|
return (
|
|
<SettingsPanel title="Source and instrument metadata" dirty={dirty}
|
|
onUpload={() => submit(s)} uploadDisabled={pending} snackbar={snackbar}>
|
|
<TextField id="source_name" label="Source name" variant="outlined"
|
|
fullWidth
|
|
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
|
setS(prev => ({...prev, source_name: event.target.value}));
|
|
}}
|
|
value={s.source_name}/>
|
|
<TextField id="instrument_name" label="Instrument name" variant="outlined"
|
|
fullWidth
|
|
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
|
setS(prev => ({...prev, instrument_name: event.target.value}));
|
|
}}
|
|
value={s.instrument_name}/>
|
|
<Autocomplete
|
|
fullWidth
|
|
freeSolo
|
|
multiple={false}
|
|
onChange={(event, newValue: string | null | undefined) => {
|
|
if (typeof newValue === "string")
|
|
setS(prev => ({...prev, source_type: newValue}));
|
|
}}
|
|
|
|
inputValue={s.source_type}
|
|
|
|
onInputChange={(_event, newInputValue: string) => {
|
|
setS(prev => ({...prev, source_type: newInputValue}));
|
|
}}
|
|
selectOnFocus
|
|
clearOnBlur
|
|
value={s.source_type}
|
|
options={source_types}
|
|
renderInput={(params) => <TextField {...params} label="Source type" variant="outlined"/>}
|
|
/>
|
|
<FormGroup>
|
|
<FormControlLabel control={
|
|
<Checkbox checked={s.pulsed_source === true}
|
|
onChange={
|
|
(event: ChangeEvent<HTMLInputElement>) => {
|
|
setS(prev => ({...prev, pulsed_source: event.target.checked}));
|
|
}}/>
|
|
} label="Pulsed source (XFEL)"/>
|
|
<FormControlLabel control={
|
|
<Checkbox checked={s.electron_source === true}
|
|
onChange={
|
|
(event: ChangeEvent<HTMLInputElement>) => {
|
|
setS(prev => ({...prev, electron_source: event.target.checked}));
|
|
}}/>
|
|
} label="Electron source"/>
|
|
</FormGroup>
|
|
</SettingsPanel>
|
|
);
|
|
}
|
|
|
|
export default memo(InstrumentMetadata);
|