Conversation
* add env example * update qserver default urls from env * update ophyd socket path and env variable * edit default url * adjust camera socket env url * add qserver key env * add env examples and fix storybook doc to match * rename httpserver to qserverapi * implement url prop for qserver * disabled style cursor not allowed * add url props for camera image and pv control * styling * add toggle for log normalize for camera server * add bl531 mono svg * add googledoc component * refactor the camera canvas icons into new component * fix jsx error * move cameraCanvas logic into custom hook * fix jsx syntax * add drawing onto cameracanvas * canvas drawings persist in local storage * add linux terminal view * add tiff streamer * allow multiple gdocs with dropdown * fix tiff canvas render size * fix background auto height * use cn style merging * initialize devices object before mounting * first skeleton of untested hexapod * get hexapod working at 531 * finish hexapod controller mvp * optimize device instantiation call * better styling * add dropdown component * fit controller content better in linux firefox, remove console logs * add beam energy skeleton untested * remove old beam energy * new button component * move utility file * add reverse calculation, enable lock on controls * add large mono icon * add ALS beam status iframe * initial tiledplot component * revise types * add utils for parsing path from link * new qserver updates, tiled plotter checkpoint * initial working execute plan flow with live tiled data view * add button to run plans * use finch favicon * add utils to get bluesky run from item uid * new layout with execute plan * add finch favicon and revise html title * hexapod * allow negatives * remove comment * new tiled heatmap wrapper component * use array block instead of png * add ophyd device ws support and beamenergyophyd controller * revise ophyd ws * separate addItem logic into separate hook * new component for qserver plan * initial log scale * add shutter * heatmap styling * enable log scale by default * fixes * integration with runId * size styling * add component * add utils to assist other component needs * default pv * full energy scan layout * eraser button in dwg mode, support relative drwg save and load from lcl storage * removed unused files * allow popup on currently running item * enable pause, resume, delete of current RE item * api status integrations and polised pause interactions * refactor into tanstack hooks * fix hidden slider * fix line plot size expansion * add dropdown with controls to shutter * poll for tiledPath * remove console logs * use env var for tiff socket url * remove console logs * fix scatter plot dynamic scaling * add tiff container, revise cam layout page * limit qserver page width * enable flip y axis * skeleton add * mostly working new skeleton * auto update logic * add type * enable vertical scroll * styling * make default colors blue shades * checkpoint * add qserver standalone plan monitor * fix alignment issues when status text is present * center sidebar text * add histogram component * add stripchart for ophyd device * new hook for pvs * add temp types for Tiled component * revise pv names * linting * new layout * new camera pv * add page * add pages * add vitest and first test * sync button props and add tests * add controller tests * add generic props arg * fix demo mode, add yAxisTitle * add controller tests * consistent className prop and small fixes * add tests * add input tests * add tests * cleanup common props * restructure and split up different plot types * add tests * add sim socket * add tests and enable styling props * add jsdoc * rename PV vs Ophyd * add plot and header controls * make deviceLabel optional * add beam energy tests * add demo mode, revise layouts * add hexapod test * fix content selection header * add jsdocs * add qserver tests * add experiment tests and jsdocs * cleanup default style logic * add jsdocs and camera test * fix style test to match new * add jsdocs * add histogram jsdocs and test * add tiled jsdocs and tests
| let cleanedUrl = url.trim(); | ||
|
|
||
| // Remove trailing slashes | ||
| cleanedUrl = cleanedUrl.replace(/\/+$/, ''); |
| </div> | ||
| <div className="flex-grow"> | ||
| <iframe | ||
| src={selectedDocUrl} |
| * @param label - Human-readable name for error messages | ||
| * @returns Cleaned URL or undefined if invalid | ||
| */ | ||
| function cleanUrl(url: string | undefined, label: string): string | undefined { |
There was a problem hiding this comment.
nit: could be beneficial to put this in a util file
| const [blueskyRunId, setBlueskyRunId] = useState<string>(""); | ||
|
|
||
| useEffect(() => { | ||
| const storedUser = localStorage.getItem("energy_scan_user"); |
There was a problem hiding this comment.
is the energy_scan_user used by both ExperimentAngleScan and ExperimentEnergyScan?
| tiledBaseUrl | ||
| }: ExperimentAngleScanProps) { | ||
| // Angle scan form state | ||
| const [user, setUser] = useState<string>(""); |
There was a problem hiding this comment.
you could potentially set the initial value here as localStorage.getItem("energy_scan_user") ?? "" so you don't have to have that initial useEffect. I would test it out though
|
|
||
| // Angle scan form handlers | ||
| const handleStartAngleChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
| setStartAngle(Number(e.target.value)); |
There was a problem hiding this comment.
If e.target.value is an empty value, this will default to zero, which is why it spontaneously spawns a zero sometimes. It might also be good to add some number validation here as well
| // Convert input angle to radians after subtracting offset | ||
| const theta_rad: number = ((mono_deg_input - mono_offset_deg) * Math.PI) / 180; | ||
|
|
||
| const theta_rad: number = ((mono_deg_input - (mono_offset_deg ?? default_mono_offset_deg)) * Math.PI) / 180; |
There was a problem hiding this comment.
this might not be a big deal if the default_mono_offset_deg is used most of the time, but if the input mono_offset_deg is the same number as mono_deg_input this function will return Infinity
| * | ||
| * @param props - Configuration options for the beam energy hook | ||
| * @param props.pv - PV name for the monochromator angle (default: 'bl531_xps1:mono_angle_deg') | ||
| * @param props.thetaOffsetDeg - Angle offset in degrees to account for mechanical offsets (default: 12.787) |
There was a problem hiding this comment.
nit: these props don't match the useBeamEnergyOphydProps
This PR includes various updates to Finch with new controller components from recent beamtime, and some quality of life upgrades to the configuration setup.
New Components
BeamEnergy*
Experiment*
Hexapod*
Histogram*
IFrame
SelectDropdown
SignalMonitorPlotDevice
SignalMonitorPlotOphyd
SignalMonitorPlotPV
*Contains various sub components , hooks, types
Styling consistency
For controller components, they have been modified to have a consistent style with ilght grey backgrounds, and consistent icons at the corners. Moving forward this will be used to enforce styling for control based components.
Consistent component arguments
Components can now take a uniform 'className' prop which is passed into a ShadCN utility function for merging classes, this allows greater customization of components from a developer.
Finch Config Provider
With various backends needed for Finch components, a convienent method of defining the backend urls and api keys in one place is needed. Individual components always take optional 'wsUrl' or 'apiKey' args which will override defaults, but most users will want to set them once and forget it. The Finch Provider is configured at the top level and wrapped around the app, making available the urls and api keys which can be loaded via env variables or JSON files at runtime. If the Finch Provider is not created, then default static urls will be utilized. The Finch Provider is completely optional.
Example usage:
API folder
Anything related to api calls has been removed from inside of components and put into the api folder. Finch is now using various backends, and future development will rely on having easy access to the hooks and functions which make the backend calls. The intent is that future components should never contain abitrary API calls, and instead should use existing functions or queries from the api folder. Using the query providers can enable taking advantage of caching via tanstack router.
Unit Tests
Unit tests with vitest have been added for all components.