@esrf/daiquiri-lib 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/hardware/base/BaseState.tsx","../src/hardware/base/BaseName.tsx","../src/hardware/base/BaseInfo.tsx","../src/hardware/utils/TypeIcon.tsx","../src/hardware/utils/HardwareTemplate.tsx","../src/hardware/base/BaseProperty.tsx","../src/hardware/base/index.tsx","../src/hardware/base/mocks/index.ts","../src/hardware/utils/State.tsx","../src/hardware/airbearing/AirBearingState.tsx","../src/hardware/airbearing/AirBearing.tsx","../src/components/ReadOnlyTextInput.tsx","../src/hardware/airbearing/AirBearingProtected.tsx","../src/hardware/airbearing/index.ts","../src/hardware/airbearing/mocks/index.ts","../src/hardware/base/mocks/Simulator.tsx","../src/hardware/airbearing/mocks/Simulator.tsx","../src/utils/formatting.ts","../src/hardware/frontend/Frontend.tsx","../src/hardware/frontend/index.ts","../src/hardware/frontend/mocks/index.ts","../src/hardware/gauge/Gauge.tsx","../src/hardware/gauge/index.ts","../src/hardware/gauge/mocks/index.ts","../src/components/NumericStep.tsx","../src/components/HardwareNumericStep.tsx","../src/hardware/laser/Laser.tsx","../src/hardware/laser/index.ts","../src/hardware/laser/mocks/index.ts","../src/hardware/laserheating/LaserHeating.tsx","../src/hardware/laserheating/index.ts","../src/hardware/laserheating/mocks/index.ts","../src/hardware/light/Light.tsx","../src/hardware/light/index.ts","../src/hardware/light/mocks/index.ts","../src/hardware/lima/LimaState.tsx","../src/hardware/lima/LimaDefault.tsx","../src/hardware/lima/LimaSize.tsx","../src/hardware/lima/LimaTransformation.tsx","../src/hardware/lima/LimaBinning.tsx","../src/hardware/lima/LimaImageRoi.tsx","../src/hardware/lima/LimaDescription.tsx","../src/registry/hooks.ts","../src/hardware/lima/index.ts","../src/hardware/lima/mocks/index.ts","../src/hardware/lima/mocks/Simulator.tsx","../src/hardware/measurementgroup/MeasurementGroup.tsx","../src/hardware/measurementgroup/index.ts","../src/hardware/measurementgroup/mocks/index.ts","../src/hardware/measurementgroup/mocks/Simulator.tsx","../src/hardware/motor/MotorState.tsx","../src/components/HardwareInputNumber.tsx","../src/hardware/motor/MotorDefault.tsx","../src/hardware/motor/MotorText.tsx","../src/hardware/motor/index.ts","../src/hardware/motor/mocks/index.ts","../src/hardware/motor/mocks/utils.ts","../src/hardware/motor/mocks/Simulator.tsx","../src/hardware/multiposition/Multiposition.tsx","../src/hardware/multiposition/MultipositionDefault2.tsx","../src/hardware/multiposition/index.ts","../src/hardware/multiposition/mocks/index.ts","../src/hardware/multiposition/mocks/Simulator.tsx","../src/hardware/optic/OpticState.tsx","../src/hardware/optic/Optic.tsx","../src/hardware/optic/index.ts","../src/hardware/optic/mocks/index.ts","../src/hardware/optic/mocks/Simulator.tsx","../src/hardware/procedure/ProcedureState.tsx","../src/hardware/procedure/ProcedureManage.tsx","../src/hardware/procedure/ProcedureExecution.tsx","../src/hardware/procedure/ProcedureValidate.tsx","../src/hardware/procedure/index.ts","../src/hardware/procedure/mocks/index.ts","../src/hardware/shutter/ShutterState.tsx","../src/hardware/shutter/ShutterDefault.tsx","../src/hardware/shutter/ShutterProtected.tsx","../src/hardware/shutter/index.ts","../src/hardware/shutter/mocks/index.ts","../src/hardware/shutter/mocks/Simulator.tsx","../src/hardware/slit/SlitState.tsx","../src/hardware/slit/SlitDefault.tsx","../src/hardware/slit/index.ts","../src/hardware/slit/mocks/index.ts","../src/hardware/pump/Pump.tsx","../src/hardware/pump/index.ts","../src/hardware/pump/mocks/index.ts","../src/hardware/pusher/PusherState.tsx","../src/hardware/pusher/Pusher.tsx","../src/hardware/pusher/index.ts","../src/hardware/pusher/mocks/index.ts","../src/hardware/pusher/mocks/Simulator.tsx","../src/hardware/service/ServiceState.tsx","../src/hardware/service/ServiceDefault.tsx","../src/hardware/service/ServiceProtected.tsx","../src/hardware/service/index.ts","../src/hardware/service/mocks/index.ts","../src/hardware/tomoflatmotion/TomoFlatMotionState.tsx","../src/hardware/tomoflatmotion/TomoFlatMotionDefault.tsx","../src/hardware/tomoflatmotion/TomoFlatMotionSmall.tsx","../src/hardware/tomoflatmotion/index.ts","../src/hardware/tomoflatmotion/mocks/index.ts","../src/hardware/tomoflatmotion/mocks/Simulator.tsx","../src/hardware/tomoreferenceposition/TomoReferencePositionDefault.tsx","../src/hardware/tomoreferenceposition/index.ts","../src/hardware/tomodetector/TomoDetectorState.tsx","../src/hardware/tomodetector/TomoDetectorSamplePixelSize.tsx","../src/hardware/tomodetector/TomoDetectorAcquisitionMode.tsx","../src/hardware/tomodetector/index.ts","../src/hardware/tomodetector/mocks/index.ts","../src/hardware/tomodetectors/TomoDetectorsState.tsx","../src/hardware/tomodetectors/TomoDetectors.tsx","../src/hardware/tomodetectors/index.ts","../src/hardware/tomodetectors/mocks/index.ts","../src/hardware/tomoimaging/TomoImagingState.tsx","../src/hardware/tomoimaging/TomoImagingDefault.tsx","../src/hardware/tomoimaging/TomoImagingExposureTime.tsx","../src/hardware/tomoimaging/TomoImagingSettleTime.tsx","../src/hardware/tomoimaging/TomoImagingActions.tsx","../src/hardware/tomoimaging/TomoImagingUpdateMode.tsx","../src/hardware/tomoimaging/index.ts","../src/hardware/tomoimaging/mocks/index.ts","../src/hardware/tomoimaging/mocks/Simulator.tsx","../src/hardware/tomosamplestage/index.ts","../src/hardware/tomoconfig/LatencyTime.tsx","../src/hardware/tomoconfig/index.ts","../src/hardware/tomoholo/TomoHoloState.tsx","../src/hardware/tomoholo/index.ts","../src/hardware/valve/Valve.tsx","../src/hardware/valve/index.ts","../src/hardware/valve/mocks/index.ts","../src/hardware/utils/NoObject.tsx","../src/hardware/utils/LoadingObject.tsx","../src/hardware/utils/MissingObject.tsx","../src/hardware/utils/ErrorObject.tsx","../src/hardware/utils/MissingComponentObject.tsx","../src/hardware/utils/NullObject.tsx","../src/components/FullSizer.tsx","../src/layout/Panel.tsx","../src/yaml-layout/utils.tsx","../src/yaml-layout/components/asserts.ts","../src/yaml-layout/components/Todo.tsx","../src/yaml-layout/components/None.tsx","../src/yaml-layout/ErrorBoundary.tsx","../src/yaml-layout/Row.tsx","../src/yaml-layout/Col.tsx","../src/yaml-layout/components/HardwareGroup.tsx","../src/yaml-layout/components/Hardware.tsx","../src/yaml-layout/Component.tsx","../src/yaml-layout/Container.tsx","../src/yaml-layout/Panel.tsx","../src/yaml-layout/Tabs.tsx","../src/yaml-layout/Form.tsx","../src/yaml-layout/Grid.tsx","../src/yaml-layout/Label.tsx","../src/yaml-layout/Main.tsx","../src/monitorpanel/MonitorHardware.tsx","../src/monitorpanel/MonitorPanel.tsx"],"sourcesContent":["import type { Hardware } from '../utils/types';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\nimport { Badge } from 'react-bootstrap';\n\nexport function AnyHardwareState(props: { hardware: Hardware }) {\n const { hardware } = props;\n const { online, locked = null } = hardware;\n const state = online\n ? (locked !== null ? 'LOCKED' : hardware.properties.state) || 'UNKNOWN'\n : 'OFFLINE';\n\n // Try to catch some common state name\n const variantMapping: { [name: string]: string } = {\n READY: 'success',\n OFFLINE: 'warning',\n MOVING: 'warning',\n DISABLED: 'secondary',\n UNKNOWN: 'danger',\n ERROR: 'danger',\n FAILED: 'danger',\n LOCKED: 'warning',\n };\n\n const variant = variantMapping[state] || 'success';\n\n return <Badge bg={variant}>{state}</Badge>;\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<AnySchema>) {\n const { hardware } = props;\n return <AnyHardwareState hardware={hardware} />;\n}\n","import type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\n\nexport interface BaseNameWidgetOptions extends HardwareWidgetOptions {\n overrideName?: string;\n emptyifnone?: boolean;\n}\n\nexport default function Name(\n props: HardwareWidgetProps<AnySchema, BaseNameWidgetOptions>\n) {\n const { hardware, options } = props;\n function getName() {\n if (hardware.name) {\n return hardware.name;\n }\n return hardware.id;\n }\n\n function getLabel() {\n if (options.overrideName !== undefined) {\n return options.overrideName;\n }\n if (hardware.alias) {\n return hardware.alias;\n }\n if (hardware.name) {\n return hardware.name;\n }\n return hardware.id;\n }\n\n function getTitle() {\n if (options.overrideName !== undefined) {\n return `Real name: ${getName()}`;\n }\n if (hardware.alias) {\n return `Real name: ${hardware.name}`;\n }\n return undefined;\n }\n\n const name = getLabel();\n const title = getTitle();\n return <span title={title}>{name}</span>;\n}\n","import type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\n\nexport interface BaseInfoWidgetOptions extends HardwareWidgetOptions {\n /** The property */\n property?: string;\n /** Unit for the property */\n unit?: string;\n}\n\nexport default function Info(\n props: HardwareWidgetProps<AnySchema, BaseInfoWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n function getValue() {\n const propertyName = options.property;\n if (propertyName === undefined) {\n return `property is not set`;\n }\n if (propertyName === null) {\n return `property is null`;\n }\n let result: any = hardware;\n for (const segment of propertyName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return `property '${propertyName}' not found`;\n }\n }\n return `${result}`;\n }\n\n return <>{getValue()}</>;\n}\n","export interface Props {\n online: boolean;\n activeMessage?: string;\n inactiveMessage?: string;\n message?: string;\n icon: string;\n name: string;\n}\n\nexport function OnlineStatus(props: Props) {\n const {\n activeMessage = 'Online',\n inactiveMessage = 'Offline',\n message = 'This device is',\n } = props;\n\n return (\n <div\n className={`dot-indicator small bg-${\n props.online ? 'success' : 'danger'\n }`}\n title={`${message} ${props.online ? activeMessage : inactiveMessage}`}\n />\n );\n}\n\nexport default function TypeIcon(props: Props) {\n const { name, icon } = props;\n return (\n <div className=\"icon\" title={name}>\n <i className={`fa ${icon}`} />\n <OnlineStatus {...props} />\n </div>\n );\n}\n","import type { ReactElement } from 'react';\nimport { Form, OverlayTrigger, Popover, Button } from 'react-bootstrap';\nimport type { Hardware } from './types';\n\ninterface Props {\n hardware: Hardware;\n headerMode?: string;\n widgetIcon: ReactElement;\n widgetState: ReactElement;\n widgetContent: ReactElement;\n}\n\n/**\n * Normalized way to compose hardware component in order to provide the same\n * kind of layout\n */\nexport default function HardwareTemplate(props: Props) {\n const { headerMode, hardware } = props;\n\n function getLabel() {\n if (hardware.alias) {\n return hardware.alias;\n }\n if (hardware.name) {\n return hardware.name;\n }\n return hardware.id;\n }\n\n const label = getLabel();\n\n switch (headerMode) {\n case 'front':\n return (\n <div className=\"hw-component\">\n <div className=\"hw-single\">\n {props.widgetIcon}\n <div className=\"name\">{label}</div>\n <div className=\"d-inline-block\">{props.widgetContent}</div>\n </div>\n </div>\n );\n case 'none':\n return (\n <div className=\"hw-component\">\n <div className=\"hw-single\">{props.widgetContent}</div>\n </div>\n );\n case 'state':\n return props.widgetState;\n // case 'top':\n default:\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n {props.widgetIcon}\n <div className=\"name\">\n <Form.Label htmlFor={hardware.id}>{label}</Form.Label>\n </div>\n {props.widgetState}\n {props.hardware.errors && props.hardware.errors.length > 0 && (\n <OverlayTrigger\n trigger=\"click\"\n placement=\"bottom\"\n rootClose\n overlay={\n <Popover id={props.hardware.id} style={{ maxWidth: 500 }}>\n <Popover.Header>Device Errors</Popover.Header>\n <Popover.Body>\n There were errors with properties on this device:\n <ul>\n {props.hardware.errors.map((error) => (\n <li>\n {error.property}:\n <span className=\"stack-trace\">\n {error.traceback}\n <br />\n {error.exception}\n </span>\n </li>\n ))}\n </ul>\n </Popover.Body>\n </Popover>\n }\n >\n <Button variant=\"danger\" size=\"sm\">\n <i className=\"fa fa-exclamation-triangle\" />\n </Button>\n </OverlayTrigger>\n )}\n </div>\n <div className=\"hw-content\">{props.widgetContent}</div>\n </div>\n );\n }\n}\n","import { InputGroup, Form, Badge } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { AnySchema } from '../utils/schema';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\n\nexport interface BasePropertyWidgetOptions extends HardwareWidgetOptions {\n header?: string;\n property?: string;\n unit?: string;\n}\n\nfunction DeviceState(props: AnySchema) {\n const state = props.online ? 'READY' : 'OFFLINE';\n return <Badge bg={state === 'READY' ? 'success' : 'warning'}>{state}</Badge>;\n}\n\nexport default function Property(\n props: HardwareWidgetProps<AnySchema, BasePropertyWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Optic\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <DeviceState {...hardware} />;\n\n function getValue() {\n const propertyName = options.property;\n if (propertyName === undefined) {\n return `property is not set`;\n }\n if (propertyName === null) {\n return `property is null`;\n }\n let result: any = hardware;\n for (const segment of propertyName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return `property '${propertyName}' not found`;\n }\n }\n return `${result}`;\n }\n\n function getUnit() {\n const unitName = options.unit;\n if (!unitName) {\n return null;\n }\n if (!unitName.includes('properties')) {\n // That's a fixed unit defined as an option\n return unitName;\n }\n\n let result: any = props;\n for (const segment of unitName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return null;\n }\n }\n return `${result}`;\n }\n\n const unit = getUnit();\n\n const widgetContent = (\n <InputGroup>\n <Form.Control value={getValue()} readOnly />\n {unit && <InputGroup.Text>{unit}</InputGroup.Text>}\n </InputGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { HardwareVariant } from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\nimport BaseState from './BaseState';\nimport BaseName from './BaseName';\nimport BaseInfo from './BaseInfo';\nimport BaseProperty from './BaseProperty';\n\nconst Variants: HardwareVariant<AnySchema> = {\n state: BaseState,\n name: BaseName,\n info: BaseInfo,\n property: BaseProperty,\n};\n\nexport default Variants;\n","import defaultjson from './Default.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { Badge, Col, OverlayTrigger, Row, Tooltip } from 'react-bootstrap';\n\n/**\n * Normalize the way to display an hardware state.\n *\n * If `minWidth` is pecified (in `em`) it ensure the widget width will stay the\n * same when the state change\n */\nexport function HardwareState(props: {\n state: string;\n variant: string;\n minWidth?: number;\n description?: string;\n}) {\n const style = {\n display: 'inline-block',\n minWidth: '',\n };\n\n if (props.minWidth) style.minWidth = `${props.minWidth}em`;\n return (\n <div style={style}>\n <Badge bg={props.variant} title={props.description}>\n {props.state}\n </Badge>\n </div>\n );\n}\n\n/**\n * Normalize the way to display an hardware exposing multiple states.\n *\n * - `states` is the states exposed by the hardware.\n * - `variants` contains a variant for each of this states, else `fatal` is used.\n * - `descriptions` can be provided to add a description to the state.\n *\n * If `minWidth` is pecified (in `em`) it ensure the widget width will stay the\n * same when the state change\n */\nexport function HardwareMultiState(props: {\n states: string[];\n variants?: Record<string, string>;\n descriptions?: Record<string, string>;\n minWidth?: number;\n}) {\n const { states, variants = {}, descriptions = {}, minWidth } = props;\n\n const mainState = states[0] ?? '';\n\n if (states.length === 0) {\n // No state is not supposed to happen\n // At least for now there is no use case\n return (\n <HardwareState\n state=\"NoState\"\n variant=\"fatal\"\n description=\"The device no not expose any state\"\n minWidth={minWidth}\n />\n );\n }\n\n if (states.length === 1) {\n // Fallback to a single state, as result the tooltip is smaller\n return (\n <HardwareState\n state={mainState}\n variant={variants[mainState] ?? 'fatal'}\n description={descriptions[mainState]}\n minWidth={minWidth}\n />\n );\n }\n\n const style = {\n display: 'inline-block',\n minWidth: minWidth ? `${minWidth}em` : '',\n };\n\n function renderTooltip(props: any) {\n return (\n <Tooltip id=\"device-state\" {...props}>\n {states.map((s, i) => {\n const desc = descriptions[s];\n // Assume a state starting with `_` is a custom state\n // which have to be displayed without this underscore\n const name = s.startsWith('_') ? s.slice(1) : s;\n return (\n <Row className=\"gx-0\">\n <Col sm=\"3\" className=\"text-end\">\n <Badge className=\"text-right\" bg={variants[s] ?? 'fatal'}>\n {name}\n </Badge>\n </Col>\n <Col sm=\"9\" className=\"text-start lh-1 my-auto ps-1\">\n {desc}\n </Col>\n </Row>\n );\n })}\n </Tooltip>\n );\n }\n\n return (\n <div style={style}>\n <OverlayTrigger\n placement=\"top\"\n delay={{ show: 250, hide: 400 }}\n overlay={renderTooltip}\n >\n <span className=\"text-nowrap\">\n <Badge className=\"rounded-end-0\" bg={variants[mainState] ?? 'fatal'}>\n {mainState}\n </Badge>\n <Badge className=\"rounded-start-0\" bg=\"secondary\">\n +{states.length - 1}\n </Badge>\n </span>\n </OverlayTrigger>\n </div>\n );\n}\n","import { HardwareState } from '../utils/State';\nimport type { AirBearingSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function AirBearingState(props: { hardware: AirBearingSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n ON: 'danger',\n OFF: 'success',\n MOVING_ON: 'warning',\n MOVING_OFF: 'warning',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<AirBearingSchema>\n) {\n const { hardware } = props;\n return <AirBearingState hardware={hardware} />;\n}\n","import { Button, ButtonGroup } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { AirBearingState } from './AirBearingState';\nimport type { AirBearingSchema } from '.';\n\nfunction RawAirBearing(props: {\n hardware: EditableHardware<AirBearingSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options, disabled } = props;\n const state = hardware.properties?.state ?? 'OFFLINE';\n const isOn = state === 'ON';\n const isOff = state === 'OFF';\n\n return (\n <div\n style={{\n display: 'grid',\n gridTemplateRows: 'min-content min-content',\n gridTemplateColumns: 'min-content auto',\n gridGap: '1px',\n }}\n >\n <ButtonGroup className=\"mx-auto\" style={{ width: '12em' }}>\n <Button\n onClick={() => {\n void hardware.actions.call('on');\n }}\n disabled={isOn || disabled}\n style={{ width: '5em' }}\n >\n <span className=\"text-nowrap\">On</span>\n </Button>\n <Button\n onClick={() => {\n void hardware.actions.call('off');\n }}\n disabled={isOff || disabled}\n style={{ width: '5em' }}\n >\n <span className=\"text-nowrap\">Off</span>\n </Button>\n </ButtonGroup>\n </div>\n );\n}\n\nexport default function AirBearing(\n props: HardwareWidgetProps<AirBearingSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Air bearing\"\n icon=\"fa-hand-point-right\"\n online={hardware.online}\n />\n );\n\n const widgetState = <AirBearingState hardware={hardware} />;\n\n function getWidgetContent() {\n return <RawAirBearing {...props} />;\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import { Form } from 'react-bootstrap';\n\n/**\n * Readonly text displayed as an input.\n *\n * Is supports variants, and can be properly integrated inside a\n * `FormGroup` to replace the main input.\n */\nexport default function ReadOnlyTextInput(props: {\n variant?: string;\n value?: string;\n style?: Record<string, any>;\n className?: string;\n title?: string;\n}) {\n const { value, variant, style, className, title } = props;\n const defaultClasses = variant\n ? `badge-${variant} bg-${variant} text-bg-${variant} border-${variant}`\n : 'border-light';\n return (\n <Form.Control\n className={`${defaultClasses} ${className} bg-secondary`}\n style={style}\n value={value}\n title={title}\n readOnly\n />\n );\n}\n","import {\n Button,\n ButtonGroup,\n Col,\n Container,\n Dropdown,\n InputGroup,\n Row,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { AirBearingState } from './AirBearingState';\nimport type { AirBearingSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport type { PropsWithChildren } from 'react';\n\nfunction ActionButton(\n props: PropsWithChildren<{\n icon: string;\n isActive?: boolean;\n wasActivated: boolean;\n disabled: boolean;\n onClick: () => void;\n title: string;\n }>\n) {\n return (\n <Button\n variant={\n props.isActive\n ? 'primary'\n : props.wasActivated\n ? 'warning'\n : 'secondary'\n }\n onClick={props.onClick}\n disabled={props.disabled || props.wasActivated}\n title={props.title}\n >\n <Row className=\"gx-0\">\n <i\n className={`col-sm-4 justify-content-center align-self-center ${props.icon}`}\n />\n <Col sm=\"8\">{props.children}</Col>\n </Row>\n </Button>\n );\n}\n\nfunction DropdownAirBearing(props: {\n hardware: EditableHardware<AirBearingSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options = {}, disabled } = props;\n function requestOn() {\n void hardware.actions.call('on');\n }\n\n function requestOff() {\n void hardware.actions.call('off');\n }\n\n const state = hardware.properties?.state ?? 'UNKNOWN';\n const hardwareDisabled = state === 'MOVING_ON' || state === 'MOVING_OFF';\n const isOn = state === 'ON';\n const isOff = state === 'OFF';\n const movingOn = state === 'MOVING_ON';\n const movingOff = state === 'MOVING_OFF';\n\n return (\n <Dropdown>\n <Dropdown.Toggle\n variant=\"secondary\"\n disabled={disabled || hardwareDisabled}\n />\n <Dropdown.Menu>\n <Container>\n <Row>\n <Col className=\"text-center\">Actions</Col>\n </Row>\n <Row>\n <Col>\n <ButtonGroup>\n <ActionButton\n icon=\"fa fa-arrow-up\"\n wasActivated={movingOn}\n onClick={() => {\n requestOn();\n }}\n disabled={disabled || hardwareDisabled}\n title=\"Turn on the air bearing\"\n >\n Turn\n <br />\n on\n </ActionButton>\n <ActionButton\n icon=\"fa fa-arrow-down\"\n wasActivated={movingOff}\n onClick={() => {\n requestOff();\n }}\n disabled={disabled || hardwareDisabled}\n title=\"Turn off the air bearing\"\n >\n Turn\n <br />\n off\n </ActionButton>\n </ButtonGroup>\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nfunction RawAirBearing(props: {\n hardware: EditableHardware<AirBearingSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options, disabled } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n\n const variants: { [state: string]: string } = {\n ON: 'danger',\n OFF: 'success',\n MOVING_ON: 'warning',\n MOVING_OFF: 'warning',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] ?? 'fatal';\n\n return (\n <InputGroup className=\"d-flex flex-nowrap\">\n <ReadOnlyTextInput\n variant={variant}\n className=\"text-center\"\n style={{ minWidth: '10em' }}\n value={state}\n />\n <DropdownAirBearing {...props} />\n </InputGroup>\n );\n}\n\nexport default function AirBearingProtected(\n props: HardwareWidgetProps<AirBearingSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Air bearing\"\n icon=\"fa-hand-point-right\"\n online={hardware.online}\n />\n );\n\n const widgetState = <AirBearingState hardware={hardware} />;\n\n function getWidgetContent() {\n return <RawAirBearing {...props} />;\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport AirBearing from './AirBearing';\nimport AirBearingProtected from './AirBearingProtected';\nimport AirBearingState from './AirBearingState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface AirBearingSchema extends Hardware {\n properties: {\n state: string;\n };\n}\n\nconst Variants: HardwareVariant<AirBearingSchema> = {\n default: AirBearing,\n protected: AirBearingProtected,\n // Override base state\n state: AirBearingState,\n};\n\nexport default Variants;\n","import defaultjson from './AirBearing.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useEffect, useMemo, useRef } from 'react';\nimport type {\n Hardware,\n EditableHardware,\n HardwareChangeActions,\n} from '../../utils/types';\nimport { isEqual } from 'lodash';\n\nexport async function delay(ms: number) {\n await new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport type PropsWithSimulator<P = Record<string, never>> = P & {\n name: string;\n alias?: string;\n useHardwareContext?: () => {\n actions: {\n updateHardware: (name: string, hardware: Hardware) => void;\n updateHardwareChangeActions: (\n name: string,\n actions: HardwareChangeActions\n ) => void;\n };\n };\n};\n\nexport function Simulator(props: {\n name: string;\n alias?: string | null;\n type: string;\n call: (name: string, value?: any) => Promise<void>;\n setProperty: (name: string, value: any) => Promise<void>;\n properties: { [name: string]: any };\n useHardwareContext?: () => {\n actions: {\n updateHardware: (name: string, hardware: Hardware) => void;\n updateHardwareChangeActions: (\n name: string,\n actions: HardwareChangeActions\n ) => void;\n };\n };\n}) {\n const {\n name,\n alias = null,\n type,\n setProperty,\n call,\n properties,\n useHardwareContext = () => {\n return null;\n },\n } = props;\n\n const ctx = useHardwareContext();\n\n const actions: HardwareChangeActions = useMemo(() => {\n const actions = {\n setProperty,\n call,\n };\n ctx?.actions.updateHardwareChangeActions?.(name, actions);\n return actions;\n }, []);\n\n const hardware: EditableHardware<Hardware> = {\n id: name,\n name,\n alias,\n online: true,\n properties,\n type,\n actions,\n user_tags: [],\n locked: null,\n };\n\n const previousHardware = useRef<EditableHardware<Hardware> | null>(null);\n\n useEffect(() => {\n if (\n previousHardware.current === null ||\n !isEqual(previousHardware.current, hardware)\n ) {\n previousHardware.current = hardware;\n ctx?.actions.updateHardware(name, hardware);\n }\n }, [name, hardware]);\n\n return <></>;\n}\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function AirBearingSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [state, setState] = useState('ON');\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'on') {\n setState('MOVING_ON');\n await delay(2000);\n setState('ON');\n return;\n }\n if (name === 'off') {\n setState('MOVING_OFF');\n await delay(2000);\n setState('OFF');\n return;\n }\n console.log('AirBearingSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log('AirBearingSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = {\n state,\n };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"tomoflatmotion\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","// https://github.com/gentooboontoo/js-quantities/issues/30\nexport function formatEng(scalar: number) {\n const powerPrefix: Record<number, string> = {\n 24: 'Y',\n 21: 'Z',\n 18: 'E',\n 15: 'P',\n 12: 'T',\n 9: 'G',\n 6: 'M',\n 3: 'k',\n '-3': 'm',\n '-6': '\\u00B5',\n '-9': 'n',\n '-12': 'p',\n '-15': 'f',\n '-18': 'a',\n '-21': 'z',\n '-24': 'y',\n };\n\n const q = Math.log(scalar) / Math.log(1e3);\n // so that for example '3 km' does not get converted to '3000 m'\n const subtrhnd = !Number.isInteger(q);\n\n const pow10 = 3 * Math.ceil(q - (subtrhnd ? 1 : 0));\n const prefix = pow10 === 0 ? '' : powerPrefix[pow10];\n\n return {\n scalar: scalar * 10 ** -pow10,\n prefix,\n multiplier: 10 ** -pow10,\n };\n}\n\n/**\n * Returns the argument as capitalized string.\n */\nexport function ucfirst(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function toHoursMins(seconds: number) {\n if (seconds < 60) return `${Math.round(seconds)} sec`;\n\n const min = Math.round(seconds / 60);\n\n const mins = min % 60;\n const hours = Math.floor(min / 60);\n\n return hours ? `${hours} hr ${mins} min` : `${mins} min`;\n}\n\nexport function toEnergy(wavelength: number) {\n return wavelength > 0\n ? (\n ((6.626_070_04e-34 * 2.997_924_58e8) /\n (wavelength * 1e-10) /\n 1.602_18e-19) *\n 1e-3\n ).toFixed(4)\n : 0;\n}\n\nexport function round(value: number, digits: number) {\n return Number.parseFloat(value.toFixed(digits));\n}\n","import { map } from 'lodash';\nimport {\n Badge,\n Button,\n ButtonGroup,\n Container,\n Row,\n Col,\n OverlayTrigger,\n Popover,\n} from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport { toHoursMins } from '../../utils/formatting';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport type { FrontendSchema } from '.';\n\nfunction FrontendOverlay(props: HardwareWidgetProps<FrontendSchema>) {\n const { hardware } = props;\n function reset() {\n void hardware.actions.call('reset');\n }\n\n type StateEnum = 'feitlk' | 'expitlk' | 'pssitlk';\n\n const itlks: { [name: string]: StateEnum } = {\n 'Front End': 'feitlk',\n Experimental: 'expitlk',\n PSS: 'pssitlk',\n };\n\n const ring = {\n Current: `${hardware.properties.current.toFixed(1)} mA`,\n Mode: hardware.properties.mode,\n Refill: toHoursMins(hardware.properties.refill),\n Message: <pre>{hardware.properties.message}</pre>,\n };\n\n function getPropertyState(key: StateEnum): string {\n if (!(key in hardware.properties)) {\n return 'UNKNOWN';\n }\n const state: any = hardware.properties[key];\n if (!state || typeof state !== 'string') {\n return 'UNKNOWN';\n }\n return state;\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <h6>Interlocks</h6>\n <Container>\n {map(itlks, (key, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>\n <Badge\n bg={getPropertyState(key) === 'ON' ? 'success' : 'danger'}\n >\n {getPropertyState(key)}\n </Badge>\n </Col>\n </Row>\n ))}\n </Container>\n\n <h6>Ring Status</h6>\n <Container>\n {map(ring, (prop, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>{prop}</Col>\n </Row>\n ))}\n </Container>\n\n <div className=\"d-grid gap-2\">\n <Button disabled={props.disabled} onClick={reset}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Shutter Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Frontend(props: HardwareWidgetProps<FrontendSchema>) {\n const { hardware, options = {} } = props;\n function onClick() {\n void hardware.actions.call(\n hardware.properties.frontend === 'FE open' ? 'close' : 'open'\n );\n }\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Frontend\"\n icon=\"fam-hardware-frontend\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={\n hardware.properties.state === 'OPEN' ||\n hardware.properties.state === 'RUNNING'\n ? 'success'\n : 'danger'\n }\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <ButtonGroup className=\"d-flex\">\n <Button\n variant={\n hardware.properties.frontend === 'FE open' ? 'danger' : 'success'\n }\n onClick={onClick}\n disabled={props.disabled}\n >\n {hardware.properties.frontend === 'FE open' ? 'Close' : 'Open'}\n </Button>\n <FrontendOverlay {...props} />\n </ButtonGroup>\n </div>\n </div>\n );\n}\n\nexport default Frontend;\n","import type { HardwareVariant } from '../utils/types';\nimport type { Hardware } from '../utils/types';\nimport Frontend from './Frontend';\n\nexport interface FrontendSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n automatic: boolean;\n frontend: string;\n // current intensity\n current: number;\n // number of seconds since the last refill\n refill: number;\n mode: string;\n message: string;\n feitlk: string;\n pssitlk: string;\n expitlk: string;\n };\n}\n\nconst Variants: HardwareVariant<FrontendSchema> = {\n default: Frontend,\n};\n\nexport default Variants;\n","import defaultjson from './FrontEnd.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import {\n Badge,\n Button,\n OverlayTrigger,\n Popover,\n InputGroup,\n Form,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { GaugeSchema } from '.';\n\nexport interface GaugeWidgetOptions extends HardwareWidgetOptions {\n /** Unit of pressure */\n unit?: string;\n /** Precision to show, default 3 */\n precision?: number;\n}\n\nfunction GaugeOverlay(\n props: HardwareWidgetProps<GaugeSchema, GaugeWidgetOptions>\n) {\n const { hardware } = props;\n const toggle = () => {\n void hardware.actions.call(\n hardware.properties.state === 'ON' ? 'off' : 'on'\n );\n };\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n\n <div className=\"d-grid gap-2\">\n <Button disabled={props.disabled} onClick={toggle}>\n {hardware.properties.state === 'ON' ? 'Off' : 'On'}\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button title=\"Gauge Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Gauge(props: HardwareWidgetProps<GaugeSchema, GaugeWidgetOptions>) {\n const { hardware, options = {} } = props;\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Gauge\"\n icon=\"fam-hardware-gauge\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge bg={hardware.properties.state === 'ON' ? 'success' : 'danger'}>\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <InputGroup>\n <Form.Control\n value={hardware.properties.pressure.toExponential(\n options.precision || 3\n )}\n disabled\n />\n {(hardware.properties.unit || options.unit) && (\n <InputGroup.Text>\n {hardware.properties.unit || options.unit}\n </InputGroup.Text>\n )}\n <GaugeOverlay {...props} />\n </InputGroup>\n </div>\n </div>\n );\n}\n\nexport default Gauge;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Gauge from './Gauge';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface GaugeSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n pressure: number;\n unit?: string; // FIXME: The server implementation is missing\n };\n}\n\nconst Variants: HardwareVariant<GaugeSchema> = {\n default: Gauge,\n};\n\nexport default Variants;\n","import defaultjson from './Gauge.json';\nimport defaultjson2 from './Gauge2.json';\n\nexport const Mocks = {\n default: defaultjson,\n default2: defaultjson2,\n};\n","import type {\n KeyboardEvent,\n ChangeEvent,\n MutableRefObject,\n ReactChild,\n} from 'react';\nimport { forwardRef, useEffect, useRef, useState } from 'react';\nimport { map } from 'lodash';\n\nimport { Form, Button, InputGroup } from 'react-bootstrap';\nimport classNames from 'classnames';\n\ninterface Props {\n step?: number | string;\n steps?: (number | string)[];\n disabled: boolean;\n stepOnly?: boolean;\n id?: string;\n unit?: string;\n overlay?: ReactChild | null;\n incIcon?: string;\n decIcon?: string;\n swapIncDec?: boolean;\n className?: string;\n type?: 'number' | 'text';\n precision?: number;\n horizontalArrows?: boolean;\n largeArrows?: boolean;\n onBlur: () => void;\n onChange: (e: ChangeEvent<HTMLInputElement>) => void;\n onStep: (params: { target: HTMLInputElement }) => void;\n onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;\n}\n\nconst NumericStep = forwardRef<HTMLInputElement, Props>((props, ref) => {\n const stepSizeRef = useRef<HTMLSelectElement>(null);\n const focusTimeoutRef = useRef<NodeJS.Timeout>();\n const [currentStep, setCurrentStep] = useState(props.step);\n const [retakeFocus, setRetakeFocus] = useState(false);\n const onStep = (up: boolean) => {\n // FIXME: Would be good to remove that cast\n const ref2 = ref as MutableRefObject<HTMLInputElement>;\n if (stepSizeRef.current === null) {\n return;\n }\n let val = Number.parseFloat(ref2.current.value);\n\n // Exponential step up / down\n if (stepSizeRef.current.value.startsWith('*')) {\n const multiplier = Number.parseFloat(\n stepSizeRef.current.value.replace('*', '')\n );\n val = up ? val * multiplier : val / multiplier;\n\n // Normal step up / down\n } else {\n const stepSize = Number.parseFloat(stepSizeRef.current.value);\n val += up ? stepSize : -stepSize;\n }\n ref2.current.value = `${val}`;\n\n if (props.onStep) {\n props.onStep({\n target: ref2.current,\n });\n }\n };\n\n const {\n onStep: onStepProp,\n step,\n overlay,\n incIcon,\n decIcon,\n swapIncDec,\n onKeyDown,\n onBlur,\n horizontalArrows,\n largeArrows,\n disabled,\n stepOnly,\n ...rest\n } = props;\n\n const onKeyDown2 = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n setRetakeFocus(true);\n onStep(true);\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n setRetakeFocus(true);\n onStep(false);\n } else if (onKeyDown) {\n onKeyDown(e);\n }\n };\n\n if (retakeFocus) {\n if (focusTimeoutRef.current) clearTimeout(focusTimeoutRef.current);\n focusTimeoutRef.current = setTimeout(() => {\n (ref as MutableRefObject<HTMLInputElement>)?.current?.focus();\n }, 100);\n }\n\n useEffect(() => {\n return () => {\n if (focusTimeoutRef.current) clearTimeout(focusTimeoutRef.current);\n };\n }, []);\n\n const onBlur2 = () => {\n if (focusTimeoutRef.current) {\n clearTimeout(focusTimeoutRef.current);\n }\n setRetakeFocus(false);\n if (onBlur) onBlur();\n };\n\n if (!props.step) {\n return (\n <Form.Control\n ref={ref}\n type=\"number\"\n step=\"any\"\n onKeyDown={onKeyDown2}\n onBlur={onBlur2}\n disabled={disabled}\n onClick={(e) => {\n // do not close parent dropdown\n e.stopPropagation();\n }}\n {...rest}\n />\n );\n }\n\n const steps = map(props.steps || [props.step], (s) => (\n <option value={s} key={s}>\n {s}\n </option>\n ));\n\n const hasIncDec = incIcon || decIcon;\n\n return (\n <div\n className={classNames('numeric-step', {\n 'numeric-step-large': largeArrows,\n 'numeric-step-horizontal': horizontalArrows,\n })}\n >\n <InputGroup>\n <Form.Control\n onKeyDown={onKeyDown2}\n onBlur={onBlur2}\n ref={ref}\n type=\"number\"\n step=\"any\"\n disabled={disabled || stepOnly}\n {...rest}\n />\n <>\n {overlay}\n {!overlay && (\n <InputGroup.Text\n className={`d-flex flex-column ${hasIncDec ? 'inc-dec' : ''}`}\n >\n <Form.Control\n ref={stepSizeRef}\n as=\"select\"\n className=\"step-size\"\n defaultValue={currentStep}\n disabled={disabled}\n onChange={(e) =>\n setCurrentStep(Number.parseFloat(e.target.value))\n }\n >\n {steps}\n </Form.Control>\n {props.unit && <div>{props.unit}</div>}\n {!incIcon && !decIcon && (\n <>\n <Button\n className=\"step step-up\"\n disabled={props.disabled}\n onClick={(e) => onStep(true)}\n />\n <Button\n className=\"step step-down\"\n disabled={props.disabled}\n onClick={(e) => onStep(false)}\n />\n </>\n )}\n </InputGroup.Text>\n )}\n {decIcon && swapIncDec && (\n <Button disabled={props.disabled} onClick={(e) => onStep(false)}>\n <i className={`fa fa-fw fa-${decIcon}`} />\n </Button>\n )}\n {incIcon && (\n <Button disabled={props.disabled} onClick={(e) => onStep(true)}>\n <i className={`fa fa-fw fa-${incIcon}`} />\n </Button>\n )}\n {decIcon && !swapIncDec && (\n <Button disabled={props.disabled} onClick={(e) => onStep(false)}>\n <i className={`fa fa-fw fa-${decIcon}`} />\n </Button>\n )}\n </>\n </InputGroup>\n </div>\n );\n});\n\nexport default NumericStep;\n","import { useRef, useState, useEffect } from 'react';\nimport type { KeyboardEvent, ChangeEvent } from 'react';\nimport classNames from 'classnames';\nimport { Button } from 'react-bootstrap';\nimport NumericStep from './NumericStep';\n\n/**\n * NumericStep handled hardware properties.\n *\n * Input related to hardware have specificities because the hardware state can\n * change during the user interaction.\n */\nexport default function HardwareNumericStep(props: {\n hardwareValue: number | null;\n hardwareIsDisabled: boolean;\n hardwareIsMoving: boolean;\n hardwareIsReady: boolean;\n onMoveRequested: (value: number) => Promise<void> | null;\n onAbortRequested: () => void;\n /** Default step size to use for up / down arrows */\n step?: number | string;\n /** Array of selectable step sizes */\n steps?: (number | string)[];\n /** Number of decimals to show */\n precision?: number;\n /** Whether this widget is read only */\n readOnly?: boolean;\n /** Whether this widget can only be changed using steps */\n stepOnly?: boolean;\n /** Specify a fontawesome to inc the value */\n incIcon?: string;\n /** Specify a fontawesome to dec the value */\n decIcon?: string;\n /** If true inc and dec icon are swapped */\n swapIncDec?: boolean;\n /** Show the step arrows horizontally instead of vertically */\n horizontalArrows?: boolean;\n /** Show large step arrows */\n largeArrows?: boolean;\n /** Identifier passed to the input element */\n id?: string;\n}) {\n const valueRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const [error, setError] = useState(false);\n useEffect(() => {\n if (valueRef.current) {\n if (props.hardwareValue === null) {\n valueRef.current.value = '';\n } else if (props.precision !== undefined) {\n valueRef.current.value = props.hardwareValue.toFixed(props.precision);\n } else {\n valueRef.current.value = props.hardwareValue.toString();\n }\n setEdited(false);\n }\n }, [props.hardwareValue]);\n\n function updateRef(value: any) {\n let newValue = value;\n if (props.precision !== undefined) {\n newValue = Number.parseFloat(newValue).toFixed(props.precision);\n }\n if (valueRef?.current) {\n valueRef.current.value = newValue;\n }\n }\n\n function onBlur() {\n if (edited) {\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setEdited(false);\n }, 3000);\n }\n }\n\n function onChange(e: ChangeEvent<HTMLInputElement>) {\n if (props.hardwareValue === null) {\n return;\n }\n setEdited(!(e.target.value === props.hardwareValue.toString()));\n }\n\n function onStep(e: any) {\n setEdited(false);\n const promise = props.onMoveRequested(e.target.value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n }\n\n function onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n switch (e.key) {\n case 'Enter':\n {\n setEdited(false);\n // @ts-expect-error\n const value: number = Number.parseFloat(e.target.value);\n const promise = props.onMoveRequested(value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n }\n e.preventDefault();\n e.stopPropagation();\n break;\n case 'Esc': // IE/Edge specific value\n case 'Escape':\n if (edited) {\n setError(false);\n setEdited(false);\n updateRef(props.hardwareValue);\n }\n // @ts-expect-error\n e.target.blur();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n\n return (\n <NumericStep\n id={props.id}\n className={classNames({\n 'form-control-edited': edited,\n 'form-control-error': error,\n 'hw-moving': props.hardwareIsMoving,\n })}\n type={props.readOnly ? 'text' : 'number'}\n ref={valueRef}\n precision={props.precision}\n onChange={onChange}\n onBlur={onBlur}\n onStep={onStep}\n onKeyDown={onKeyDown}\n disabled={\n props.hardwareIsDisabled || props.readOnly || !props.hardwareIsReady\n }\n stepOnly={props.stepOnly}\n step={props.step}\n steps={props.steps}\n incIcon={props.incIcon}\n decIcon={props.decIcon}\n swapIncDec={props.swapIncDec}\n horizontalArrows={props.horizontalArrows}\n largeArrows={props.largeArrows}\n overlay={\n props.hardwareIsMoving && !props.hardwareIsDisabled ? (\n <Button variant=\"danger\" onClick={props.onAbortRequested}>\n <i className=\"fa fa-times\" />\n </Button>\n ) : null\n }\n />\n );\n}\n","import _debounce from 'lodash/debounce';\nimport { Button, InputGroup } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport HardwareNumericStep from '../../components/HardwareNumericStep';\nimport { HardwareState } from '../utils/State';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { LaserSchema } from '.';\n\nexport interface LaserWidgetOptions extends HardwareWidgetOptions {\n /** Default step size to use for up / down arrows */\n step?: number;\n /** Array of selectable step sizes */\n steps?: number[];\n}\n\nexport default function Laser(\n props: HardwareWidgetProps<LaserSchema, LaserWidgetOptions>\n) {\n const { hardware, options = {}, disabled } = props;\n\n function requestPowerChange(value: number) {\n return hardware.actions.setProperty('power', value);\n }\n\n function requestStateChange(state: boolean) {\n return hardware.actions.call(state ? 'on' : 'off');\n }\n\n const state = hardware.properties.state;\n\n const widgetIcon = (\n <TypeIcon name=\"Laser\" icon=\"fam-hardware-laser\" online={hardware.online} />\n );\n\n const widgetState = (\n <HardwareState\n state={state}\n minWidth={6}\n variant={state === 'ON' ? 'success' : 'warning'}\n />\n );\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={\n <InputGroup>\n <HardwareNumericStep\n id={hardware.id}\n hardwareValue={hardware.properties.power}\n hardwareIsDisabled={false}\n hardwareIsReady\n hardwareIsMoving={state === 'MOVING'}\n onMoveRequested={requestPowerChange}\n onAbortRequested={() => null}\n precision={1}\n readOnly={false}\n step={options.step}\n steps={options.steps}\n incIcon={undefined}\n decIcon={undefined}\n swapIncDec={undefined}\n />\n <Button\n size=\"sm\"\n style={{\n fontSize: '0.6rem',\n padding: '0.05rem 0.6rem',\n marginTop: '0.1rem',\n }}\n onClick={() => {\n void requestStateChange(hardware.properties.state !== 'ON');\n }}\n >\n <i\n className={\n hardware.properties.state === 'ON'\n ? 'fa fa-toggle-on'\n : 'fa fa-toggle-off'\n }\n />\n </Button>\n </InputGroup>\n }\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Laser from './Laser';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface LaserSchema extends Hardware {\n properties: {\n state: string;\n power: number;\n };\n}\n\nconst Variants: HardwareVariant<LaserSchema> = {\n default: Laser,\n};\n\nexport default Variants;\n","import defaultjson from './Laser.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import {\n Button,\n InputGroup,\n OverlayTrigger,\n Popover,\n Container,\n Row,\n Col,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport HardwareNumericStep from '../../components/HardwareNumericStep';\nimport { HardwareState } from '../utils/State';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { LaserHeatingSchema } from '.';\nimport { useState } from 'react';\n\ninterface LaserHeatingOverlayProps {\n hardware: EditableHardware<LaserHeatingSchema>;\n disabled: boolean;\n}\n\nfunction LaserHeatingOverlay(props: LaserHeatingOverlayProps) {\n const { hardware } = props;\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"laserheating_overlay\">\n <Popover.Header>{hardware.name} details</Popover.Header>\n <Popover.Body>\n <Container>\n <Row>\n <Col>Background Mode</Col>\n <Col>{hardware.properties.background_mode}</Col>\n </Row>\n <Row>\n <Col>Calibration</Col>\n <Col>{hardware.properties.current_calibration}</Col>\n </Row>\n <Row>\n <Col>Fit Wavelength</Col>\n <Col>\n {hardware.properties.fit_wavelength?.join(' - ')}{' '}\n <span>nm</span>\n </Col>\n </Row>\n </Container>\n </Popover.Body>\n </Popover>\n }\n >\n <Button>\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport interface LaserHeatingWidgetOptions extends HardwareWidgetOptions {\n /** Default step size to use for up / down arrows */\n exposureStep?: number;\n /** Array of selectable step sizes */\n exposureSteps?: number[];\n}\n\nexport default function LaserHeating(\n props: HardwareWidgetProps<LaserHeatingSchema, LaserHeatingWidgetOptions>\n) {\n const { hardware, options = {}, disabled } = props;\n const [pending, setPending] = useState<boolean>(false);\n function requestExposureChange(value: number) {\n if (value <= 0) {\n return Promise.reject(new Error('exposure_time must be > 0'));\n }\n return hardware.actions.setProperty('exposure_time', value);\n }\n\n function requestMeasure() {\n setPending(true);\n const promise = hardware.actions.call('measure');\n\n if (promise !== undefined) {\n console.log('pending');\n promise\n .then(() => {\n setPending(false);\n })\n .catch((error) => {\n setPending(false);\n });\n }\n\n return promise;\n }\n\n const state = hardware.properties.state;\n\n const widgetIcon = (\n <TypeIcon name=\"Laser Heating\" icon=\"fa-fire\" online={hardware.online} />\n );\n\n const widgetState = (\n <HardwareState\n state={state}\n minWidth={6}\n variant={state === 'READY' ? 'success' : 'warning'}\n />\n );\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={\n <InputGroup>\n <HardwareNumericStep\n id={hardware.id}\n hardwareValue={hardware.properties.exposure_time}\n hardwareIsReady\n hardwareIsDisabled={props.disabled}\n hardwareIsMoving={false}\n onMoveRequested={requestExposureChange}\n onAbortRequested={() => null}\n precision={1}\n readOnly={false}\n step={options.exposureStep}\n steps={options.exposureSteps}\n incIcon={undefined}\n decIcon={undefined}\n swapIncDec={undefined}\n />\n <InputGroup.Text>s</InputGroup.Text>\n <Button\n size=\"sm\"\n disabled={props.disabled || pending}\n onClick={() => {\n void requestMeasure();\n }}\n >\n {pending ? (\n <i className=\"fa fa-spinner fa-spin\" />\n ) : (\n <>\n <i className=\"fa fa-play me-1\" />\n Measure\n </>\n )}\n </Button>\n <LaserHeatingOverlay hardware={hardware} disabled={props.disabled} />\n </InputGroup>\n }\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport LaserHeating from './LaserHeating';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface LaserHeatingSchema extends Hardware {\n properties: {\n state: string;\n exposure_time: number;\n background_mode: 'ON' | 'OFF' | 'ALWAYS';\n fit_wavelength: number[];\n current_calibration: string;\n };\n}\n\nconst Variants: HardwareVariant<LaserHeatingSchema> = {\n default: LaserHeating,\n};\n\nexport default Variants;\n","import defaultjson from './LaserHeating.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useRef, useCallback } from 'react';\nimport _debounce from 'lodash/debounce';\nimport { Badge, Form, Button } from 'react-bootstrap';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { LightSchema } from '.';\n\nexport default function Light(props: HardwareWidgetProps<LightSchema>) {\n const sliderRef = useRef<HTMLInputElement>(null);\n const { hardware, options = {} } = props;\n\n function requestIntensityChange(value: number) {\n void hardware.actions.setProperty('intensity', value);\n }\n\n const debounceIntensityChange = useCallback(\n _debounce(requestIntensityChange, 100),\n []\n );\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon name=\"Light\" icon=\"fa-lightbulb-o\" online={hardware.online} />\n <div className=\"name\">{hardware.name}</div>\n <Badge bg={hardware.properties.state === 'ON' ? 'success' : 'danger'}>\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <Form.Control\n ref={sliderRef}\n disabled={props.disabled}\n type=\"range\"\n min=\"0\"\n max=\"100\"\n onChange={(e) =>\n debounceIntensityChange(Number.parseFloat(e.target.value))\n }\n defaultValue={hardware.properties.intensity}\n />\n <div>\n <Button\n disabled={hardware.properties.intensity === 0}\n size=\"sm\"\n style={{\n fontSize: '0.6rem',\n padding: '0.05rem 0.6rem',\n marginTop: '0.1rem',\n }}\n onClick={() => debounceIntensityChange(0)}\n >\n <i className=\"fa fa-power-off\" />\n </Button>\n <span className=\"float-end\">{hardware.properties.intensity} %</span>\n </div>\n </div>\n </div>\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Light from './Light';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface LightSchema extends Hardware {\n properties: {\n state: string;\n temperature: number;\n intensity: number;\n };\n}\n\nconst Variants: HardwareVariant<LightSchema> = {\n default: Light,\n};\n\nexport default Variants;\n","import defaultjson from './Light.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { LimaSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function LimaState(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { online, locked = null } = hardware;\n const state = hardware.properties.state ?? 'UNKNOWN';\n console.log(state);\n const finalState = online\n ? (state === 'ACQUIRING' ? state : locked !== null ? 'LOCKED' : state) ||\n 'UNKNOWN'\n : 'OFFLINE';\n\n const variants: { [state: string]: string } = {\n UNKNOWN: 'critical',\n ACQUIRING: 'warning',\n READY: 'success',\n OFFLINE: 'secondary',\n LOCKED: 'warning',\n };\n const variant = variants[finalState] ?? variants.UNKNOWN;\n return <HardwareState state={finalState} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<LimaSchema>) {\n const { hardware } = props;\n return <LimaState hardware={hardware} />;\n}\n","import { Stack } from 'react-bootstrap';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { LimaState } from './LimaState';\nimport type { LimaSchema } from '.';\n\nfunction Content(props: HardwareWidgetProps<LimaSchema>) {\n const { hardware, options = {} } = props;\n\n return (\n <Stack className=\"bg-light rounded-2 ps-2 p-1\" direction=\"horizontal\">\n <div>{hardware.name}</div>\n </Stack>\n );\n}\n\nexport default function LimaDefault(props: HardwareWidgetProps<LimaSchema>) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const headerMode = options.header || 'top';\n if (headerMode === 'none') {\n return <Content {...props} />;\n }\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={<Content {...props} />}\n headerMode={headerMode}\n />\n );\n}\n","import { Stack } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\n\nfunction Content(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n\n const [width, height] = hardware.properties.size ?? ['?', '?'];\n\n return (\n <Stack className=\"bg-light rounded-2 ps-2 p-1\" direction=\"horizontal\">\n <div>\n {width} × {height}\n </div>\n <div className=\"ms-auto\">\n <small>\n <small>px</small>\n </small>\n </div>\n </Stack>\n );\n}\n\nexport default function TomoDetectorSize(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const headerMode = options.header ?? 'top';\n if (headerMode === 'none') {\n return <Content {...props} />;\n }\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={<Content {...props} />}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Form, Badge } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\n\nfunction LimaTransformationFlags(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { properties } = hardware;\n\n const [flipH, flipV] = properties.flip;\n const rotation = properties.rotation ?? 0;\n const noTransformation = !flipH && !flipV && rotation === 0;\n return (\n <div>\n <InputGroup.Text>\n {flipH && (\n <Badge style={{ fontSize: '130%' }} className=\"me-1\">\n Flip\n <i className=\"fa fa-fw fa-left-right\" />\n </Badge>\n )}\n {flipV && (\n <Badge style={{ fontSize: '130%' }} className=\"me-1\">\n Flip\n <i className=\"fa fa-fw fa-up-down\" />\n </Badge>\n )}\n {rotation !== 0 && (\n <Badge style={{ fontSize: '130%' }} className=\"me-1\">\n Rot {rotation.toFixed(0)}\n <i className=\"fa fa-fw fa-arrow-rotate-right\" />\n </Badge>\n )}\n {noTransformation && (\n <Badge\n bg=\"secondary\"\n style={{ fontSize: '130%' }}\n title=\"No transformation\"\n >\n None\n </Badge>\n )}\n </InputGroup.Text>\n </div>\n );\n}\n\nexport default function TomoDetectorSize(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <LimaTransformationFlags hardware={hardware} />\n </>\n );\n\n const headerMode = options.header ?? 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Form, Button } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\n\nfunction LimaBinningControl(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, disabled } = props;\n const { properties } = hardware;\n const [bh, bv] = properties.binning;\n const b = bh === bv ? bh : 0;\n\n function setBinning(value: number) {\n void hardware.actions.setProperty('binning', [value, value]);\n }\n\n return (\n <InputGroup>\n <InputGroup.Text title=\"Binning applied to the detector\">\n <i className=\"fa fa-fw fa-ruler-combined fa-2x\" />\n </InputGroup.Text>\n <Form.Control value={`${properties.binning[0]}`} readOnly />\n <Form.Control value={`${properties.binning[1]}`} readOnly />\n <Button\n variant={b === 1 ? 'primary' : 'secondary'}\n onClick={() => {\n setBinning(1);\n }}\n disabled={disabled}\n >\n 1\n </Button>\n <Button\n variant={b === 2 ? 'primary' : 'secondary'}\n onClick={() => {\n setBinning(2);\n }}\n disabled={disabled}\n >\n 2\n </Button>\n <Button\n variant={b === 3 ? 'primary' : 'secondary'}\n onClick={() => {\n setBinning(3);\n }}\n disabled={disabled}\n >\n 3\n </Button>\n <Button\n variant={b === 4 ? 'primary' : 'secondary'}\n onClick={() => {\n setBinning(4);\n }}\n disabled={disabled}\n >\n 4\n </Button>\n </InputGroup>\n );\n}\n\nexport default function LimaBinning(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <LimaBinningControl {...props} />\n </>\n );\n\n const headerMode = options.header ?? 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Form } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\n\nfunction LimaRoiImageControl(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { properties } = hardware;\n return (\n <InputGroup>\n <InputGroup.Text title=\"Rotation applied to the detector\">\n <i className=\"fa fa-fw fa-crop-simple fa-2x\" />\n </InputGroup.Text>\n <Form.Control value={`${properties.roi[0]}`} readOnly />\n <Form.Control value={`${properties.roi[1]}`} readOnly />\n <Form.Control value={`${properties.roi[2]}`} readOnly />\n <Form.Control value={`${properties.roi[3]}`} readOnly />\n <InputGroup.Text>px</InputGroup.Text>\n </InputGroup>\n );\n}\n\nexport default function TomoDetectorSize(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <LimaRoiImageControl hardware={hardware} />\n </>\n );\n\n const headerMode = options.header ?? 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Form } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\n\nfunction LimaMaxSizeControl(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { properties } = hardware;\n const struct = properties.static;\n const [width, height] = struct?.image_max_dim ?? ['?', '?'];\n return (\n <InputGroup>\n <InputGroup.Text title=\"Max size of the detector\">\n Max size\n </InputGroup.Text>\n <Form.Control value={`${width} × ${height}`} readOnly />\n <InputGroup.Text>px</InputGroup.Text>\n </InputGroup>\n );\n}\n\nfunction LimaLimaVersionControl(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { properties } = hardware;\n const struct = properties.static;\n return (\n <InputGroup>\n <InputGroup.Text title=\"Version of the Lima server\">\n Lima version\n </InputGroup.Text>\n <Form.Control value={`${struct?.lima_version}`} readOnly />\n </InputGroup>\n );\n}\n\nfunction LimaModelControl(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { properties } = hardware;\n const struct = properties.static;\n return (\n <InputGroup>\n <InputGroup.Text title=\"Model of the detector\">\n Type/model\n </InputGroup.Text>\n <Form.Control value={`${struct?.camera_type}`} readOnly />\n <Form.Control value={`${struct?.camera_model}`} readOnly />\n </InputGroup>\n );\n}\n\nexport default function TomoDetectorSize(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <LimaModelControl hardware={hardware} />\n <LimaMaxSizeControl hardware={hardware} />\n <LimaLimaVersionControl hardware={hardware} />\n </>\n );\n\n const headerMode = options.header ?? 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareChangeActions } from '../hardware/utils/types';\n\ninterface RuntimeHooks {\n useHardware?: (id: string | null) => Hardware | null;\n useHardwareChangeActions?: (name: string | null) => HardwareChangeActions;\n}\n\nconst runtimeHooks: RuntimeHooks = {};\n\nexport function registerRuntimeHook(hooks: Partial<RuntimeHooks>) {\n if (hooks.useHardware) {\n if (runtimeHooks.useHardware) {\n console.warn('useHardware hook was already registered');\n }\n runtimeHooks.useHardware = hooks.useHardware;\n }\n if (hooks.useHardwareChangeActions) {\n if (runtimeHooks.useHardwareChangeActions) {\n console.warn('useHardwareChangeActions hook was already registered');\n }\n runtimeHooks.useHardwareChangeActions = hooks.useHardwareChangeActions;\n }\n}\n\n/**\n * Return a hardware from it's hardware name.\n *\n * Return `null` if the name refers to nothing.\n *\n * @param name: An hardware identifier, or null\n */\nexport function useHardware(id: string | null): Hardware | null {\n if (!runtimeHooks.useHardware) {\n throw new Error('No `useHardware` hook registered');\n }\n return runtimeHooks.useHardware(id);\n}\n\n/**\n * Expose the generic actions provided by a specific hardware.\n *\n * If null is passed, dummy actions are exposed.\n *\n * @param name: Am hardware identifier, or null\n */\nexport function useHardwareChangeActions(\n name: string | null\n): HardwareChangeActions {\n if (!runtimeHooks.useHardwareChangeActions) {\n throw new Error('No `useHardwareChangeActions` hook registered');\n }\n return runtimeHooks.useHardwareChangeActions(name);\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport LimaDefault from './LimaDefault';\nimport LimaSize from './LimaSize';\nimport LimaTransformation from './LimaTransformation';\nimport LimaBinning from './LimaBinning';\nimport LimaImageRoi from './LimaImageRoi';\nimport LimaDescription from './LimaDescription';\nimport LimaState from './LimaState';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface LimaSchema extends Hardware {\n properties: {\n state:\n | 'READY'\n | 'ACQUIRING'\n | 'CONFIGURATION'\n | 'FAULT'\n | 'UNKNOWN'\n | 'OFFLINE';\n\n static: {\n /* The lima core library version number*/\n lima_version: string;\n\n /* Name of the camera plugin: Maxipix, Pilatus, Frelon, Pco, Basler, Simulator...*/\n lima_type: string;\n\n /* Type of the camera as exposed by the camera plugin.*/\n camera_type: string;\n\n /* Model of the camera as exposed by the camera plugin: 5x1- TPX1*/\n camera_model: string;\n\n /* The camera pixel size in x and y dimension, in micron\n\n Despit the Lima Tango API, this value is returned in micron instead of meter.\n */\n camera_pixelsize: [number, number];\n\n /* Maximum image dimension, width and height in pixel*/\n image_max_dim: [number, number];\n } | null;\n\n /**\n * Pixel size of the detector (without binning).\n *\n * It's a read-only property.\n */\n pixel_size: [number, number];\n\n /**\n * Max exposition time of a single sub frame in accumulation.\n *\n * It is used (together with the exposure time) to determine the\n * nb of sub frames and the expo time of a single sub frame.\n * See `guessSubframes`.\n */\n acc_max_expo_time: number | null;\n\n /**\n * Flip applied to the resulting image\n */\n flip: [boolean, boolean];\n\n /**\n * Rotation applied to the resulting image.\n *\n * One of 0, 90, 180, 270\n */\n rotation: 0 | 90 | 180 | 270;\n\n /**\n * Binning applied to the resulting image\n */\n binning: [number, number];\n\n /**\n * Location and size of the ROI in the raw image.\n *\n * When binning=[1, 1] flip=[false, false], rotation=0\n */\n raw_roi: [number, number, number, number];\n\n /**\n * Location of the ROI in the transformed image.\n */\n roi: [number, number, number, number];\n\n /**\n * Final size of the detector. Including the crop of the ROI.\n */\n size: [number, number];\n };\n}\n\nexport function isLimaHardware(entity: Hardware): entity is LimaSchema {\n return entity.type === 'lima';\n}\n\nexport function useLimaHardware(name: string | null): LimaSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isLimaHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n\n/**\n * Compute the nb sub frames which will be used for a specific exposure time\n */\nexport function limaGuessSubframes(\n exposureTime: number,\n accMaxExpoTime: number\n): [number, number] {\n const nbSubFrames = Math.ceil(exposureTime / accMaxExpoTime);\n const accExpoTime = exposureTime / nbSubFrames;\n return [nbSubFrames, accExpoTime];\n}\n\nconst Variants: HardwareVariant<LimaSchema> = {\n default: LimaDefault,\n size: LimaSize,\n transformation: LimaTransformation,\n binning: LimaBinning,\n imageroi: LimaImageRoi,\n description: LimaDescription,\n // Override base state\n state: LimaState,\n};\n\nexport default Variants;\n","import defaultjson from './Lima.json';\nimport flipjson from './LimaFlip.json';\nimport rotjson from './LimaRot.json';\n\nexport const Mocks = {\n default: defaultjson,\n flip: flipjson,\n rot: rotjson,\n};\n","import { useState } from 'react';\nimport type { LimaSchema } from '..';\nimport { Simulator } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function LimaSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const imageMaxDim: [number, number] = [1920, 1920];\n const cameraPixelSize: [number, number] = [1.6e-5, 1.6e-5];\n const [properties, setProperties] = useState<LimaSchema['properties']>({\n static: {\n lima_version: '1.9.23',\n lima_type: 'Frelon',\n camera_type: 'Frelon',\n camera_model: 'SPB8x2 CcdFT2k-F16',\n camera_pixelsize: cameraPixelSize,\n image_max_dim: imageMaxDim,\n },\n acc_max_expo_time: 1,\n binning: [1, 1],\n flip: [false, false],\n pixel_size: cameraPixelSize,\n raw_roi: [0, 0, ...imageMaxDim],\n roi: [0, 0, ...imageMaxDim],\n rotation: 0,\n size: imageMaxDim,\n state: 'READY',\n });\n\n async function call(name: string, value?: any): Promise<void> {\n console.log('LimaSimulator: Unsupported call', name, value);\n }\n\n function changeBinning(\n props: LimaSchema['properties'],\n binning: [number, number]\n ): LimaSchema['properties'] {\n const pixelSize: [number, number] = [\n Math.round(cameraPixelSize[0] * binning[0]),\n Math.round(cameraPixelSize[1] * binning[1]),\n ];\n const size: [number, number] = [\n Math.round(imageMaxDim[0] / binning[0]),\n Math.round(imageMaxDim[1] / binning[1]),\n ];\n return {\n ...props,\n binning,\n pixel_size: pixelSize,\n roi: [0, 0, ...size],\n size,\n };\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n if (name === 'binning') {\n setProperties((p) => {\n return changeBinning(p, value);\n });\n return;\n }\n console.log('LimaSimulator: Unsupported setProperty', name, value);\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"lima\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import 'react-bootstrap-typeahead/css/Typeahead.css';\nimport 'react-bootstrap-typeahead/css/Typeahead.bs5.css';\nimport type { TypeaheadInputProps } from 'react-bootstrap-typeahead/types/types';\n\nimport { useRef } from 'react';\nimport {\n Button,\n Form,\n InputGroup,\n OverlayTrigger,\n Tooltip,\n} from 'react-bootstrap';\nimport {\n Highlighter,\n Hint,\n Menu,\n MenuItem,\n Typeahead,\n} from 'react-bootstrap-typeahead';\nimport type { MeasurementGroupSchema } from '.';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { HardwareWidgetProps } from '../utils/types';\n\ninterface CustomTypeaheadInputProps extends TypeaheadInputProps {\n [key: string]: any;\n}\n\nfunction RenderInput(inputProps: CustomTypeaheadInputProps, state: any) {\n const {\n inputRef,\n referenceElementRef,\n onAddSelection,\n onRemoveSelection,\n ...otherInputProps\n } = inputProps;\n const fieldRef = useRef<HTMLInputElement>();\n\n const clearInput = () => {\n setTimeout(() => {\n // @ts-expect-error\n const setValue = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n 'value'\n ).set;\n if (setValue) {\n setValue.call(fieldRef.current, '');\n }\n if (fieldRef.current) {\n fieldRef.current.dispatchEvent(new Event('input', { bubbles: true }));\n }\n }, 500);\n };\n\n const addSelection = () => {\n if (onAddSelection) {\n onAddSelection(state.results).then(() => {\n clearInput();\n });\n }\n };\n\n const removeSelection = () => {\n const selected = state.text\n ? [...state.selected].filter((option) => {\n return option.toLowerCase().indexOf(state.text.toLowerCase()) !== -1;\n })\n : [...state.selected];\n\n if (onRemoveSelection) {\n onRemoveSelection(selected).then(() => {\n clearInput();\n });\n }\n };\n\n return (\n <InputGroup>\n <Hint>\n {\n // @ts-expect-error\n <Form.Control\n style={{ width: '100%' }}\n {...otherInputProps}\n ref={(node: HTMLInputElement) => {\n fieldRef.current = node;\n inputRef(node);\n referenceElementRef(node);\n }}\n placeholder={`${state.selected.length} enabled`}\n />\n }\n </Hint>\n <Button\n disabled={inputProps.disabled || state.results.length === 0}\n onClick={addSelection}\n >\n <i className=\"fa fa-plus\" />\n </Button>\n <Button disabled={inputProps.disabled} onClick={removeSelection}>\n <i className=\"fa fa-minus\" />\n </Button>\n </InputGroup>\n );\n}\n\nfunction withExtraProps(extraProps: { [prop: string]: any }) {\n return function (wrappedComponent: any) {\n function WithExtraProps(props: any, props2: any, props3: any) {\n return wrappedComponent(props, props2, props3, extraProps);\n }\n\n WithExtraProps.displayName = `WithExtraProps(${\n wrappedComponent.displayName || wrappedComponent.name || 'Component'\n })`;\n\n return WithExtraProps;\n };\n}\n\nfunction RenderMenu(results: any, menuProps: any, state: any, extraProps: any) {\n const selected = [...state.selected] // eslint-disable-line @typescript-eslint/require-array-sort-compare\n .filter((option) => {\n return option.toLowerCase().indexOf(state.text.toLowerCase()) !== -1;\n })\n .sort();\n\n const selectedItems = selected.map((opt) => (\n /* eslint-disable-next-line jsx-a11y/anchor-is-valid */\n <a\n href=\"#\"\n className=\"dropdown-item\"\n key={opt}\n onClick={() => state.onRemove(opt)}\n >\n <Highlighter search={state.text}>{opt}</Highlighter>\n </a>\n ));\n const items = [...state.results].sort(); // eslint-disable-line @typescript-eslint/require-array-sort-compare\n const availableItems = items.map((opt, i) => (\n <MenuItem key={opt} option={opt} position={i}>\n <Highlighter search={state.text}>{opt}</Highlighter>\n </MenuItem>\n ));\n\n return (\n <Menu {...{ ...menuProps, style: { ...menuProps.style, width: 350 } }}>\n {extraProps.pending && <Menu.Header>Loading...</Menu.Header>}\n {!extraProps.pending && (\n <>\n <Menu.Header>Enabled</Menu.Header>\n {selectedItems}\n {selectedItems.length === 0 && (\n <span className=\"dropdown-item disabled\">No items enabled</span>\n )}\n\n <Menu.Header>Available</Menu.Header>\n {availableItems}\n {availableItems.length === 0 && (\n <span className=\"dropdown-item disabled\">No items available</span>\n )}\n </>\n )}\n </Menu>\n );\n}\n\nexport default function MeasurementGroup(\n props: HardwareWidgetProps<MeasurementGroupSchema>\n) {\n const { hardware } = props;\n const { disabled = false } = props;\n\n const enabled = hardware.properties.available.filter(\n (x) => !hardware.properties.disabled.includes(x)\n );\n\n function setSelection(selected: any) {\n const added = selected.filter((x: string) => !enabled.includes(x));\n const removed = enabled.filter((x) => !selected.includes(x));\n\n if (added.length > 0) {\n added.forEach((counter: string) => {\n void hardware.actions.call('enable', counter);\n });\n }\n\n if (removed.length > 0) {\n removed.forEach((counter: string) => {\n void hardware.actions.call('disable', counter);\n });\n }\n }\n\n function onAddSelection(selection: any) {\n const promises: Promise<any>[] = [];\n selection.forEach((counter: string) => {\n const promise = hardware.actions.call('enable', counter);\n promises.push(promise);\n });\n return Promise.all(promises);\n }\n\n function onRemoveSelection(selection: any) {\n const promises: Promise<any>[] = [];\n selection.forEach((counter: string) => {\n const promise = hardware.actions.call('disable', counter);\n promises.push(promise);\n });\n\n return Promise.all(promises);\n }\n\n function setActive() {\n return hardware.actions.call('set_active');\n }\n\n const active = false;\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon name=\"Measurement Group\" icon=\"fa-list-ol\" online />\n <div className=\"name\">{hardware.name}</div>\n {!active && (\n <OverlayTrigger\n placement=\"top\"\n overlay={\n <Tooltip id=\"active\">Activate this measurement group</Tooltip>\n }\n >\n <Button\n size=\"sm\"\n disabled={disabled}\n onClick={() => void setActive()}\n className=\"float-right ml-1\"\n >\n <i className=\"fa fa-power-off\" />\n </Button>\n </OverlayTrigger>\n )}\n </div>\n <div className=\"hw-content\">\n <Typeahead\n disabled={disabled}\n id={`typeahead_mg_${hardware.name}`}\n multiple\n flip\n positionFixed\n renderInput={RenderInput}\n renderMenu={withExtraProps({\n name: hardware.id,\n })(RenderMenu)}\n onChange={setSelection}\n inputProps={{\n // @ts-expect-error\n onAddSelection,\n onRemoveSelection,\n }}\n selected={enabled}\n options={hardware.properties.available}\n selectHint={(shouldSelect, e) => {\n return e.key === 'Enter' || shouldSelect;\n }}\n />\n </div>\n </div>\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport MeasurementGroup from './MeasurementGroup';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface MeasurementGroupSchema extends Hardware {\n properties: {\n /** List of available counters */\n available: string[];\n\n /** List of disabled counters.\n *\n * It is a subset of the `available` list.\n */\n disabled: string[];\n };\n}\n\nconst Variants: HardwareVariant<MeasurementGroupSchema> = {\n default: MeasurementGroup,\n};\n\nexport default Variants;\n","import defaultjson from './MG.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\nimport type { MeasurementGroupSchema } from '..';\n\nexport default function MeasurementGroupSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [properties, setProperties] = useState<\n MeasurementGroupSchema['properties']\n >({\n available: [\n 'lima:image',\n 'diode1',\n 'diode2',\n 'machinfo:current',\n 'machinfo:srcurrent',\n ],\n disabled: ['machinfo:current'],\n });\n\n async function enable(counter: string) {\n setProperties((p) => {\n const { disabled } = p;\n return { ...p, disabled: disabled.filter((c) => c !== counter) };\n });\n }\n\n async function disable(counter: string) {\n setProperties((p) => {\n const { disabled } = p;\n return {\n ...p,\n disabled: disabled.includes(counter)\n ? disabled\n : [...disabled, counter],\n };\n });\n }\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'enable') {\n await enable(value as string);\n return;\n }\n if (name === 'disable') {\n await disable(value as string);\n return;\n }\n if (name === 'set_active') {\n return;\n }\n console.log('MeasurementGroupSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log(\n 'MeasurementGroupSimulator: Unsupported setProperty',\n name,\n value\n );\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"measurementgroup\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { useMemo } from 'react';\nimport type { MotorSchema } from '.';\nimport { HardwareMultiState } from '../utils/State';\nimport type { HardwareWidgetProps } from '../utils/types';\n\ninterface State {\n description?: string;\n variant: string;\n priority: number;\n}\n\n/** Boiler plate */\nconst UNKNOWN: State = {\n description: 'Unknown state is exposed',\n variant: 'fatal',\n priority: 100,\n};\n\n/**\n * Available default state.\n *\n * The list is ordered by priority: the first will override the second.\n *\n * More 'dynamic' states can also be exposed.\n */\nconst AVAILABLE_STATES: Record<string, State> = {\n // Reserved by Daiquiri\n OFFLINE: {\n description: 'Axis is offline',\n variant: 'secondary',\n priority: 0,\n },\n // Real hardware state\n MOVING: {\n description: 'Axis is moving',\n variant: 'warning',\n priority: 10,\n },\n FAULT: {\n description: 'Axis is in fault',\n variant: 'danger',\n priority: 20,\n },\n // Reserved by Daiquiri\n LOCKED: {\n description: 'Axis is locked',\n variant: 'warning',\n priority: 25,\n },\n OFF: {\n description: 'Power is off',\n variant: 'secondary',\n priority: 30,\n },\n DISABLED: {\n description: 'Axis is disabled',\n variant: 'warning',\n priority: 40,\n },\n LOWLIMIT: {\n description: 'Low limit is reached',\n variant: 'warning',\n priority: 50,\n },\n HIGHLIMIT: {\n description: 'High limit is reached',\n variant: 'warning',\n priority: 51,\n },\n HOME: {\n description: 'Home signal active',\n variant: 'info',\n priority: 52,\n },\n READY: {\n description: 'Ready to handle request',\n variant: 'success',\n priority: 60,\n },\n // Reserved by Daiquiri\n NOT_READY: {\n description: 'Not ready',\n variant: 'warning',\n priority: 100,\n },\n // Reserved by Daiquiri\n UNKNOWN,\n};\n\n/**\n * A motor have a set of flags as state.\n *\n * For example an axis can expose `READY` and `MOVING` at the same time.\n * It means the controller is ready to change it's target, even\n * during a motion.\n *\n * For now we only display a \"main\" state.\n */\nexport function MotorState(props: { hardware: MotorSchema }) {\n const { hardware } = props;\n const { locked = null } = hardware;\n const { state = ['UNKNOWN'] } = hardware.properties;\n\n const [states, descriptions] = useMemo(() => {\n if (!hardware.online) {\n return [['OFFLINE'], undefined];\n }\n function priority(n1: string, n2: string) {\n const s1: State = AVAILABLE_STATES[n1] ?? UNKNOWN;\n const s2: State = AVAILABLE_STATES[n2] ?? UNKNOWN;\n return s1.priority - s2.priority;\n }\n const orderedStates = [\n ...state,\n ...(locked !== null ? ['LOCKED'] : []),\n ...(state.length === 0 ? ['NOT_READY'] : []),\n ];\n orderedStates.sort(priority);\n\n function splitCustomStates(s: string): [string, string | undefined] {\n const elems = s.split(':', 2);\n if (elems.length === 1) {\n return [s, undefined];\n }\n // @ts-expect-error\n return elems;\n }\n\n const descriptions: Record<string, string> = {};\n const states = orderedStates.map((s) => {\n if (s.startsWith('_')) {\n const desc = splitCustomStates(s);\n if (desc[1] !== undefined) {\n descriptions[desc[0]] = desc[1];\n }\n return desc[0];\n }\n if (s === 'LOCKED') {\n descriptions[s] = `Locked by ${locked}`;\n } else {\n descriptions[s] = AVAILABLE_STATES[s].description ?? '';\n }\n return s;\n });\n\n return [states, descriptions];\n }, [state, hardware.online, locked]);\n\n return (\n <HardwareMultiState\n states={states}\n descriptions={descriptions}\n minWidth={6}\n variants={Object.fromEntries(\n Object.entries(AVAILABLE_STATES).map(([n, s]) => [n, s.variant])\n )}\n />\n );\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<MotorSchema>) {\n const { hardware } = props;\n return <MotorState hardware={hardware} />;\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent, ChangeEvent } from 'react';\nimport { Form } from 'react-bootstrap';\nimport classNames from 'classnames';\n\n/**\n * Input number synchronized with a hardware.\n *\n * Input related to hardware have specificities because the hardware state can\n * change during the user interaction.\n *\n * TODO: Maybe normalize `precision` and `step` together\n */\nexport default function HardwareInputNumber(props: {\n hardwareValue: number;\n hardwareIsDisabled: boolean;\n hardwareIsMoving?: boolean;\n hardwareIsReady?: boolean;\n onMoveRequested: (value: number) => Promise<void> | null;\n onAbortRequested?: () => void;\n readOnly?: boolean;\n precision?: number;\n step?: number;\n}) {\n const valueRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const [error, setError] = useState(false);\n\n function normalizeNumber(value: string): string {\n if (props.precision !== undefined) {\n return Number.parseFloat(value).toFixed(props.precision);\n }\n return value;\n }\n\n useEffect(() => {\n if (valueRef.current) {\n valueRef.current.value = normalizeNumber(props.hardwareValue?.toString());\n setEdited(false);\n }\n }, [props.hardwareValue, props.precision]);\n\n function updateRef(value: any) {\n const newValue = normalizeNumber(value);\n if (valueRef?.current) {\n valueRef.current.value = newValue;\n }\n }\n\n function onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n switch (e.key) {\n case 'Enter': {\n setEdited(false);\n // @ts-expect-error\n const value: number = Number.parseFloat(e.target.value);\n const promise = props.onMoveRequested(value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n case 'Esc': // IE/Edge specific value\n case 'Escape':\n if (edited) {\n setError(false);\n setEdited(false);\n updateRef(props.hardwareValue);\n }\n // @ts-expect-error\n e.target.blur();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n\n function onChange(e: ChangeEvent<HTMLInputElement>) {\n setEdited(!(e.target.value === props.hardwareValue.toString()));\n }\n\n return (\n <Form.Control\n className={classNames({\n 'form-control-edited': edited,\n 'form-control-error': error,\n 'hw-moving': props.hardwareIsMoving,\n })}\n type=\"number\"\n ref={valueRef}\n onChange={onChange}\n onKeyDown={onKeyDown}\n disabled={\n props.readOnly || props.hardwareIsMoving || props.hardwareIsDisabled\n }\n step={props.step}\n onClick={(e) => {\n // do not close parent dropdown\n e.stopPropagation();\n }}\n />\n );\n}\n","import {\n Button,\n Form,\n OverlayTrigger,\n InputGroup,\n Popover,\n} from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { MotorState } from './MotorState';\nimport HardwareNumericStep from '../../components/HardwareNumericStep';\nimport HardwareInputNumber from '../../components/HardwareInputNumber';\nimport { useMotorStates } from '.';\nimport type { MotorSchema, MotorStates } from '.';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport type { MotorDefaultOptions } from './options';\n\ninterface MotorOverlayProps {\n hardware: EditableHardware<MotorSchema>;\n disabled: boolean;\n readOnly?: boolean;\n states: MotorStates;\n}\n\nfunction MotorOverlay(props: MotorOverlayProps) {\n const { states } = props;\n function onMoveVelocityRequested(target: number) {\n return props.hardware.actions.setProperty('velocity', target);\n }\n\n function onMoveAccelerationRequested(target: number) {\n return props.hardware.actions.setProperty('acceleration', target);\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{props.hardware.name} details</Popover.Header>\n <Popover.Body>\n <Form.Group>\n <Form.Label>Velocity</Form.Label>\n <HardwareInputNumber\n hardwareValue={props.hardware.properties?.velocity ?? 0}\n onMoveRequested={onMoveVelocityRequested}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={states.READY}\n hardwareIsMoving={states.MOVING}\n readOnly={props.readOnly}\n />\n </Form.Group>\n <Form.Group>\n <Form.Label>Acceleration</Form.Label>\n <HardwareInputNumber\n hardwareValue={props.hardware.properties?.acceleration ?? 0}\n onMoveRequested={onMoveAccelerationRequested}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={states.READY}\n hardwareIsMoving={states.MOVING}\n readOnly={props.readOnly}\n />\n </Form.Group>\n </Popover.Body>\n </Popover>\n }\n >\n <Button>\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\n/**\n * The default motor widget\n */\nexport default function MotorDefault(\n props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties, user_tags } = hardware;\n function onAbortRequested() {\n void hardware.actions.call('stop');\n }\n\n function onMovePositionRequested(target: number) {\n return hardware.actions.call('move', target);\n }\n\n const states = useMotorStates(properties.state, user_tags);\n const widgetIcon = (\n <TypeIcon name=\"Motor\" icon=\"fam-hardware-motor\" online={hardware.online} />\n );\n\n const widgetState = <MotorState hardware={hardware} />;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={\n <InputGroup className=\"flex-nowrap\">\n <HardwareNumericStep\n id={hardware.id}\n hardwareValue={properties?.position ?? null}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={states.READY ?? false}\n hardwareIsMoving={states.MOVING ?? false}\n onMoveRequested={onMovePositionRequested}\n onAbortRequested={onAbortRequested}\n precision={\n options.precision ?? properties.display_digits ?? undefined\n }\n readOnly={options.readOnly}\n stepOnly={options.stepOnly}\n step={options.step}\n steps={options.steps}\n incIcon={options.incicon}\n decIcon={options.decicon}\n swapIncDec={options.swapincdec}\n horizontalArrows={options.horizontalarrows}\n largeArrows={options.largearrows}\n />\n {properties.unit && (\n <InputGroup.Text>{properties.unit}</InputGroup.Text>\n )}\n\n {!states.MOVING && options.extended && (\n <MotorOverlay\n hardware={hardware}\n disabled={props.disabled}\n readOnly={options.readOnly}\n states={states}\n />\n )}\n\n {states.MOVING && !props.disabled && !options.step && (\n <Button variant=\"danger\" onClick={onAbortRequested}>\n <i className=\"fa fa-times\" />\n </Button>\n )}\n </InputGroup>\n }\n headerMode={headerMode}\n />\n );\n}\n","import classNames from 'classnames';\nimport { Stack } from 'react-bootstrap';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport { MotorState } from './MotorState';\nimport { useMotorStates } from '.';\nimport type { MotorSchema } from '.';\nimport type { MotorDefaultOptions } from './options';\n\nfunction Content(props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>) {\n const { hardware, options = {} } = props;\n const states = useMotorStates(hardware.properties.state, hardware.user_tags);\n\n function normalizeNumber(value: number | null): string {\n if (value === null) {\n return '∅';\n }\n const digits =\n options.precision ?? hardware.properties.display_digits ?? undefined;\n if (digits !== undefined) {\n return value.toFixed(digits);\n }\n return `${value}`;\n }\n\n return (\n <Stack className=\"bg-light rounded-2 ps-2 p-1\" direction=\"horizontal\">\n <div\n className={classNames({\n 'hw-moving': states.MOVING,\n })}\n >\n {normalizeNumber(hardware.properties.position)}\n </div>\n {hardware.properties.unit && (\n <div className=\"ms-auto\">\n <small>\n <small>{hardware.properties.unit}</small>\n </small>\n </div>\n )}\n </Stack>\n );\n}\n\n/**\n * The default motor widget\n */\nexport default function MotorText(\n props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>\n) {\n const { hardware } = props;\n\n const widgetIcon = (\n <TypeIcon name=\"Motor\" icon=\"fam-hardware-motor\" online={hardware.online} />\n );\n\n const widgetState = <MotorState hardware={hardware} />;\n\n const headerMode = props.options ? props.options.header : 'top';\n if (headerMode === 'none') {\n return <Content {...props} />;\n }\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={<Content {...props} />}\n headerMode={headerMode}\n />\n );\n}\n","import { useMemo } from 'react';\nimport { useHardware } from '../../registry/hooks';\nimport type { Hardware, HardwareVariant } from '../utils/types';\nimport MotorDefault from './MotorDefault';\nimport MotorText from './MotorText';\nimport MotorState from './MotorState';\n\nexport interface MotorSchema extends Hardware {\n properties: {\n position: number | null;\n /**\n * Target of the actual motion.\n *\n * If there is no motion, it is `null`.\n */\n target: number | null;\n tolerance: number;\n acceleration: number;\n velocity: number;\n limits: [number, number];\n state: string[];\n unit: string;\n offset: number;\n sign: number;\n display_digits: number | null;\n };\n}\n\n/**\n * Exposes the standard supported motor states\n */\nexport interface MotorStates {\n // Axis is READY\n READY?: true;\n // Axis is MOVING\n MOVING?: true;\n // Error from controller\n FAULT?: true;\n // Hardware high limit active\n HIGHLIMIT?: true;\n // Hardware low limit active\n LOWLIMIT?: true;\n // Home signal active\n HOME?: true;\n // Axis power is off\n OFF?: true;\n // Axis cannot move\n DISABLED?: true;\n // The state of the motor is not handlable\n UNKNOWN?: true;\n // If none of the state are set, this flag is set, to simplify the logic\n NOT_READY?: true;\n}\n\n/**\n * Normalize the motor state exposed by the hardware.\n *\n * This does not exposes the custom states in a useful maner.\n *\n * Store states are changed depending of existing user tags\n *\n * - `auto_on`: This allow to move the motor even if `OFF` is enabled.\n * When `OFF` is enabled `READY` is turned to true.\n * - `auto_ready`: This allow to move the motor even if `NOT_READY` is enabled.\n *\n * TODO: An improvement would be to normalize that when redux is populated.\n * instead of storing a list.\n *\n * @param state: List of the controller state\n * @param userTags: List of the hardware user tags\n */\nexport function useMotorStates(\n state: string[] | undefined,\n userTags: string[] = []\n): MotorStates {\n return useMemo(() => {\n const autoReady = userTags.includes('auto_ready');\n const autoOn = userTags.includes('auto_on');\n\n if (state === undefined) {\n return { UNKNOWN: true };\n }\n if (state?.length === 0) {\n if (autoReady) {\n return { READY: true };\n }\n return { NOT_READY: true };\n }\n const newState = state.reduce((reduced: Record<string, boolean>, s) => {\n reduced[s] = true;\n return reduced;\n }, {});\n if (newState.READY === undefined) {\n if (autoOn && newState.OFF) {\n newState.READY = true;\n }\n }\n return newState;\n }, [state, userTags]);\n}\n\nexport function isMotorHardware(entity: Hardware): entity is MotorSchema {\n return entity.type === 'motor';\n}\n\n/**\n * Return a motor from it's hardware name.\n *\n * Return `null` if the name refers to nothing or a mismatching hardware.\n *\n * @param name: An hardware identifier\n */\nexport function useMotorHardware(name: string | null): MotorSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isMotorHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n\nconst Variants: HardwareVariant<MotorSchema> = {\n default: MotorDefault,\n text: MotorText,\n // Override base state\n state: MotorState,\n};\n\nexport default Variants;\n","import motor from './Motor.json';\nimport halfMotor from './HalfMotor.json';\nimport unknownMotor from './MotorUnknown.json';\nimport notReadyMotor from './MotorNotReady.json';\nimport disconnectedMotor from './MotorDisconnected.json';\nimport powerOffMotor from './MotorPowerOff.json';\n\nexport const Mocks = {\n default: motor,\n halfMotor,\n unknownMotor,\n notReadyMotor,\n disconnectedMotor,\n powerOffMotor,\n};\n","export function createMotorMock(name: string, position: number) {\n return {\n id: name,\n name,\n type: 'motor',\n properties: {\n position,\n unit: 'mm',\n limits: [-100, 100],\n },\n online: true,\n };\n}\n","import {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { PropsWithChildren } from 'react';\nimport type { MotorSchema } from '..';\nimport type {\n Hardware,\n EditableHardware,\n HardwareChangeActions,\n} from '../../utils/types';\nimport { isEqual } from 'lodash';\n\ninterface Props {\n name?: string;\n minLimit?: number;\n maxLimit?: number;\n initialPosition?: number;\n initialVelocity?: number;\n useHardwareContext?: () => {\n actions: {\n updateHardware: (name: string, hardware: Hardware) => void;\n updateHardwareChangeActions: (\n name: string,\n actions: HardwareChangeActions\n ) => void;\n };\n };\n}\n\nexport default function MotorSimulator(props: Props) {\n const {\n name = 'omega',\n minLimit = -999_999_999,\n maxLimit = 999_999_999,\n initialPosition = 0,\n initialVelocity = 1000,\n useHardwareContext = () => {\n return null;\n },\n } = props;\n const [position, setPosition] = useState(initialPosition);\n const [state, setState] = useState(['READY']);\n const [target, setTarget] = useState<number | null>(null);\n const internalTimeRef = useRef(Date.now());\n\n const ctx = useHardwareContext();\n\n const updatePosition = () => {\n const now = Date.now();\n const deltaTime = (now - internalTimeRef.current) / 1000;\n let newPosition;\n internalTimeRef.current = now;\n if (target !== null && target !== position) {\n let newState;\n let newTarget;\n const deltaPosition = deltaTime * initialVelocity;\n if (deltaPosition > Math.abs(position - target)) {\n newPosition = target;\n newState = ['READY'];\n newTarget = null;\n } else {\n const direction = target > position ? 1 : -1;\n newPosition = position + direction * deltaPosition;\n newState = ['MOVING'];\n newTarget = target;\n }\n setPosition(newPosition);\n setState(newState);\n setTarget(newTarget);\n }\n };\n\n const call = useCallback((name: string, value?: any) => {\n if (name === 'stop') {\n setTarget(null);\n setState(['READY']);\n return Promise.resolve();\n }\n if (name === 'move') {\n const pos = Number.parseFloat(value);\n setTarget(Number.isNaN(pos) ? null : pos);\n return Promise.resolve();\n }\n console.log('MotorSimulator: Unsupported call', name, value);\n return Promise.resolve();\n }, []);\n\n const setProperty = useCallback((name: string, value: any) => {\n console.log('MotorSimulator: Unsupported setProperty', name, value);\n return Promise.resolve();\n }, []);\n\n useEffect(() => {\n const timer = setInterval(() => {\n updatePosition();\n }, 500);\n return () => clearInterval(timer);\n });\n\n const actions: HardwareChangeActions = useMemo(() => {\n const actions = {\n setProperty,\n call,\n };\n ctx?.actions.updateHardwareChangeActions?.(name, actions);\n return actions;\n }, []);\n\n const rawHardware: EditableHardware<MotorSchema> = {\n id: name,\n name,\n alias: null,\n online: true,\n properties: {\n acceleration: 300,\n limits: [minLimit, maxLimit],\n position,\n offset: 0,\n sign: 1,\n state,\n tolerance: 0.0001,\n unit: 'mm',\n velocity: initialVelocity,\n target,\n display_digits: 3,\n },\n type: 'motor',\n actions,\n user_tags: [],\n locked: null,\n };\n\n const previousHardware = useRef<EditableHardware<MotorSchema> | null>(null);\n\n useEffect(() => {\n if (\n previousHardware.current !== null &&\n isEqual(previousHardware.current, rawHardware)\n ) {\n return;\n }\n previousHardware.current = rawHardware;\n ctx?.actions.updateHardware(name, rawHardware);\n }, [name, rawHardware]);\n\n return <></>;\n}\n","import { useRef, useEffect } from 'react';\nimport { map } from 'lodash';\nimport { Badge, Button, InputGroup, Form } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport type { MultipositionSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport default function Multiposition(\n props: HardwareWidgetProps<MultipositionSchema>\n) {\n const { hardware, options = {} } = props;\n const selectionRef = useRef<HTMLSelectElement>(null);\n\n useEffect(() => {\n if (!selectionRef.current) {\n console.error('selectionRef ref is unset');\n return;\n }\n selectionRef.current.value = hardware.properties.position;\n }, [hardware.properties.position]);\n\n function onMove(e: any) {\n console.debug('change', e);\n if (!selectionRef || !selectionRef.current) {\n console.error('selection ref is unset');\n return;\n }\n void hardware.actions.call('move', selectionRef.current.value);\n }\n\n function stop(e: any) {\n void hardware.actions.call('stop');\n }\n\n const opts = map(hardware.properties.positions, (p) => (\n <option key={p.position} title={p.description}>\n {p.position}\n </option>\n ));\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Multiposition\"\n icon=\"fam-hardware-multiposition\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={hardware.properties.state === 'READY' ? 'success' : 'warning'}\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <InputGroup>\n <Form.Control\n className=\"custom-select\"\n as=\"select\"\n ref={selectionRef}\n disabled={props.disabled}\n defaultValue={hardware.properties.position}\n >\n <option disabled>unknown</option>\n {opts}\n </Form.Control>\n {hardware.properties.state !== 'MOVING' && (\n <Button onClick={onMove} disabled={props.disabled}>\n Move\n </Button>\n )}\n\n {hardware.properties.state === 'MOVING' && !props.disabled && (\n <Button variant=\"danger\" onClick={stop}>\n <i className=\"fa fa-times\" />\n </Button>\n )}\n </InputGroup>\n </div>\n </div>\n );\n}\n","import { Button, InputGroup, Dropdown } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport type { MultipositionSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport classNames from 'classnames';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport { HardwareTemplate } from '../..';\nimport { AnyHardwareState } from '../base/BaseState';\n\nfunction DropdownPositions(props: HardwareWidgetProps<MultipositionSchema>) {\n const { hardware } = props;\n const { properties } = hardware;\n const hardwareReady = properties.state === 'READY';\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n const position = properties.position;\n\n function moveTo(positionId: string) {\n void hardware.actions.call('move', positionId);\n }\n\n function createSelectableItem(\n positionSchema: MultipositionSchema['properties']['positions'][0]\n ) {\n const positionId = positionSchema.position;\n const selected = positionId === position;\n const icon = selected ? 'fa fa-fw fa-dot-circle-o' : 'fa fa-fw fa-circle-o';\n\n return (\n <Dropdown.Item\n key={positionId}\n disabled={disabled}\n onClick={() => {\n moveTo(positionId);\n }}\n title={positionSchema.description}\n >\n <i className={icon} />\n &nbsp; {positionId}\n </Dropdown.Item>\n );\n }\n\n return (\n <Dropdown>\n <Dropdown.Toggle disabled={disabled} variant=\"secondary\" />\n <Dropdown.Menu align=\"end\">\n {properties.positions.map((m) => createSelectableItem(m))}\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport default function Multiposition(\n props: HardwareWidgetProps<MultipositionSchema>\n) {\n const { hardware, options = {} } = props;\n\n const hardwareIsMoving = hardware.properties?.state === 'MOVING';\n\n function stop(e: any) {\n void hardware.actions.call('stop');\n }\n\n const widgetIcon = (\n <TypeIcon\n name=\"Multiposition\"\n icon=\"fam-hardware-multiposition\"\n online={hardware.online}\n />\n );\n\n const widgetState = <AnyHardwareState hardware={hardware} />;\n\n // Actually we can't know when it goes\n const targetPosition = hardwareIsMoving ? 'Moving' : null;\n\n const position = hardware.properties?.position;\n\n function getWidgetContent() {\n return (\n <InputGroup>\n <ReadOnlyTextInput\n className={classNames({\n 'hw-moving': hardwareIsMoving,\n })}\n value={targetPosition ?? position ?? 'Unknown'}\n />\n {!hardwareIsMoving && !props.disabled && (\n <DropdownPositions {...props} />\n )}\n {hardwareIsMoving && !props.disabled && (\n <Button variant=\"danger\" onClick={stop}>\n <i className=\"fa fa-fw fa-times\" />\n </Button>\n )}\n </InputGroup>\n );\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport MultipositionDefault from './Multiposition';\nimport MultipositionDefault2 from './MultipositionDefault2';\n\nexport interface MultipositionSchema extends Hardware {\n properties: {\n position: string;\n positions: {\n position: string;\n description: string;\n target: {\n axis: string;\n destination: number;\n tolerance: number;\n }[];\n }[];\n state: string;\n };\n}\n\nconst Variants: HardwareVariant<MultipositionSchema> = {\n default: MultipositionDefault,\n default2: MultipositionDefault2,\n};\n\nexport default Variants;\n","import defaultjson from './Multiposition.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function MultipositionSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [position, setPosition] = useState('empty');\n const [state, setState] = useState('READY');\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'move') {\n setState('MOVING');\n setPosition('unknown');\n await delay(2000);\n setState('READY');\n setPosition(value);\n return;\n }\n if (name === 'stop') {\n setPosition('unknown');\n await delay(2000);\n return;\n }\n console.log('MultipositionSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log('MultipositionSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = {\n position,\n state,\n positions: [\n { position: 'empty', description: 'No filter', target: [] },\n { position: 'gold2', description: 'Gold filter 2mm', target: [] },\n { position: 'silver3', description: 'Silver filter 3mm', target: [] },\n ],\n };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"multiposition\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { HardwareState } from '../utils/State';\nimport type { OpticSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function OpticState(props: { hardware: OpticSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n READY: 'success',\n MOVING: 'warning',\n INVALID: 'danger',\n UNKNOWN: 'danger',\n DISABLED: 'secondary',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<OpticSchema>) {\n const { hardware } = props;\n return <OpticState hardware={hardware} />;\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent } from 'react';\nimport classNames from 'classnames';\nimport { Dropdown, InputGroup, Form } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { OpticState } from './OpticState';\nimport type { OpticSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nexport interface OpticWidgetOptions extends HardwareWidgetOptions {\n readonly?: boolean;\n digits?: number;\n allowtuning?: boolean;\n}\n\nfunction MultiPositionMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n options: OpticWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options = {} } = props;\n const { properties } = hardware;\n const { state } = properties;\n const hardwareMoving = state === 'MOVING';\n const hardwareReady = state === 'READY';\n const magnification = hardwareMoving\n ? properties.target_magnification || 0\n : properties.magnification || 0;\n const availableMagnifications = properties.available_magnifications;\n const magnifications = [...(availableMagnifications ?? [])];\n magnifications.sort((a, b) => {\n if (a > b) return 1;\n if (b > a) return -1;\n return 0;\n });\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n const digits = options.digits || 2;\n\n function moveHardwareMagnification(value: number) {\n if (hardware.actions) {\n void hardware.actions.call('move', value);\n } else {\n console.error('Change request was triggered with:', value);\n }\n }\n\n function createSelectableItem(index: number, itemMagnification: number) {\n const selected = magnification === itemMagnification;\n const icon = selected ? 'fa fa-fw fa-dot-circle-o' : 'fa fa-fw fa-circle-o';\n return (\n <Dropdown.Item\n key={`id${index}`}\n disabled={disabled}\n onClick={() => {\n moveHardwareMagnification(itemMagnification);\n }}\n >\n <i className={icon} />\n &nbsp; × {itemMagnification}\n </Dropdown.Item>\n );\n }\n\n return (\n <>\n <ReadOnlyTextInput\n value={magnification.toFixed(digits)}\n className={classNames({\n 'hw-moving': hardwareMoving,\n })}\n />\n <Dropdown>\n <Dropdown.Toggle disabled={!hardwareReady} variant=\"secondary\" />\n <Dropdown.Menu>\n {magnifications.map((m, index) => createSelectableItem(index, m))}\n </Dropdown.Menu>\n </Dropdown>\n </>\n );\n}\n\nfunction FixedMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n options: OpticWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options = {} } = props;\n const magnification = hardware.properties.magnification || 0;\n const digits = options.digits || 2;\n const allowtuning = !!options.allowtuning;\n\n return (\n <>\n <ReadOnlyTextInput value={magnification.toFixed(digits)} />\n {allowtuning && (\n <Dropdown>\n <Dropdown.Toggle variant=\"secondary\" />\n <Dropdown.Menu>\n <InputGroup>\n <InputGroup.Text>×</InputGroup.Text>\n <InputMagnification {...props} />\n </InputGroup>\n </Dropdown.Menu>\n </Dropdown>\n )}\n </>\n );\n}\n\nfunction InputMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n disabled: boolean;\n options: OpticWidgetOptions;\n mode?: string;\n}) {\n const { hardware, options = {} } = props;\n const magnification = hardware.properties.magnification || 0;\n const { state } = hardware.properties;\n const hardwareReady = state === 'READY';\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n\n const [rangeMin, rangeMax] = hardware.properties.magnification_range || [\n null,\n null,\n ];\n\n const formRef = useRef<HTMLInputElement>(null);\n const rangeRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = options.digits || 2;\n\n function setHardwareMagnification(value: number) {\n if (hardware.actions) {\n if (props.mode === 'move') {\n void hardware.actions.call('move', value);\n } else {\n void hardware.actions.setProperty('magnification', value);\n }\n } else {\n console.error('Change request was triggered with:', value);\n }\n }\n\n function onKeyDown(event: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n return;\n }\n if (event.key === 'Enter') {\n setEdited(false);\n const { value } = formRef.current;\n const valueAsFloat = Number.parseFloat(value);\n\n if (rangeMin !== null && valueAsFloat < rangeMin) {\n return;\n }\n if (rangeMax !== null && valueAsFloat > rangeMax) {\n return;\n }\n setHardwareMagnification(valueAsFloat);\n } else if (event.key === 'Escape') {\n formRef.current.value = magnification.toFixed(digits);\n if (rangeRef.current) {\n rangeRef.current.value = magnification.toString();\n }\n setEdited(false);\n } else {\n console.log(event.key);\n }\n }\n\n function updateEdit(value: number) {\n if (value !== magnification && !edited) {\n setEdited(true);\n }\n if (value === magnification && edited) {\n setEdited(false);\n }\n }\n\n function onInputChange(event: any) {\n if (!formRef || !formRef.current) {\n console.error('formRef is not set');\n return;\n }\n const value = Number.parseFloat(formRef.current.value);\n updateEdit(value);\n if (rangeRef.current) {\n rangeRef.current.value = value.toString();\n }\n }\n\n function onRangeChange(event: any) {\n if (!formRef || !formRef.current) {\n console.error('formRef is not set');\n return;\n }\n if (!rangeRef || !rangeRef.current) {\n console.error('rangeRef is not set');\n return;\n }\n const value = Number.parseFloat(rangeRef.current.value);\n updateEdit(value);\n formRef.current.value = value.toFixed(digits);\n }\n\n function onRangeAccepted() {\n if (!rangeRef || !rangeRef.current) {\n console.error('rangeRef is not set');\n return;\n }\n const value = Number.parseFloat(rangeRef.current.value);\n setHardwareMagnification(value);\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.error('formRef is not set');\n return;\n }\n if (!edited) {\n formRef.current.value = magnification.toFixed(digits);\n }\n if (rangeRef.current) {\n rangeRef.current.value = magnification.toString();\n }\n }, [digits, edited, magnification]);\n\n return (\n <>\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={magnification.toFixed(digits)}\n onChange={onInputChange}\n disabled={disabled}\n step={10 ** -digits}\n onKeyDown={onKeyDown}\n />\n {rangeMin !== null && rangeMax !== null && (\n <Form.Control\n ref={rangeRef}\n disabled={disabled}\n type=\"range\"\n min={rangeMin}\n max={rangeMax}\n step={10 ** -digits}\n onChange={onRangeChange}\n onMouseUp={onRangeAccepted}\n defaultValue={magnification}\n />\n )}\n </>\n );\n}\n\nfunction RangeMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n options: OpticWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options = {} } = props;\n const { properties } = hardware;\n const hardwareMoving = properties.state === 'MOVING';\n const hardwareReady = properties.state === 'READY';\n const magnification = hardwareMoving\n ? properties.target_magnification || 0\n : properties.magnification || 0;\n const digits = props.options.digits || 2;\n\n return (\n <>\n <ReadOnlyTextInput\n value={magnification.toFixed(digits)}\n className={classNames({\n 'hw-moving': hardwareMoving,\n })}\n />\n <Dropdown>\n <Dropdown.Toggle disabled={!hardwareReady} variant=\"secondary\" />\n <Dropdown.Menu>\n <InputGroup>\n <InputGroup.Text>×</InputGroup.Text>\n <InputMagnification {...props} mode=\"move\" />\n </InputGroup>\n </Dropdown.Menu>\n </Dropdown>\n </>\n );\n}\n\nfunction OffMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n options: OpticWidgetOptions;\n}) {\n return (\n <Form.Control\n className=\"border-light\"\n type=\"text\"\n disabled\n defaultValue=\"Missing\"\n />\n );\n}\n\nexport default function Optic(\n props: HardwareWidgetProps<OpticSchema, OpticWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Optic\" icon=\"fam-hardware-optic\" online={hardware.online} />\n );\n\n const widgetState = <OpticState hardware={hardware} />;\n\n function getWidgetContent() {\n function getOpticClass() {\n if (!hardware.online) {\n return OffMagnification;\n }\n if (hardware.properties.available_magnifications) {\n return MultiPositionMagnification;\n }\n if (hardware.properties.magnification_range) {\n return RangeMagnification;\n }\n return FixedMagnification;\n }\n\n const Class = getOpticClass();\n\n return (\n <InputGroup>\n <InputGroup.Text className=\"border-light\">×</InputGroup.Text>\n <Class {...props} />\n </InputGroup>\n );\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Optic from './Optic';\nimport OpticState from './OpticState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface OpticSchema extends Hardware {\n properties: {\n state: string;\n magnification: number;\n available_magnifications: number[] | null;\n /**\n * Target of the actual motion.\n *\n * If there is no motion, it is `null `.\n */\n target_magnification: number | null;\n magnification_range: [number, number] | null;\n };\n}\n\nexport function isOpticHardware(entity: Hardware): entity is OpticSchema {\n return entity.type === 'optic';\n}\n\nconst Variants: HardwareVariant<OpticSchema> = {\n default: Optic,\n // Override base state\n state: OpticState,\n};\n\nexport default Variants;\n","import defaultjson from './Optic.json';\nimport fixedjson from './Optic.json';\nimport offjson from './Optic.json';\nimport rangejson from './Optic.json';\n\nexport const Mocks = {\n default: defaultjson,\n fixed: fixedjson,\n off: offjson,\n range: rangejson,\n};\n","/* eslint no-await-in-loop: \"off\" */\nimport { useState } from 'react';\nimport type { OpticSchema } from '..';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\ninterface Props {\n kind: 'fixed' | 'range' | 'multi';\n}\n\nexport default function OpticSimulator(props: PropsWithSimulator<Props>) {\n const { name, alias, kind, useHardwareContext } = props;\n\n function getInitial() {\n if (kind === 'fixed') {\n return {\n available_magnifications: null,\n magnification_range: null,\n };\n }\n if (kind === 'range') {\n return {\n available_magnifications: null,\n magnification_range: [5, 10] as [number, number],\n };\n }\n if (kind === 'multi') {\n return {\n available_magnifications: [5, 7.5, 10],\n magnification_range: null,\n };\n }\n return { available_magnifications: null, magnification_range: null };\n }\n\n const [properties, setProperties] = useState<OpticSchema['properties']>({\n state: 'READY',\n magnification: 10,\n target_magnification: null,\n ...getInitial(),\n });\n\n async function move(magnification: number) {\n let pos = properties.magnification;\n setProperties((p) => {\n return {\n ...p,\n state: 'MOVING',\n target_magnification: magnification,\n };\n });\n await delay(100);\n const speed = 0.2 * (pos < magnification ? 1 : -1);\n\n function setMagnification(pos: number) {\n setProperties((p) => {\n return {\n ...p,\n magnification: pos,\n };\n });\n }\n\n while (Math.abs(magnification - pos) >= Math.abs(speed) * 1.01) {\n pos += speed;\n setMagnification(pos);\n await delay(100);\n }\n\n setProperties((p) => {\n return {\n ...p,\n state: 'READY',\n magnification,\n target_magnification: null,\n };\n });\n }\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'move') {\n await move(value as number);\n return;\n }\n console.log('OpticSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n if (name === 'magnification') {\n setProperties((p) => {\n return {\n ...p,\n magnifications: value,\n };\n });\n return;\n }\n console.log('OpticSimulator: Unsupported setProperty', name, value);\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"optic\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { HardwareState } from '../utils/State';\nimport type { ProcedureSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function ProcedureState(props: { hardware: ProcedureSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n STANDBY: 'success',\n DISABLED: 'secondary',\n OFFLINE: 'secondary',\n RUNNING: 'warning',\n ABORTING: 'warning',\n AWAITING_USER_INPUT: 'warning',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<ProcedureSchema>\n) {\n const { hardware } = props;\n return <ProcedureState hardware={hardware} />;\n}\n","import type { MouseEvent } from 'react';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { Button, ButtonGroup, Container } from 'react-bootstrap';\nimport { ProcedureState } from './ProcedureState';\nimport type { ProcedureSchema } from '.';\n\nfunction Actions(props: {\n hardware: EditableHardware<ProcedureSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const disabled = props.disabled || !hardware.online;\n const waitingUserInput = hardware.properties.state === 'AWAITING_USER_INPUT';\n const aborting = hardware.properties.state === 'ABORTING';\n const isRunning =\n hardware.properties.state === 'RUNNING' || waitingUserInput || aborting;\n\n function doStart(event: MouseEvent) {\n void hardware.actions.call('start');\n }\n\n function doAbort(event: MouseEvent) {\n void hardware.actions.call('abort');\n }\n\n return (\n <ButtonGroup size=\"lg\" className=\"w-100\">\n <Button\n onClick={doStart}\n disabled={disabled || isRunning}\n variant=\"primary\"\n >\n Start\n </Button>\n <Button\n onClick={doAbort}\n disabled={disabled || !isRunning}\n variant=\"primary\"\n >\n Abort\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function ProcedureManage(\n props: HardwareWidgetProps<ProcedureSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon name=\"Procedure\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ProcedureState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <Actions hardware={hardware} disabled={!props.operator} />\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { Container, Badge } from 'react-bootstrap';\nimport { ProcedureState } from './ProcedureState';\nimport type { ProcedureSchema } from '.';\n\nfunction State(props: { hardware: EditableHardware<ProcedureSchema> }) {\n const { hardware } = props;\n const awaitingUserInput = hardware.properties.state === 'AWAITING_USER_INPUT';\n const aborting = hardware.properties.state === 'ABORTING';\n const isRunning = hardware.properties.state === 'RUNNING';\n\n if (aborting) {\n return (\n <Badge bg=\"warning\">\n <i className=\"fa-solid fa-heart-crack fa-beat\" /> ABORTING\n </Badge>\n );\n }\n\n if (isRunning) {\n return (\n <Badge bg=\"info\">\n <i className=\"fa-solid fa-heart fa-beat\" /> RUNNING\n </Badge>\n );\n }\n\n if (awaitingUserInput) {\n return (\n <Badge bg=\"warning\" title=\"A user input is expected\">\n <i className=\"fa-solid fa-user fa-beat\" /> AWAITING INPUT\n </Badge>\n );\n }\n\n return <FinishedState hardware={hardware} />;\n}\n\nfunction FinishedState(props: { hardware: EditableHardware<ProcedureSchema> }) {\n const { hardware } = props;\n const { previous_run_state: runState, previous_run_exception: runException } =\n hardware.properties;\n\n const variants: { [state: string]: [string, string | null] } = {\n NONE: ['secondary', null],\n ABORTED: ['warning', 'fa-heart-crack'],\n FAILED: ['danger', null],\n SUCCESSED: ['success', null],\n UNKNOWN: ['danger', null],\n };\n\n const definition = variants[runState] || variants.UNKNOWN;\n const [variant, icon] = definition;\n\n return (\n <Badge bg={variant} title={runException ?? undefined}>\n {icon && (\n <>\n <i className={`fa-solid ${icon}`} />{' '}\n </>\n )}\n {runState}\n </Badge>\n );\n}\n\nexport default function ProcedureExecution(\n props: HardwareWidgetProps<ProcedureSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon name=\"Procedure\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ProcedureState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <div>\n <h3>\n <State hardware={hardware} />\n </h3>\n </div>\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { MouseEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { Button, ButtonGroup, Container, Badge } from 'react-bootstrap';\nimport { ProcedureState } from './ProcedureState';\nimport type { ProcedureSchema } from '.';\n\nfunction Actions(props: {\n hardware: EditableHardware<ProcedureSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const disabled = props.disabled || !hardware.online;\n const waitingUserInput = hardware.properties.state === 'AWAITING_USER_INPUT';\n\n function doValidate(event: MouseEvent) {\n void hardware.actions.call('validate');\n }\n\n return (\n <ButtonGroup size=\"lg\" className=\"w-100\">\n <Button\n onClick={doValidate}\n disabled={disabled || !waitingUserInput}\n variant=\"primary\"\n >\n Validate\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function ProcedureValidate(\n props: HardwareWidgetProps<ProcedureSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon name=\"Procedure\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ProcedureState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <Actions hardware={hardware} disabled={!props.operator} />\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport ProcedureManage from './ProcedureManage';\nimport ProcedureExecution from './ProcedureExecution';\nimport ProcedureValidate from './ProcedureValidate';\nimport ProcedureState from './ProcedureState';\n\nexport interface ProcedureSchema extends Hardware {\n properties: {\n state: string;\n previous_run_state: string;\n previous_run_exception: string | null;\n parameters: Record<string, any>;\n };\n}\n\nconst Variants: HardwareVariant<ProcedureSchema> = {\n default: ProcedureManage,\n manage: ProcedureManage,\n execution: ProcedureExecution,\n validate: ProcedureValidate,\n // Override base state\n state: ProcedureState,\n};\n\nexport default Variants;\n\nexport interface HardwareFromProcedure {\n __type__: 'hardware';\n name: string;\n}\n\nexport interface ScanFromProcedure {\n __type__: 'scan';\n mmh3: number;\n node?: string;\n key?: string;\n}\n\nexport interface ExceptionFromProcedure {\n __type__: 'exception';\n class: string;\n message: string;\n traceback: Record<string, any>;\n}\n","import standby from './ProcedureStandBy.json';\n\nexport const Mocks = {\n standby,\n};\n","import type { ShutterSchema } from '.';\nimport { HardwareState } from '../utils/State';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function ShutterState(props: {\n hardware: ShutterSchema;\n useReadyState?: boolean;\n}) {\n const { hardware } = props;\n function getState() {\n if (!hardware.online) {\n return 'OFFLINE';\n }\n const s = hardware.properties.state;\n if (props.useReadyState && (s === 'OPEN' || s === 'CLOSED')) {\n return 'READY';\n }\n return s;\n }\n\n const state = getState();\n\n function getVariant() {\n switch (state) {\n case 'READY':\n return 'success';\n case 'OPEN':\n return 'success';\n case 'CLOSED':\n return 'danger';\n case 'DISABLED':\n return 'secondary';\n case 'MOVING':\n case 'STANDBY':\n case 'OFFLINE':\n return 'warning';\n case 'FAULT':\n return 'fatal';\n default:\n return 'fatal';\n }\n }\n\n return <HardwareState state={state} minWidth={6} variant={getVariant()} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<ShutterSchema>\n) {\n const { hardware } = props;\n return <ShutterState hardware={hardware} useReadyState />;\n}\n","import { Button, OverlayTrigger, Popover, ButtonGroup } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { ShutterState } from './ShutterState';\nimport type { ShutterSchema } from '.';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\n\nfunction ShutterOverlay(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware } = props;\n function reset() {\n void hardware.actions.call('reset');\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <div className=\"d-grid gap-2\">\n <Button onClick={reset} disabled={props.disabled}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Shutter Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport default function ShutterDefault(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Shutter\"\n icon=\"fam-hardware-shutter\"\n online={hardware.online}\n />\n );\n\n const widgetState = <ShutterState hardware={hardware} />;\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function getAction(s: string) {\n if (s === 'OPEN') {\n return ['Close', 'close'];\n }\n if (s === 'CLOSED') {\n return ['Open', 'open'];\n }\n if (s === 'DISABLED' || s === 'STANDBY' || s === 'FAULT') {\n return ['Closed', ''];\n }\n if (s === 'MOVING') {\n return ['...', ''];\n }\n return ['Unknown', ''];\n }\n\n const state = getState();\n const [label, action] = getAction(state);\n const variants: { [name: string]: string } = {\n OPEN: 'danger',\n CLOSED: 'success',\n MOVING: 'warning',\n DISABLED: 'secondary',\n STANDBY: 'danger',\n FAULT: 'fatal',\n UNKNOWN: 'warning',\n };\n const variant = variants[state] || 'danger';\n\n function onClick() {\n void hardware.actions.call(action);\n }\n\n const widgetContent = (\n <ButtonGroup className=\"d-flex flex-nowrap\">\n <Button\n variant={variant}\n onClick={onClick}\n disabled={props.disabled || action === ''}\n >\n {label}\n </Button>\n\n {options.extended && <ShutterOverlay {...props} />}\n </ButtonGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import {\n InputGroup,\n Button,\n ButtonGroup,\n Dropdown,\n Container,\n Row,\n Col,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport type { ShutterSchema } from '.';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { ShutterState } from './ShutterState';\nimport TypeIcon from '../utils/TypeIcon';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nfunction DropdownShutter(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n function requestOpen() {\n void hardware.actions.call('open');\n }\n\n function requestClose() {\n void hardware.actions.call('close');\n }\n\n const state = hardware.properties?.state ?? 'UNKNOWN';\n const hardwareMoving = state === 'MOVING';\n const hardwareDisabled = state === 'DISABLED' || hardwareMoving;\n\n return (\n <Dropdown>\n <Dropdown.Toggle\n variant=\"secondary\"\n disabled={props.disabled || hardwareDisabled}\n />\n <Dropdown.Menu>\n <Container>\n <Row>\n <Col className=\"text-center\">Actions</Col>\n </Row>\n <Row>\n <Col>\n <ButtonGroup>\n <Button\n variant={hardwareMoving ? 'warning' : 'secondary'}\n onClick={() => {\n requestOpen();\n }}\n disabled={props.disabled || hardwareDisabled}\n title=\"Open the shutter\"\n >\n Open\n </Button>\n <Button\n variant={hardwareMoving ? 'warning' : 'secondary'}\n onClick={() => {\n requestClose();\n }}\n disabled={props.disabled || hardwareDisabled}\n title=\"Close the shutter\"\n >\n Close\n </Button>\n </ButtonGroup>\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport default function ShutterProtected(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Shutter\"\n icon=\"fam-hardware-shutter\"\n online={hardware.online}\n />\n );\n\n const widgetState = <ShutterState hardware={hardware} useReadyState />;\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function getValue(s: string) {\n if (s === 'OPEN' || s === 'CLOSED') {\n return s;\n }\n if (s === 'DISABLED' || s === 'STANDBY' || s === 'FAULT') {\n return 'CLOSED';\n }\n if (s === 'MOVING') {\n return '...';\n }\n return 'UNKNOWN';\n }\n\n function capitalize(s: string) {\n return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n }\n\n const state = getState();\n const value = getValue(state);\n const hardwareDisabled = state === 'DISABLED' || state === 'MOVING';\n\n const variants: { [name: string]: string } = {\n OPEN: 'success',\n CLOSED: 'danger',\n MOVING: 'warning',\n DISABLED: 'secondary',\n STANDBY: 'success',\n FAULT: 'fatal',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state];\n const valueName = capitalize(value);\n\n const widgetContent = (\n <InputGroup className=\"d-flex flex-nowrap\">\n <ReadOnlyTextInput\n variant={variant}\n className=\"text-center\"\n style={{ minWidth: '10em' }}\n value={valueName}\n />\n <DropdownShutter {...props} />\n </InputGroup>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport ShutterDefault from './ShutterDefault';\nimport ShutterProtected from './ShutterProtected';\nimport ShutterState from './ShutterState';\n\nexport interface ShutterSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n valid: boolean;\n open_text: string;\n closed_text: string;\n };\n}\n\nconst Variants: HardwareVariant<ShutterSchema> = {\n default: ShutterDefault,\n protected: ShutterProtected,\n // Override default state\n state: ShutterState,\n};\n\nexport default Variants;\n","import defaultjson from './BeamShutter.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function ShutterSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [state, setState] = useState('OPEN');\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'open') {\n setState('MOVING');\n await delay(2000);\n setState('OPEN');\n return;\n }\n if (name === 'close') {\n setState('MOVING');\n await delay(2000);\n setState('CLOSED');\n return;\n }\n console.log('ShutterSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log('ShutterSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = {\n state,\n closed_text: '',\n open_text: '',\n status: `Shutter is ${state}`,\n valid: true,\n };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"shutter\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { useMemo } from 'react';\nimport { useMotorHardware } from '../motor';\nimport type { MotorSchema } from '../motor';\nimport type { SlitSchema } from '.';\nimport { HardwareState } from '../utils/State';\nimport type { HardwareWidgetProps } from '../utils/types';\n\ninterface ResolvedSlit {\n vgap: MotorSchema['properties']['state'] | null;\n voffset: MotorSchema['properties']['state'] | null;\n hgap: MotorSchema['properties']['state'] | null;\n hoffset: MotorSchema['properties']['state'] | null;\n}\n\nfunction useResolvedSlit(hardware: SlitSchema): ResolvedSlit {\n const { properties } = hardware;\n\n const vgapId = properties.vgap.slice(9);\n const vgap = useMotorHardware(vgapId);\n\n const hgapId = properties.hgap.slice(9);\n const hgap = useMotorHardware(hgapId);\n\n const voffsetId = properties.voffset.slice(9);\n const voffset = useMotorHardware(voffsetId);\n\n const hoffsetId = properties.hoffset.slice(9);\n const hoffset = useMotorHardware(hoffsetId);\n\n return useMemo(() => {\n return {\n vgap: vgap?.properties?.state ?? null,\n hgap: hgap?.properties?.state ?? null,\n voffset: voffset?.properties?.state ?? null,\n hoffset: hoffset?.properties?.state ?? null,\n };\n }, [vgap, hgap, voffset, hoffset]);\n}\n\nexport function SlitState(props: { hardware: SlitSchema }) {\n const { hardware } = props;\n\n const info = useResolvedSlit(hardware);\n\n const [state, variant, description] = useMemo(() => {\n if (\n info.vgap === null &&\n info.hgap === null &&\n info.voffset === null &&\n info.hoffset === null\n ) {\n return ['OFFLINE', 'secondary', 'No motor online'];\n }\n\n const states = new Set([\n ...(info.vgap ?? []),\n ...(info.hgap ?? []),\n ...(info.voffset ?? []),\n ...(info.hoffset ?? []),\n ]);\n\n if (states.has('MOVING')) {\n return ['MOVING', 'warning', 'A motor is moving'];\n }\n if (states.has('OFF')) {\n return ['OFF', 'secondary', 'A motor is off'];\n }\n return ['READY', 'success', 'The slit is ready'];\n }, [info]);\n\n return (\n <HardwareState\n state={state}\n description={description}\n variant={variant}\n minWidth={6}\n />\n );\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<SlitSchema>) {\n const { hardware } = props;\n return <SlitState hardware={hardware} />;\n}\n","import type {\n HardwareWidgetProps,\n EditableHardware,\n HardwareChangeActions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { Container, Row, Col, InputGroup, Dropdown } from 'react-bootstrap';\nimport type { SlitDefaultOptions, SlitSchema } from '.';\nimport { useMotorHardware } from '../motor';\nimport type { MotorSchema } from '../motor';\nimport { SlitState } from './SlitState';\nimport MotorDefault from '../motor/MotorDefault';\nimport { useHardwareChangeActions } from '../../registry/hooks';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport { useMemo } from 'react';\nimport classNames from 'classnames';\n\ninterface ResolvedSlit {\n vgap: EditableHardware<MotorSchema> | null;\n voffset: EditableHardware<MotorSchema> | null;\n hgap: EditableHardware<MotorSchema> | null;\n hoffset: EditableHardware<MotorSchema> | null;\n}\n\nfunction useResolvedSlit(hardware: SlitSchema): ResolvedSlit {\n const { properties } = hardware;\n\n const vgapId = properties.vgap.slice(9);\n const vgap = useMotorHardware(vgapId);\n const vgapActions = useHardwareChangeActions(vgapId);\n\n const hgapId = properties.hgap.slice(9);\n const hgap = useMotorHardware(hgapId);\n const hgapActions = useHardwareChangeActions(hgapId);\n\n const voffsetId = properties.voffset.slice(9);\n const voffset = useMotorHardware(voffsetId);\n const voffsetActions = useHardwareChangeActions(voffsetId);\n\n const hoffsetId = properties.hoffset.slice(9);\n const hoffset = useMotorHardware(hoffsetId);\n const hoffsetActions = useHardwareChangeActions(hoffsetId);\n\n function merge(motor: MotorSchema | null, actions: HardwareChangeActions) {\n if (motor === null) {\n return null;\n }\n return { ...motor, actions };\n }\n\n return {\n vgap: merge(vgap, vgapActions),\n hgap: merge(hgap, hgapActions),\n voffset: merge(voffset, voffsetActions),\n hoffset: merge(hoffset, hoffsetActions),\n } as ResolvedSlit;\n}\n\nfunction DropdownSlit(\n props: HardwareWidgetProps<SlitSchema, SlitDefaultOptions> & {\n resolved: ResolvedSlit;\n }\n) {\n const { hardware, schema, operator, disabled, resolved } = props;\n\n return (\n <Dropdown>\n <Dropdown.Toggle variant=\"secondary\" />\n <Dropdown.Menu align=\"end\">\n <Container>\n <Row className=\"flex-nowrap\">\n <Col sm={1} className=\"d-flex\">\n <i\n className=\"fa fa-fw fa-square\"\n title=\"Gap\"\n style={{ alignSelf: 'center' }}\n />\n </Col>\n <Col sm={5}>\n {resolved.hgap && (\n <MotorDefault\n hardware={resolved.hgap}\n options={{ header: 'none' }}\n schema={schema}\n disabled={disabled}\n operator={operator}\n />\n )}\n </Col>\n <Col sm={1} className=\"d-flex\">\n <span style={{ alignSelf: 'center' }}>×</span>\n </Col>\n <Col sm={5}>\n {resolved.vgap && (\n <MotorDefault\n hardware={resolved.vgap}\n options={{ header: 'none' }}\n schema={schema}\n disabled={disabled}\n operator={operator}\n />\n )}\n </Col>\n </Row>\n <Row className=\"flex-nowrap\">\n <Col sm={1} className=\"d-flex\">\n <i\n className=\"fa fa-fw fa-arrows-up-down-left-right \"\n title=\"Offset\"\n style={{ alignSelf: 'center' }}\n />\n </Col>\n <Col sm={5}>\n {resolved.hoffset && (\n <MotorDefault\n hardware={resolved.hoffset}\n options={{ header: 'none' }}\n schema={schema}\n disabled={disabled}\n operator={operator}\n />\n )}\n </Col>\n <Col sm={1} className=\"d-flex\">\n <span style={{ alignSelf: 'center' }}>;</span>\n </Col>\n <Col sm={5}>\n {resolved.voffset && (\n <MotorDefault\n hardware={resolved.voffset}\n options={{ header: 'none' }}\n schema={schema}\n disabled={disabled}\n operator={operator}\n />\n )}\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nfunction Widget(props: HardwareWidgetProps<SlitSchema, SlitDefaultOptions>) {\n const { hardware, options = {} } = props;\n const resolved = useResolvedSlit(hardware);\n const { readonly: readOnly = false } = options;\n\n function normalizePosition(motor: MotorSchema | null): string {\n const position = motor?.properties?.position ?? null;\n if (position === null) {\n return '∅';\n }\n const digits =\n options.precision ?? motor?.properties?.display_digits ?? undefined;\n if (digits !== undefined) {\n return position.toFixed(digits);\n }\n return `${position}`;\n }\n\n const [gap, gapUnit, gapMoving, offset, offsetUnit, offsetMoving] =\n useMemo(() => {\n const gap = `${normalizePosition(resolved.hgap)} × ${normalizePosition(\n resolved.vgap\n )}`;\n\n const gapUnit =\n resolved.hgap?.properties.unit ?? resolved.vgap?.properties.unit ?? '?';\n\n const gapStates = new Set([\n ...(resolved.hgap?.properties.state ?? []),\n ...(resolved.vgap?.properties.state ?? []),\n ]);\n const gapMoving = gapStates.has('MOVING');\n\n const offset = `${normalizePosition(\n resolved.hoffset\n )} ; ${normalizePosition(resolved.voffset)}`;\n\n const offsetUnit =\n resolved.hoffset?.properties.unit ??\n resolved.voffset?.properties.unit ??\n '?';\n\n const offsetStates = new Set([\n ...(resolved.hoffset?.properties.state ?? []),\n ...(resolved.voffset?.properties.state ?? []),\n ]);\n const offsetMoving = offsetStates.has('MOVING');\n\n return [gap, gapUnit, gapMoving, offset, offsetUnit, offsetMoving];\n }, [resolved.hgap, resolved.hoffset, resolved.vgap, resolved.voffset]);\n\n return (\n <InputGroup className=\"w-100 flex-nowrap\">\n <InputGroup.Text title=\"Gap (horizontal and vertical)\">\n <i className=\"fa fa-fw fa-square fa-2x\" />\n </InputGroup.Text>\n <ReadOnlyTextInput\n value={gap}\n title=\"Gap\"\n className={classNames({ 'hw-moving': gapMoving })}\n />\n <InputGroup.Text>{gapUnit}</InputGroup.Text>\n <InputGroup.Text title=\"Offset (horizontal and vertical)\">\n <i className=\"fa fa-fw fa-arrows-up-down-left-right fa-2x\" />\n </InputGroup.Text>\n <ReadOnlyTextInput\n value={offset}\n title=\"Offset\"\n className={classNames({ 'hw-moving': offsetMoving })}\n />\n <InputGroup.Text>{offsetUnit}</InputGroup.Text>\n {!readOnly && <DropdownSlit {...props} resolved={resolved} />}\n </InputGroup>\n );\n}\n\nexport default function SlitDefault(\n props: HardwareWidgetProps<SlitSchema, SlitDefaultOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Slit\" icon=\"fam-hardware-motor\" online={hardware.online} />\n );\n\n const widgetState = <SlitState hardware={hardware} />;\n\n const widgetContent = <Widget {...props} />;\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type {\n Hardware,\n HardwareVariant,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport SlitDefault from './SlitDefault';\nimport SlitState from './SlitState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface SlitSchema extends Hardware {\n properties: {\n state: string;\n type: 'vertical' | 'horizontal' | 'both';\n hgap: string;\n vgap: string;\n hoffset: string;\n voffset: string;\n };\n}\n\nexport interface SlitDefaultOptions extends HardwareWidgetOptions {\n /** Number of decimals to show */\n precision?: number;\n /** Setup the widget to be read only */\n readonly?: boolean;\n}\n\nconst Variants: HardwareVariant<SlitSchema> = {\n default: SlitDefault,\n // Override default state\n state: SlitState,\n};\n\nexport default Variants;\n","import slit from './Slit.json';\nimport horizontal from './HSlit.json';\nimport vertical from './VSlit.json';\n\nexport const Mocks = {\n default: slit,\n horizontal,\n vertical,\n};\n","import { map } from 'lodash';\n\nimport {\n Badge,\n Button,\n InputGroup,\n Form,\n OverlayTrigger,\n Popover,\n Container,\n Row,\n Col,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { PumpSchema } from '.';\n\ninterface PumpWidgetOptions extends HardwareWidgetOptions {\n // Unit of pressure\n unit?: string;\n // Precision to show, default 3\n precision?: number;\n}\n\nfunction PumpOverlay(\n props: HardwareWidgetProps<PumpSchema, PumpWidgetOptions>\n) {\n const { hardware } = props;\n const toggle = () => {\n void hardware.actions.call(\n hardware.properties.state === 'ON' ? 'off' : 'on'\n );\n };\n\n const attrs = {\n Voltage: `${hardware.properties.voltage.toFixed(0)} V`,\n Current: `${(hardware.properties.current * 1000).toFixed(2)} mA`,\n };\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n\n <h6>Properties</h6>\n <Container>\n {map(attrs, (prop, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>{prop}</Col>\n </Row>\n ))}\n </Container>\n\n <div className=\"d-grid gap-2\">\n <Button\n disabled={props.disabled}\n onClick={toggle}\n variant={\n hardware.properties.state === 'ON' ? 'danger' : 'success'\n }\n >\n {hardware.properties.state === 'ON' ? 'Off' : 'On'}\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button title=\"Pump Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Pump(props: HardwareWidgetProps<PumpSchema, PumpWidgetOptions>) {\n const { hardware, options = {} } = props;\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Pump\"\n icon=\"fam-hardware-pump\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge bg={hardware.properties.state === 'ON' ? 'success' : 'danger'}>\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <InputGroup>\n <Form.Control\n value={hardware.properties.pressure.toExponential(\n options.precision || 3\n )}\n disabled\n />\n {(hardware.properties.unit || options.unit) && (\n <InputGroup.Text>\n {hardware.properties.unit || options.unit}\n </InputGroup.Text>\n )}\n <PumpOverlay {...props} />\n </InputGroup>\n </div>\n </div>\n );\n}\n\nexport default Pump;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Pump from './Pump';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface PumpSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n pressure: number;\n voltage: number;\n current: number;\n unit?: string; // FIXME: The server implementation is missing\n };\n}\n\nconst Variants: HardwareVariant<PumpSchema> = {\n default: Pump,\n};\n\nexport default Variants;\n","import defaultjson from './Pump.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { PusherSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function PusherState(props: { hardware: PusherSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n RETRACTED: 'success',\n IN_TOUCH: 'warning',\n MOVING_IN: 'warning',\n MOVING_OUT: 'warning',\n UNKNOWN: 'danger',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<PusherSchema>) {\n const { hardware } = props;\n return <PusherState hardware={hardware} />;\n}\n","import { Button, ButtonGroup } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { PusherState } from './PusherState';\nimport type { PusherSchema } from '.';\nimport { useState } from 'react';\n\nfunction PusherBlock(props: {\n hardware: EditableHardware<PusherSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n className: string;\n}) {\n const { className, hardware, options = {} } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n const isInTouch = state === 'IN_TOUCH';\n const disabled = !isInTouch || props.disabled;\n\n function ButtonPush(props: { distance: number }) {\n const { distance } = props;\n const [pushing, setPushing] = useState(false);\n return (\n <Button\n variant=\"secondary\"\n onClick={() => {\n setPushing(true);\n hardware.actions.call('push', distance).finally(() => {\n setPushing(false);\n });\n }}\n disabled={disabled}\n >\n <span className=\"text-nowrap\">\n <i\n className={\n pushing\n ? 'fa-solid fa-fw fa-cog fa-spin'\n : 'fa fa-fw fa-arrow-left'\n }\n />{' '}\n {distance}\n </span>\n </Button>\n );\n }\n return (\n <div\n className={className}\n style={{\n display: 'grid',\n gridTemplateRows: 'min-content min-content min-content',\n gridTemplateColumns: 'min-content min-content min-content',\n gridGap: '1px',\n }}\n >\n <ButtonPush distance={5} />\n <ButtonPush distance={0.5} />\n <ButtonPush distance={0.05} />\n <ButtonPush distance={2} />\n <ButtonPush distance={0.2} />\n <ButtonPush distance={0.02} />\n <ButtonPush distance={1} />\n <ButtonPush distance={0.1} />\n <ButtonPush distance={0.01} />\n </div>\n );\n}\n\nfunction RawPusher(props: {\n hardware: EditableHardware<PusherSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options, disabled } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n const isRetracted = state === 'RETRACTED';\n const isInTouch = state === 'IN_TOUCH';\n const [movingIn, setMovingIn] = useState(false);\n const [movingOut, setMovingOut] = useState(false);\n\n const location = isRetracted ? 'ms-auto' : isInTouch ? 'ms-0' : 'mx-auto';\n\n return (\n <div\n style={{\n display: 'grid',\n gridTemplateRows: 'min-content min-content',\n gridTemplateColumns: 'min-content auto',\n gridGap: '1px',\n }}\n >\n <i\n className={`${\n isInTouch ? 'fas fa-dizzy' : 'fa fa-smile'\n } fa-3x my-auto`}\n />\n <PusherBlock className={location} {...props} />\n <span />\n <ButtonGroup className=\"mx-auto\" style={{ width: '12em' }}>\n <Button\n onClick={() => {\n setMovingIn(true);\n hardware.actions.call('move_in').finally(() => {\n setMovingIn(false);\n });\n }}\n disabled={isInTouch || disabled || movingIn || movingOut}\n style={{ width: '5em' }}\n >\n <span className=\"text-nowrap\">\n <i\n className={\n movingIn\n ? 'fa-solid fa-fw fa-cog fa-spin'\n : 'fa fa-fw fa-arrow-left'\n }\n />{' '}\n In\n </span>\n </Button>\n <Button\n onClick={() => {\n setMovingOut(true);\n hardware.actions.call('move_out').finally(() => {\n setMovingOut(false);\n });\n }}\n disabled={isRetracted || disabled || movingIn || movingOut}\n style={{ width: '5em' }}\n >\n <span className=\"text-nowrap\">\n Out{' '}\n <i\n className={\n movingOut\n ? 'fa-solid fa-fw fa-cog fa-spin'\n : 'fa fa-fw fa-arrow-right'\n }\n />\n </span>\n </Button>\n </ButtonGroup>\n </div>\n );\n}\n\nexport default function Pusher(\n props: HardwareWidgetProps<PusherSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Pusher\"\n icon=\"fa-hand-point-right\"\n online={hardware.online}\n />\n );\n\n const widgetState = <PusherState hardware={hardware} />;\n\n function getWidgetContent() {\n return <RawPusher {...props} />;\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Pusher from './Pusher';\nimport PusherState from './PusherState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface PusherSchema extends Hardware {\n properties: {\n state: string;\n };\n}\n\nconst Variants: HardwareVariant<PusherSchema> = {\n default: Pusher,\n // Override base state\n state: PusherState,\n};\n\nexport default Variants;\n","import defaultjson from './Pusher.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function PusherSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [state, setState] = useState('RETRACTED');\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'move_in') {\n setState('MOVING_IN');\n await delay(2000);\n setState('IN_TOUCH');\n return;\n }\n if (name === 'move_out') {\n setState('MOVING_OUT');\n await delay(2000);\n setState('RETRACTED');\n return;\n }\n if (name === 'push') {\n await delay(100);\n return;\n }\n console.log('PusherSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log('PusherSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = { state };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"pusher\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { HardwareState } from '../utils/State';\nimport type { ServiceSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function ServiceState(props: { hardware: ServiceSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n STOPPED: 'danger',\n STARTING: 'warning',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'warning',\n EXITED: 'secondary',\n FATAL: 'fatal',\n UNKNOWN: 'fatal',\n OFFLINE: 'secondary',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<ServiceSchema>\n) {\n const { hardware } = props;\n return <ServiceState hardware={hardware} />;\n}\n","import { Form, Button, InputGroup } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { ServiceState } from './ServiceState';\nimport type { ServiceSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nexport default function ServiceDefault(\n props: HardwareWidgetProps<ServiceSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Shutter\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ServiceState hardware={hardware} />;\n\n function requestStart() {\n void hardware.actions.call('start');\n }\n\n function requestRestart() {\n void hardware.actions.call('restart');\n }\n\n function requestStop() {\n void hardware.actions.call('stop');\n }\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function capitalize(s: string) {\n return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n }\n\n const state = getState();\n const label = capitalize(state);\n const variants: { [name: string]: string } = {\n STOPPED: 'danger',\n STARTING: 'warning',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'warning',\n EXITED: 'secondary',\n FATAL: 'fatal',\n UNKNOWN: 'secondary',\n OFFLINE: 'secondary',\n };\n const variant = variants[state] || 'danger';\n\n function getStartAction() {\n const restartEnabled = state === 'RUNNING' || state === 'STARTING';\n return {\n icon: restartEnabled ? 'fa fa-refresh fa-wp' : 'fa fa-play fa-wp',\n variant: props.disabled ? '' : 'success',\n callback: state === 'RUNNING' ? requestRestart : requestStart,\n disabled: props.disabled,\n title: !props.operator\n ? 'You dont have the control to the session'\n : restartEnabled\n ? 'Restart the service'\n : 'Start the serStaticTextInputvice',\n };\n }\n\n function getStopAction() {\n const stopEnabled = state === 'RUNNING' || state === 'STARTING';\n return {\n icon: 'fa fa-stop fa-wp',\n variant: props.disabled ? '' : !stopEnabled ? 'secondary' : 'danger',\n callback: requestStop,\n disabled: props.disabled,\n title: !props.operator\n ? 'You dont have the control to the session'\n : 'Stop the service',\n };\n }\n\n const startAction = getStartAction();\n const stopAction = getStopAction();\n\n const widgetContent = (\n <InputGroup className=\"d-flex flex-nowrap\">\n <ReadOnlyTextInput\n variant={variant}\n className=\"text-center\"\n style={{ minWidth: '8em' }}\n value={label}\n />\n <Button\n style={{ width: '2.5em' }}\n variant=\"light\"\n className={`px-0 text-${startAction.variant}`}\n onClick={startAction.callback}\n disabled={startAction.disabled}\n title={startAction.title}\n >\n <i className={`${startAction.icon}`} />\n </Button>\n <Button\n style={{ width: '2.5em' }}\n variant=\"light\"\n className={`px-0 text-${stopAction.variant}`}\n onClick={stopAction.callback}\n disabled={stopAction.disabled}\n title={stopAction.title}\n >\n <i className={`${stopAction.icon}`} />\n </Button>\n </InputGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import {\n InputGroup,\n Button,\n Popover,\n Row,\n Col,\n OverlayTrigger,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { ServiceState } from './ServiceState';\nimport type { ServiceSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nexport interface ServiceProectedOptions extends HardwareWidgetOptions {\n /** Direction to drop the menu */\n dropDirection?: string;\n}\n\nfunction DropdownService(\n props: HardwareWidgetProps<ServiceSchema, ServiceProectedOptions>\n) {\n const { hardware, options = {} } = props;\n function requestStart() {\n void hardware.actions.call('start');\n }\n\n function requestRestart() {\n void hardware.actions.call('restart');\n }\n\n function requestStop() {\n void hardware.actions.call('stop');\n }\n\n const state = hardware.properties?.state ?? 'UNKNOWN';\n const hardwareDisabled = state === 'STOPPING' || state === 'STARTING';\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n placement={options.dropDirection === 'up' ? 'top' : 'bottom'}\n overlay={\n <Popover id=\"service-protected-overlay\">\n <Popover.Body>\n <Row>\n <Col className=\"text-center\">Actions</Col>\n </Row>\n <Row>\n <Col>\n {state === 'RUNNING' && (\n <Button\n className=\"me-1 text-success border-secondary\"\n variant=\"light\"\n onClick={() => {\n requestRestart();\n }}\n disabled={props.disabled}\n title=\"Restart the service\"\n >\n <i className=\"fa fa-refresh fa-wp me-1\" />\n Restart\n </Button>\n )}\n {state !== 'RUNNING' && (\n <Button\n className=\"me-1 text-success border-secondary\"\n variant=\"light\"\n onClick={() => {\n requestStart();\n }}\n disabled={props.disabled}\n title=\"Start the service\"\n >\n <i className=\"fa fa-play fa-wp me-1\" />\n Start\n </Button>\n )}\n <Button\n className={`text-${\n state !== 'STOPPED' ? 'danger' : 'primary'\n } border-secondary`}\n variant=\"light\"\n onClick={() => {\n requestStop();\n }}\n disabled={props.disabled}\n title=\"Stop the service\"\n >\n <i className=\"fa fa-stop fa-wp me-1\" />\n Stop\n </Button>\n </Col>\n </Row>\n </Popover.Body>\n </Popover>\n }\n >\n <Button disabled={props.disabled || hardwareDisabled}>\n <i\n className={`fa fa-caret-${\n options.dropDirection === 'up' ? 'up' : 'down'\n }`}\n />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport default function ServiceProtected(\n props: HardwareWidgetProps<ServiceSchema, ServiceProectedOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Shutter\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ServiceState hardware={hardware} />;\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function capitalize(s: string) {\n return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n }\n\n const state = getState();\n const hardwareDisabled = state === 'STOPPING' || state === 'STARTING';\n\n const variants: { [name: string]: string } = {\n STOPPED: 'danger',\n STARTING: 'warning',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'warning',\n EXITED: 'secondary',\n FATAL: 'fatal',\n UNKNOWN: 'fatal',\n OFFLINE: 'secondary',\n };\n const variant = variants[state];\n const valueName = capitalize(state);\n\n const widgetContent = (\n <InputGroup className=\"d-flex flex-nowrap\">\n <ReadOnlyTextInput\n variant={variant}\n style={{ minWidth: '10em' }}\n value={valueName}\n className=\"text-center\"\n />\n <DropdownService {...props} />\n </InputGroup>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport ServiceDefault from './ServiceDefault';\nimport ServiceProtected from './ServiceProtected';\nimport ServiceState from './ServiceState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface ServiceSchema extends Hardware {\n properties: {\n state:\n | 'STOPPED'\n | 'STARTING'\n | 'RUNNING'\n | 'BACKOFF'\n | 'STOPPING'\n | 'EXITED'\n | 'FATAL'\n | 'UNKNOWN';\n };\n}\n\nconst Variants: HardwareVariant<ServiceSchema> = {\n default: ServiceDefault,\n protected: ServiceProtected,\n // Override base state\n state: ServiceState,\n};\n\nexport default Variants;\n","import defaultjson from './Service.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { TomoFlatMotionSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoFlatMotionState(props: { hardware: TomoFlatMotionSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n UNKNOWN: 'danger',\n READY: 'success',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoFlatMotionSchema>\n) {\n const { hardware } = props;\n return <TomoFlatMotionState hardware={hardware} />;\n}\n","import type {\n HardwareWidgetProps,\n HardwareChangeActions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport {\n Container,\n Row,\n Col,\n ButtonGroup,\n Button,\n InputGroup,\n Form,\n} from 'react-bootstrap';\nimport { TomoFlatMotionState } from './TomoFlatMotionState';\nimport type { TomoFlatMotionStep, TomoFlatMotionSchema } from '.';\nimport { useMotorHardware } from '../motor';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\nimport { Fragment } from 'react';\nimport { useMemo } from 'react';\nimport { useEffect } from 'react';\nimport { useRef, useState } from 'react';\n\nfunction AxisName(props: { motion: TomoFlatMotionStep; disabled?: boolean }) {\n const { motion } = props;\n const axisRef = motion.axisRef;\n const axisId = axisRef.slice(9);\n const axis = useMotorHardware(axisId);\n const name = axis?.alias ?? axis?.name ?? axis?.id ?? axisId;\n return <div className=\"my-auto\">{name}</div>;\n}\n\nfunction DropAxis(props: {\n actions: HardwareChangeActions;\n motion: TomoFlatMotionStep;\n disabled?: boolean;\n}) {\n const { motion, actions, disabled } = props;\n const axisRef = motion.axisRef;\n\n function requestDropAxis() {\n void actions.call('update_axis', { axis_ref: axisRef });\n }\n\n return (\n <Button variant=\"danger\" onClick={requestDropAxis} disabled={disabled}>\n <i className=\"fa fa-trash\" />\n </Button>\n );\n}\n\nfunction AxisOnOff(props: {\n actions: HardwareChangeActions;\n axisRef: string;\n motion: TomoFlatMotionStep[];\n disabled?: boolean;\n}) {\n const { motion, actions, axisRef, disabled } = props;\n\n const isUsed = useMemo(() => {\n for (const m of motion) {\n if (m.axisRef === axisRef) {\n return true;\n }\n }\n return false;\n }, [motion, axisRef]);\n\n const axisId = axisRef.slice(9);\n const axis = useMotorHardware(axisId);\n const name = axis?.alias ?? axis?.name ?? axis?.id ?? axisId;\n\n function requestAppendAxis() {\n void actions.call('update_axis', {\n axis_ref: axisRef,\n relative_position: 0,\n });\n }\n\n return (\n <Button\n className=\"ms-1\"\n variant={isUsed ? 'primary' : 'secondary'}\n onClick={() => {\n if (!isUsed) requestAppendAxis();\n }}\n title={\n isUsed\n ? 'This axis is already part of the motion'\n : 'Use this axis in the motion'\n }\n disabled={disabled}\n >\n {name}\n </Button>\n );\n}\n\nfunction InputAxisMotion(props: {\n actions: HardwareChangeActions;\n motion: TomoFlatMotionStep;\n disabled?: boolean;\n}) {\n const { motion, actions } = props;\n const axisRef = motion.axisRef;\n const position = motion.absolute_position ?? motion.relative_position ?? 0;\n\n const axisId = axisRef.slice(9);\n const axis = useMotorHardware(axisId);\n const disabled = props.disabled || !axis?.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n const unit = axis?.properties?.unit ?? '';\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n const newPosition = Number.parseFloat(formRef.current.value);\n void actions.call('update_axis', {\n axis_ref: axisRef,\n absolute_position:\n motion.absolute_position !== null ? newPosition : null,\n relative_position:\n motion.relative_position !== null ? newPosition : null,\n });\n } else if (e.key === 'Escape') {\n formRef.current.value = position.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== position && !edited) {\n setEdited(true);\n }\n if (exp === position && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = position.toFixed(digits);\n }\n }, [edited, position]);\n\n return (\n <InputGroup className=\"w-100\">\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={position.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>{unit}</InputGroup.Text>\n </InputGroup>\n );\n}\n\nfunction MotionKind(props: {\n actions: HardwareChangeActions;\n motion: TomoFlatMotionStep;\n disabled?: boolean;\n}) {\n const { actions, motion, disabled } = props;\n\n function requestAbsoluteMotion() {\n void actions.call('update_axis', {\n axis_ref: motion.axisRef,\n absolute_position: motion.absolute_position ?? motion.relative_position,\n });\n }\n\n function requestRelativeMotion() {\n void actions.call('update_axis', {\n axis_ref: motion.axisRef,\n relative_position: motion.absolute_position ?? motion.relative_position,\n });\n }\n\n return (\n <ButtonGroup>\n <Button\n onClick={requestAbsoluteMotion}\n variant={motion.absolute_position !== null ? 'primary' : 'secondary'}\n disabled={disabled}\n >\n Abs\n </Button>\n <Button\n onClick={requestRelativeMotion}\n variant={motion.relative_position !== null ? 'primary' : 'secondary'}\n disabled={disabled}\n >\n Rel\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function TomoFlatMotionDefault(\n props: HardwareWidgetProps<TomoFlatMotionSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { properties } = hardware;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoFlatMotion\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoFlatMotionState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <Row className=\"mt-1\">\n <Col xs={3}>Move in parallel</Col>\n <Col xs={9}>{properties.move_in_parallel ? 'true' : 'false'}</Col>\n </Row>\n <Row className=\"mt-1\">\n <Col xs={3}>Switch power on/off</Col>\n <Col xs={9}>{properties.power_onoff ? 'true' : 'false'}</Col>\n </Row>\n <Row className=\"mt-1\">\n <Col xs={3}>Settle time</Col>\n <Col xs={9}>\n {properties.settle_time.toFixed(2)} <span title=\"seconds\">s</span>\n </Col>\n </Row>\n <Row className=\"mt-1\">\n <Col xs={3}>Available axes</Col>\n <Col xs={9}>\n {properties.available_axes.map((axisRef) => {\n return (\n <AxisOnOff\n key={axisRef}\n axisRef={axisRef}\n motion={properties.motion}\n actions={hardware.actions}\n disabled={disabled}\n />\n );\n })}\n </Col>\n </Row>\n <Row className=\"mt-1\">\n <Col xs={3}>Actual motion</Col>\n <Col xs={9}>\n <div\n style={{\n display: 'grid',\n gridGap: 5,\n gridTemplateColumns: 'min-content min-content auto min-content',\n }}\n >\n <div>Axis</div>\n <div>Kind</div>\n <div>Displacement</div>\n <div />\n {properties.motion.map((motion, imotion) => {\n return (\n <Fragment key={`motion${imotion}`}>\n <AxisName motion={motion} />\n <MotionKind\n motion={motion}\n actions={hardware.actions}\n disabled={disabled}\n />\n <InputAxisMotion\n motion={motion}\n actions={hardware.actions}\n disabled={disabled}\n />\n <DropAxis\n motion={motion}\n actions={hardware.actions}\n disabled={disabled}\n />\n </Fragment>\n );\n })}\n </div>\n </Col>\n </Row>\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type {\n HardwareWidgetProps,\n HardwareChangeActions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { InputGroup, Form, Stack, Alert } from 'react-bootstrap';\nimport { TomoFlatMotionState } from './TomoFlatMotionState';\nimport type { TomoFlatMotionStep, TomoFlatMotionSchema } from '.';\nimport { useMotorHardware } from '../motor';\nimport { useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\n\nfunction InputAxisMotion(props: {\n actions: HardwareChangeActions;\n motion: TomoFlatMotionStep;\n disabled?: boolean;\n}) {\n const { motion, actions } = props;\n const axisRef = motion.axisRef;\n const position = motion.absolute_position ?? motion.relative_position ?? 0;\n\n const axisId = axisRef.slice(9);\n const axis = useMotorHardware(axisId);\n const disabled = props.disabled || !axis?.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n const unit = axis?.properties?.unit ?? '';\n const name = axis?.alias ?? axis?.name ?? axis?.id ?? 'none';\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n const newPosition = Number.parseFloat(formRef.current.value);\n void actions.call('update_axis', {\n axis_ref: axisRef,\n absolute_position:\n motion.absolute_position !== null ? newPosition : null,\n relative_position:\n motion.relative_position !== null ? newPosition : null,\n });\n } else if (e.key === 'Escape') {\n formRef.current.value = position.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== position && !edited) {\n setEdited(true);\n }\n if (exp === position && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = position.toFixed(digits);\n }\n }, [edited, position]);\n\n function getKind(): [string, string, string] {\n if (motion.absolute_position !== null) {\n return ['ABS', 'warning', 'Absolute displacement'];\n }\n if (motion.relative_position !== null) {\n return ['REL', 'none', 'Relative displacement'];\n }\n return ['ERR', 'danger', 'Unknown motion kind'];\n }\n const [kind, kindVariant, kindTitle] = getKind();\n\n return (\n <InputGroup className=\"w-100\">\n <InputGroup.Text\n title=\"Displacement to apply on this axis to take a flat\"\n style={{ width: '5em' }}\n >\n {name}\n </InputGroup.Text>\n <InputGroup.Text\n className={`bg-${kindVariant}`}\n title={kindTitle}\n style={{ width: '3em' }}\n >\n {kind}\n </InputGroup.Text>\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={position.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>{unit}</InputGroup.Text>\n </InputGroup>\n );\n}\n\nexport default function TomoFlatMotionSmall(\n props: HardwareWidgetProps<TomoFlatMotionSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { properties } = hardware;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoFlatMotion\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoFlatMotionState hardware={hardware} />;\n\n const widgetContent = (\n <>\n {properties.motion.length === 0 && (\n <Alert variant=\"danger\" className=\"mb-0\">\n No flat motion defined\n </Alert>\n )}\n {properties.motion.length > 0 && (\n <Stack direction=\"vertical\">\n {properties.motion.map((motion, imotion) => {\n return (\n <InputAxisMotion\n key={motion.axisRef}\n actions={hardware.actions}\n motion={motion}\n disabled={disabled}\n />\n );\n })}\n </Stack>\n )}\n </>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import TomoFlatMotionDefault from './TomoFlatMotionDefault';\nimport TomoFlatMotionSmall from './TomoFlatMotionSmall';\nimport TomoFlatMotionState from './TomoFlatMotionState';\nimport type { Hardware, HardwareVariant } from '../utils/types';\nimport { useHardware } from '../../registry/hooks';\n\nexport interface TomoFlatMotionStep {\n /** Axis reference, following the pattern `hardware:my_axis` */\n axisRef: string;\n absolute_position: number | null;\n relative_position: number | null;\n}\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoFlatMotionSchema extends Hardware {\n properties: {\n state: 'READY';\n available_axes: string[];\n motion: TomoFlatMotionStep[];\n move_in_parallel: boolean;\n power_onoff: boolean;\n settle_time: number;\n };\n}\n\nconst Variants: HardwareVariant<TomoFlatMotionSchema> = {\n default: TomoFlatMotionDefault,\n small: TomoFlatMotionSmall,\n // Override base state\n state: TomoFlatMotionState,\n};\n\nexport default Variants;\n\nexport function isTomoFlatMotionHardware(\n entity: Hardware\n): entity is TomoFlatMotionSchema {\n return entity.type === 'tomoflatmotion';\n}\n\nexport function useTomoFlatMotionHardware(\n name: string | null\n): TomoFlatMotionSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoFlatMotionHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import defaultjson from './TomoFlatMotion.json';\nimport sy from './sy.json';\nimport sy2 from './sy2.json';\n\nexport const Mocks = {\n default: defaultjson,\n sy,\n sy2,\n};\n","import { useState } from 'react';\nimport type { TomoFlatMotionSchema } from '..';\nimport { Simulator } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function TomoFlatMotionSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n\n const [properties, setProperties] = useState<\n TomoFlatMotionSchema['properties']\n >({\n state: 'READY',\n settle_time: 2,\n power_onoff: false,\n move_in_parallel: true,\n available_axes: ['hardware:sy', 'hardware:sy2'],\n motion: [\n {\n axisRef: 'hardware:sy',\n absolute_position: null,\n relative_position: 1,\n },\n ],\n });\n\n function updateAxes(\n props: TomoFlatMotionSchema['properties'],\n axis: {\n axis_ref: string;\n relative_position?: number;\n absolute_position?: number;\n }\n ): TomoFlatMotionSchema['properties'] {\n const motion: TomoFlatMotionSchema['properties']['motion'] = [];\n let inList = false;\n props.motion.forEach((m) => {\n if (m.axisRef === axis.axis_ref) {\n inList = true;\n if (\n axis.relative_position === undefined &&\n axis.absolute_position === undefined\n ) {\n return;\n }\n motion.push({\n axisRef: axis.axis_ref,\n relative_position: axis.relative_position ?? null,\n absolute_position: axis.absolute_position ?? null,\n });\n return;\n }\n motion.push(m);\n });\n if (!inList) {\n motion.push({\n axisRef: axis.axis_ref,\n relative_position: axis.relative_position ?? null,\n absolute_position: axis.absolute_position ?? null,\n });\n }\n return {\n ...props,\n motion,\n };\n }\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'update_axis') {\n setProperties((p) => {\n return updateAxes(p, value);\n });\n return;\n }\n console.log('TomoFlatMotionSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log(\n 'TomoFlatMotionSimulator: Unsupported setProperty',\n name,\n value\n );\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"tomoflatmotion\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { Button } from 'react-bootstrap';\nimport type { TomoReferencePositionSchema } from '.';\n\nexport default function TomoReferencePositionDefault(\n props: HardwareWidgetProps<TomoReferencePositionSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { actions } = hardware;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoReferencePositionSchema\"\n icon=\"fam-hardware-motor\"\n online={hardware.online}\n />\n );\n\n function moveToReference() {\n void actions.call('move_to_reference');\n }\n\n const widgetState = <></>;\n\n const widgetContent = (\n <Button\n className=\"w-100\"\n onClick={() => {\n moveToReference();\n }}\n disabled={disabled}\n >\n Back to parking position\n </Button>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoReferencePositionDefault from './TomoReferencePositionDefault';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoReferencePositionSchema extends Hardware {\n properties: Record<string, never>;\n}\n\nexport function isTomoReferencePositionHardware(\n entity: Hardware\n): entity is TomoReferencePositionSchema {\n return entity.type === 'tomoreferenceposition';\n}\n\nconst Variants: HardwareVariant<TomoReferencePositionSchema> = {\n default: TomoReferencePositionDefault,\n};\n\nexport default Variants;\n","import { HardwareState } from '../utils/State';\nimport type { TomoDetectorSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoDetectorState(props: { hardware: TomoDetectorSchema }) {\n const { hardware } = props;\n const { online, locked = null } = hardware;\n const state = online\n ? (locked !== null ? 'LOCKED' : hardware.properties.state) || 'UNKNOWN'\n : 'OFFLINE';\n\n const variants: { [state: string]: string } = {\n UNKNOWN: 'danger',\n READY: 'success',\n OFFLINE: 'secondary',\n INVALID: 'danger',\n MOUNTING: 'warning',\n UNMOUNTING: 'warning',\n LOCKED: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoDetectorSchema>\n) {\n const { hardware } = props;\n return <TomoDetectorState hardware={hardware} />;\n}\n","import {\n InputGroup,\n Dropdown,\n Container,\n Row,\n Col,\n ButtonGroup,\n Button,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { TomoDetectorSchema } from '.';\nimport { TomoDetectorState } from './TomoDetectorState';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport Qty from 'js-quantities';\nimport { useMemo } from 'react';\nimport { HardwareInputNumber } from '../..';\n\ninterface TomoDetectorSamplePixelSizeOptions extends HardwareWidgetOptions {\n /* The unit to be used to display the pixel size.\n\n FIXME: If undefined it is actually serialized as `null`. In the future,\n this should be instead converted to `undefined`.\n */\n display_unit?: string | null;\n}\n\n/**\n * Widget to select the mouse mode for the tomo view\n */\nfunction SelectPixelSizeMode(\n props: HardwareWidgetProps<\n TomoDetectorSchema,\n TomoDetectorSamplePixelSizeOptions\n > & { style: { [key: string]: any } }\n) {\n const { hardware, options = {} } = props;\n function requestMode(value: string) {\n if (hardware.actions) {\n void hardware.actions.setProperty('sample_pixel_size_mode', value);\n } else {\n console.error('Change request was triggered with:', value);\n }\n return null;\n }\n const mode = hardware.properties.sample_pixel_size_mode;\n\n return (\n <Dropdown style={props.style}>\n <ButtonGroup>\n <Button\n variant={mode === 'USER' ? 'primary' : 'secondary'}\n onClick={() => {\n requestMode('USER');\n }}\n disabled={props.disabled}\n title=\"Use a fixed pixel size defined by the user\"\n >\n USER\n </Button>\n <Button\n variant={mode === 'AUTO' ? 'primary' : 'secondary'}\n onClick={() => {\n requestMode('AUTO');\n }}\n disabled={props.disabled}\n title=\"Compute the pixel size automatically based on the beamline geometry\"\n >\n AUTO\n </Button>\n </ButtonGroup>\n </Dropdown>\n );\n}\n\nfunction InputUserPixelSize(\n props: HardwareWidgetProps<\n TomoDetectorSchema,\n TomoDetectorSamplePixelSizeOptions\n >\n) {\n const { hardware, options = {} } = props;\n const userSamplePixelSize = hardware.properties.user_sample_pixel_size || 0;\n const { state } = hardware.properties;\n const hardwareReady = state === 'READY';\n\n function requestUserSamplePixelSize(value: number) {\n if (hardware.actions) {\n void hardware.actions.setProperty('user_sample_pixel_size', value);\n } else {\n console.error('Change request was triggered with:', value);\n }\n return null;\n }\n\n return (\n <HardwareInputNumber\n hardwareValue={userSamplePixelSize}\n onMoveRequested={requestUserSamplePixelSize}\n hardwareIsDisabled={false}\n hardwareIsReady={hardwareReady}\n hardwareIsMoving={false}\n readOnly={hardware.properties.sample_pixel_size_mode !== 'USER'}\n />\n );\n}\n\nfunction DropdownPixelSize(\n props: HardwareWidgetProps<\n TomoDetectorSchema,\n TomoDetectorSamplePixelSizeOptions\n >\n) {\n const { hardware, options = {} } = props;\n const hardwareReady = hardware.properties.state === 'READY';\n return (\n <Dropdown>\n <Dropdown.Toggle disabled={props.disabled} variant=\"secondary\" />\n <Dropdown.Menu>\n <Container>\n <Row>\n <Col className=\"text-center\">Mode</Col>\n </Row>\n <Row>\n <Col>\n <SelectPixelSizeMode {...props} style={{ width: '100%' }} />\n </Col>\n </Row>\n <Row>\n <Col className=\"text-center mt-1\">User pixel size</Col>\n </Row>\n <Row>\n <Col>\n <InputGroup>\n <InputUserPixelSize {...props} />\n <InputGroup.Text>um</InputGroup.Text>\n </InputGroup>\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nfunction useFormattedQuantity(\n value: number | null,\n unit: string,\n displayUnit: string\n): [string, string] {\n return useMemo(() => {\n function normUnit(u: string): string {\n if (u === 'um') {\n return 'μm';\n }\n return u;\n }\n function normValue(v: number): string {\n return v.toFixed(2).replace(/\\.?0+$/, '');\n }\n if (value === null || value === undefined) {\n return ['∅', ''];\n }\n if (unit === displayUnit) {\n return [normValue(value), normUnit(displayUnit)];\n }\n const q = Qty(value, unit);\n return [normValue(q.to(displayUnit).scalar), normUnit(displayUnit)];\n }, [value, unit, displayUnit]);\n}\n\nexport default function TomoDetectorSamplePixelSize(\n props: HardwareWidgetProps<\n TomoDetectorSchema,\n TomoDetectorSamplePixelSizeOptions\n >\n) {\n const { hardware, options = {} } = props;\n const displayUnit = options.display_unit ?? 'um';\n const widgetIcon = (\n <TypeIcon name=\"TomoDetector\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <TomoDetectorState hardware={hardware} />;\n\n const [formattedValue, unit] = useFormattedQuantity(\n hardware.properties.sample_pixel_size,\n 'um',\n displayUnit\n );\n\n const widgetContent = (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text\n className=\"justify-content-center\"\n style={{ minWidth: '4em' }}\n >\n {hardware.properties.sample_pixel_size_mode}\n </InputGroup.Text>\n <ReadOnlyTextInput\n value={formattedValue}\n title={`${hardware.properties.sample_pixel_size} um`}\n />\n <InputGroup.Text>{unit}</InputGroup.Text>\n <DropdownPixelSize {...props} />\n </InputGroup>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import {\n InputGroup,\n Dropdown,\n Container,\n Row,\n Col,\n ButtonGroup,\n Button,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n HardwareChangeActions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { TomoDetectorSchema } from '.';\nimport { TomoDetectorState } from './TomoDetectorState';\nimport type { LimaSchema } from '../lima';\nimport { isLimaHardware } from '../lima';\nimport { useHardware } from '../../registry/hooks';\nimport { useHardwareChangeActions } from '../../registry/hooks';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport { HardwareInputNumber } from '../..';\n\n/**\n * Widget to select the acquisition mode\n */\nfunction AcquisitionMode(\n props: HardwareWidgetProps<TomoDetectorSchema, HardwareWidgetOptions> &\n HardwareWidgetOptions & { style: { [key: string]: any } }\n) {\n const { hardware, options = {} } = props;\n function requestMode(value: string) {\n if (hardware.actions) {\n void hardware.actions.setProperty('acq_mode', value);\n } else {\n console.error('Change request was triggered with:', value);\n }\n return null;\n }\n const mode = hardware.properties.acq_mode;\n\n return (\n <Dropdown style={props.style}>\n <ButtonGroup>\n <Button\n variant={mode === 'SINGLE' ? 'primary' : 'secondary'}\n onClick={() => {\n requestMode('SINGLE');\n }}\n disabled={props.disabled}\n title=\"Do acquisition in a single shot\"\n >\n SINGLE\n </Button>\n <Button\n variant={mode === 'ACCUMULATION' ? 'primary' : 'secondary'}\n onClick={() => {\n requestMode('ACCUMULATION');\n }}\n disabled={props.disabled}\n title=\"Do acqisition in multiple sub frame with accumulation\"\n >\n ACCU\n </Button>\n </ButtonGroup>\n </Dropdown>\n );\n}\n\nfunction InputAccMaxExpoTime(props: {\n hardware: LimaSchema;\n actions: HardwareChangeActions;\n}) {\n const { hardware, actions } = props;\n const value = hardware.properties.acc_max_expo_time || 0;\n const { state } = hardware.properties;\n const hardwareReady = state === 'READY';\n\n function requestUpdate(value: number) {\n void actions.setProperty('acc_max_expo_time', value);\n return null;\n }\n\n return (\n <HardwareInputNumber\n hardwareValue={value}\n onMoveRequested={requestUpdate}\n hardwareIsDisabled={false}\n hardwareIsReady={hardwareReady}\n hardwareIsMoving={false}\n readOnly={hardware.properties.state !== 'READY'}\n />\n );\n}\n\nfunction useLimaHardware(id: string): LimaSchema | null {\n const lima = useHardware(id);\n if (lima !== null && isLimaHardware(lima)) {\n return lima;\n }\n return null;\n}\n\nfunction DropdownAcquisitionMode(\n props: HardwareWidgetProps<TomoDetectorSchema, HardwareWidgetOptions>\n) {\n const { hardware } = props;\n const { properties } = hardware;\n const limaId = properties.detector.slice(9);\n const lima = useLimaHardware(limaId);\n const limaActions = useHardwareChangeActions(limaId);\n\n return (\n <Dropdown>\n <Dropdown.Toggle disabled={props.disabled} variant=\"secondary\" />\n <Dropdown.Menu>\n <Container>\n <Row>\n <Col className=\"text-center\">Acquisition mode</Col>\n </Row>\n <Row>\n <Col>\n <AcquisitionMode {...props} style={{ width: '100%' }} />\n </Col>\n </Row>\n <Row>\n <Col className=\"text-center mt-1\">Max sub frame exposition</Col>\n </Row>\n <Row>\n <Col>\n {lima && (\n <InputGroup>\n <InputAccMaxExpoTime hardware={lima} actions={limaActions} />\n <InputGroup.Text>um</InputGroup.Text>\n </InputGroup>\n )}\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport default function TomoDetectorAcquisitionMode(\n props: HardwareWidgetProps<TomoDetectorSchema, HardwareWidgetOptions>\n) {\n const { hardware } = props;\n const widgetIcon = (\n <TypeIcon name=\"TomoDetector\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <TomoDetectorState hardware={hardware} />;\n\n const widgetContent = (\n <InputGroup className=\"flex-nowrap\">\n <ReadOnlyTextInput value={hardware.properties.acq_mode} />\n <DropdownAcquisitionMode {...props} />\n </InputGroup>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoDetectorSamplePixelSize from './TomoDetectorSamplePixelSize';\nimport TomoDetectorAcquisitionMode from './TomoDetectorAcquisitionMode';\nimport TomoDetectorState from './TomoDetectorState';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoDetectorSchema extends Hardware {\n properties: {\n state: string;\n user_sample_pixel_size: number | null;\n sample_pixel_size_mode: string;\n sample_pixel_size: number | null;\n field_of_view: number;\n detector: string;\n optic: string;\n source_distance: number | null;\n acq_mode: 'MANUAL' | 'SINGLE' | 'ACCUMULATION';\n };\n}\n\nconst Variants: HardwareVariant<TomoDetectorSchema> = {\n samplepixelsize: TomoDetectorSamplePixelSize,\n acquisitionmode: TomoDetectorAcquisitionMode,\n // Override base state\n state: TomoDetectorState,\n};\n\nexport default Variants;\n\nexport function isTomoDetectorHardware(\n entity: Hardware\n): entity is TomoDetectorSchema {\n return entity.type === 'tomodetector';\n}\n\nexport function useTomoDetectorHardware(\n name: string | null\n): TomoDetectorSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoDetectorHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import defaultjson from './TomoDetector.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { TomoDetectorsSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoDetectorsState(props: { hardware: TomoDetectorsSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n READY: 'success',\n MOUNTING: 'warning',\n UNMOUNTING: 'warning',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoDetectorsSchema>\n) {\n const { hardware } = props;\n return <TomoDetectorsState hardware={hardware} />;\n}\n","import classNames from 'classnames';\nimport { Dropdown, InputGroup } from 'react-bootstrap';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { TomoDetectorsState } from './TomoDetectorsState';\nimport type { TomoDetectorsSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nfunction getHardwareIdFromRef(ref: string | undefined) {\n if (!ref) {\n return null;\n }\n if (!ref.startsWith('hardware:')) {\n // FIXME: Handle user error, the content is not of hardware kind\n return null;\n }\n return ref.slice(9);\n}\n\nfunction DropdownDetectors(props: HardwareWidgetProps<TomoDetectorsSchema>) {\n const { hardware } = props;\n const { properties } = hardware;\n const { detectors } = properties;\n const activeDetectorId = getHardwareIdFromRef(properties.active_detector);\n const targetDetectorId = getHardwareIdFromRef(properties.target_detector);\n const hardwareReady = properties.state === 'READY';\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n\n function mountDetector(detectorId: string | null) {\n if (hardware.actions) {\n void hardware.actions.call('mount', detectorId);\n } else {\n console.error('Change request was triggered with:', detectorId);\n }\n }\n\n function createSelectableItem(detectorRef: string) {\n const detectorId = getHardwareIdFromRef(detectorRef);\n const selected = detectorId === (targetDetectorId || activeDetectorId);\n const icon = selected ? 'fa fa-fw fa-dot-circle-o' : 'fa fa-fw fa-circle-o';\n\n return (\n <Dropdown.Item\n key={detectorRef}\n disabled={disabled}\n onClick={() => {\n mountDetector(detectorId);\n }}\n >\n <i className={icon} />\n &nbsp; {detectorId}\n </Dropdown.Item>\n );\n }\n\n return (\n <Dropdown>\n <Dropdown.Toggle disabled={disabled} variant=\"secondary\" />\n <Dropdown.Menu>\n {detectors.map((m) => createSelectableItem(m))}\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport default function TomoDetectors(\n props: HardwareWidgetProps<TomoDetectorsSchema>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Optic\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoDetectorsState hardware={hardware} />;\n\n const { properties } = hardware;\n const hardwareMounting = properties.state === 'MOUNTING';\n const activeDetectorId = getHardwareIdFromRef(properties.active_detector);\n const targetDetectorId = getHardwareIdFromRef(properties.target_detector);\n\n function getWidgetContent() {\n return (\n <InputGroup>\n <ReadOnlyTextInput\n className={classNames({\n 'hw-moving': hardwareMounting,\n })}\n value={targetDetectorId || activeDetectorId || 'No detector'}\n />\n <DropdownDetectors {...props} />\n </InputGroup>\n );\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoDetectors from './TomoDetectors';\nimport TomoDetectorsState from './TomoDetectorsState';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoDetectorsSchema extends Hardware {\n properties: {\n state: string;\n detectors: string[];\n active_detector: string;\n target_detector?: string; // FIXME: The server implementation is missing\n };\n}\n\nconst Variants: HardwareVariant<TomoDetectorsSchema> = {\n default: TomoDetectors,\n // Override base state\n state: TomoDetectorsState,\n};\n\nexport default Variants;\n\nexport function isTomoDetectorsHardware(\n entity: Hardware\n): entity is TomoDetectorsSchema {\n return entity.type === 'tomodetectors';\n}\n\nexport function useTomoDetectorsHardware(\n name: string | null\n): TomoDetectorsSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoDetectorsHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import defaultjson from './TomoDetectors.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { TomoImagingSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoImagingState(props: { hardware: TomoImagingSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n READY: 'success',\n BLOCKED: 'secondary',\n ACQUIRING: 'warning',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware } = props;\n return <TomoImagingState hardware={hardware} />;\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { MouseEvent, ChangeEvent, KeyboardEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport {\n Button,\n ButtonGroup,\n InputGroup,\n Container,\n Row,\n Col,\n Form,\n} from 'react-bootstrap';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\n\nfunction UpdateMode(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const updateOnMove = hardware.properties.update_on_move;\n const disabled = props.disabled || !hardware.online;\n\n function setUpdateModeOff(event: MouseEvent) {\n void hardware.actions.setProperty('update_on_move', false);\n }\n\n function setUpdateModeAuto(event: MouseEvent) {\n void hardware.actions.setProperty('update_on_move', true);\n }\n\n return (\n <ButtonGroup className=\"me-2\">\n <InputGroup.Text>Update mode</InputGroup.Text>\n <Button\n onClick={setUpdateModeAuto}\n disabled={disabled}\n variant={updateOnMove ? 'primary' : 'secondary'}\n >\n Auto\n </Button>\n <Button\n onClick={setUpdateModeOff}\n disabled={disabled}\n variant={updateOnMove ? 'secondary' : 'primary'}\n >\n Off\n </Button>\n </ButtonGroup>\n );\n}\n\nfunction ExposureTime(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const exposureTime = hardware.properties.exposure_time ?? 0;\n const disabled = props.disabled || !hardware.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 2;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n void hardware.actions.setProperty(\n 'exposure_time',\n Number.parseFloat(formRef.current.value)\n );\n } else if (e.key === 'Escape') {\n formRef.current.value = exposureTime.toFixed(digits);\n setEdited(false);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== exposureTime && !edited) {\n setEdited(true);\n }\n if (exp === exposureTime && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = exposureTime.toFixed(digits);\n }\n }, [edited, exposureTime]);\n\n return (\n <InputGroup className=\"me-2\">\n <InputGroup.Text>Exposure time</InputGroup.Text>\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={exposureTime.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>s</InputGroup.Text>\n </InputGroup>\n );\n}\n\nfunction TakeActions(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const disabled = props.disabled || !hardware.online;\n\n function takeProj(event: MouseEvent) {\n void hardware.actions.call('take_proj');\n }\n\n function takeDark(event: MouseEvent) {\n void hardware.actions.call('take_dark');\n }\n\n function takeFlat(event: MouseEvent) {\n void hardware.actions.call('take_flat');\n }\n\n return (\n <ButtonGroup size=\"lg\" className=\"me-2\">\n <InputGroup.Text>Take</InputGroup.Text>\n <Button onClick={takeProj} disabled={disabled} variant=\"primary\">\n Proj\n </Button>\n <Button onClick={takeFlat} disabled={disabled} variant=\"primary\">\n Flat\n </Button>\n <Button onClick={takeDark} disabled={disabled} variant=\"primary\">\n Dark\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function TomoImagingDefault(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <Row className=\"mt-1\">\n <Col>\n <UpdateMode hardware={hardware} disabled={props.disabled} />\n </Col>\n </Row>\n <Row className=\"mt-1\">\n <Col>\n <ExposureTime hardware={hardware} disabled={props.disabled} />\n </Col>\n </Row>\n <Row className=\"mt-1\">\n <Col>\n <TakeActions hardware={hardware} disabled={props.disabled} />\n </Col>\n </Row>\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { InputGroup, Form } from 'react-bootstrap';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\nimport { useHardware } from '../../registry/hooks';\nimport { limaGuessSubframes, isLimaHardware } from '../lima';\nimport { isTomoDetectorHardware } from '../tomodetector';\n\nfunction ExposureTime(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const exposureTime = hardware.properties.exposure_time ?? 0;\n const disabled = props.disabled || !hardware.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n void hardware.actions.setProperty(\n 'exposure_time',\n Number.parseFloat(formRef.current.value)\n );\n } else if (e.key === 'Escape') {\n formRef.current.value = exposureTime.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== exposureTime && !edited) {\n setEdited(true);\n }\n if (exp === exposureTime && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = exposureTime.toFixed(digits);\n }\n }, [edited, exposureTime]);\n\n return (\n <InputGroup className=\"w-100\">\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={exposureTime.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>s</InputGroup.Text>\n </InputGroup>\n );\n}\n\nfunction AccumulationIfOne(props: { exposureTime: number }) {\n const { exposureTime } = props;\n const hardware = useHardware(\n 'ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector'\n );\n const hardwareTomo = useHardware(\n 'ACTIVE_TOMOCONFIG.ref.detectors.active_detector'\n );\n if (hardware === null || hardwareTomo === null) {\n return <></>;\n }\n if (!isLimaHardware(hardware) || !isTomoDetectorHardware(hardwareTomo)) {\n return <></>;\n }\n const accMaxExpoTime = hardware.properties.acc_max_expo_time;\n const acqMode = hardwareTomo.properties.acq_mode;\n if (!accMaxExpoTime || acqMode !== 'ACCUMULATION') {\n return <></>;\n }\n const [nbSubFrames, accExpoTime] = limaGuessSubframes(\n exposureTime,\n accMaxExpoTime\n );\n return (\n <div className=\"text-center\" title=\"Decompisiton of the accumulation\">\n {nbSubFrames} × {accExpoTime.toFixed(3)}\n </div>\n );\n}\n\nexport default function TomoImagingExposureTime(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <ExposureTime hardware={hardware} disabled={props.disabled} />\n <AccumulationIfOne exposureTime={hardware.properties.exposure_time} />\n </>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { InputGroup, Form } from 'react-bootstrap';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\n\nfunction SettleTime(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const settleTime = hardware.properties.settle_time || 0;\n const disabled = props.disabled || !hardware.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n void hardware.actions.setProperty(\n 'settle_time',\n Number.parseFloat(formRef.current.value)\n );\n } else if (e.key === 'Escape') {\n formRef.current.value = settleTime.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== settleTime && !edited) {\n setEdited(true);\n }\n if (exp === settleTime && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = settleTime.toFixed(digits);\n }\n }, [edited, settleTime]);\n\n return (\n <InputGroup className=\"w-100\">\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={settleTime.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>s</InputGroup.Text>\n </InputGroup>\n );\n}\n\nexport default function TomoImagingSettleTime(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <SettleTime hardware={hardware} disabled={props.disabled} />\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { useState } from 'react';\nimport type { MouseEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { Button, ButtonGroup } from 'react-bootstrap';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\nimport classNames from 'classnames';\n\n/**\n * Button with an active icon during a processing.\n *\n * The implementation aim to have a fixed width with or without\n * the processing.\n */\nfunction ProcessingButton(props: {\n text: string;\n processing: boolean;\n disabled: boolean;\n onClick: (event: MouseEvent) => void;\n title?: string;\n}) {\n const { text, processing, disabled, onClick, title } = props;\n return (\n <Button\n onClick={onClick}\n disabled={disabled}\n variant=\"primary\"\n className={classNames({ 'ps-4': !processing, 'pe-4': !processing })}\n title={title}\n >\n {processing && <i className=\"fa-solid fa-cog fa-spin me-1\" />}\n {text}\n </Button>\n );\n}\n\nfunction TakeActions(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const [doDark, setDoDark] = useState(false);\n const [doFlat, setDoFlat] = useState(false);\n const [doProj, setDoProj] = useState(false);\n const disabled =\n props.disabled || !hardware.online || doDark || doFlat || doProj;\n\n function takeProj(event: MouseEvent) {\n setDoProj(true);\n hardware.actions.call('take_proj').finally(() => {\n setDoProj(false);\n });\n }\n\n function takeDark(event: MouseEvent) {\n setDoDark(true);\n void hardware.actions.call('take_dark').finally(() => {\n setDoDark(false);\n });\n }\n\n function takeFlat(event: MouseEvent) {\n setDoFlat(true);\n void hardware.actions.call('take_flat').finally(() => {\n setDoFlat(false);\n });\n }\n\n return (\n <ButtonGroup size=\"lg\" className=\"w-100\">\n <ProcessingButton\n onClick={takeProj}\n disabled={disabled}\n processing={doProj}\n text=\"Proj\"\n title=\"Take a projection\"\n />\n <ProcessingButton\n onClick={takeFlat}\n disabled={disabled}\n processing={doFlat}\n text=\"Flat\"\n title=\"Take a flat\"\n />\n <ProcessingButton\n onClick={takeDark}\n disabled={disabled}\n processing={doDark}\n text=\"Dark\"\n title=\"Take a dark\"\n />\n </ButtonGroup>\n );\n}\n\nexport default function TomoImagingActions(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <TakeActions hardware={hardware} disabled={props.disabled} />\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { MouseEvent } from 'react';\nimport { Button, ButtonGroup } from 'react-bootstrap';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\n\nfunction UpdateMode(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const updateOnMove = hardware.properties.update_on_move;\n const disabled = props.disabled || !hardware.online;\n\n function setUpdateModeOff(event: MouseEvent) {\n void hardware.actions.setProperty('update_on_move', false);\n }\n\n function setUpdateModeAuto(event: MouseEvent) {\n void hardware.actions.setProperty('update_on_move', true);\n }\n\n return (\n <ButtonGroup className=\"w-100\">\n <Button\n onClick={setUpdateModeAuto}\n disabled={disabled}\n variant={updateOnMove ? 'primary' : 'secondary'}\n >\n Auto\n </Button>\n <Button\n onClick={setUpdateModeOff}\n disabled={disabled}\n variant={updateOnMove ? 'secondary' : 'primary'}\n >\n Off\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function TomoImagingUpdateMode(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <UpdateMode hardware={hardware} disabled={props.disabled} />\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoImagingDefault from './TomoImagingDefault';\nimport TomoImagingExposureTime from './TomoImagingExposureTime';\nimport TomoImagingSettleTime from './TomoImagingSettleTime';\nimport TomoImagingActions from './TomoImagingActions';\nimport TomoImagingUpdateMode from './TomoImagingUpdateMode';\nimport TomoImagingState from './TomoImagingState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoImagingSchema extends Hardware {\n properties: {\n state: string;\n update_on_move: boolean;\n exposure_time: number;\n settle_time: number;\n };\n}\n\nconst Variants: HardwareVariant<TomoImagingSchema> = {\n default: TomoImagingDefault,\n exposuretime: TomoImagingExposureTime,\n settletime: TomoImagingSettleTime,\n actions: TomoImagingActions,\n updatemode: TomoImagingUpdateMode,\n // Override base state\n state: TomoImagingState,\n};\n\nexport default Variants;\n","import defaultjson from './TomoImaging.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function TomoImagingSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [properties, setProperties] = useState({\n state: 'READY',\n update_on_move: true,\n exposure_time: 1,\n settle_time: 0,\n });\n\n function setState(state: string) {\n setProperties((p) => {\n return { ...p, state };\n });\n }\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'take_dark') {\n setState('ACQUIRING');\n await delay(2000);\n setState('READY');\n return;\n }\n if (name === 'take_flat') {\n setState('ACQUIRING');\n await delay(2000);\n setState('READY');\n return;\n }\n if (name === 'take_proj') {\n setState('ACQUIRING');\n await delay(2000);\n setState('READY');\n return;\n }\n console.log('TomoImagingSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n setProperties((p) => {\n return { ...p, [name]: value };\n });\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"tomoimaging\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoSampleStageSchema extends Hardware {\n properties: {\n sx: string;\n sy: string;\n sz: string;\n somega: string;\n sampx: string;\n sampy: string;\n sampu: string;\n sampv: string;\n x_axis_focal_pos: number | null;\n detector_center: [number | null, number | null];\n };\n}\n\nconst Variants: HardwareVariant<TomoSampleStageSchema> = {};\n\nexport default Variants;\n\nexport function isTomoSampleStageHardware(\n entity: Hardware\n): entity is TomoSampleStageSchema {\n return entity.type === 'tomosamplestage';\n}\n\nexport function useTomoSampleStageHardware(\n name: string | null\n): TomoSampleStageSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoSampleStageHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { InputGroup, Form } from 'react-bootstrap';\nimport type { TomoConfigSchema } from '.';\n\nfunction LatencyTime(props: {\n hardware: EditableHardware<TomoConfigSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const valueFromHardware = hardware.properties.latency_time || 0;\n const disabled = props.disabled || !hardware.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n void hardware.actions.setProperty('latency_time', formRef.current.value);\n } else if (e.key === 'Escape') {\n formRef.current.value = valueFromHardware.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== valueFromHardware && !edited) {\n setEdited(true);\n }\n if (exp === valueFromHardware && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = valueFromHardware.toFixed(digits);\n }\n }, [edited, valueFromHardware]);\n\n return (\n <InputGroup className=\"w-100\">\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={valueFromHardware.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>s</InputGroup.Text>\n </InputGroup>\n );\n}\n\nexport default function TomoConfigLatencyTime(\n props: HardwareWidgetProps<TomoConfigSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <LatencyTime hardware={hardware} disabled={props.disabled} />\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoConfigLatencyTime from './LatencyTime';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoConfigSchema extends Hardware {\n properties: {\n sample_stage: string;\n sxbeam: string;\n detectors: string;\n holotomo: string;\n latency_time: number;\n };\n}\n\nconst Variants: HardwareVariant<TomoConfigSchema> = {\n latencytime: TomoConfigLatencyTime,\n};\n\nexport default Variants;\n\nexport function isTomoConfigHardware(\n entity: Hardware\n): entity is TomoConfigSchema {\n return entity.type === 'tomoconfig';\n}\n\nexport function useTomoConfigHardware(\n name: string | null\n): TomoConfigSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoConfigHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import { HardwareState } from '../utils/State';\nimport type { TomoHoloSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoHoloState(props: { hardware: TomoHoloSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n READY: 'success',\n MOVING: 'warning',\n STABILIZING: 'warning',\n INVALID: 'danger',\n INVALID_DETECTOR_BINNING_CHANGED: 'danger',\n INVALID_DETECTOR_DISTANCE_CHANGED: 'danger',\n INVALID_DETECTOR_CHANGED: 'danger',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoHoloSchema>\n) {\n const { hardware } = props;\n return <TomoHoloState hardware={hardware} />;\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport { useHardware } from '../../registry/hooks';\nimport TomoHoloState from './TomoHoloState';\n\nexport interface TomoHoloDistance {\n z1: number;\n position: number;\n pixel_size: number;\n}\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoHoloSchema extends Hardware {\n properties: {\n state: string;\n settle_time: number;\n pixel_size: number | null;\n nb_distances: number;\n distances: TomoHoloDistance[];\n };\n}\n\nconst Variants: HardwareVariant<TomoHoloSchema> = {\n // Override base state\n state: TomoHoloState,\n};\n\nexport default Variants;\n\nexport function isTomoHoloHardware(entity: Hardware): entity is TomoHoloSchema {\n return entity.type === 'tomoholo';\n}\n\nexport function useTomoHoloHardware(\n name: string | null\n): TomoHoloSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoHoloHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import {\n Badge,\n Button,\n ButtonGroup,\n OverlayTrigger,\n Popover,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { ValveSchema } from '.';\n\nfunction ValveOverlay(props: HardwareWidgetProps<ValveSchema>) {\n const { hardware } = props;\n const reset = () => {\n void hardware.actions.call('reset');\n };\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popover\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <div className=\"d-grid gap-2\">\n <Button disabled={props.disabled} onClick={reset}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Valve Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Valve(props: HardwareWidgetProps<ValveSchema>) {\n const { hardware, options = {} } = props;\n const onClick = () => {\n void hardware.actions.call(\n hardware.properties.state === 'OPEN' ? 'close' : 'open'\n );\n };\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Valve\"\n icon=\"fam-hardware-valve\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={\n hardware.properties.state === 'OPEN' ||\n hardware.properties.state === 'RUNNING'\n ? 'success'\n : 'danger'\n }\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <ButtonGroup className=\"d-flex\">\n <Button\n variant={\n hardware.properties.state === 'OPEN' ? 'danger' : 'success'\n }\n onClick={onClick}\n disabled={props.disabled}\n >\n {hardware.properties.state === 'OPEN' ? 'Close' : 'Open'}\n </Button>\n <ValveOverlay {...props} />\n </ButtonGroup>\n </div>\n </div>\n );\n}\n\nexport default Valve;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Valve from './Valve';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface ValveSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n };\n}\n\nconst Variants: HardwareVariant<ValveSchema> = {\n default: Valve,\n};\n\nexport default Variants;\n","import defaultjson from './Valve.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import debug from 'debug';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\n\nconst logger = debug('daiquiri.components.hardware.NoObject');\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function NoObject(props: NoObjectProps) {\n if (props.options.emptyifnone) {\n logger(\n 'Component id:\"%s\" name:\"%s\" not displayed cause setup with emptyifnone.',\n props.id,\n props.name\n );\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <span title={`Object '${props.name}' is missing`}>Missing</span>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n };\n}\n\nexport default function LoadingObject(props: NoObjectProps) {\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <span title={`Object '${props.name}' is loading`}>\n <i className=\"fa-solid fa-spinner fa-spin-pulse\" />\n </span>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import debug from 'debug';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\n\nconst logger = debug('daiquiri.components.hardware.MissingObject');\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function MissingObject(props: NoObjectProps) {\n if (props.options.emptyifnone) {\n logger(\n 'Component id:\"%s\" name:\"%s\" not displayed cause setup with emptyifnone.',\n props.id,\n props.name\n );\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <span title={`Object '${props.name}' is missing`}>Missing</span>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\nimport { Button, OverlayTrigger, Popover } from 'react-bootstrap';\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n properties?: { message?: string };\n options: {\n header?: string;\n };\n}\n\nexport default function ErrorObject(props: NoObjectProps) {\n const { properties = {} } = props;\n const { message = 'Unknown error' } = properties;\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <OverlayTrigger\n trigger={['focus', 'hover']}\n placement=\"bottom\"\n rootClose\n overlay={\n <Popover id=\"error\" style={{ maxWidth: 500 }}>\n <Popover.Header>Error</Popover.Header>\n <Popover.Body>\n <ul>\n <li>{message}</li>\n </ul>\n </Popover.Body>\n </Popover>\n }\n >\n <Button variant=\"danger\" size=\"sm\" className=\"w-100\">\n <i className=\"fa fa-exclamation-triangle\" /> Error\n </Button>\n </OverlayTrigger>\n );\n\n <span title={`${message}`}>Error</span>;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import debug from 'debug';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\nimport { Button, OverlayTrigger, Popover } from 'react-bootstrap';\n\nconst logger = debug('daiquiri.components.hardware.MissingComponentObject');\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n type?: string;\n options: {\n variant?: string;\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function MissingComponentObject(props: NoObjectProps) {\n const { options } = props;\n const { variant = 'default' } = options;\n if (options.emptyifnone) {\n logger(\n 'Component id:\"%s\" name:\"%s\" not displayed cause setup with emptyifnone.',\n props.id,\n props.name\n );\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <OverlayTrigger\n trigger={['focus', 'hover']}\n placement=\"bottom\"\n rootClose\n overlay={\n <Popover id=\"error\" style={{ maxWidth: 500 }}>\n <Popover.Header>Error</Popover.Header>\n <Popover.Body>\n <ul>\n <li>\n No component available for object id '{props.name}' (type '\n {props.type}' and/or variant '{variant}' are not registred)\n </li>\n </ul>\n </Popover.Body>\n </Popover>\n }\n >\n <Button variant=\"danger\" size=\"sm\" className=\"w-100\">\n <i className=\"fa fa-exclamation-triangle\" /> Error\n </Button>\n </OverlayTrigger>\n );\n\n const headerMode = options ? options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function NoObject(props: NoObjectProps) {\n if (props.options.emptyifnone) {\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = <></>;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { PropsWithChildren } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\ninterface Props {\n className?: string;\n}\n\nexport default function FullSizer(props: PropsWithChildren<Props>) {\n const [state, setState] = useState<Record<string, number>>({});\n const containerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (containerRef.current) {\n const view = containerRef.current;\n setState({\n width: view.clientWidth,\n height: view.clientHeight,\n });\n }\n }, []);\n\n return (\n <div\n ref={containerRef}\n style={{ width: '100%', height: '100%' }}\n className={props.className}\n >\n {state.width > 0 && (\n <div\n className=\"full-sizer\"\n style={{\n width: `${state.width}px`,\n height: `${state.height}px`,\n overflow: 'scroll',\n }}\n >\n {props.children}\n </div>\n )}\n </div>\n );\n}\n","import type { ReactChild, PropsWithChildren } from 'react';\nimport { Fragment } from 'react';\nimport FullSizer from '../components/FullSizer';\n\nfunction PanelHeader(props: {\n children?: ReactChild | ReactChild[];\n style?: Record<string, any>;\n}) {\n return (\n <div className=\"panel-header\" style={props.style}>\n {props.children}\n </div>\n );\n}\n\nfunction PanelContents(props: {\n children?: ReactChild | ReactChild[];\n style?: Record<string, any>;\n className?: string;\n}) {\n return (\n <div className={`panel-contents ${props.className}`} style={props.style}>\n {props.children}\n </div>\n );\n}\n\ninterface Props {\n style?: Record<string, any>;\n scroll?: boolean;\n className?: string;\n}\n\nfunction Panel(props: PropsWithChildren<Props>) {\n const Wrap = props.scroll ? FullSizer : Fragment;\n\n return (\n <div className={`panel ${props.className ?? ''}`} style={props.style}>\n <Wrap>{props.children}</Wrap>\n </div>\n );\n}\n\nPanel.Header = PanelHeader;\nPanel.Contents = PanelContents;\n\nexport default Panel;\n","import type { ReactChild } from 'react';\nimport { Children, cloneElement, isValidElement } from 'react';\nimport Panel from '../layout/Panel';\nimport type { AnyYamlNode, YamlNode, YamlRoot } from './model';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlWrapperMap: Record<string, React.ComponentType<any>> = {};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerYamlType(\n name: string,\n component: React.ComponentType<any>\n) {\n yamlWrapperMap[name] = component;\n}\n\n/**\n * Render a Yaml node using registred component from the node type\n */\nexport function renderYamlNode(\n yamlNode: AnyYamlNode,\n key: number | string,\n panel = true\n): ReactChild {\n // Allow null nodes to be ignored (useful for templating)\n if (!yamlNode) return <></>;\n const { type } = yamlNode;\n const Comp =\n type && type in yamlWrapperMap\n ? yamlWrapperMap[type]\n : yamlWrapperMap.component;\n return <Comp yamlNode={yamlNode} key={key} panel={panel} />;\n}\n\ninterface OptionalPanelProps {\n children?: ReactChild | ReactChild[];\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n panel: boolean;\n key?: number | string;\n}\n\n/**\n * Wrap the children into a panel if it is requested by the options\n */\nexport function OptionalPanel({\n children,\n key,\n panel,\n options,\n}: OptionalPanelProps) {\n return panel ? (\n <Panel key={key} style={options.style} scroll={options.scroll}>\n <Panel.Contents>{children}</Panel.Contents>\n </Panel>\n ) : (\n <>\n {Children.map(children, (child) =>\n isValidElement(child)\n ? cloneElement(child, { key, ...child.props })\n : undefined\n )}\n </>\n );\n}\n\nexport function assertOnRemainingKeys(\n yamlNode: YamlNode | undefined,\n remainingContent: Record<string, any>\n) {\n const { _parentNode, _indexFromParent, ...remainingContent2 } =\n remainingContent;\n if (yamlNode) {\n if (Object.keys(remainingContent2).length > 0) {\n throw new UnknownKeysError(yamlNode, Object.keys(remainingContent2));\n }\n }\n}\n\nexport class LayoutError extends Error {\n public readonly yamlNode: YamlNode;\n public constructor(message: string, yamlNode: YamlNode) {\n super(message);\n this.yamlNode = yamlNode;\n }\n}\n\nexport class UnknownKeysError extends LayoutError {\n public readonly keys: string[];\n public constructor(yamlNode: YamlNode, unknownKeys: string[]) {\n super(`Unexpected keys: ${unknownKeys.join(', ')}`, yamlNode);\n this.keys = unknownKeys;\n }\n}\n\nexport class MissingKeysError extends LayoutError {\n public readonly keys: string[];\n public constructor(yamlNode: YamlNode, missingKeys: string[]) {\n super(`Keys ${missingKeys.join(', ')} are missing`, yamlNode);\n this.keys = missingKeys;\n }\n}\n\nexport class KeyError extends LayoutError {\n public readonly key: string;\n public readonly keyMessage: string;\n public constructor(yamlNode: YamlNode, key: string, message: string) {\n super(`Key ${key} error: ${message}`, yamlNode);\n this.key = key;\n this.keyMessage = message;\n }\n}\n\n/**\n * Returns the root of the YamlNode\n */\nexport function getYamlRoot(node: YamlNode): YamlRoot {\n let n = node;\n while (n._parentNode) {\n n = n._parentNode;\n }\n return n as YamlRoot;\n}\n\n/**\n * Returns a list of nodes from the root to this node.\n */\nexport function getYamlHierarchy(\n node: YamlNode\n): { node: YamlNode; indexFromParent: number | null }[] {\n const path: { node: YamlNode; indexFromParent: number | null }[] = [];\n let n: YamlNode | null = node;\n while (n) {\n path.push({\n node: n,\n indexFromParent: n._indexFromParent,\n });\n n = n._parentNode;\n }\n path.reverse();\n return path;\n}\n\n/**\n * Create links between layout node in order to simplify further processing\n * (mainly error handling).\n */\nexport function normalizeLayout<R extends YamlNode>(\n node: R,\n parentNode: YamlNode | null = null,\n indexFromParent: number | null = null\n): R {\n if (node._parentNode) {\n throw new Error(\n 'Attribute _parentNode was already defined by the yml layout.'\n );\n }\n const newNode = {\n ...node,\n _parentNode: parentNode,\n _indexFromParent: indexFromParent,\n };\n if (node.children) {\n // NOTE: use a map from a real array\n const children = [...node.children];\n Object.freeze(children);\n newNode.children = children.map((c, i) => normalizeLayout(c, newNode, i));\n }\n Object.freeze(newNode);\n return newNode;\n}\n","import type { YamlNode } from '../model';\nimport { KeyError, MissingKeysError, UnknownKeysError } from '../utils';\n\ntype Defined<T> = T extends undefined ? never : T;\n\nexport function assertKeyExpected<T>(\n yamlNode: YamlNode | undefined,\n key: string,\n value: T\n): asserts value is Defined<T> {\n if (yamlNode) {\n if (value === undefined) {\n throw new MissingKeysError(yamlNode, [key]);\n }\n }\n}\n\nexport function assertString(\n yamlNode: YamlNode,\n key: string,\n value: any\n): asserts value is string {\n if (typeof value !== 'string') {\n throw new KeyError(yamlNode, key, 'A string is expected');\n }\n}\n\nexport function assertBoolean(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is boolean {\n if (typeof value !== 'boolean') {\n throw new KeyError(yamlNode, key, 'A boolean is expected');\n }\n}\n\nexport function assertNumber(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number {\n if (typeof value !== 'number') {\n throw new KeyError(yamlNode, key, 'A number is expected');\n }\n}\n\nexport function assertOptionalBoolean(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is boolean | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'boolean') {\n throw new KeyError(yamlNode, key, 'An optional boolean is expected');\n }\n}\n\nexport function assertOptionalString(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'string') {\n throw new KeyError(yamlNode, key, 'An optional string is expected');\n }\n}\n\nexport function assertStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] {\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'A list of string is expected');\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(yamlNode, key, 'A list of string is expected');\n }\n });\n}\n\nexport function assertOptionalStringOrStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string | string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value === 'string') {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional string or list of string is expected'\n );\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional string or list of string is expected'\n );\n }\n });\n}\n\nexport function assertOptionalStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'An optional list of string is expected');\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(\n yamlNode,\n key,\n 'A optional list of string is expected'\n );\n }\n });\n}\n\nexport function assertOptionalNumber(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'number') {\n throw new KeyError(yamlNode, key, 'An optional number is expected');\n }\n}\n\nexport function assertOptionalNumberList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional list of numbers is expected'\n );\n }\n value.forEach((v) => {\n if (typeof v !== 'number') {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional list of numbers is expected'\n );\n }\n });\n}\n\nexport function assertNoUnknownKeys(\n yamlNode: YamlNode | undefined,\n remainingContent: Record<string, any>\n) {\n const { _parentNode, _indexFromParent, ...remainingContent2 } =\n remainingContent;\n if (yamlNode) {\n if (Object.keys(remainingContent2).length > 0) {\n throw new UnknownKeysError(yamlNode, Object.keys(remainingContent2));\n }\n }\n}\n\nexport function assertDataCollectionId(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number | 'last' {\n if (value === 'last') {\n return;\n }\n if (typeof value === 'number') {\n return;\n }\n throw new KeyError(yamlNode, key, '\"last\" or a number is expected');\n}\n\nexport function assertOptionalBackend(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is 'plotly' | 'h5web' | undefined {\n if (value === undefined) {\n return;\n }\n if (value === 'h5web') {\n return;\n }\n if (value === 'plotly') {\n return;\n }\n throw new KeyError(yamlNode, key, '\"h5web\" or \"plotly\" string is expected');\n}\n","import type { YamlComponent } from '@esrf/daiquiri-lib';\nimport { Alert } from 'react-bootstrap';\nimport { assertOptionalString, assertNoUnknownKeys } from './asserts';\n\nexport default function Yaml(props: YamlComponent) {\n const { providers = {}, yamlNode, message, ...unknownOptions } = props;\n assertOptionalString(yamlNode, 'message', message);\n assertNoUnknownKeys(yamlNode, unknownOptions);\n\n return (\n <Alert variant=\"warning\" className=\"mb-0\">\n {message ?? 'TODO'}\n </Alert>\n );\n}\n","import type { YamlComponent } from '@esrf/daiquiri-lib';\n\nexport default function Yaml(props: YamlComponent) {\n return <></>;\n}\n","import type { PropsWithChildren } from 'react';\nimport React, { Component } from 'react';\nimport { Container, Alert, Button } from 'react-bootstrap';\nimport {\n KeyError,\n MissingKeysError,\n UnknownKeysError,\n getYamlHierarchy,\n getYamlRoot,\n LayoutError,\n} from './utils';\n\nfunction DefaultErrorMessage(props: {\n message: string;\n error: Error | undefined;\n}) {\n return (\n <Alert variant=\"danger\">\n {props.message}\n <br />\n <pre>{props.error?.stack}</pre>\n </Alert>\n );\n}\n\nfunction LayoutErrorMessage(props: {\n message: string;\n error: Error | undefined;\n}) {\n const { error } = props;\n if (!(error instanceof LayoutError)) {\n return <></>;\n }\n function formatPreview(\n error: MissingKeysError | UnknownKeysError | KeyError,\n indent = 3\n ) {\n const path = getYamlHierarchy(error.yamlNode);\n const lines: string[] = [];\n let actualIndentation = '';\n for (let i = 1; i < path.length; i++) {\n const { node, indexFromParent } = path[i];\n lines.push(`${actualIndentation}children:`);\n actualIndentation += ' '.repeat(indent);\n if (indexFromParent === 1) {\n lines.push(`${actualIndentation}- type: ...`);\n } else if (indexFromParent ?? 0 > 1) {\n lines.push(\n `${actualIndentation}...`,\n `${actualIndentation}...`,\n `${actualIndentation}# children number ${indexFromParent ?? 0 + 1}`\n );\n }\n lines.push(`${actualIndentation}- type: ${node.type}`);\n actualIndentation += ' '.repeat(2);\n }\n if (error instanceof UnknownKeysError) {\n error.keys.forEach((k) => {\n lines.push(\n `${actualIndentation}${k}: ... ${' '.repeat(\n 50 - actualIndentation.length - k.length\n )}<-- unexpected key`\n );\n });\n } else if (error instanceof MissingKeysError) {\n error.keys.forEach((k) => {\n lines.push(\n `${actualIndentation}???: ${' '.repeat(\n 50 - actualIndentation.length - k.length\n )}<-- key **${k}** is expected`\n );\n });\n } else if (error instanceof KeyError) {\n lines.push(\n `${actualIndentation}${error.key}: ${' '.repeat(\n 50 - actualIndentation.length - error.key.length\n )}<-- ${error.keyMessage}`\n );\n }\n return lines.join('\\n');\n }\n const layoutRoot = getYamlRoot(error.yamlNode);\n const layoutName = layoutRoot.name;\n\n if (error instanceof UnknownKeysError) {\n const key = error.keys.length === 1 ? 'key' : 'keys';\n return (\n <Alert variant=\"danger\">\n Unexpected {key}{' '}\n {error.keys.map((k, i) => {\n return (\n <>\n {i !== 0 && ', '}\n <b>{k}</b>\n </>\n );\n })}{' '}\n from the layout name <b>{layoutName}</b>.\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n if (error instanceof MissingKeysError) {\n const key = error.keys.length === 1 ? 'Key' : 'Keys';\n return (\n <Alert variant=\"danger\">\n Expected {key}{' '}\n {error.keys.map((k, i) => {\n return (\n <>\n {i !== 0 && ', '}\n <b>{k}</b>\n </>\n );\n })}{' '}\n from the layout name <b>{layoutName}</b>.\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n if (error instanceof KeyError) {\n return (\n <Alert variant=\"danger\">\n Error on key <b>{error.key}</b> from the layout name <b>{layoutName}</b>\n .\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n return <DefaultErrorMessage {...props} />;\n}\n\ninterface State {\n hasError: boolean;\n message: string;\n error?: Error;\n}\n\ninterface Props {\n resetKey?: any;\n unhandledComponentDidCatch?: (\n error: Error,\n setStateCallback: (data: Record<string, any>) => void\n ) => void;\n UnhandledErrorComponent?: React.ComponentType<any>;\n}\n\nconst INITIAL_STATE = {\n hasError: false,\n message: '',\n error: undefined,\n};\n\nexport default class ErrorBoundary extends Component<\n PropsWithChildren<Props>,\n State\n> {\n public constructor(props: Props) {\n super(props);\n this.state = INITIAL_STATE;\n }\n\n public static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n private readonly reload = () => {\n window.location.reload();\n };\n\n public componentDidCatch(error: Error) {\n if (\n error instanceof LayoutError ||\n !this.props.unhandledComponentDidCatch\n ) {\n this.setState({\n hasError: true,\n message: error.message,\n error,\n });\n return;\n }\n\n this.props.unhandledComponentDidCatch?.(error, (data) => {\n this.setState({\n hasError: true,\n message: error.message,\n error,\n ...data,\n });\n });\n }\n\n // https://github.com/bvaughn/react-error-boundary/blob/23a4d779744f3079dfe0960acaa4bdfd5dede87b/src/ErrorBoundary.ts#L53\n public componentDidUpdate(prevProps: Props, prevState: State) {\n if (\n this.state.hasError &&\n prevState.error !== undefined &&\n prevProps.resetKey !== this.props.resetKey\n ) {\n this.setState(INITIAL_STATE);\n }\n }\n\n public render() {\n if (this.state.hasError) {\n const { UnhandledErrorComponent } = this.props;\n const { hasError, ...props } = this.state;\n return (\n <Container className=\"mt-2\">\n <h4>Something went wrong</h4>\n {this.state.error instanceof LayoutError && (\n <LayoutErrorMessage\n message={this.state.message}\n error={this.state.error}\n />\n )}\n {!(this.state.error instanceof LayoutError) && (\n <>\n {UnhandledErrorComponent ? (\n <UnhandledErrorComponent {...props} />\n ) : (\n <DefaultErrorMessage\n message={this.state.message}\n error={this.state.error}\n />\n )}\n </>\n )}\n <p>\n This error has been logged. Please{' '}\n <Button size=\"sm\" onClick={this.reload}>\n <i className=\"fa fa-refresh\" /> Reload\n </Button>{' '}\n the application\n </p>\n </Container>\n );\n }\n return this.props.children;\n }\n}\n","import { map } from 'lodash';\nimport { Row } from 'react-bootstrap';\nimport { renderYamlNode } from './utils';\nimport { assertNoUnknownKeys } from './components/asserts';\nimport type { AnyYamlNode } from './model';\n\ninterface Props {\n yamlNode: AnyYamlNode;\n panel: boolean;\n}\n\nexport default function YamlRow({ yamlNode, panel }: Props) {\n const { type, style, children, ...unknownOptions } = yamlNode;\n assertNoUnknownKeys(yamlNode, unknownOptions);\n return (\n <Row className=\"ymllayout-row gx-0\" style={style}>\n {map(children, (node, key) => renderYamlNode(node, key, panel))}\n </Row>\n );\n}\n","import { map } from 'lodash';\nimport { Col } from 'react-bootstrap';\nimport classNames from 'classnames';\nimport { renderYamlNode } from './utils';\nimport {\n assertNoUnknownKeys,\n assertOptionalNumber,\n} from './components/asserts';\nimport type { AnyYamlNode } from './model';\n\ninterface Props {\n yamlNode: AnyYamlNode;\n panel: boolean;\n}\n\nexport default function YamlCol({ yamlNode, panel }: Props) {\n const { type, style, xs, children, ...unknownOptions } = yamlNode;\n assertNoUnknownKeys(yamlNode, unknownOptions);\n assertOptionalNumber(yamlNode, 'xs', xs);\n return (\n <Col\n className={classNames('yamymllayout-col', { col: !!xs })}\n style={style}\n xs={xs}\n >\n {map(yamlNode.children, (node, key) => renderYamlNode(node, key, panel))}\n </Col>\n );\n}\n","import { Alert } from 'react-bootstrap';\nimport type { YamlNode } from '../model';\nimport { KeyError, MissingKeysError } from '../utils';\nimport {\n assertNoUnknownKeys,\n assertOptionalBoolean,\n assertOptionalString,\n} from './asserts';\nimport type { YamlComponent } from '../model';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlHardwareComponent: Record<\n string,\n React.ComponentType<any>\n> = {};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerHardwareComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n yamlHardwareComponent[name] = component;\n}\n\nexport interface HardwareDesc {\n id: string;\n}\n\nexport type HardwareListDesc = HardwareDesc[];\n\nexport interface HardwareGroupProps {\n fetched: boolean;\n fetchedGroups: boolean;\n ids?: HardwareListDesc;\n groupid?: string;\n actions?: {\n fetch: () => void;\n fetchGroups: () => void;\n };\n even?: boolean;\n nowrap: boolean;\n}\n\nfunction assertHardwareDesc(\n yamlNode: YamlNode,\n value: any\n): asserts value is HardwareDesc {\n if (value === undefined) {\n // FIXME: That's not a nice exception in this case, the rendering will be bad\n throw new MissingKeysError(yamlNode, ['id']);\n }\n if (typeof value.id !== 'string') {\n // FIXME: That's not a nice exception in this case, the rendering will be bad\n throw new KeyError(yamlNode, 'id', 'A string is expected');\n }\n}\n\nfunction assertOptionalHardwareListDesc(\n yamlNode: YamlNode,\n key: string,\n value: any\n): asserts value is HardwareListDesc | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'A option list is expected');\n }\n\n value.forEach((hardwareDesc, i) => {\n try {\n assertHardwareDesc(yamlNode, hardwareDesc);\n } catch {\n // FIXME: For now we catch it, but assertHardwareDesc could do a better job\n throw new KeyError(\n yamlNode,\n key,\n `The hardware description ${i} is wrong`\n );\n }\n });\n}\n\nexport default function YamlHardwareGroup(props: YamlComponent) {\n const {\n providers = {},\n yamlNode,\n ids,\n groupid,\n even,\n nowrap,\n ...unknownOptions\n } = props;\n assertOptionalHardwareListDesc(yamlNode, 'ids', ids);\n assertOptionalString(yamlNode, 'groupid', groupid);\n assertOptionalBoolean(yamlNode, 'even', even);\n assertOptionalBoolean(yamlNode, 'nowrap', nowrap);\n assertNoUnknownKeys(yamlNode, unknownOptions);\n\n if (!yamlHardwareComponent.HardwareGroup) {\n return (\n <Alert variant=\"warning\">No `HardwareGroup` component registered</Alert>\n );\n }\n\n const HardwareGroup = yamlHardwareComponent.HardwareGroup;\n return (\n <HardwareGroup\n providers={providers}\n ids={ids}\n groupid={groupid}\n nowrap={nowrap || false}\n even={even || false}\n />\n );\n}\n","import type { YamlComponent } from '@esrf/daiquiri-lib';\nimport { Alert } from 'react-bootstrap';\nimport {\n assertString,\n assertOptionalBoolean,\n assertOptionalString,\n assertOptionalNumber,\n} from './asserts';\nimport { yamlHardwareComponent } from './HardwareGroup';\n\nexport default function Yaml(props: YamlComponent) {\n const {\n providers = {},\n yamlNode,\n id,\n variant,\n header,\n width,\n colWidth,\n emptyifnone,\n ...unknownOptions\n } = props;\n assertString(yamlNode, 'id', id);\n assertOptionalString(yamlNode, 'variant', variant);\n assertOptionalString(yamlNode, 'header', header);\n assertOptionalNumber(yamlNode, 'width', width);\n assertOptionalNumber(yamlNode, 'colWidth', colWidth);\n assertOptionalBoolean(yamlNode, 'emptyifnone', emptyifnone);\n // FIXME: Each hardware variant/kind have it's own options\n // And the hardware kind can change dynamically\n // We could try to normalize that in the future\n // assertNoUnknownKeys(yamlNode, unknownOptions);\n const options = {\n variant,\n header,\n width,\n colWidth,\n emptyifnone,\n ...unknownOptions,\n };\n\n if (!yamlHardwareComponent.HardwareGroup) {\n return <Alert variant=\"warning\">No `Hardware` component registered</Alert>;\n }\n\n const Hardware = yamlHardwareComponent.Hardware;\n\n return <Hardware providers={providers} id={id} options={options} />;\n}\n","import React, { Suspense } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport type { YamlNode } from './model';\nimport YamlHardwareGroup from './components/HardwareGroup';\nimport YamlHardware from './components/Hardware';\nimport YamlTodo from './components/Todo';\nimport YamlNone from './components/None';\n\nexport const componentMap: Record<string, React.ComponentType<any>> = {\n hardwaregroup: YamlHardwareGroup,\n hardware: YamlHardware,\n todo: YamlTodo,\n none: YamlNone,\n};\n\nexport function registerComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n componentMap[name] = component;\n}\n\nexport function registerComponents(\n map: Record<string, React.ComponentType<any>>\n) {\n Object.entries(map).forEach(([key, component]) =>\n registerComponent(key, component)\n );\n}\n\ninterface YamlComponentNode extends YamlNode {\n type: string;\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n title?: string;\n}\n\nexport default function YamlComponent(props: {\n yamlNode: YamlComponentNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n const { type, style, scroll, title, ...remainingContent } = yamlNode;\n if (!(type in componentMap)) {\n return (\n <Panel>\n <Panel.Contents>\n <Alert variant=\"warning\">Unknown component &quot;{type}&quot;</Alert>\n </Panel.Contents>\n </Panel>\n );\n }\n const Comp = componentMap[yamlNode.type];\n if (panel) {\n return (\n <Panel style={style} scroll={scroll}>\n <Suspense fallback={<p>Loading...</p>}>\n {title && <Panel.Header>{title}</Panel.Header>}\n <Panel.Contents>\n <Comp {...remainingContent} yamlNode={yamlNode} />\n </Panel.Contents>\n </Suspense>\n </Panel>\n );\n }\n return (\n <Suspense fallback={<p>Loading...</p>}>\n <Comp {...remainingContent} yamlNode={yamlNode} />\n </Suspense>\n );\n}\n","import { map } from 'lodash';\nimport { Container } from 'react-bootstrap';\nimport { renderYamlNode } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n };\n panel: boolean;\n}\n\nexport default function YamlContainer({ yamlNode, panel }: Props) {\n const options = yamlNode.options || {};\n return (\n <Container className=\"ymllayout-container\" {...options}>\n {map(yamlNode.children, (node, key) => renderYamlNode(node, key, panel))}\n </Container>\n );\n}\n","import type { ReactElement, CSSProperties } from 'react';\nimport { map } from 'lodash';\nimport Panel from '../layout/Panel';\nimport { renderYamlNode } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n title?: string;\n };\n panel: boolean;\n}\n\nexport default function YamlPanel(props: Props): ReactElement {\n const { yamlNode } = props;\n const options = yamlNode.options || {};\n const contentsStyle: CSSProperties = {};\n if (options.centerContent) {\n contentsStyle.margin = 'auto';\n }\n\n return (\n <Panel className=\"ymllayout-panel\" {...options}>\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents style={contentsStyle}>\n {map(yamlNode.children, (node, key) =>\n renderYamlNode(node, key, false)\n )}\n </Panel.Contents>\n </Panel>\n );\n}\n","import { each } from 'lodash';\nimport { Tab, Tabs } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport { renderYamlNode } from './utils';\n\nconst hash = () => {\n return (\n Math.random().toString(36).slice(2, 15) +\n Math.random().toString(36).slice(2, 15)\n );\n};\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n title: string;\n };\n panel: boolean;\n}\n\nexport default function YamlTabs({ yamlNode, panel }: Props) {\n const tabs: React.ReactElement[] = [];\n each(yamlNode.children, (t, i) => {\n tabs.push(\n <Tab key={i} eventKey={hash()} title={t.title}>\n {renderYamlNode(t, 0, false)}\n </Tab>\n );\n });\n\n return panel ? (\n <Panel className=\"ymllayout-tabs\">\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents>\n <Tabs mountOnEnter>{tabs}</Tabs>\n </Panel.Contents>\n </Panel>\n ) : (\n <Tabs>{tabs}</Tabs>\n );\n}\n","import { map } from 'lodash';\nimport Panel from '../layout/Panel';\nimport type { ReactChild } from 'react';\nimport { assertOnRemainingKeys, renderYamlNode } from './utils';\nimport type { YamlNode } from './model';\nimport React from 'react';\n\ninterface YamlFormHeaderNode extends YamlNode {\n type: 'formheader';\n title?: string;\n}\n\ninterface YamlFormRowNode extends YamlNode {\n type: string;\n title: string;\n component?: string;\n stateinheader?: boolean;\n titlealign?: string;\n id?: string;\n variant?: string;\n options?: Record<string, any>;\n even: boolean;\n}\n\ninterface YamlFormNode extends YamlNode {\n children: (YamlFormHeaderNode | YamlFormRowNode)[];\n title?: string;\n [key: string]: any;\n}\n\nfunction Header(props: { node: YamlFormHeaderNode; row: number }) {\n const { node } = props;\n const { type, title, ...remainingContent } = node;\n assertOnRemainingKeys(node, remainingContent);\n return (\n <div className=\"ymllayout-form-header\" style={{ gridColumn: '1 / 3' }}>\n <h3>{title}</h3>\n </div>\n );\n}\n\n/**\n * Render the title of a row.\n *\n * It supports a fixed title, and can display formatted hardware id and state.\n */\nfunction RowTitle(props: {\n node: YamlFormRowNode;\n state: ReactChild | null;\n row: number;\n}) {\n const { node, state, row } = props;\n const { title } = node;\n\n function getId() {\n if (node.id) {\n return node.id;\n }\n return undefined;\n }\n\n function getText() {\n if (title !== undefined) {\n return title;\n }\n if (node.type === 'hardware') {\n const id = getId();\n const idContent = {\n _parentNode: node._parentNode,\n _indexFromParent: node._indexFromParent,\n type: 'hardware',\n id,\n variant: 'name',\n emptyifnone: true,\n };\n return renderYamlNode(idContent, 'a', false);\n }\n return '';\n }\n const text = getText();\n\n return (\n <div\n style={{\n textAlign: 'center',\n }}\n >\n <h5\n style={{\n margin: '0px',\n whiteSpace: 'nowrap',\n }}\n >\n {text}\n </h5>\n {state && <div style={{ position: 'relative', top: -5 }}>{state}</div>}\n </div>\n );\n}\n\nfunction Row(props: { node: YamlFormRowNode; row: number }) {\n const { node, row } = props;\n const {\n titlealign,\n title,\n stateinheader = false,\n variant,\n id,\n ...remainingContent\n } = node;\n let newContent;\n let state;\n if (remainingContent.type === 'hardware') {\n newContent = {\n ...remainingContent,\n id,\n variant,\n };\n if (stateinheader) {\n const stateContent = {\n ...remainingContent,\n id,\n variant: 'state',\n emptyifnone: true,\n };\n state = renderYamlNode(stateContent, 'k', false);\n } else {\n state = null;\n }\n } else {\n newContent = remainingContent;\n state = null;\n }\n return (\n <>\n <div\n style={{\n gridColumn: 1,\n alignSelf: titlealign ?? 'center',\n }}\n >\n <RowTitle node={node} state={state} row={row} />\n </div>\n <div style={{ gridColumn: 2, alignSelf: 'center' }}>\n {renderYamlNode(newContent, 'k', false)}\n </div>\n </>\n );\n}\n\nexport default function YamlForm(props: {\n yamlNode: YamlFormNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n const { type, children, options = {}, title, ...remainingContent } = yamlNode;\n assertOnRemainingKeys(yamlNode, remainingContent);\n\n return (\n <Panel className=\"ymllayout-form\" {...options}>\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents className=\"full-sizer\" style={{ overflow: 'auto' }}>\n <div\n style={{\n display: 'grid',\n gridTemplateColumns: 'min-content auto',\n }}\n >\n {map(children, (content, key) => {\n if (content.type === 'formheader') {\n return (\n <Header\n node={content as YamlFormHeaderNode}\n key={key}\n row={key}\n />\n );\n }\n if (content.type === 'none') {\n return <React.Fragment key={key} />;\n }\n return (\n <Row node={content as YamlFormRowNode} key={key} row={key} />\n );\n })}\n </div>\n </Panel.Contents>\n </Panel>\n );\n}\n","import { map } from 'lodash';\nimport { renderYamlNode } from './utils';\nimport type { YamlNode } from './model';\n\ninterface YamlGridNode extends YamlNode {\n children: YamlGridCellNode[];\n title?: string;\n columns?: string;\n rows?: string;\n}\n\ninterface YamlGridCellNode extends YamlNode {\n columnSpan?: number;\n rowSpan?: number;\n}\n\nexport default function YamlGrid(props: {\n yamlNode: YamlGridNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n return (\n <div\n className=\"ymllayout-grid\"\n style={{\n gridTemplateColumns: yamlNode.columns,\n gridTemplateRows: yamlNode.rows,\n }}\n >\n {map(yamlNode.children, (content, key) => {\n const { columnSpan = 1, rowSpan = 1, ...remainingContent } = content;\n const gridColumn = columnSpan > 1 ? `span ${columnSpan}` : undefined;\n const gridRow = rowSpan > 1 ? `span ${rowSpan}` : undefined;\n return (\n <div\n key={key}\n className=\"ymllayout-grid-cell\"\n style={{\n gridColumn,\n gridRow,\n }}\n >\n {renderYamlNode(remainingContent, key, panel)}\n </div>\n );\n })}{' '}\n </div>\n );\n}\n","import React from 'react';\nimport { OptionalPanel } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: {\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n };\n label?: string;\n };\n panel: boolean;\n}\n\nexport default function YamlLabel({ yamlNode, panel }: Props) {\n const options = yamlNode.options || {};\n return (\n <OptionalPanel panel={panel} options={options}>\n <div>{yamlNode.label}</div>\n </OptionalPanel>\n );\n}\n","import { useMemo } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport ErrorBoundary from './ErrorBoundary';\nimport YamlRow from './Row';\nimport YamlCol from './Col';\nimport YamlComponent from './Component';\nimport YamlContainer from './Container';\nimport YamlPanel from './Panel';\nimport YamlTabs from './Tabs';\nimport YamlForm from './Form';\nimport YamlGrid from './Grid';\nimport YamlLabel from './Label';\nimport { renderYamlNode, registerYamlType, normalizeLayout } from './utils';\nimport type { YamlRoot } from './model';\n\nexport const yamlMap = {\n row: YamlRow,\n col: YamlCol,\n container: YamlContainer,\n component: YamlComponent,\n panel: YamlPanel,\n tabs: YamlTabs,\n form: YamlForm,\n grid: YamlGrid,\n label: YamlLabel,\n};\n\nObject.entries(yamlMap).forEach(([type, YamlComponent]) => {\n registerYamlType(type, YamlComponent);\n});\n\ninterface Props {\n testid: string;\n layout: YamlRoot;\n className?: string;\n unhandledComponentDidCatch?: (\n error: Error,\n setStateCallback: (data: Record<string, any>) => void\n ) => void;\n UnhandledErrorComponent?: React.ComponentType<any>;\n}\n\nexport default function Main(props: Props) {\n const layout = useMemo(() => {\n return normalizeLayout(props.layout);\n }, [props.layout]);\n\n if (layout.error) {\n return (\n <div\n className={`${props.className ?? ''} ymllayout-main`}\n data-testid={props.testid}\n >\n <Panel>\n <Panel.Header>Layout Error</Panel.Header>\n <Panel.Contents>\n <p>File: {layout.name}</p>\n <Alert variant=\"warning\">\n <pre className=\"mb-0\">{layout.error}</pre>\n </Alert>\n </Panel.Contents>\n </Panel>\n </div>\n );\n }\n\n return (\n <div\n className={`${props.className ?? ''} ymllayout-main`}\n data-testid={props.testid}\n >\n <ErrorBoundary\n resetKey={layout}\n unhandledComponentDidCatch={props.unhandledComponentDidCatch}\n UnhandledErrorComponent={props.UnhandledErrorComponent}\n >\n {layout.children?.map((node, key) => renderYamlNode(node, key))}\n </ErrorBoundary>\n </div>\n );\n}\n","import { Col, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type { Monitor } from './types';\nimport { useHardware } from '../registry/hooks';\n\nexport const dynamicOp = (op: string, a1: any, b1: any) => {\n const operators: { [op: string]: (a: any, b: any) => boolean } = {\n '>': (a, b) => a > b,\n '<': (a, b) => a < b,\n '>=': (a, b) => a >= b,\n '<=': (a, b) => a <= b,\n '==': (a, b) => a === b,\n '!=': (a, b) => a !== b,\n in: (a, b) => b.indexOf(a) > -1,\n };\n\n if (op in operators) return operators[op](a1, b1);\n return undefined;\n};\n\nfunction rsplit(s: string, separator: string, limits?: number): string[] {\n const split = s.split(separator);\n return limits\n ? [split.slice(0, -limits).join(separator)].concat(split.slice(-limits))\n : split;\n}\n\nexport function useValue(valuePath: string | undefined): unknown {\n const path = valuePath !== undefined ? rsplit(valuePath, '.', 1) : [null, ''];\n const obj = useHardware(path[0]);\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n return undefined;\n }\n if (path[1] === null) {\n return undefined;\n }\n if (!Array.isArray(obj.properties[path[1]])) {\n return obj.properties[path[1]];\n }\n return obj.properties[path[1]][0];\n}\n\nexport function useUnit(unitPath?: string): string | undefined {\n const isFixedUnit = unitPath !== undefined && !unitPath.includes('.');\n const path = unitPath !== undefined ? rsplit(unitPath, '.', 1) : [null, ''];\n const obj = useHardware(path[0]);\n if (isFixedUnit) {\n // That's a fixed unit defined as an option\n return unitPath;\n }\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n // The unit is maybe not yet there\n return undefined;\n }\n if (path[1] === null) {\n return undefined;\n }\n return `${obj.properties[path[1]]}`;\n}\n\nexport function MonitorHardware(props: { monitor: Monitor }) {\n const { monitor } = props;\n\n let value = useValue(monitor.value) ?? '-';\n const unit = useUnit(monitor.unit);\n const overlay = useValue(monitor.overlay);\n\n const flt = Number.parseFloat(`${value}`);\n if (!Number.isNaN(flt)) {\n const str = String(flt);\n if (str.length > 5) {\n value = flt.toPrecision(5);\n }\n }\n\n let checkClass;\n if (monitor.comparator && monitor.comparison) {\n const check = dynamicOp(monitor.comparator, value, monitor.comparison);\n checkClass = check ? 'valid' : 'invalid';\n }\n\n if (!Number.isNaN(flt)) {\n if (unit !== undefined) {\n value = `${value} ${unit}`;\n }\n }\n\n if (overlay) {\n const overlayStr = `${overlay}`;\n\n return (\n <OverlayTrigger\n key={monitor.name}\n placement=\"bottom\"\n overlay={\n <Tooltip id=\"tooltipid\" className=\"monitor-panel-tooltip\">\n {overlayStr.includes('\\n') ? <pre>{overlayStr}</pre> : overlayStr}\n </Tooltip>\n }\n >\n <Col className=\"monitor-panel-item\">\n <h1>{monitor.name}</h1>\n <div className={checkClass}>{`${value}`}</div>\n </Col>\n </OverlayTrigger>\n );\n }\n\n return (\n <Col key={monitor.name} className=\"monitor-panel-item\">\n <h1>{monitor.name}</h1>\n <div className={checkClass}>{`${value}`}</div>\n </Col>\n );\n}\n","import { map } from 'lodash';\nimport type { ComponentType, PropsWithChildren } from 'react';\nimport classNames from 'classnames';\nimport { Row, Col, Container } from 'react-bootstrap';\nimport { MonitorHardware } from './MonitorHardware';\nimport type { Monitor } from './types';\n\ninterface MonitorMapping {\n [name: string]: ComponentType<any>;\n}\n\nexport const monitorMap: MonitorMapping = {\n hardware: MonitorHardware,\n};\n\nexport function registerMonitorComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n monitorMap[name] = component;\n}\n\nfunction YmlError(props: { monitor: Monitor; message: string }) {\n return (\n <Col\n className=\"monitor-panel-item bg-fatal\"\n title={`Error from yaml configuration: ${props.message}`}\n >\n <h1>{props.monitor.name}</h1>\n <div>Parsing error</div>\n </Col>\n );\n}\n\nexport interface MonitorPanelProps {\n monitors: Monitor[];\n margin?: 'start' | null;\n bg?: 'light' | null;\n}\n\nexport function MonitorPanel(props: MonitorPanelProps) {\n const properties = map(props.monitors, (monitor, i) => {\n const type = monitor.type ?? 'hardware';\n const Comp = monitorMap[type];\n if (Comp === undefined) {\n return (\n <YmlError\n key={`m${i}`}\n monitor={monitor}\n message={`Type ${type} unsupported`}\n />\n );\n }\n return <Comp key={`m${i}`} monitor={monitor} />;\n });\n\n return (\n <div\n className={classNames(\n { 'ms-auto': props.margin === 'start' },\n 'me-auto',\n 'monitor-panel',\n { 'monitor-panel-light': props.bg === 'light' }\n )}\n >\n <Container fluid>\n <Row className=\"flex-nowrap\">{properties}</Row>\n </Container>\n </div>\n );\n}\n\ninterface MonitorPanelItemProps {}\n\nexport function MonitorPanelItem(\n props: PropsWithChildren<MonitorPanelItemProps>\n) {\n return <Col className=\"monitor-panel-item\">{props.children}</Col>;\n}\n"],"names":["AnyHardwareState","props","hardware","online","locked","state","variant","jsx","Badge","DefaultState","Name","options","getName","getLabel","getTitle","name","title","Info","getValue","propertyName","result","segment","Fragment","OnlineStatus","activeMessage","inactiveMessage","message","TypeIcon","icon","jsxs","HardwareTemplate","headerMode","label","Form","OverlayTrigger","Popover","error","Button","DeviceState","Property","widgetIcon","widgetState","getUnit","unitName","unit","widgetContent","InputGroup","Variants","BaseState","BaseName","BaseInfo","BaseProperty","Variants$R","Mocks","defaultjson","HardwareState","style","HardwareMultiState","states","variants","descriptions","minWidth","mainState","renderTooltip","Tooltip","s","i","desc","Row","Col","AirBearingState","RawAirBearing","disabled","_a","isOn","isOff","ButtonGroup","AirBearing","getWidgetContent","ReadOnlyTextInput","value","className","defaultClasses","ActionButton","DropdownAirBearing","requestOn","requestOff","hardwareDisabled","movingOn","movingOff","Dropdown","Container","AirBearingProtected","Variants$P","delay","ms","resolve","Simulator","alias","type","setProperty","call","properties","useHardwareContext","ctx","actions","useMemo","_b","previousHardware","useRef","useEffect","isEqual","AirBearingSimulator","setState","useState","formatEng","scalar","powerPrefix","q","subtrhnd","pow10","prefix","ucfirst","str","toHoursMins","seconds","min","mins","hours","toEnergy","wavelength","round","digits","FrontendOverlay","reset","itlks","ring","getPropertyState","key","map","prop","Frontend","onClick","Variants$N","GaugeOverlay","toggle","Gauge","Variants$L","defaultjson2","NumericStep","forwardRef","ref","stepSizeRef","focusTimeoutRef","currentStep","setCurrentStep","retakeFocus","setRetakeFocus","onStep","up","ref2","val","multiplier","stepSize","onStepProp","step","overlay","incIcon","decIcon","swapIncDec","onKeyDown","onBlur","horizontalArrows","largeArrows","stepOnly","rest","onKeyDown2","e","onBlur2","steps","hasIncDec","classNames","NumericStep$1","HardwareNumericStep","valueRef","edited","setEdited","setError","updateRef","newValue","onChange","promise","Laser","requestPowerChange","requestStateChange","Variants$J","LaserHeatingOverlay","LaserHeating","pending","setPending","requestExposureChange","requestMeasure","Variants$H","Light","sliderRef","requestIntensityChange","debounceIntensityChange","useCallback","_debounce","Variants$F","LimaState","finalState","Content","Stack","LimaDefault","width","height","TomoDetectorSize","LimaTransformationFlags","flipH","flipV","rotation","noTransformation","LimaBinningControl","bh","bv","b","setBinning","LimaBinning","LimaRoiImageControl","LimaMaxSizeControl","struct","LimaLimaVersionControl","LimaModelControl","runtimeHooks","registerRuntimeHook","hooks","useHardware","id","useHardwareChangeActions","isLimaHardware","entity","useLimaHardware","limaGuessSubframes","exposureTime","accMaxExpoTime","nbSubFrames","accExpoTime","LimaSize","LimaTransformation","LimaImageRoi","LimaDescription","Variants$D","flipjson","rotjson","LimaSimulator","imageMaxDim","cameraPixelSize","setProperties","changeBinning","binning","pixelSize","size","p","RenderInput","inputProps","inputRef","referenceElementRef","onAddSelection","onRemoveSelection","otherInputProps","fieldRef","clearInput","setValue","addSelection","removeSelection","selected","option","Hint","node","withExtraProps","extraProps","wrappedComponent","WithExtraProps","props2","props3","RenderMenu","results","menuProps","selectedItems","opt","Highlighter","availableItems","MenuItem","Menu","MeasurementGroup","enabled","x","setSelection","added","removed","counter","selection","promises","setActive","Typeahead","shouldSelect","Variants$B","MeasurementGroupSimulator","enable","c","disable","UNKNOWN","AVAILABLE_STATES","MotorState","priority","n1","n2","s1","s2","orderedStates","splitCustomStates","elems","n","HardwareInputNumber","normalizeNumber","MotorOverlay","onMoveVelocityRequested","target","onMoveAccelerationRequested","MotorDefault","user_tags","onAbortRequested","onMovePositionRequested","useMotorStates","MotorText","userTags","autoReady","autoOn","newState","reduced","isMotorHardware","useMotorHardware","Variants$z","motor","halfMotor","unknownMotor","notReadyMotor","disconnectedMotor","powerOffMotor","createMotorMock","position","MotorSimulator","minLimit","maxLimit","initialPosition","initialVelocity","setPosition","setTarget","internalTimeRef","updatePosition","now","deltaTime","newPosition","newTarget","deltaPosition","direction","pos","timer","rawHardware","Multiposition","selectionRef","onMove","stop","opts","DropdownPositions","hardwareReady","moveTo","positionId","createSelectableItem","positionSchema","m","hardwareIsMoving","targetPosition","MultipositionDefault","MultipositionDefault2","Variants$x","MultipositionSimulator","OpticState","MultiPositionMagnification","hardwareMoving","magnification","magnifications","a","moveHardwareMagnification","index","itemMagnification","FixedMagnification","allowtuning","InputMagnification","rangeMin","rangeMax","formRef","rangeRef","setHardwareMagnification","event","valueAsFloat","updateEdit","onInputChange","onRangeChange","onRangeAccepted","RangeMagnification","OffMagnification","Optic","getOpticClass","Class","isOpticHardware","Variants$v","fixedjson","offjson","rangejson","OpticSimulator","kind","getInitial","move","speed","setMagnification","ProcedureState","Actions","waitingUserInput","aborting","isRunning","doStart","doAbort","ProcedureManage","State","awaitingUserInput","FinishedState","runState","runException","definition","ProcedureExecution","doValidate","ProcedureValidate","Variants$t","standby","ShutterState","getState","getVariant","ShutterOverlay","ShutterDefault","getAction","action","DropdownShutter","requestOpen","requestClose","ShutterProtected","capitalize","valueName","Variants$r","ShutterSimulator","useResolvedSlit","vgapId","vgap","hgapId","hgap","voffsetId","voffset","hoffsetId","hoffset","_c","_d","SlitState","info","description","vgapActions","hgapActions","voffsetActions","hoffsetActions","merge","DropdownSlit","schema","operator","resolved","Widget","readOnly","normalizePosition","gap","gapUnit","gapMoving","offset","offsetUnit","offsetMoving","_e","_f","_g","_h","SlitDefault","Variants$p","slit","horizontal","vertical","PumpOverlay","attrs","Pump","Variants$n","PusherState","PusherBlock","ButtonPush","distance","pushing","setPushing","RawPusher","isRetracted","isInTouch","movingIn","setMovingIn","movingOut","setMovingOut","location","Pusher","Variants$l","PusherSimulator","ServiceState","ServiceDefault","requestStart","requestRestart","requestStop","getStartAction","restartEnabled","getStopAction","stopEnabled","startAction","stopAction","DropdownService","ServiceProtected","Variants$j","TomoFlatMotionState","AxisName","motion","axisId","axis","DropAxis","axisRef","requestDropAxis","AxisOnOff","isUsed","requestAppendAxis","InputAxisMotion","exp","MotionKind","requestAbsoluteMotion","requestRelativeMotion","TomoFlatMotionDefault","imotion","getKind","kindVariant","kindTitle","TomoFlatMotionSmall","Alert","Variants$h","isTomoFlatMotionHardware","useTomoFlatMotionHardware","sy","sy2","TomoFlatMotionSimulator","updateAxes","inList","TomoReferencePositionDefault","moveToReference","isTomoReferencePositionHardware","Variants$f","TomoDetectorState","SelectPixelSizeMode","requestMode","mode","InputUserPixelSize","userSamplePixelSize","requestUserSamplePixelSize","DropdownPixelSize","useFormattedQuantity","displayUnit","normUnit","u","normValue","v","Qty","TomoDetectorSamplePixelSize","formattedValue","AcquisitionMode","InputAccMaxExpoTime","requestUpdate","lima","DropdownAcquisitionMode","limaId","limaActions","TomoDetectorAcquisitionMode","Variants$d","isTomoDetectorHardware","useTomoDetectorHardware","TomoDetectorsState","getHardwareIdFromRef","DropdownDetectors","detectors","activeDetectorId","targetDetectorId","mountDetector","detectorId","detectorRef","TomoDetectors","hardwareMounting","Variants$b","isTomoDetectorsHardware","useTomoDetectorsHardware","TomoImagingState","UpdateMode","updateOnMove","setUpdateModeOff","setUpdateModeAuto","ExposureTime","TakeActions","takeProj","takeDark","takeFlat","TomoImagingDefault","AccumulationIfOne","hardwareTomo","acqMode","TomoImagingExposureTime","SettleTime","settleTime","TomoImagingSettleTime","ProcessingButton","text","processing","doDark","setDoDark","doFlat","setDoFlat","doProj","setDoProj","TomoImagingActions","TomoImagingUpdateMode","Variants$9","TomoImagingSimulator","Variants$7","isTomoSampleStageHardware","useTomoSampleStageHardware","LatencyTime","valueFromHardware","TomoConfigLatencyTime","Variants$5","isTomoConfigHardware","useTomoConfigHardware","TomoHoloState","Variants$3","isTomoHoloHardware","useTomoHoloHardware","ValveOverlay","Valve","Variants$1","logger","debug","NoObject","LoadingObject","MissingObject","ErrorObject","MissingComponentObject","FullSizer","containerRef","view","PanelHeader","PanelContents","Panel","Wrap","yamlWrapperMap","registerYamlType","component","renderYamlNode","yamlNode","panel","Comp","OptionalPanel","children","Children","child","isValidElement","cloneElement","assertOnRemainingKeys","remainingContent","_parentNode","_indexFromParent","remainingContent2","UnknownKeysError","LayoutError","unknownKeys","MissingKeysError","missingKeys","KeyError","getYamlRoot","getYamlHierarchy","path","normalizeLayout","parentNode","indexFromParent","newNode","assertKeyExpected","assertString","assertBoolean","assertNumber","assertOptionalBoolean","assertOptionalString","assertStringList","assertOptionalStringOrStringList","assertOptionalStringList","assertOptionalNumber","assertOptionalNumberList","assertNoUnknownKeys","assertDataCollectionId","assertOptionalBackend","Yaml","providers","unknownOptions","DefaultErrorMessage","LayoutErrorMessage","formatPreview","indent","lines","actualIndentation","k","layoutName","INITIAL_STATE","ErrorBoundary","Component","data","prevProps","prevState","UnhandledErrorComponent","hasError","YamlRow","YamlCol","xs","yamlHardwareComponent","registerHardwareComponent","assertHardwareDesc","assertOptionalHardwareListDesc","hardwareDesc","YamlHardwareGroup","ids","groupid","even","nowrap","HardwareGroup","header","colWidth","emptyifnone","Hardware","componentMap","YamlHardware","YamlTodo","YamlNone","registerComponent","registerComponents","YamlComponent","scroll","Suspense","YamlContainer","YamlPanel","contentsStyle","hash","YamlTabs","tabs","each","t","Tab","Tabs","Header","RowTitle","row","getId","getText","idContent","titlealign","stateinheader","newContent","stateContent","YamlForm","content","React","YamlGrid","columnSpan","rowSpan","gridColumn","gridRow","YamlLabel","yamlMap","Main","layout","dynamicOp","op","a1","b1","operators","rsplit","separator","limits","split","useValue","valuePath","obj","useUnit","unitPath","isFixedUnit","MonitorHardware","monitor","flt","checkClass","overlayStr","monitorMap","registerMonitorComponent","YmlError","MonitorPanel","MonitorPanelItem"],"mappings":"wiBAKO,SAASA,GAAiBC,EAA+B,CACxD,KAAA,CAAE,SAAAC,CAAa,EAAAD,EACf,CAAE,OAAAE,EAAQ,OAAAC,EAAS,IAAA,EAASF,EAC5BG,EAAQF,GACTC,IAAW,KAAO,SAAWF,EAAS,WAAW,QAAU,UAC5D,UAcEI,EAX6C,CACjD,MAAO,UACP,QAAS,UACT,OAAQ,UACR,SAAU,YACV,QAAS,SACT,MAAO,SACP,OAAQ,SACR,OAAQ,SAAA,EAGqBD,CAAK,GAAK,UAEzC,OAAQE,EAAAA,IAAAC,EAAAA,MAAA,CAAM,GAAIF,EAAU,SAAMD,CAAA,CAAA,CACpC,CAEA,SAAwBI,GAAaR,EAAuC,CACpE,KAAA,CAAE,SAAAC,CAAa,EAAAD,EACd,OAAAM,MAACP,IAAiB,SAAAE,CAAoB,CAAA,CAC/C,CCrBA,SAAwBQ,GACtBT,EACA,CACM,KAAA,CAAE,SAAAC,EAAU,QAAAS,CAAY,EAAAV,EAC9B,SAASW,GAAU,CACjB,OAAIV,E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AMqG,EAAaqC,EAAAA,IAAI1I,EAAM,SAAU,CAAC6yB,EAAS5uB,IAAM,CAC/C,MAAAiC,EAAO2sB,EAAQ,MAAQ,WACvBrI,EAAOyI,GAAW/sB,CAAI,EAC5B,OAAIskB,IAAS,OAETlqB,EAAA,IAAC6yB,GAAA,CAEC,QAAAN,EACA,QAAS,QAAQ3sB,CAAI,cAAA,EAFhB,IAAIjC,CAAC,EAAA,EAMR3D,EAAA,IAAAkqB,EAAA,CAAmB,QAAAqI,CAAT,EAAA,IAAI5uB,CAAC,EAAsB,CAAA,CAC9C,EAGC,OAAA3D,EAAA,IAAC,MAAA,CACC,UAAW8K,EAAA,QACT,CAAE,UAAWpL,EAAM,SAAW,OAAQ,EACtC,UACA,gBACA,CAAE,sBAAuBA,EAAM,KAAO,OAAQ,CAChD,EAEA,SAAAM,EAAA,IAACoF,aAAU,MAAK,GACd,eAACvB,EAAAA,IAAI,CAAA,UAAU,cAAe,SAAAkC,CAAA,CAAW,CAC3C,CAAA,CAAA,CAAA,CAGN,CAIO,SAASgtB,GACdrzB,EACA,CACA,OAAQM,EAAA,IAAA8D,EAAA,IAAA,CAAI,UAAU,qBAAsB,WAAM,QAAS,CAAA,CAC7D"}
1
+ {"version":3,"file":"index.js","sources":["../src/hardware/base/BaseState.tsx","../src/hardware/base/BaseName.tsx","../src/hardware/base/BaseInfo.tsx","../src/hardware/utils/TypeIcon.tsx","../src/hardware/utils/HardwareTemplate.tsx","../src/hardware/base/BaseProperty.tsx","../src/hardware/base/index.tsx","../src/hardware/base/mocks/index.ts","../src/hardware/utils/State.tsx","../src/hardware/airbearing/AirBearingState.tsx","../src/hardware/airbearing/AirBearing.tsx","../src/components/ReadOnlyTextInput.tsx","../src/hardware/airbearing/AirBearingProtected.tsx","../src/hardware/airbearing/index.ts","../src/hardware/airbearing/mocks/index.ts","../src/hardware/base/mocks/Simulator.tsx","../src/hardware/airbearing/mocks/Simulator.tsx","../src/utils/formatting.ts","../src/hardware/frontend/Frontend.tsx","../src/hardware/frontend/index.ts","../src/hardware/frontend/mocks/index.ts","../src/hardware/gauge/Gauge.tsx","../src/hardware/gauge/index.ts","../src/hardware/gauge/mocks/index.ts","../src/components/NumericStep.tsx","../src/components/HardwareNumericStep.tsx","../src/hardware/laser/Laser.tsx","../src/hardware/laser/index.ts","../src/hardware/laser/mocks/index.ts","../src/hardware/laserheating/LaserHeating.tsx","../src/hardware/laserheating/index.ts","../src/hardware/laserheating/mocks/index.ts","../src/hardware/light/Light.tsx","../src/hardware/light/index.ts","../src/hardware/light/mocks/index.ts","../src/hardware/lima/LimaState.tsx","../src/hardware/lima/LimaDefault.tsx","../src/hardware/lima/LimaSize.tsx","../src/hardware/lima/LimaTransformation.tsx","../src/hardware/lima/LimaBinning.tsx","../src/hardware/lima/LimaImageRoi.tsx","../src/hardware/lima/LimaDescription.tsx","../src/hardware/lima/LimaShape.tsx","../src/registry/hooks.ts","../src/hardware/lima/index.ts","../src/hardware/lima/mocks/index.ts","../src/hardware/lima/mocks/Simulator.tsx","../src/hardware/measurementgroup/MeasurementGroup.tsx","../src/hardware/measurementgroup/index.ts","../src/hardware/measurementgroup/mocks/index.ts","../src/hardware/measurementgroup/mocks/Simulator.tsx","../src/hardware/motor/MotorState.tsx","../src/components/HardwareInputNumber.tsx","../src/hardware/motor/MotorDefault.tsx","../src/hardware/motor/MotorText.tsx","../src/hardware/motor/index.ts","../src/hardware/motor/mocks/index.ts","../src/hardware/motor/mocks/utils.ts","../src/hardware/motor/mocks/Simulator.tsx","../src/hardware/multiposition/Multiposition.tsx","../src/hardware/multiposition/MultipositionDefault2.tsx","../src/hardware/multiposition/index.ts","../src/hardware/multiposition/mocks/index.ts","../src/hardware/multiposition/mocks/Simulator.tsx","../src/hardware/optic/OpticState.tsx","../src/hardware/optic/Optic.tsx","../src/hardware/optic/index.ts","../src/hardware/optic/mocks/index.ts","../src/hardware/optic/mocks/Simulator.tsx","../src/hardware/procedure/ProcedureState.tsx","../src/hardware/procedure/ProcedureManage.tsx","../src/hardware/procedure/ProcedureExecution.tsx","../src/hardware/procedure/ProcedureValidate.tsx","../src/hardware/procedure/index.ts","../src/hardware/procedure/mocks/index.ts","../src/hardware/shutter/ShutterState.tsx","../src/hardware/shutter/ShutterDefault.tsx","../src/hardware/shutter/ShutterProtected.tsx","../src/hardware/shutter/index.ts","../src/hardware/shutter/mocks/index.ts","../src/hardware/shutter/mocks/Simulator.tsx","../src/hardware/slit/SlitState.tsx","../src/hardware/slit/SlitDefault.tsx","../src/hardware/slit/index.ts","../src/hardware/slit/mocks/index.ts","../src/hardware/pump/Pump.tsx","../src/hardware/pump/index.ts","../src/hardware/pump/mocks/index.ts","../src/hardware/pusher/PusherState.tsx","../src/hardware/pusher/Pusher.tsx","../src/hardware/pusher/index.ts","../src/hardware/pusher/mocks/index.ts","../src/hardware/pusher/mocks/Simulator.tsx","../src/hardware/service/ServiceState.tsx","../src/hardware/service/ServiceDefault.tsx","../src/hardware/service/ServiceProtected.tsx","../src/hardware/service/index.ts","../src/hardware/service/mocks/index.ts","../src/hardware/tomoflatmotion/TomoFlatMotionState.tsx","../src/hardware/tomoflatmotion/TomoFlatMotionDefault.tsx","../src/hardware/tomoflatmotion/TomoFlatMotionSmall.tsx","../src/hardware/tomoflatmotion/index.ts","../src/hardware/tomoflatmotion/mocks/index.ts","../src/hardware/tomoflatmotion/mocks/Simulator.tsx","../src/hardware/tomoreferenceposition/TomoReferencePositionDefault.tsx","../src/hardware/tomoreferenceposition/index.ts","../src/hardware/tomodetector/TomoDetectorState.tsx","../src/hardware/tomodetector/TomoDetectorSamplePixelSize.tsx","../src/hardware/tomodetector/TomoDetectorAcquisitionMode.tsx","../src/hardware/tomodetector/index.ts","../src/hardware/tomodetector/mocks/index.ts","../src/hardware/tomodetectors/TomoDetectorsState.tsx","../src/hardware/tomodetectors/TomoDetectors.tsx","../src/hardware/tomodetectors/index.ts","../src/hardware/tomodetectors/mocks/index.ts","../src/hardware/tomoimaging/TomoImagingState.tsx","../src/hardware/tomoimaging/TomoImagingDefault.tsx","../src/hardware/tomoimaging/TomoImagingExposureTime.tsx","../src/hardware/tomoimaging/TomoImagingSettleTime.tsx","../src/hardware/tomoimaging/TomoImagingActions.tsx","../src/hardware/tomoimaging/TomoImagingUpdateMode.tsx","../src/hardware/tomoimaging/index.ts","../src/hardware/tomoimaging/mocks/index.ts","../src/hardware/tomoimaging/mocks/Simulator.tsx","../src/hardware/tomosamplestage/index.ts","../src/hardware/tomoconfig/LatencyTime.tsx","../src/hardware/tomoconfig/index.ts","../src/hardware/tomoholo/TomoHoloState.tsx","../src/hardware/tomoholo/index.ts","../src/hardware/valve/Valve.tsx","../src/hardware/valve/index.ts","../src/hardware/valve/mocks/index.ts","../src/hardware/utils/NoObject.tsx","../src/hardware/utils/LoadingObject.tsx","../src/hardware/utils/MissingObject.tsx","../src/hardware/utils/ErrorObject.tsx","../src/hardware/utils/MissingComponentObject.tsx","../src/hardware/utils/NullObject.tsx","../src/components/FullSizer.tsx","../src/layout/Panel.tsx","../src/yaml-layout/utils.tsx","../src/yaml-layout/components/asserts.ts","../src/yaml-layout/components/Todo.tsx","../src/yaml-layout/components/None.tsx","../src/yaml-layout/ErrorBoundary.tsx","../src/yaml-layout/Row.tsx","../src/yaml-layout/Col.tsx","../src/yaml-layout/components/HardwareGroup.tsx","../src/yaml-layout/components/Hardware.tsx","../src/yaml-layout/Component.tsx","../src/yaml-layout/Container.tsx","../src/yaml-layout/Panel.tsx","../src/yaml-layout/Tabs.tsx","../src/yaml-layout/Form.tsx","../src/yaml-layout/Grid.tsx","../src/yaml-layout/Label.tsx","../src/yaml-layout/Main.tsx","../src/monitorpanel/MonitorHardware.tsx","../src/monitorpanel/MonitorPanel.tsx"],"sourcesContent":["import type { Hardware } from '../utils/types';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\nimport { Badge } from 'react-bootstrap';\n\nexport function AnyHardwareState(props: { hardware: Hardware }) {\n const { hardware } = props;\n const { online, locked = null } = hardware;\n const state = online\n ? (locked !== null ? 'LOCKED' : hardware.properties.state) || 'UNKNOWN'\n : 'OFFLINE';\n\n // Try to catch some common state name\n const variantMapping: { [name: string]: string } = {\n READY: 'success',\n OFFLINE: 'warning',\n MOVING: 'warning',\n DISABLED: 'secondary',\n UNKNOWN: 'danger',\n ERROR: 'danger',\n FAILED: 'danger',\n LOCKED: 'warning',\n };\n\n const variant = variantMapping[state] || 'success';\n\n return <Badge bg={variant}>{state}</Badge>;\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<AnySchema>) {\n const { hardware } = props;\n return <AnyHardwareState hardware={hardware} />;\n}\n","import type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\n\nexport interface BaseNameWidgetOptions extends HardwareWidgetOptions {\n overrideName?: string;\n emptyifnone?: boolean;\n}\n\nexport default function Name(\n props: HardwareWidgetProps<AnySchema, BaseNameWidgetOptions>\n) {\n const { hardware, options } = props;\n function getName() {\n if (hardware.name) {\n return hardware.name;\n }\n return hardware.id;\n }\n\n function getLabel() {\n if (options.overrideName !== undefined) {\n return options.overrideName;\n }\n if (hardware.alias) {\n return hardware.alias;\n }\n if (hardware.name) {\n return hardware.name;\n }\n return hardware.id;\n }\n\n function getTitle() {\n if (options.overrideName !== undefined) {\n return `Real name: ${getName()}`;\n }\n if (hardware.alias) {\n return `Real name: ${hardware.name}`;\n }\n return undefined;\n }\n\n const name = getLabel();\n const title = getTitle();\n return <span title={title}>{name}</span>;\n}\n","import type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\n\nexport interface BaseInfoWidgetOptions extends HardwareWidgetOptions {\n /** The property */\n property?: string;\n /** Unit for the property */\n unit?: string;\n}\n\nexport default function Info(\n props: HardwareWidgetProps<AnySchema, BaseInfoWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n function getValue() {\n const propertyName = options.property;\n if (propertyName === undefined) {\n return `property is not set`;\n }\n if (propertyName === null) {\n return `property is null`;\n }\n let result: any = hardware;\n for (const segment of propertyName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return `property '${propertyName}' not found`;\n }\n }\n return `${result}`;\n }\n\n return <>{getValue()}</>;\n}\n","export interface Props {\n online: boolean;\n activeMessage?: string;\n inactiveMessage?: string;\n message?: string;\n icon: string;\n name: string;\n}\n\nexport function OnlineStatus(props: Props) {\n const {\n activeMessage = 'Online',\n inactiveMessage = 'Offline',\n message = 'This device is',\n } = props;\n\n return (\n <div\n className={`dot-indicator small bg-${\n props.online ? 'success' : 'danger'\n }`}\n title={`${message} ${props.online ? activeMessage : inactiveMessage}`}\n />\n );\n}\n\nexport default function TypeIcon(props: Props) {\n const { name, icon } = props;\n return (\n <div className=\"icon\" title={name}>\n <i className={`fa ${icon}`} />\n <OnlineStatus {...props} />\n </div>\n );\n}\n","import type { ReactElement } from 'react';\nimport { Form, OverlayTrigger, Popover, Button } from 'react-bootstrap';\nimport type { Hardware } from './types';\n\ninterface Props {\n hardware: Hardware;\n headerMode?: string;\n widgetIcon: ReactElement;\n widgetState: ReactElement;\n widgetContent: ReactElement;\n}\n\n/**\n * Normalized way to compose hardware component in order to provide the same\n * kind of layout\n */\nexport default function HardwareTemplate(props: Props) {\n const { headerMode, hardware } = props;\n\n function getLabel() {\n if (hardware.alias) {\n return hardware.alias;\n }\n if (hardware.name) {\n return hardware.name;\n }\n return hardware.id;\n }\n\n const label = getLabel();\n\n switch (headerMode) {\n case 'front':\n return (\n <div className=\"hw-component\">\n <div className=\"hw-single\">\n {props.widgetIcon}\n <div className=\"name\">{label}</div>\n <div className=\"d-inline-block\">{props.widgetContent}</div>\n </div>\n </div>\n );\n case 'none':\n return (\n <div className=\"hw-component\">\n <div className=\"hw-single\">{props.widgetContent}</div>\n </div>\n );\n case 'state':\n return props.widgetState;\n // case 'top':\n default:\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n {props.widgetIcon}\n <div className=\"name\">\n <Form.Label htmlFor={hardware.id}>{label}</Form.Label>\n </div>\n {props.widgetState}\n {props.hardware.errors && props.hardware.errors.length > 0 && (\n <OverlayTrigger\n trigger=\"click\"\n placement=\"bottom\"\n rootClose\n overlay={\n <Popover id={props.hardware.id} style={{ maxWidth: 500 }}>\n <Popover.Header>Device Errors</Popover.Header>\n <Popover.Body>\n There were errors with properties on this device:\n <ul>\n {props.hardware.errors.map((error) => (\n <li>\n {error.property}:\n <span className=\"stack-trace\">\n {error.traceback}\n <br />\n {error.exception}\n </span>\n </li>\n ))}\n </ul>\n </Popover.Body>\n </Popover>\n }\n >\n <Button variant=\"danger\" size=\"sm\">\n <i className=\"fa fa-exclamation-triangle\" />\n </Button>\n </OverlayTrigger>\n )}\n </div>\n <div className=\"hw-content\">{props.widgetContent}</div>\n </div>\n );\n }\n}\n","import { InputGroup, Form, Badge } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { AnySchema } from '../utils/schema';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\n\nexport interface BasePropertyWidgetOptions extends HardwareWidgetOptions {\n header?: string;\n property?: string;\n unit?: string;\n}\n\nfunction DeviceState(props: AnySchema) {\n const state = props.online ? 'READY' : 'OFFLINE';\n return <Badge bg={state === 'READY' ? 'success' : 'warning'}>{state}</Badge>;\n}\n\nexport default function Property(\n props: HardwareWidgetProps<AnySchema, BasePropertyWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Optic\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <DeviceState {...hardware} />;\n\n function getValue() {\n const propertyName = options.property;\n if (propertyName === undefined) {\n return `property is not set`;\n }\n if (propertyName === null) {\n return `property is null`;\n }\n let result: any = hardware;\n for (const segment of propertyName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return `property '${propertyName}' not found`;\n }\n }\n return `${result}`;\n }\n\n function getUnit() {\n const unitName = options.unit;\n if (!unitName) {\n return null;\n }\n if (!unitName.includes('properties')) {\n // That's a fixed unit defined as an option\n return unitName;\n }\n\n let result: any = props;\n for (const segment of unitName.split('/')) {\n result = result[segment];\n if (result === undefined) {\n return null;\n }\n }\n return `${result}`;\n }\n\n const unit = getUnit();\n\n const widgetContent = (\n <InputGroup>\n <Form.Control value={getValue()} readOnly />\n {unit && <InputGroup.Text>{unit}</InputGroup.Text>}\n </InputGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { HardwareVariant } from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\nimport BaseState from './BaseState';\nimport BaseName from './BaseName';\nimport BaseInfo from './BaseInfo';\nimport BaseProperty from './BaseProperty';\n\nconst Variants: HardwareVariant<AnySchema> = {\n state: BaseState,\n name: BaseName,\n info: BaseInfo,\n property: BaseProperty,\n};\n\nexport default Variants;\n","import defaultjson from './Default.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { Badge, Col, OverlayTrigger, Row, Tooltip } from 'react-bootstrap';\n\n/**\n * Normalize the way to display an hardware state.\n *\n * If `minWidth` is pecified (in `em`) it ensure the widget width will stay the\n * same when the state change\n */\nexport function HardwareState(props: {\n state: string;\n variant: string;\n minWidth?: number;\n description?: string;\n}) {\n const style = {\n display: 'inline-block',\n minWidth: '',\n };\n\n if (props.minWidth) style.minWidth = `${props.minWidth}em`;\n return (\n <div style={style}>\n <Badge bg={props.variant} title={props.description}>\n {props.state}\n </Badge>\n </div>\n );\n}\n\n/**\n * Normalize the way to display an hardware exposing multiple states.\n *\n * - `states` is the states exposed by the hardware.\n * - `variants` contains a variant for each of this states, else `fatal` is used.\n * - `descriptions` can be provided to add a description to the state.\n *\n * If `minWidth` is pecified (in `em`) it ensure the widget width will stay the\n * same when the state change\n */\nexport function HardwareMultiState(props: {\n states: string[];\n variants?: Record<string, string>;\n descriptions?: Record<string, string>;\n minWidth?: number;\n}) {\n const { states, variants = {}, descriptions = {}, minWidth } = props;\n\n const mainState = states[0] ?? '';\n\n if (states.length === 0) {\n // No state is not supposed to happen\n // At least for now there is no use case\n return (\n <HardwareState\n state=\"NoState\"\n variant=\"fatal\"\n description=\"The device no not expose any state\"\n minWidth={minWidth}\n />\n );\n }\n\n if (states.length === 1) {\n // Fallback to a single state, as result the tooltip is smaller\n return (\n <HardwareState\n state={mainState}\n variant={variants[mainState] ?? 'fatal'}\n description={descriptions[mainState]}\n minWidth={minWidth}\n />\n );\n }\n\n const style = {\n display: 'inline-block',\n minWidth: minWidth ? `${minWidth}em` : '',\n };\n\n function renderTooltip(props: any) {\n return (\n <Tooltip id=\"device-state\" {...props}>\n {states.map((s, i) => {\n const desc = descriptions[s];\n // Assume a state starting with `_` is a custom state\n // which have to be displayed without this underscore\n const name = s.startsWith('_') ? s.slice(1) : s;\n return (\n <Row className=\"gx-0\">\n <Col sm=\"3\" className=\"text-end\">\n <Badge className=\"text-right\" bg={variants[s] ?? 'fatal'}>\n {name}\n </Badge>\n </Col>\n <Col sm=\"9\" className=\"text-start lh-1 my-auto ps-1\">\n {desc}\n </Col>\n </Row>\n );\n })}\n </Tooltip>\n );\n }\n\n return (\n <div style={style}>\n <OverlayTrigger\n placement=\"top\"\n delay={{ show: 250, hide: 400 }}\n overlay={renderTooltip}\n >\n <span className=\"text-nowrap\">\n <Badge className=\"rounded-end-0\" bg={variants[mainState] ?? 'fatal'}>\n {mainState}\n </Badge>\n <Badge className=\"rounded-start-0\" bg=\"secondary\">\n +{states.length - 1}\n </Badge>\n </span>\n </OverlayTrigger>\n </div>\n );\n}\n","import { HardwareState } from '../utils/State';\nimport type { AirBearingSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function AirBearingState(props: { hardware: AirBearingSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n ON: 'danger',\n OFF: 'success',\n MOVING_ON: 'warning',\n MOVING_OFF: 'warning',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<AirBearingSchema>\n) {\n const { hardware } = props;\n return <AirBearingState hardware={hardware} />;\n}\n","import { Button, ButtonGroup } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { AirBearingState } from './AirBearingState';\nimport type { AirBearingSchema } from '.';\n\nfunction RawAirBearing(props: {\n hardware: EditableHardware<AirBearingSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options, disabled } = props;\n const state = hardware.properties?.state ?? 'OFFLINE';\n const isOn = state === 'ON';\n const isOff = state === 'OFF';\n\n return (\n <div\n style={{\n display: 'grid',\n gridTemplateRows: 'min-content min-content',\n gridTemplateColumns: 'min-content auto',\n gridGap: '1px',\n }}\n >\n <ButtonGroup className=\"mx-auto\" style={{ width: '12em' }}>\n <Button\n onClick={() => {\n void hardware.actions.call('on');\n }}\n disabled={isOn || disabled}\n style={{ width: '5em' }}\n >\n <span className=\"text-nowrap\">On</span>\n </Button>\n <Button\n onClick={() => {\n void hardware.actions.call('off');\n }}\n disabled={isOff || disabled}\n style={{ width: '5em' }}\n >\n <span className=\"text-nowrap\">Off</span>\n </Button>\n </ButtonGroup>\n </div>\n );\n}\n\nexport default function AirBearing(\n props: HardwareWidgetProps<AirBearingSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Air bearing\"\n icon=\"fa-hand-point-right\"\n online={hardware.online}\n />\n );\n\n const widgetState = <AirBearingState hardware={hardware} />;\n\n function getWidgetContent() {\n return <RawAirBearing {...props} />;\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import { Form } from 'react-bootstrap';\n\n/**\n * Readonly text displayed as an input.\n *\n * Is supports variants, and can be properly integrated inside a\n * `FormGroup` to replace the main input.\n */\nexport default function ReadOnlyTextInput(props: {\n variant?: string;\n value?: string;\n style?: Record<string, any>;\n className?: string;\n title?: string;\n}) {\n const { value, variant, style, className, title } = props;\n const defaultClasses = variant\n ? `badge-${variant} bg-${variant} text-bg-${variant} border-${variant}`\n : 'border-light';\n return (\n <Form.Control\n className={`${defaultClasses} ${className} bg-secondary`}\n style={style}\n value={value}\n title={title}\n readOnly\n />\n );\n}\n","import {\n Button,\n ButtonGroup,\n Col,\n Container,\n Dropdown,\n InputGroup,\n Row,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { AirBearingState } from './AirBearingState';\nimport type { AirBearingSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport type { PropsWithChildren } from 'react';\n\nfunction ActionButton(\n props: PropsWithChildren<{\n icon: string;\n isActive?: boolean;\n wasActivated: boolean;\n disabled: boolean;\n onClick: () => void;\n title: string;\n }>\n) {\n return (\n <Button\n variant={\n props.isActive\n ? 'primary'\n : props.wasActivated\n ? 'warning'\n : 'secondary'\n }\n onClick={props.onClick}\n disabled={props.disabled || props.wasActivated}\n title={props.title}\n >\n <Row className=\"gx-0\">\n <i\n className={`col-sm-4 justify-content-center align-self-center ${props.icon}`}\n />\n <Col sm=\"8\">{props.children}</Col>\n </Row>\n </Button>\n );\n}\n\nfunction DropdownAirBearing(props: {\n hardware: EditableHardware<AirBearingSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options = {}, disabled } = props;\n function requestOn() {\n void hardware.actions.call('on');\n }\n\n function requestOff() {\n void hardware.actions.call('off');\n }\n\n const state = hardware.properties?.state ?? 'UNKNOWN';\n const hardwareDisabled = state === 'MOVING_ON' || state === 'MOVING_OFF';\n const isOn = state === 'ON';\n const isOff = state === 'OFF';\n const movingOn = state === 'MOVING_ON';\n const movingOff = state === 'MOVING_OFF';\n\n return (\n <Dropdown>\n <Dropdown.Toggle\n variant=\"secondary\"\n disabled={disabled || hardwareDisabled}\n />\n <Dropdown.Menu popperConfig={{ strategy: 'fixed' }}>\n <Container>\n <Row>\n <Col className=\"text-center\">Actions</Col>\n </Row>\n <Row>\n <Col>\n <ButtonGroup>\n <ActionButton\n icon=\"fa fa-arrow-up\"\n wasActivated={movingOn}\n onClick={() => {\n requestOn();\n }}\n disabled={disabled || hardwareDisabled}\n title=\"Turn on the air bearing\"\n >\n Turn\n <br />\n on\n </ActionButton>\n <ActionButton\n icon=\"fa fa-arrow-down\"\n wasActivated={movingOff}\n onClick={() => {\n requestOff();\n }}\n disabled={disabled || hardwareDisabled}\n title=\"Turn off the air bearing\"\n >\n Turn\n <br />\n off\n </ActionButton>\n </ButtonGroup>\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nfunction RawAirBearing(props: {\n hardware: EditableHardware<AirBearingSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options, disabled } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n\n const variants: { [state: string]: string } = {\n ON: 'danger',\n OFF: 'success',\n MOVING_ON: 'warning',\n MOVING_OFF: 'warning',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] ?? 'fatal';\n\n return (\n <InputGroup className=\"d-flex flex-nowrap\">\n <ReadOnlyTextInput\n variant={variant}\n className=\"text-center\"\n style={{ minWidth: '10em' }}\n value={state}\n />\n <DropdownAirBearing {...props} />\n </InputGroup>\n );\n}\n\nexport default function AirBearingProtected(\n props: HardwareWidgetProps<AirBearingSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Air bearing\"\n icon=\"fa-hand-point-right\"\n online={hardware.online}\n />\n );\n\n const widgetState = <AirBearingState hardware={hardware} />;\n\n function getWidgetContent() {\n return <RawAirBearing {...props} />;\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport AirBearing from './AirBearing';\nimport AirBearingProtected from './AirBearingProtected';\nimport AirBearingState from './AirBearingState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface AirBearingSchema extends Hardware {\n properties: {\n state: string;\n };\n}\n\nconst Variants: HardwareVariant<AirBearingSchema> = {\n default: AirBearing,\n protected: AirBearingProtected,\n // Override base state\n state: AirBearingState,\n};\n\nexport default Variants;\n","import defaultjson from './AirBearing.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useEffect, useMemo, useRef } from 'react';\nimport type {\n Hardware,\n EditableHardware,\n HardwareChangeActions,\n} from '../../utils/types';\nimport { isEqual } from 'lodash';\n\nexport async function delay(ms: number) {\n await new Promise((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport type PropsWithSimulator<P = Record<string, never>> = P & {\n name: string;\n alias?: string;\n useHardwareContext?: () => {\n actions: {\n updateHardware: (name: string, hardware: Hardware) => void;\n updateHardwareChangeActions: (\n name: string,\n actions: HardwareChangeActions\n ) => void;\n };\n };\n};\n\nexport function Simulator(props: {\n name: string;\n alias?: string | null;\n type: string;\n call: (name: string, value?: any) => Promise<void>;\n setProperty: (name: string, value: any) => Promise<void>;\n properties: { [name: string]: any };\n useHardwareContext?: () => {\n actions: {\n updateHardware: (name: string, hardware: Hardware) => void;\n updateHardwareChangeActions: (\n name: string,\n actions: HardwareChangeActions\n ) => void;\n };\n };\n}) {\n const {\n name,\n alias = null,\n type,\n setProperty,\n call,\n properties,\n useHardwareContext = () => {\n return null;\n },\n } = props;\n\n const ctx = useHardwareContext();\n\n const actions: HardwareChangeActions = useMemo(() => {\n const actions = {\n setProperty,\n call,\n };\n ctx?.actions.updateHardwareChangeActions?.(name, actions);\n return actions;\n }, []);\n\n const hardware: EditableHardware<Hardware> = {\n id: name,\n name,\n alias,\n online: true,\n properties,\n type,\n actions,\n user_tags: [],\n locked: null,\n };\n\n const previousHardware = useRef<EditableHardware<Hardware> | null>(null);\n\n useEffect(() => {\n if (\n previousHardware.current === null ||\n !isEqual(previousHardware.current, hardware)\n ) {\n previousHardware.current = hardware;\n ctx?.actions.updateHardware(name, hardware);\n }\n }, [name, hardware]);\n\n return <></>;\n}\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function AirBearingSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [state, setState] = useState('ON');\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'on') {\n setState('MOVING_ON');\n await delay(2000);\n setState('ON');\n return;\n }\n if (name === 'off') {\n setState('MOVING_OFF');\n await delay(2000);\n setState('OFF');\n return;\n }\n console.log('AirBearingSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log('AirBearingSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = {\n state,\n };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"tomoflatmotion\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","// https://github.com/gentooboontoo/js-quantities/issues/30\nexport function formatEng(scalar: number) {\n const powerPrefix: Record<number, string> = {\n 24: 'Y',\n 21: 'Z',\n 18: 'E',\n 15: 'P',\n 12: 'T',\n 9: 'G',\n 6: 'M',\n 3: 'k',\n '-3': 'm',\n '-6': '\\u00B5',\n '-9': 'n',\n '-12': 'p',\n '-15': 'f',\n '-18': 'a',\n '-21': 'z',\n '-24': 'y',\n };\n\n const q = Math.log(scalar) / Math.log(1e3);\n // so that for example '3 km' does not get converted to '3000 m'\n const subtrhnd = !Number.isInteger(q);\n\n const pow10 = 3 * Math.ceil(q - (subtrhnd ? 1 : 0));\n const prefix = pow10 === 0 ? '' : powerPrefix[pow10];\n\n return {\n scalar: scalar * 10 ** -pow10,\n prefix,\n multiplier: 10 ** -pow10,\n };\n}\n\n/**\n * Returns the argument as capitalized string.\n */\nexport function ucfirst(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function toHoursMins(seconds: number) {\n if (seconds < 60) return `${Math.round(seconds)} sec`;\n\n const min = Math.round(seconds / 60);\n\n const mins = min % 60;\n const hours = Math.floor(min / 60);\n\n return hours ? `${hours} hr ${mins} min` : `${mins} min`;\n}\n\nexport function toEnergy(wavelength: number) {\n return wavelength > 0\n ? (\n ((6.626_070_04e-34 * 2.997_924_58e8) /\n (wavelength * 1e-10) /\n 1.602_18e-19) *\n 1e-3\n ).toFixed(4)\n : 0;\n}\n\nexport function round(value: number, digits: number) {\n return Number.parseFloat(value.toFixed(digits));\n}\n","import { map } from 'lodash';\nimport {\n Badge,\n Button,\n ButtonGroup,\n Container,\n Row,\n Col,\n OverlayTrigger,\n Popover,\n} from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport { toHoursMins } from '../../utils/formatting';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport type { FrontendSchema } from '.';\n\nfunction FrontendOverlay(props: HardwareWidgetProps<FrontendSchema>) {\n const { hardware } = props;\n function reset() {\n void hardware.actions.call('reset');\n }\n\n type StateEnum = 'feitlk' | 'expitlk' | 'pssitlk';\n\n const itlks: { [name: string]: StateEnum } = {\n 'Front End': 'feitlk',\n Experimental: 'expitlk',\n PSS: 'pssitlk',\n };\n\n const ring = {\n Current: `${hardware.properties.current.toFixed(1)} mA`,\n Mode: hardware.properties.mode,\n Refill: toHoursMins(hardware.properties.refill),\n Message: <pre>{hardware.properties.message}</pre>,\n };\n\n function getPropertyState(key: StateEnum): string {\n if (!(key in hardware.properties)) {\n return 'UNKNOWN';\n }\n const state: any = hardware.properties[key];\n if (!state || typeof state !== 'string') {\n return 'UNKNOWN';\n }\n return state;\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <h6>Interlocks</h6>\n <Container>\n {map(itlks, (key, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>\n <Badge\n bg={getPropertyState(key) === 'ON' ? 'success' : 'danger'}\n >\n {getPropertyState(key)}\n </Badge>\n </Col>\n </Row>\n ))}\n </Container>\n\n <h6>Ring Status</h6>\n <Container>\n {map(ring, (prop, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>{prop}</Col>\n </Row>\n ))}\n </Container>\n\n <div className=\"d-grid gap-2\">\n <Button disabled={props.disabled} onClick={reset}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Shutter Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Frontend(props: HardwareWidgetProps<FrontendSchema>) {\n const { hardware, options = {} } = props;\n function onClick() {\n void hardware.actions.call(\n hardware.properties.frontend === 'FE open' ? 'close' : 'open'\n );\n }\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Frontend\"\n icon=\"fam-hardware-frontend\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={\n hardware.properties.state === 'OPEN' ||\n hardware.properties.state === 'RUNNING'\n ? 'success'\n : 'danger'\n }\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <ButtonGroup className=\"d-flex\">\n <Button\n variant={\n hardware.properties.frontend === 'FE open' ? 'danger' : 'success'\n }\n onClick={onClick}\n disabled={props.disabled}\n >\n {hardware.properties.frontend === 'FE open' ? 'Close' : 'Open'}\n </Button>\n <FrontendOverlay {...props} />\n </ButtonGroup>\n </div>\n </div>\n );\n}\n\nexport default Frontend;\n","import type { HardwareVariant } from '../utils/types';\nimport type { Hardware } from '../utils/types';\nimport Frontend from './Frontend';\n\nexport interface FrontendSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n automatic: boolean;\n frontend: string;\n // current intensity\n current: number;\n // number of seconds since the last refill\n refill: number;\n mode: string;\n message: string;\n feitlk: string;\n pssitlk: string;\n expitlk: string;\n };\n}\n\nconst Variants: HardwareVariant<FrontendSchema> = {\n default: Frontend,\n};\n\nexport default Variants;\n","import defaultjson from './FrontEnd.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import {\n Badge,\n Button,\n OverlayTrigger,\n Popover,\n InputGroup,\n Form,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { GaugeSchema } from '.';\n\nexport interface GaugeWidgetOptions extends HardwareWidgetOptions {\n /** Unit of pressure */\n unit?: string;\n /** Precision to show, default 3 */\n precision?: number;\n}\n\nfunction GaugeOverlay(\n props: HardwareWidgetProps<GaugeSchema, GaugeWidgetOptions>\n) {\n const { hardware } = props;\n const toggle = () => {\n void hardware.actions.call(\n hardware.properties.state === 'ON' ? 'off' : 'on'\n );\n };\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n\n <div className=\"d-grid gap-2\">\n <Button disabled={props.disabled} onClick={toggle}>\n {hardware.properties.state === 'ON' ? 'Off' : 'On'}\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button title=\"Gauge Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Gauge(props: HardwareWidgetProps<GaugeSchema, GaugeWidgetOptions>) {\n const { hardware, options = {} } = props;\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Gauge\"\n icon=\"fam-hardware-gauge\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge bg={hardware.properties.state === 'ON' ? 'success' : 'danger'}>\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <InputGroup>\n <Form.Control\n value={hardware.properties.pressure.toExponential(\n options.precision || 3\n )}\n disabled\n />\n {(hardware.properties.unit || options.unit) && (\n <InputGroup.Text>\n {hardware.properties.unit || options.unit}\n </InputGroup.Text>\n )}\n <GaugeOverlay {...props} />\n </InputGroup>\n </div>\n </div>\n );\n}\n\nexport default Gauge;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Gauge from './Gauge';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface GaugeSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n pressure: number;\n unit?: string; // FIXME: The server implementation is missing\n };\n}\n\nconst Variants: HardwareVariant<GaugeSchema> = {\n default: Gauge,\n};\n\nexport default Variants;\n","import defaultjson from './Gauge.json';\nimport defaultjson2 from './Gauge2.json';\n\nexport const Mocks = {\n default: defaultjson,\n default2: defaultjson2,\n};\n","import type {\n KeyboardEvent,\n ChangeEvent,\n MutableRefObject,\n ReactNode,\n} from 'react';\nimport { forwardRef, useEffect, useRef, useState } from 'react';\nimport { map } from 'lodash';\n\nimport { Form, Button, InputGroup } from 'react-bootstrap';\nimport classNames from 'classnames';\n\ninterface Props {\n step?: number | string;\n steps?: (number | string)[];\n disabled: boolean;\n stepOnly?: boolean;\n id?: string;\n unit?: string;\n overlay?: ReactNode | null;\n incIcon?: string;\n decIcon?: string;\n swapIncDec?: boolean;\n className?: string;\n type?: 'number' | 'text';\n precision?: number;\n horizontalArrows?: boolean;\n largeArrows?: boolean;\n onBlur: () => void;\n onChange: (e: ChangeEvent<HTMLInputElement>) => void;\n onStep: (params: { target: HTMLInputElement }) => void;\n onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;\n}\n\nconst NumericStep = forwardRef<HTMLInputElement, Props>((props, ref) => {\n const stepSizeRef = useRef<HTMLSelectElement>(null);\n const focusTimeoutRef = useRef<NodeJS.Timeout>();\n const [currentStep, setCurrentStep] = useState(props.step);\n const [retakeFocus, setRetakeFocus] = useState(false);\n const onStep = (up: boolean) => {\n // FIXME: Would be good to remove that cast\n const ref2 = ref as MutableRefObject<HTMLInputElement>;\n if (stepSizeRef.current === null) {\n return;\n }\n let val = Number.parseFloat(ref2.current.value);\n\n // Exponential step up / down\n if (stepSizeRef.current.value.startsWith('*')) {\n const multiplier = Number.parseFloat(\n stepSizeRef.current.value.replace('*', '')\n );\n val = up ? val * multiplier : val / multiplier;\n\n // Normal step up / down\n } else {\n const stepSize = Number.parseFloat(stepSizeRef.current.value);\n val += up ? stepSize : -stepSize;\n }\n ref2.current.value = `${val}`;\n\n if (props.onStep) {\n props.onStep({\n target: ref2.current,\n });\n }\n };\n\n const {\n onStep: onStepProp,\n step,\n overlay,\n incIcon,\n decIcon,\n swapIncDec,\n onKeyDown,\n onBlur,\n horizontalArrows,\n largeArrows,\n disabled,\n stepOnly,\n ...rest\n } = props;\n\n const onKeyDown2 = (e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n setRetakeFocus(true);\n onStep(true);\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n setRetakeFocus(true);\n onStep(false);\n } else if (onKeyDown) {\n onKeyDown(e);\n }\n };\n\n if (retakeFocus) {\n if (focusTimeoutRef.current) clearTimeout(focusTimeoutRef.current);\n focusTimeoutRef.current = setTimeout(() => {\n (ref as MutableRefObject<HTMLInputElement>)?.current?.focus();\n }, 100);\n }\n\n useEffect(() => {\n return () => {\n if (focusTimeoutRef.current) clearTimeout(focusTimeoutRef.current);\n };\n }, []);\n\n const onBlur2 = () => {\n if (focusTimeoutRef.current) {\n clearTimeout(focusTimeoutRef.current);\n }\n setRetakeFocus(false);\n if (onBlur) onBlur();\n };\n\n if (!props.step) {\n return (\n <Form.Control\n ref={ref}\n type=\"number\"\n step=\"any\"\n onKeyDown={onKeyDown2}\n onBlur={onBlur2}\n disabled={disabled}\n onClick={(e) => {\n // do not close parent dropdown\n e.stopPropagation();\n }}\n {...rest}\n />\n );\n }\n\n const steps = map(props.steps || [props.step], (s) => (\n <option value={s} key={s}>\n {s}\n </option>\n ));\n\n const hasIncDec = incIcon || decIcon;\n\n return (\n <div\n className={classNames('numeric-step', {\n 'numeric-step-large': largeArrows,\n 'numeric-step-horizontal': horizontalArrows,\n })}\n >\n <InputGroup>\n <Form.Control\n onKeyDown={onKeyDown2}\n onBlur={onBlur2}\n ref={ref}\n type=\"number\"\n step=\"any\"\n disabled={disabled || stepOnly}\n {...rest}\n />\n <>\n {overlay}\n {!overlay && (\n <InputGroup.Text\n className={`d-flex flex-column ${hasIncDec ? 'inc-dec' : ''}`}\n >\n <Form.Control\n ref={stepSizeRef}\n as=\"select\"\n className=\"step-size\"\n defaultValue={currentStep}\n disabled={disabled}\n onChange={(e) =>\n setCurrentStep(Number.parseFloat(e.target.value))\n }\n >\n {steps}\n </Form.Control>\n {props.unit && <div>{props.unit}</div>}\n {!incIcon && !decIcon && (\n <>\n <Button\n className=\"step step-up\"\n disabled={props.disabled}\n onClick={(e) => onStep(true)}\n />\n <Button\n className=\"step step-down\"\n disabled={props.disabled}\n onClick={(e) => onStep(false)}\n />\n </>\n )}\n </InputGroup.Text>\n )}\n {decIcon && swapIncDec && (\n <Button disabled={props.disabled} onClick={(e) => onStep(false)}>\n <i className={`fa fa-fw fa-${decIcon}`} />\n </Button>\n )}\n {incIcon && (\n <Button disabled={props.disabled} onClick={(e) => onStep(true)}>\n <i className={`fa fa-fw fa-${incIcon}`} />\n </Button>\n )}\n {decIcon && !swapIncDec && (\n <Button disabled={props.disabled} onClick={(e) => onStep(false)}>\n <i className={`fa fa-fw fa-${decIcon}`} />\n </Button>\n )}\n </>\n </InputGroup>\n </div>\n );\n});\n\nexport default NumericStep;\n","import { useRef, useState, useEffect } from 'react';\nimport type { KeyboardEvent, ChangeEvent } from 'react';\nimport classNames from 'classnames';\nimport { Button } from 'react-bootstrap';\nimport NumericStep from './NumericStep';\n\n/**\n * NumericStep handled hardware properties.\n *\n * Input related to hardware have specificities because the hardware state can\n * change during the user interaction.\n */\nexport default function HardwareNumericStep(props: {\n hardwareValue: number | null;\n hardwareIsDisabled: boolean;\n hardwareIsMoving: boolean;\n hardwareIsReady: boolean;\n onMoveRequested: (value: number) => Promise<void> | null;\n onAbortRequested: () => void;\n /** Default step size to use for up / down arrows */\n step?: number | string;\n /** Array of selectable step sizes */\n steps?: (number | string)[];\n /** Number of decimals to show */\n precision?: number;\n /** Whether this widget is read only */\n readOnly?: boolean;\n /** Whether this widget can only be changed using steps */\n stepOnly?: boolean;\n /** Specify a fontawesome to inc the value */\n incIcon?: string;\n /** Specify a fontawesome to dec the value */\n decIcon?: string;\n /** If true inc and dec icon are swapped */\n swapIncDec?: boolean;\n /** Show the step arrows horizontally instead of vertically */\n horizontalArrows?: boolean;\n /** Show large step arrows */\n largeArrows?: boolean;\n /** Identifier passed to the input element */\n id?: string;\n}) {\n const valueRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const [error, setError] = useState(false);\n useEffect(() => {\n if (valueRef.current) {\n if (props.hardwareValue === null) {\n valueRef.current.value = '';\n } else if (props.precision !== undefined) {\n valueRef.current.value = props.hardwareValue.toFixed(props.precision);\n } else {\n valueRef.current.value = props.hardwareValue.toString();\n }\n setEdited(false);\n }\n }, [props.hardwareValue]);\n\n function updateRef(value: any) {\n let newValue = value;\n if (props.precision !== undefined) {\n newValue = Number.parseFloat(newValue).toFixed(props.precision);\n }\n if (valueRef?.current) {\n valueRef.current.value = newValue;\n }\n }\n\n function onBlur() {\n if (edited) {\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setEdited(false);\n }, 3000);\n }\n }\n\n function onChange(e: ChangeEvent<HTMLInputElement>) {\n if (props.hardwareValue === null) {\n return;\n }\n setEdited(!(e.target.value === props.hardwareValue.toString()));\n }\n\n function onStep(e: any) {\n setEdited(false);\n const promise = props.onMoveRequested(e.target.value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n }\n\n function onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n switch (e.key) {\n case 'Enter':\n {\n setEdited(false);\n // @ts-expect-error\n const value: number = Number.parseFloat(e.target.value);\n const promise = props.onMoveRequested(value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n }\n e.preventDefault();\n e.stopPropagation();\n break;\n case 'Esc': // IE/Edge specific value\n case 'Escape':\n if (edited) {\n setError(false);\n setEdited(false);\n updateRef(props.hardwareValue);\n }\n // @ts-expect-error\n e.target.blur();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n\n return (\n <NumericStep\n id={props.id}\n className={classNames({\n 'form-control-edited': edited,\n 'form-control-error': error,\n 'hw-moving': props.hardwareIsMoving,\n })}\n type={props.readOnly ? 'text' : 'number'}\n ref={valueRef}\n precision={props.precision}\n onChange={onChange}\n onBlur={onBlur}\n onStep={onStep}\n onKeyDown={onKeyDown}\n disabled={\n props.hardwareIsDisabled || props.readOnly || !props.hardwareIsReady\n }\n stepOnly={props.stepOnly}\n step={props.step}\n steps={props.steps}\n incIcon={props.incIcon}\n decIcon={props.decIcon}\n swapIncDec={props.swapIncDec}\n horizontalArrows={props.horizontalArrows}\n largeArrows={props.largeArrows}\n overlay={\n props.hardwareIsMoving && !props.hardwareIsDisabled ? (\n <Button variant=\"danger\" onClick={props.onAbortRequested}>\n <i className=\"fa fa-times\" />\n </Button>\n ) : null\n }\n />\n );\n}\n","import _debounce from 'lodash/debounce';\nimport { Button, InputGroup } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport HardwareNumericStep from '../../components/HardwareNumericStep';\nimport { HardwareState } from '../utils/State';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { LaserSchema } from '.';\n\nexport interface LaserWidgetOptions extends HardwareWidgetOptions {\n /** Default step size to use for up / down arrows */\n step?: number;\n /** Array of selectable step sizes */\n steps?: number[];\n}\n\nexport default function Laser(\n props: HardwareWidgetProps<LaserSchema, LaserWidgetOptions>\n) {\n const { hardware, options = {}, disabled } = props;\n\n function requestPowerChange(value: number) {\n return hardware.actions.setProperty('power', value);\n }\n\n function requestStateChange(state: boolean) {\n return hardware.actions.call(state ? 'on' : 'off');\n }\n\n const state = hardware.properties.state;\n\n const widgetIcon = (\n <TypeIcon name=\"Laser\" icon=\"fam-hardware-laser\" online={hardware.online} />\n );\n\n const widgetState = (\n <HardwareState\n state={state}\n minWidth={6}\n variant={state === 'ON' ? 'success' : 'warning'}\n />\n );\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={\n <InputGroup>\n <HardwareNumericStep\n id={hardware.id}\n hardwareValue={hardware.properties.power}\n hardwareIsDisabled={false}\n hardwareIsReady\n hardwareIsMoving={state === 'MOVING'}\n onMoveRequested={requestPowerChange}\n onAbortRequested={() => null}\n precision={1}\n readOnly={false}\n step={options.step}\n steps={options.steps}\n incIcon={undefined}\n decIcon={undefined}\n swapIncDec={undefined}\n />\n <Button\n size=\"sm\"\n style={{\n fontSize: '0.6rem',\n padding: '0.05rem 0.6rem',\n marginTop: '0.1rem',\n }}\n onClick={() => {\n void requestStateChange(hardware.properties.state !== 'ON');\n }}\n >\n <i\n className={\n hardware.properties.state === 'ON'\n ? 'fa fa-toggle-on'\n : 'fa fa-toggle-off'\n }\n />\n </Button>\n </InputGroup>\n }\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Laser from './Laser';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface LaserSchema extends Hardware {\n properties: {\n state: string;\n power: number;\n };\n}\n\nconst Variants: HardwareVariant<LaserSchema> = {\n default: Laser,\n};\n\nexport default Variants;\n","import defaultjson from './Laser.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import {\n Button,\n InputGroup,\n OverlayTrigger,\n Popover,\n Container,\n Row,\n Col,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport HardwareNumericStep from '../../components/HardwareNumericStep';\nimport { HardwareState } from '../utils/State';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { LaserHeatingSchema } from '.';\nimport { useState } from 'react';\n\ninterface LaserHeatingOverlayProps {\n hardware: EditableHardware<LaserHeatingSchema>;\n disabled: boolean;\n}\n\nfunction LaserHeatingOverlay(props: LaserHeatingOverlayProps) {\n const { hardware } = props;\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"laserheating_overlay\">\n <Popover.Header>{hardware.name} details</Popover.Header>\n <Popover.Body>\n <Container>\n <Row>\n <Col>Background Mode</Col>\n <Col>{hardware.properties.background_mode}</Col>\n </Row>\n <Row>\n <Col>Calibration</Col>\n <Col>{hardware.properties.current_calibration}</Col>\n </Row>\n <Row>\n <Col>Fit Wavelength</Col>\n <Col>\n {hardware.properties.fit_wavelength?.join(' - ')}{' '}\n <span>nm</span>\n </Col>\n </Row>\n </Container>\n </Popover.Body>\n </Popover>\n }\n >\n <Button>\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport interface LaserHeatingWidgetOptions extends HardwareWidgetOptions {\n /** Default step size to use for up / down arrows */\n exposureStep?: number;\n /** Array of selectable step sizes */\n exposureSteps?: number[];\n}\n\nexport default function LaserHeating(\n props: HardwareWidgetProps<LaserHeatingSchema, LaserHeatingWidgetOptions>\n) {\n const { hardware, options = {}, disabled } = props;\n const [pending, setPending] = useState<boolean>(false);\n function requestExposureChange(value: number) {\n if (value <= 0) {\n return Promise.reject(new Error('exposure_time must be > 0'));\n }\n return hardware.actions.setProperty('exposure_time', value);\n }\n\n function requestMeasure() {\n setPending(true);\n const promise = hardware.actions.call('measure');\n\n if (promise !== undefined) {\n console.log('pending');\n promise\n .then(() => {\n setPending(false);\n })\n .catch((error) => {\n setPending(false);\n });\n }\n\n return promise;\n }\n\n const state = hardware.properties.state;\n\n const widgetIcon = (\n <TypeIcon name=\"Laser Heating\" icon=\"fa-fire\" online={hardware.online} />\n );\n\n const widgetState = (\n <HardwareState\n state={state}\n minWidth={6}\n variant={state === 'READY' ? 'success' : 'warning'}\n />\n );\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={\n <InputGroup>\n <HardwareNumericStep\n id={hardware.id}\n hardwareValue={hardware.properties.exposure_time}\n hardwareIsReady\n hardwareIsDisabled={props.disabled}\n hardwareIsMoving={false}\n onMoveRequested={requestExposureChange}\n onAbortRequested={() => null}\n precision={1}\n readOnly={false}\n step={options.exposureStep}\n steps={options.exposureSteps}\n incIcon={undefined}\n decIcon={undefined}\n swapIncDec={undefined}\n />\n <InputGroup.Text>s</InputGroup.Text>\n <Button\n size=\"sm\"\n disabled={props.disabled || pending}\n onClick={() => {\n void requestMeasure();\n }}\n >\n {pending ? (\n <i className=\"fa fa-spinner fa-spin\" />\n ) : (\n <>\n <i className=\"fa fa-play me-1\" />\n Measure\n </>\n )}\n </Button>\n <LaserHeatingOverlay hardware={hardware} disabled={props.disabled} />\n </InputGroup>\n }\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport LaserHeating from './LaserHeating';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface LaserHeatingSchema extends Hardware {\n properties: {\n state: string;\n exposure_time: number;\n background_mode: 'ON' | 'OFF' | 'ALWAYS';\n fit_wavelength: number[];\n current_calibration: string;\n };\n}\n\nconst Variants: HardwareVariant<LaserHeatingSchema> = {\n default: LaserHeating,\n};\n\nexport default Variants;\n","import defaultjson from './LaserHeating.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useRef, useCallback } from 'react';\nimport _debounce from 'lodash/debounce';\nimport { Badge, Form, Button } from 'react-bootstrap';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { LightSchema } from '.';\n\nexport default function Light(props: HardwareWidgetProps<LightSchema>) {\n const sliderRef = useRef<HTMLInputElement>(null);\n const { hardware, options = {} } = props;\n\n function requestIntensityChange(value: number) {\n void hardware.actions.setProperty('intensity', value);\n }\n\n const debounceIntensityChange = useCallback(\n _debounce(requestIntensityChange, 100),\n []\n );\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon name=\"Light\" icon=\"fa-lightbulb-o\" online={hardware.online} />\n <div className=\"name\">{hardware.name}</div>\n <Badge bg={hardware.properties.state === 'ON' ? 'success' : 'danger'}>\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <Form.Control\n ref={sliderRef}\n disabled={props.disabled}\n type=\"range\"\n min=\"0\"\n max=\"100\"\n onChange={(e) =>\n debounceIntensityChange(Number.parseFloat(e.target.value))\n }\n defaultValue={hardware.properties.intensity}\n />\n <div>\n <Button\n disabled={hardware.properties.intensity === 0}\n size=\"sm\"\n style={{\n fontSize: '0.6rem',\n padding: '0.05rem 0.6rem',\n marginTop: '0.1rem',\n }}\n onClick={() => debounceIntensityChange(0)}\n >\n <i className=\"fa fa-power-off\" />\n </Button>\n <span className=\"float-end\">{hardware.properties.intensity} %</span>\n </div>\n </div>\n </div>\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Light from './Light';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface LightSchema extends Hardware {\n properties: {\n state: string;\n temperature: number;\n intensity: number;\n };\n}\n\nconst Variants: HardwareVariant<LightSchema> = {\n default: Light,\n};\n\nexport default Variants;\n","import defaultjson from './Light.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { LimaSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function LimaState(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { online, locked = null } = hardware;\n const state = hardware.properties.state ?? 'UNKNOWN';\n console.log(state);\n const finalState = online\n ? (state === 'ACQUIRING' ? state : locked !== null ? 'LOCKED' : state) ||\n 'UNKNOWN'\n : 'OFFLINE';\n\n const variants: { [state: string]: string } = {\n UNKNOWN: 'critical',\n ACQUIRING: 'warning',\n READY: 'success',\n OFFLINE: 'secondary',\n LOCKED: 'warning',\n };\n const variant = variants[finalState] ?? variants.UNKNOWN;\n return <HardwareState state={finalState} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<LimaSchema>) {\n const { hardware } = props;\n return <LimaState hardware={hardware} />;\n}\n","import { Stack } from 'react-bootstrap';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { LimaState } from './LimaState';\nimport type { LimaSchema } from '.';\n\nfunction Content(props: HardwareWidgetProps<LimaSchema>) {\n const { hardware, options = {} } = props;\n\n return (\n <Stack className=\"bg-light rounded-2 ps-2 p-1\" direction=\"horizontal\">\n <div>{hardware.name}</div>\n </Stack>\n );\n}\n\nexport default function LimaDefault(props: HardwareWidgetProps<LimaSchema>) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const headerMode = options.header || 'top';\n if (headerMode === 'none') {\n return <Content {...props} />;\n }\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={<Content {...props} />}\n headerMode={headerMode}\n />\n );\n}\n","import { Stack } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\n\nfunction Content(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n\n const [width, height] = hardware.properties.size ?? ['?', '?'];\n\n return (\n <Stack className=\"bg-light rounded-2 ps-2 p-1\" direction=\"horizontal\">\n <div>\n {width} × {height}\n </div>\n <div className=\"ms-auto\">\n <small>\n <small>px</small>\n </small>\n </div>\n </Stack>\n );\n}\n\nexport default function TomoDetectorSize(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const headerMode = options.header ?? 'top';\n if (headerMode === 'none') {\n return <Content {...props} />;\n }\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={<Content {...props} />}\n headerMode={headerMode}\n />\n );\n}\n","import {\n InputGroup,\n Badge,\n Container,\n Row,\n Col,\n ButtonGroup,\n Button,\n Dropdown,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n EditableHardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\nimport { useState } from 'react';\nimport type { PropsWithChildren } from 'react';\n\nfunction ActionButton(\n props: PropsWithChildren<{\n icon?: string;\n isActive?: boolean;\n disabled: boolean;\n onAction: () => Promise<void>;\n title: string;\n }>\n) {\n const [doingAction, setDoingAction] = useState(false);\n return (\n <Button\n variant={\n props.isActive ? 'primary' : doingAction ? 'warning' : 'secondary'\n }\n onClick={() => {\n setDoingAction(true);\n props.onAction().finally(() => {\n setDoingAction(false);\n });\n }}\n disabled={props.disabled || doingAction}\n title={props.title}\n className=\"text-nowrap\"\n >\n {props.icon && (\n <i\n className={`col-sm-4 justify-content-center align-self-center ${props.icon}`}\n />\n )}\n {props.children}\n </Button>\n );\n}\n\nfunction DropdownLimaTransformation(props: {\n hardware: EditableHardware<LimaSchema>;\n options: EditableHardwareWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options = {}, disabled } = props;\n const { actions, properties } = hardware;\n const {\n rotation,\n flip: [flipX, flipY],\n } = properties;\n\n return (\n <Dropdown>\n <Dropdown.Toggle variant=\"secondary\" disabled={disabled} />\n <Dropdown.Menu align=\"end\" popperConfig={{ strategy: 'fixed' }}>\n <Container>\n <Row>\n <Col className=\"text-center\">Rotation</Col>\n </Row>\n <Row>\n <Col>\n <ButtonGroup>\n <ActionButton\n isActive={rotation === 0}\n onAction={() => actions.setProperty('rotation', 0)}\n disabled={disabled}\n title=\"Disable rotation transformation\"\n >\n None\n </ActionButton>\n <ActionButton\n isActive={rotation === 90}\n onAction={() => actions.setProperty('rotation', 90)}\n disabled={disabled}\n title=\"Disable rotation transformation\"\n >\n 90 <i className=\"fa fa-fw fa-arrow-rotate-right\" />\n </ActionButton>\n <ActionButton\n isActive={rotation === 180}\n onAction={() => actions.setProperty('rotation', 180)}\n disabled={disabled}\n title=\"Disable rotation transformation\"\n >\n 180 <i className=\"fa fa-fw fa-arrow-rotate-right\" />\n </ActionButton>\n <ActionButton\n isActive={rotation === 270}\n onAction={() => actions.setProperty('rotation', 270)}\n disabled={disabled}\n title=\"Disable rotation transformation\"\n >\n 270 <i className=\"fa fa-fw fa-arrow-rotate-right\" />\n </ActionButton>\n </ButtonGroup>\n </Col>\n </Row>\n <Row>\n <Col className=\"text-center\">Flip</Col>\n </Row>\n <Row className=\"gx-0\">\n <Col xs={6}>\n <ButtonGroup>\n <ActionButton\n isActive={flipX}\n onAction={() => actions.setProperty('flip', [true, flipY])}\n disabled={disabled}\n title=\"Enable horizontal flip transformation\"\n >\n Horiz <i className=\"fa fa-fw fa-left-right\" />\n </ActionButton>\n <ActionButton\n isActive={!flipX}\n onAction={() => actions.setProperty('flip', [false, flipY])}\n disabled={disabled}\n title=\"Disable horizontal flip transformation\"\n >\n No\n </ActionButton>\n </ButtonGroup>\n </Col>\n <Col xs={6}>\n <ButtonGroup>\n <ActionButton\n isActive={flipY}\n onAction={() => actions.setProperty('flip', [flipX, true])}\n disabled={disabled}\n title=\"Enable vertical flip transformation\"\n >\n Vert <i className=\"fa fa-fw fa-up-down\" />\n </ActionButton>\n <ActionButton\n isActive={!flipY}\n onAction={() => actions.setProperty('flip', [flipX, false])}\n disabled={disabled}\n title=\"Disable vertical flip transformation\"\n >\n No\n </ActionButton>\n </ButtonGroup>\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nfunction LimaTransformationFlags(\n props: HardwareWidgetProps<LimaSchema, EditableHardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties } = hardware;\n\n const [flipH, flipV] = properties.flip;\n const rotation = properties.rotation ?? 0;\n const noTransformation = !flipH && !flipV && rotation === 0;\n return (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text>\n {flipH && (\n <Badge style={{ fontSize: '130%' }} className=\"me-1\">\n Flip\n <i className=\"fa fa-fw fa-left-right\" />\n </Badge>\n )}\n {flipV && (\n <Badge style={{ fontSize: '130%' }} className=\"me-1\">\n Flip\n <i className=\"fa fa-fw fa-up-down\" />\n </Badge>\n )}\n {rotation !== 0 && (\n <Badge style={{ fontSize: '130%' }} className=\"me-1\">\n Rot {rotation.toFixed(0)}\n <i className=\"fa fa-fw fa-arrow-rotate-right\" />\n </Badge>\n )}\n {noTransformation && (\n <Badge\n bg=\"secondary\"\n style={{ fontSize: '130%' }}\n title=\"No transformation\"\n >\n None\n </Badge>\n )}\n </InputGroup.Text>\n {!options.readonly && <DropdownLimaTransformation {...props} />}\n </InputGroup>\n );\n}\n\nexport default function LimaTransformation(\n props: HardwareWidgetProps<LimaSchema, EditableHardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <LimaTransformationFlags {...props} />\n </>\n );\n\n const headerMode = options.header ?? 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Button, Dropdown, Badge } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n EditableHardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { limaBinningModeSupported } from '.';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\n/** Size of longest text mode, in order to not change the size of the widget */\nconst LONGEST_MODE_WIDTH = '4.2em';\n\nfunction DropdownBinning(props: HardwareWidgetProps<LimaSchema>) {\n const { hardware } = props;\n const { properties } = hardware;\n const hardwareReady = properties.state === 'READY';\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n const binningMode = properties.binning_mode ?? 'SUM';\n\n function SelectableItem(props: {\n binningMode: string;\n selectedMode: string;\n title: string;\n }) {\n const { binningMode, selectedMode, title } = props;\n const selected = binningMode === selectedMode;\n const icon = selected ? 'fa fa-fw fa-dot-circle-o' : 'fa fa-fw fa-circle-o';\n\n return (\n <Dropdown.Item\n key={binningMode}\n disabled={disabled}\n onClick={() => {\n void hardware.actions.setProperty('binning_mode', binningMode);\n }}\n title={title}\n >\n <i className={icon} />\n &nbsp;{' '}\n <Badge style={{ minWidth: LONGEST_MODE_WIDTH }}>{binningMode}</Badge>\n </Dropdown.Item>\n );\n }\n\n return (\n <Dropdown>\n <Dropdown.Toggle disabled={disabled} variant=\"secondary\" />\n <Dropdown.Menu align=\"end\" popperConfig={{ strategy: 'fixed' }}>\n <SelectableItem\n binningMode=\"SUM\"\n selectedMode={binningMode}\n title=\"Merge binned pixel with SUM operation\"\n />\n <SelectableItem\n binningMode=\"MEAN\"\n selectedMode={binningMode}\n title=\"Merge binned pixel with MEAN operation\"\n />\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nfunction LimaBinningControl(\n props: HardwareWidgetProps<LimaSchema, EditableHardwareWidgetOptions>\n) {\n const { hardware, options, disabled } = props;\n const { properties } = hardware;\n const [bh, bv] = properties.binning;\n const b = bh === bv ? bh : 0;\n const binningMode = properties.binning_mode ?? 'SUM';\n\n function setBinning(value: number) {\n void hardware.actions.setProperty('binning', [value, value]);\n }\n\n const supportedBinningMode = limaBinningModeSupported(hardware);\n const readOnly = options.readonly ?? false;\n\n return (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text title=\"Binning applied to the detector\">\n <i className=\"fa fa-fw fa-ruler-combined fa-2x\" />\n </InputGroup.Text>\n <ReadOnlyTextInput\n value={`${properties.binning[0]} × ${properties.binning[1]}`}\n />\n {!readOnly && (\n <>\n <Button\n variant={b === 1 ? 'primary' : 'secondary'}\n onClick={() => {\n setBinning(1);\n }}\n disabled={disabled}\n >\n 1\n </Button>\n <Button\n variant={b === 2 ? 'primary' : 'secondary'}\n onClick={() => {\n setBinning(2);\n }}\n disabled={disabled}\n >\n 2\n </Button>\n <Button\n variant={b === 3 ? 'primary' : 'secondary'}\n onClick={() => {\n setBinning(3);\n }}\n disabled={disabled}\n >\n 3\n </Button>\n <Button\n variant={b === 4 ? 'primary' : 'secondary'}\n onClick={() => {\n setBinning(4);\n }}\n disabled={disabled}\n >\n 4\n </Button>\n </>\n )}\n <InputGroup.Text title=\"Binning applied to the detector\">\n <Badge\n style={{ fontSize: '130%', minWidth: LONGEST_MODE_WIDTH }}\n title={`Detector setup with binning ${binningMode}`}\n >\n {binningMode}\n </Badge>\n </InputGroup.Text>\n {!readOnly && supportedBinningMode && <DropdownBinning {...props} />}\n </InputGroup>\n );\n}\n\nexport default function LimaBinning(\n props: HardwareWidgetProps<LimaSchema, EditableHardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <LimaBinningControl {...props} />\n </>\n );\n\n const headerMode = options.header ?? 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Form } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\n\nfunction LimaRoiImageControl(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { properties } = hardware;\n return (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text title=\"Rotation applied to the detector\">\n <i className=\"fa fa-fw fa-crop-simple fa-2x\" />\n </InputGroup.Text>\n <Form.Control value={`${properties.roi[0]}`} readOnly />\n <Form.Control value={`${properties.roi[1]}`} readOnly />\n <Form.Control value={`${properties.roi[2]}`} readOnly />\n <Form.Control value={`${properties.roi[3]}`} readOnly />\n <InputGroup.Text>px</InputGroup.Text>\n </InputGroup>\n );\n}\n\nexport default function TomoDetectorSize(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <LimaRoiImageControl hardware={hardware} />\n </>\n );\n\n const headerMode = options.header ?? 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Form } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\n\nfunction LimaMaxSizeControl(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { properties } = hardware;\n const struct = properties.static;\n const [width, height] = struct?.image_max_dim ?? ['?', '?'];\n return (\n <InputGroup>\n <InputGroup.Text title=\"Max size of the detector\">\n Max size\n </InputGroup.Text>\n <Form.Control value={`${width} × ${height}`} readOnly />\n <InputGroup.Text>px</InputGroup.Text>\n </InputGroup>\n );\n}\n\nfunction LimaLimaVersionControl(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { properties } = hardware;\n const struct = properties.static;\n return (\n <InputGroup>\n <InputGroup.Text title=\"Version of the Lima server (lima-core)\">\n Lima version\n </InputGroup.Text>\n <Form.Control value={`${struct?.lima_version}`} readOnly />\n </InputGroup>\n );\n}\n\nfunction LimaModelControl(props: { hardware: LimaSchema }) {\n const { hardware } = props;\n const { properties } = hardware;\n const struct = properties.static;\n return (\n <InputGroup>\n <InputGroup.Text title=\"Model of the detector\">\n Type/model\n </InputGroup.Text>\n <Form.Control value={`${struct?.camera_type}`} readOnly />\n <Form.Control value={`${struct?.camera_model}`} readOnly />\n </InputGroup>\n );\n}\n\nexport default function TomoDetectorSize(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <LimaModelControl hardware={hardware} />\n <LimaMaxSizeControl hardware={hardware} />\n <LimaLimaVersionControl hardware={hardware} />\n </>\n );\n\n const headerMode = options.header ?? 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { InputGroup, Form, Button, Dropdown, Badge } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { LimaSchema } from '.';\nimport { LimaState } from './LimaState';\n\nfunction LimaRoiShapeWidget(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, disabled } = props;\n const { properties } = hardware;\n const imageMaxDim = properties.static?.image_max_dim ?? [0, 0];\n const roi = properties.roi;\n const binning = properties.binning ?? [1, 1];\n\n const maxw = imageMaxDim[0] / binning[0];\n const maxh = imageMaxDim[1] / binning[1];\n\n function getPercentageCoef() {\n if (maxh > maxw) {\n return 1 / maxh;\n }\n return 1 / maxw;\n }\n\n const coef = getPercentageCoef();\n\n const [pdw, pdh] = [100 * maxw * coef, 100 * maxh * coef];\n\n function getPercentageRoi() {\n const [x, y, w, h] = roi;\n return [\n (100 * x) / maxw,\n (100 * y) / maxh,\n (100 * w) / maxw,\n (100 * h) / maxh,\n ];\n }\n\n function getPercentageText() {\n const [x, y, w, h] = roi;\n return [(100 * (x + w * 0.5)) / maxw, (100 * (y + h * 0.5)) / maxh];\n }\n\n const [px, py, pw, ph] = getPercentageRoi();\n const [tx, ty] = getPercentageText();\n\n return (\n <div style={{ backgroundColor: '#AAAAAA', width: '10em', height: '10em' }}>\n <div\n className=\"position-relative\"\n title={`Detector ${hardware.id}`}\n style={{\n backgroundColor: '#FFFFFF',\n border: '2px solid black',\n width: `${pdw}%`,\n height: `${pdh}%`,\n }}\n >\n <div\n title=\"ROI location\"\n className=\"position-absolute\"\n style={{\n backgroundColor: '#FFFFFF',\n border: '2px dotted black',\n left: `${px}%`,\n top: `${py}%`,\n width: `${pw}%`,\n height: `${ph}%`,\n }}\n />\n <span\n className=\"position-absolute\"\n style={{\n left: `${tx}%`,\n top: `${ty}%`,\n transform: 'translate(-50%, -50%)',\n }}\n >\n {roi[2]}×{roi[3]}\n </span>\n </div>\n </div>\n );\n}\n\nexport default function LimaRoiShape(\n props: HardwareWidgetProps<LimaSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Lima\" icon=\"fam-hardware-camera\" online={hardware.online} />\n );\n\n const widgetState = <LimaState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <LimaRoiShapeWidget {...props} />\n </>\n );\n\n const headerMode = options.header ?? 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareChangeActions } from '../hardware/utils/types';\n\ninterface RuntimeHooks {\n useHardware?: (id: string | null) => Hardware | null;\n useHardwareChangeActions?: (name: string | null) => HardwareChangeActions;\n}\n\nconst runtimeHooks: RuntimeHooks = {};\n\nexport function registerRuntimeHook(hooks: Partial<RuntimeHooks>) {\n if (hooks.useHardware) {\n if (runtimeHooks.useHardware) {\n console.warn('useHardware hook was already registered');\n }\n runtimeHooks.useHardware = hooks.useHardware;\n }\n if (hooks.useHardwareChangeActions) {\n if (runtimeHooks.useHardwareChangeActions) {\n console.warn('useHardwareChangeActions hook was already registered');\n }\n runtimeHooks.useHardwareChangeActions = hooks.useHardwareChangeActions;\n }\n}\n\n/**\n * Return a hardware from it's hardware name.\n *\n * Return `null` if the name refers to nothing.\n *\n * @param name: An hardware identifier, or null\n */\nexport function useHardware(id: string | null): Hardware | null {\n if (!runtimeHooks.useHardware) {\n throw new Error('No `useHardware` hook registered');\n }\n return runtimeHooks.useHardware(id);\n}\n\n/**\n * Expose the generic actions provided by a specific hardware.\n *\n * If null is passed, dummy actions are exposed.\n *\n * @param name: Am hardware identifier, or null\n */\nexport function useHardwareChangeActions(\n name: string | null\n): HardwareChangeActions {\n if (!runtimeHooks.useHardwareChangeActions) {\n throw new Error('No `useHardwareChangeActions` hook registered');\n }\n return runtimeHooks.useHardwareChangeActions(name);\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport LimaDefault from './LimaDefault';\nimport LimaSize from './LimaSize';\nimport LimaTransformation from './LimaTransformation';\nimport LimaBinning from './LimaBinning';\nimport LimaImageRoi from './LimaImageRoi';\nimport LimaDescription from './LimaDescription';\nimport LimaShape from './LimaShape';\nimport LimaState from './LimaState';\nimport { useHardware } from '../../registry/hooks';\nimport semver from 'semver';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface LimaSchema extends Hardware {\n properties: {\n state:\n | 'READY'\n | 'ACQUIRING'\n | 'CONFIGURATION'\n | 'FAULT'\n | 'UNKNOWN'\n | 'OFFLINE';\n\n static: {\n /* The lima core library version number*/\n lima_version: string;\n\n /* Name of the camera plugin: Maxipix, Pilatus, Frelon, Pco, Basler, Simulator...*/\n lima_type: string;\n\n /* Type of the camera as exposed by the camera plugin.*/\n camera_type: string;\n\n /* Model of the camera as exposed by the camera plugin: 5x1- TPX1*/\n camera_model: string;\n\n /* The camera pixel size in x and y dimension, in micron\n\n Despit the Lima Tango API, this value is returned in micron instead of meter.\n */\n camera_pixelsize: [number, number];\n\n /* Maximum image dimension, width and height in pixel*/\n image_max_dim: [number, number];\n } | null;\n\n /**\n * Pixel size of the detector (without binning).\n *\n * It's a read-only property.\n */\n pixel_size: [number, number];\n\n /**\n * Max exposition time of a single sub frame in accumulation.\n *\n * It is used (together with the exposure time) to determine the\n * nb of sub frames and the expo time of a single sub frame.\n * See `guessSubframes`.\n */\n acc_max_expo_time: number | null;\n\n /**\n * Flip applied to the resulting image\n */\n flip: [boolean, boolean];\n\n /**\n * Rotation applied to the resulting image.\n *\n * One of 0, 90, 180, 270\n */\n rotation: 0 | 90 | 180 | 270;\n\n /**\n * Binning applied to the resulting image\n */\n binning: [number, number];\n\n /**\n * Binning mode applied to the resulting image\n *\n * Introduced in BLISS 2.3, Lima 1.10.4\n */\n binning_mode?: 'SUM' | 'MEAN';\n\n /**\n * Location and size of the ROI in the raw image.\n *\n * When binning=[1, 1] flip=[false, false], rotation=0\n */\n raw_roi: [number, number, number, number];\n\n /**\n * Location of the ROI in the transformed image.\n */\n roi: [number, number, number, number];\n\n /**\n * Final size of the detector. Including the crop of the ROI.\n */\n size: [number, number];\n };\n}\n\nexport function isLimaHardware(entity: Hardware): entity is LimaSchema {\n return entity.type === 'lima';\n}\n\nexport function useLimaHardware(name: string | null): LimaSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isLimaHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n\n/**\n * Compute the nb sub frames which will be used for a specific exposure time\n */\nexport function limaGuessSubframes(\n exposureTime: number,\n accMaxExpoTime: number\n): [number, number] {\n const nbSubFrames = Math.ceil(exposureTime / accMaxExpoTime);\n const accExpoTime = exposureTime / nbSubFrames;\n return [nbSubFrames, accExpoTime];\n}\n\nconst Variants: HardwareVariant<LimaSchema> = {\n default: LimaDefault,\n size: LimaSize,\n transformation: LimaTransformation,\n binning: LimaBinning,\n imageroi: LimaImageRoi,\n description: LimaDescription,\n shape: LimaShape,\n // Override base state\n state: LimaState,\n};\n\nexport default Variants;\n\n/**\n * The binning_mode is supported when both Lima and BLISS support it.\n */\nexport function limaBinningModeSupported(hardware: LimaSchema): boolean {\n return (\n hardware.properties.binning_mode !== undefined &&\n semver.gte(hardware.properties.static?.lima_version ?? '0.0.0', '1.10.4')\n );\n}\n","import defaultjson from './Lima.json';\nimport flipjson from './LimaFlip.json';\nimport rotjson from './LimaRot.json';\nimport roicenter from './RoiCenter.json';\nimport squaredetector from './SquareDetector.json';\n\nexport const Mocks = {\n default: defaultjson,\n flip: flipjson,\n rot: rotjson,\n roicenter,\n squaredetector,\n};\n","import { useState } from 'react';\nimport type { LimaSchema } from '..';\nimport { Simulator } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function LimaSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const imageMaxDim: [number, number] = [1920, 1920];\n const cameraPixelSize: [number, number] = [1.6e-5, 1.6e-5];\n const [properties, setProperties] = useState<LimaSchema['properties']>({\n static: {\n lima_version: '1.9.23',\n lima_type: 'Frelon',\n camera_type: 'Frelon',\n camera_model: 'SPB8x2 CcdFT2k-F16',\n camera_pixelsize: cameraPixelSize,\n image_max_dim: imageMaxDim,\n },\n acc_max_expo_time: 1,\n binning: [1, 1],\n flip: [false, false],\n pixel_size: cameraPixelSize,\n raw_roi: [0, 0, ...imageMaxDim],\n roi: [0, 0, ...imageMaxDim],\n rotation: 0,\n size: imageMaxDim,\n state: 'READY',\n });\n\n async function call(name: string, value?: any): Promise<void> {\n console.log('LimaSimulator: Unsupported call', name, value);\n }\n\n function changeBinning(\n props: LimaSchema['properties'],\n binning: [number, number]\n ): LimaSchema['properties'] {\n const pixelSize: [number, number] = [\n Math.round(cameraPixelSize[0] * binning[0]),\n Math.round(cameraPixelSize[1] * binning[1]),\n ];\n const size: [number, number] = [\n Math.round(imageMaxDim[0] / binning[0]),\n Math.round(imageMaxDim[1] / binning[1]),\n ];\n return {\n ...props,\n binning,\n pixel_size: pixelSize,\n roi: [0, 0, ...size],\n size,\n };\n }\n\n function changeBinningMode(\n props: LimaSchema['properties'],\n binningMode: 'SUM' | 'MEAN'\n ): LimaSchema['properties'] {\n return {\n ...props,\n binning_mode: binningMode,\n };\n }\n\n function changeRotation(\n props: LimaSchema['properties'],\n rotation: 0 | 90 | 180 | 270\n ): LimaSchema['properties'] {\n return {\n ...props,\n rotation,\n };\n }\n\n function changeFlipX(\n props: LimaSchema['properties'],\n flip: boolean\n ): LimaSchema['properties'] {\n return {\n ...props,\n flip: [flip, props.flip[1]],\n };\n }\n function changeFlipY(\n props: LimaSchema['properties'],\n flip: boolean\n ): LimaSchema['properties'] {\n return {\n ...props,\n flip: [props.flip[0], flip],\n };\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n if (name === 'binning') {\n setProperties((p) => {\n return changeBinning(p, value);\n });\n return;\n }\n if (name === 'binning_mode') {\n setProperties((p) => {\n return changeBinningMode(p, value);\n });\n return;\n }\n if (name === 'rotation') {\n setProperties((p) => {\n return changeRotation(p, value);\n });\n return;\n }\n if (name === 'flip_x') {\n setProperties((p) => {\n return changeFlipX(p, value);\n });\n return;\n }\n if (name === 'flip_y') {\n setProperties((p) => {\n return changeFlipY(p, value);\n });\n return;\n }\n console.log('LimaSimulator: Unsupported setProperty', name, value);\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"lima\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import 'react-bootstrap-typeahead/css/Typeahead.css';\nimport 'react-bootstrap-typeahead/css/Typeahead.bs5.css';\nimport type { TypeaheadInputProps } from 'react-bootstrap-typeahead/types/types';\n\nimport { useRef } from 'react';\nimport {\n Button,\n Form,\n InputGroup,\n OverlayTrigger,\n Tooltip,\n} from 'react-bootstrap';\nimport {\n Highlighter,\n Hint,\n Menu,\n MenuItem,\n Typeahead,\n} from 'react-bootstrap-typeahead';\nimport type { MeasurementGroupSchema } from '.';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { HardwareWidgetProps } from '../utils/types';\n\ninterface CustomTypeaheadInputProps extends TypeaheadInputProps {\n [key: string]: any;\n}\n\nfunction RenderInput(inputProps: CustomTypeaheadInputProps, state: any) {\n const {\n inputRef,\n referenceElementRef,\n onAddSelection,\n onRemoveSelection,\n ...otherInputProps\n } = inputProps;\n const fieldRef = useRef<HTMLInputElement>();\n\n const clearInput = () => {\n setTimeout(() => {\n // @ts-expect-error\n const setValue = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n 'value'\n ).set;\n if (setValue) {\n setValue.call(fieldRef.current, '');\n }\n if (fieldRef.current) {\n fieldRef.current.dispatchEvent(new Event('input', { bubbles: true }));\n }\n }, 500);\n };\n\n const addSelection = () => {\n if (onAddSelection) {\n onAddSelection(state.results).then(() => {\n clearInput();\n });\n }\n };\n\n const removeSelection = () => {\n const selected = state.text\n ? [...state.selected].filter((option) => {\n return option.toLowerCase().indexOf(state.text.toLowerCase()) !== -1;\n })\n : [...state.selected];\n\n if (onRemoveSelection) {\n onRemoveSelection(selected).then(() => {\n clearInput();\n });\n }\n };\n\n return (\n <InputGroup>\n <Hint>\n {\n // @ts-expect-error\n <Form.Control\n style={{ width: '100%' }}\n {...otherInputProps}\n ref={(node: HTMLInputElement) => {\n fieldRef.current = node;\n inputRef(node);\n referenceElementRef(node);\n }}\n placeholder={`${state.selected.length} enabled`}\n />\n }\n </Hint>\n <Button\n disabled={inputProps.disabled || state.results.length === 0}\n onClick={addSelection}\n >\n <i className=\"fa fa-plus\" />\n </Button>\n <Button disabled={inputProps.disabled} onClick={removeSelection}>\n <i className=\"fa fa-minus\" />\n </Button>\n </InputGroup>\n );\n}\n\nfunction withExtraProps(extraProps: { [prop: string]: any }) {\n return function (wrappedComponent: any) {\n function WithExtraProps(props: any, props2: any, props3: any) {\n return wrappedComponent(props, props2, props3, extraProps);\n }\n\n WithExtraProps.displayName = `WithExtraProps(${\n wrappedComponent.displayName || wrappedComponent.name || 'Component'\n })`;\n\n return WithExtraProps;\n };\n}\n\nfunction RenderMenu(results: any, menuProps: any, state: any, extraProps: any) {\n const selected = [...state.selected] // eslint-disable-line @typescript-eslint/require-array-sort-compare\n .filter((option) => {\n return option.toLowerCase().indexOf(state.text.toLowerCase()) !== -1;\n })\n .sort();\n\n const selectedItems = selected.map((opt) => (\n /* eslint-disable-next-line jsx-a11y/anchor-is-valid */\n <a\n href=\"#\"\n className=\"dropdown-item\"\n key={opt}\n onClick={() => state.onRemove(opt)}\n >\n <Highlighter search={state.text}>{opt}</Highlighter>\n </a>\n ));\n const items = [...state.results].sort(); // eslint-disable-line @typescript-eslint/require-array-sort-compare\n const availableItems = items.map((opt, i) => (\n <MenuItem key={opt} option={opt} position={i}>\n <Highlighter search={state.text}>{opt}</Highlighter>\n </MenuItem>\n ));\n\n return (\n <Menu {...{ ...menuProps, style: { ...menuProps.style, width: 350 } }}>\n {extraProps.pending && <Menu.Header>Loading...</Menu.Header>}\n {!extraProps.pending && (\n <>\n <Menu.Header>Enabled</Menu.Header>\n {selectedItems}\n {selectedItems.length === 0 && (\n <span className=\"dropdown-item disabled\">No items enabled</span>\n )}\n\n <Menu.Header>Available</Menu.Header>\n {availableItems}\n {availableItems.length === 0 && (\n <span className=\"dropdown-item disabled\">No items available</span>\n )}\n </>\n )}\n </Menu>\n );\n}\n\nexport default function MeasurementGroup(\n props: HardwareWidgetProps<MeasurementGroupSchema>\n) {\n const { hardware } = props;\n const { disabled = false } = props;\n\n const enabled = hardware.properties.available.filter(\n (x) => !hardware.properties.disabled.includes(x)\n );\n\n function setSelection(selected: any) {\n const added = selected.filter((x: string) => !enabled.includes(x));\n const removed = enabled.filter((x) => !selected.includes(x));\n\n if (added.length > 0) {\n added.forEach((counter: string) => {\n void hardware.actions.call('enable', counter);\n });\n }\n\n if (removed.length > 0) {\n removed.forEach((counter: string) => {\n void hardware.actions.call('disable', counter);\n });\n }\n }\n\n function onAddSelection(selection: any) {\n const promises: Promise<any>[] = [];\n selection.forEach((counter: string) => {\n const promise = hardware.actions.call('enable', counter);\n promises.push(promise);\n });\n return Promise.all(promises);\n }\n\n function onRemoveSelection(selection: any) {\n const promises: Promise<any>[] = [];\n selection.forEach((counter: string) => {\n const promise = hardware.actions.call('disable', counter);\n promises.push(promise);\n });\n\n return Promise.all(promises);\n }\n\n function setActive() {\n return hardware.actions.call('set_active');\n }\n\n const active = false;\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon name=\"Measurement Group\" icon=\"fa-list-ol\" online />\n <div className=\"name\">{hardware.name}</div>\n {!active && (\n <OverlayTrigger\n placement=\"top\"\n overlay={\n <Tooltip id=\"active\">Activate this measurement group</Tooltip>\n }\n >\n <Button\n size=\"sm\"\n disabled={disabled}\n onClick={() => void setActive()}\n className=\"float-right ml-1\"\n >\n <i className=\"fa fa-power-off\" />\n </Button>\n </OverlayTrigger>\n )}\n </div>\n <div className=\"hw-content\">\n <Typeahead\n disabled={disabled}\n id={`typeahead_mg_${hardware.name}`}\n multiple\n flip\n positionFixed\n renderInput={RenderInput}\n renderMenu={withExtraProps({\n name: hardware.id,\n })(RenderMenu)}\n onChange={setSelection}\n inputProps={{\n // @ts-expect-error\n onAddSelection,\n onRemoveSelection,\n }}\n selected={enabled}\n options={hardware.properties.available}\n selectHint={(shouldSelect, e) => {\n return e.key === 'Enter' || shouldSelect;\n }}\n />\n </div>\n </div>\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport MeasurementGroup from './MeasurementGroup';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface MeasurementGroupSchema extends Hardware {\n properties: {\n /** List of available counters */\n available: string[];\n\n /** List of disabled counters.\n *\n * It is a subset of the `available` list.\n */\n disabled: string[];\n };\n}\n\nconst Variants: HardwareVariant<MeasurementGroupSchema> = {\n default: MeasurementGroup,\n};\n\nexport default Variants;\n","import defaultjson from './MG.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\nimport type { MeasurementGroupSchema } from '..';\n\nexport default function MeasurementGroupSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [properties, setProperties] = useState<\n MeasurementGroupSchema['properties']\n >({\n available: [\n 'lima:image',\n 'diode1',\n 'diode2',\n 'machinfo:current',\n 'machinfo:srcurrent',\n ],\n disabled: ['machinfo:current'],\n });\n\n async function enable(counter: string) {\n setProperties((p) => {\n const { disabled } = p;\n return { ...p, disabled: disabled.filter((c) => c !== counter) };\n });\n }\n\n async function disable(counter: string) {\n setProperties((p) => {\n const { disabled } = p;\n return {\n ...p,\n disabled: disabled.includes(counter)\n ? disabled\n : [...disabled, counter],\n };\n });\n }\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'enable') {\n await enable(value as string);\n return;\n }\n if (name === 'disable') {\n await disable(value as string);\n return;\n }\n if (name === 'set_active') {\n return;\n }\n console.log('MeasurementGroupSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log(\n 'MeasurementGroupSimulator: Unsupported setProperty',\n name,\n value\n );\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"measurementgroup\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { useMemo } from 'react';\nimport type { MotorSchema } from '.';\nimport { HardwareMultiState } from '../utils/State';\nimport type { HardwareWidgetProps } from '../utils/types';\n\ninterface State {\n description?: string;\n variant: string;\n priority: number;\n}\n\n/** Boiler plate */\nconst UNKNOWN: State = {\n description: 'Unknown state is exposed',\n variant: 'fatal',\n priority: 100,\n};\n\n/**\n * Available default state.\n *\n * The list is ordered by priority: the first will override the second.\n *\n * More 'dynamic' states can also be exposed.\n */\nconst AVAILABLE_STATES: Record<string, State> = {\n // Reserved by Daiquiri\n OFFLINE: {\n description: 'Axis is offline',\n variant: 'secondary',\n priority: 0,\n },\n // Real hardware state\n MOVING: {\n description: 'Axis is moving',\n variant: 'warning',\n priority: 10,\n },\n FAULT: {\n description: 'Axis is in fault',\n variant: 'danger',\n priority: 20,\n },\n // Reserved by Daiquiri\n LOCKED: {\n description: 'Axis is locked',\n variant: 'warning',\n priority: 25,\n },\n OFF: {\n description: 'Power is off',\n variant: 'secondary',\n priority: 30,\n },\n DISABLED: {\n description: 'Axis is disabled',\n variant: 'warning',\n priority: 40,\n },\n LOWLIMIT: {\n description: 'Low limit is reached',\n variant: 'warning',\n priority: 50,\n },\n HIGHLIMIT: {\n description: 'High limit is reached',\n variant: 'warning',\n priority: 51,\n },\n HOME: {\n description: 'Home signal active',\n variant: 'info',\n priority: 52,\n },\n READY: {\n description: 'Ready to handle request',\n variant: 'success',\n priority: 60,\n },\n // Reserved by Daiquiri\n NOT_READY: {\n description: 'Not ready',\n variant: 'warning',\n priority: 100,\n },\n // Reserved by Daiquiri\n UNKNOWN,\n};\n\n/**\n * A motor have a set of flags as state.\n *\n * For example an axis can expose `READY` and `MOVING` at the same time.\n * It means the controller is ready to change it's target, even\n * during a motion.\n *\n * For now we only display a \"main\" state.\n */\nexport function MotorState(props: { hardware: MotorSchema }) {\n const { hardware } = props;\n const { locked = null } = hardware;\n const { state = ['UNKNOWN'] } = hardware.properties;\n\n const [states, descriptions] = useMemo(() => {\n if (!hardware.online) {\n return [['OFFLINE'], undefined];\n }\n function priority(n1: string, n2: string) {\n const s1: State = AVAILABLE_STATES[n1] ?? UNKNOWN;\n const s2: State = AVAILABLE_STATES[n2] ?? UNKNOWN;\n return s1.priority - s2.priority;\n }\n const orderedStates = [\n ...state,\n ...(locked !== null ? ['LOCKED'] : []),\n ...(state.length === 0 ? ['NOT_READY'] : []),\n ];\n orderedStates.sort(priority);\n\n function splitCustomStates(s: string): [string, string | undefined] {\n const elems = s.split(':', 2);\n if (elems.length === 1) {\n return [s, undefined];\n }\n // @ts-expect-error\n return elems;\n }\n\n const descriptions: Record<string, string> = {};\n const states = orderedStates.map((s) => {\n if (s.startsWith('_')) {\n const desc = splitCustomStates(s);\n if (desc[1] !== undefined) {\n descriptions[desc[0]] = desc[1];\n }\n return desc[0];\n }\n if (s === 'LOCKED') {\n descriptions[s] = `Locked by ${locked}`;\n } else {\n descriptions[s] = AVAILABLE_STATES[s].description ?? '';\n }\n return s;\n });\n\n return [states, descriptions];\n }, [state, hardware.online, locked]);\n\n return (\n <HardwareMultiState\n states={states}\n descriptions={descriptions}\n minWidth={6}\n variants={Object.fromEntries(\n Object.entries(AVAILABLE_STATES).map(([n, s]) => [n, s.variant])\n )}\n />\n );\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<MotorSchema>) {\n const { hardware } = props;\n return <MotorState hardware={hardware} />;\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent, ChangeEvent } from 'react';\nimport { Form } from 'react-bootstrap';\nimport classNames from 'classnames';\n\n/**\n * Input number synchronized with a hardware.\n *\n * Input related to hardware have specificities because the hardware state can\n * change during the user interaction.\n *\n * TODO: Maybe normalize `precision` and `step` together\n */\nexport default function HardwareInputNumber(props: {\n hardwareValue: number;\n hardwareIsDisabled: boolean;\n hardwareIsMoving?: boolean;\n hardwareIsReady?: boolean;\n onMoveRequested: (value: number) => Promise<void> | null;\n onAbortRequested?: () => void;\n readOnly?: boolean;\n precision?: number;\n step?: number;\n}) {\n const valueRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const [error, setError] = useState(false);\n\n function normalizeNumber(value: string): string {\n if (props.precision !== undefined) {\n return Number.parseFloat(value).toFixed(props.precision);\n }\n return value;\n }\n\n useEffect(() => {\n if (valueRef.current) {\n valueRef.current.value = normalizeNumber(props.hardwareValue?.toString());\n setEdited(false);\n }\n }, [props.hardwareValue, props.precision]);\n\n function updateRef(value: any) {\n const newValue = normalizeNumber(value);\n if (valueRef?.current) {\n valueRef.current.value = newValue;\n }\n }\n\n function onKeyDown(e: KeyboardEvent<HTMLInputElement>) {\n switch (e.key) {\n case 'Enter': {\n setEdited(false);\n // @ts-expect-error\n const value: number = Number.parseFloat(e.target.value);\n const promise = props.onMoveRequested(value);\n if (promise) {\n promise.catch(() => {\n setError(true);\n setTimeout(() => {\n updateRef(props.hardwareValue);\n setError(false);\n }, 2000);\n });\n }\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n case 'Esc': // IE/Edge specific value\n case 'Escape':\n if (edited) {\n setError(false);\n setEdited(false);\n updateRef(props.hardwareValue);\n }\n // @ts-expect-error\n e.target.blur();\n e.preventDefault();\n e.stopPropagation();\n break;\n }\n }\n\n function onChange(e: ChangeEvent<HTMLInputElement>) {\n setEdited(!(e.target.value === props.hardwareValue.toString()));\n }\n\n return (\n <Form.Control\n className={classNames({\n 'form-control-edited': edited,\n 'form-control-error': error,\n 'hw-moving': props.hardwareIsMoving,\n })}\n type=\"number\"\n ref={valueRef}\n onChange={onChange}\n onKeyDown={onKeyDown}\n disabled={\n props.readOnly || props.hardwareIsMoving || props.hardwareIsDisabled\n }\n step={props.step}\n onClick={(e) => {\n // do not close parent dropdown\n e.stopPropagation();\n }}\n />\n );\n}\n","import {\n Button,\n Form,\n OverlayTrigger,\n InputGroup,\n Popover,\n} from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { MotorState } from './MotorState';\nimport HardwareNumericStep from '../../components/HardwareNumericStep';\nimport HardwareInputNumber from '../../components/HardwareInputNumber';\nimport { useMotorStates } from '.';\nimport type { MotorSchema, MotorStates } from '.';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport type { MotorDefaultOptions } from './options';\n\ninterface MotorOverlayProps {\n hardware: EditableHardware<MotorSchema>;\n disabled: boolean;\n readOnly?: boolean;\n states: MotorStates;\n}\n\nfunction MotorOverlay(props: MotorOverlayProps) {\n const { states } = props;\n function onMoveVelocityRequested(target: number) {\n return props.hardware.actions.setProperty('velocity', target);\n }\n\n function onMoveAccelerationRequested(target: number) {\n return props.hardware.actions.setProperty('acceleration', target);\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{props.hardware.name} details</Popover.Header>\n <Popover.Body>\n <Form.Group>\n <Form.Label>Velocity</Form.Label>\n <HardwareInputNumber\n hardwareValue={props.hardware.properties?.velocity ?? 0}\n onMoveRequested={onMoveVelocityRequested}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={states.READY}\n hardwareIsMoving={states.MOVING}\n readOnly={props.readOnly}\n />\n </Form.Group>\n <Form.Group>\n <Form.Label>Acceleration</Form.Label>\n <HardwareInputNumber\n hardwareValue={props.hardware.properties?.acceleration ?? 0}\n onMoveRequested={onMoveAccelerationRequested}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={states.READY}\n hardwareIsMoving={states.MOVING}\n readOnly={props.readOnly}\n />\n </Form.Group>\n </Popover.Body>\n </Popover>\n }\n >\n <Button>\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\n/**\n * The default motor widget\n */\nexport default function MotorDefault(\n props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties, user_tags } = hardware;\n function onAbortRequested() {\n void hardware.actions.call('stop');\n }\n\n function onMovePositionRequested(target: number) {\n return hardware.actions.call('move', target);\n }\n\n const states = useMotorStates(properties.state, user_tags);\n const widgetIcon = (\n <TypeIcon name=\"Motor\" icon=\"fam-hardware-motor\" online={hardware.online} />\n );\n\n const widgetState = <MotorState hardware={hardware} />;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={\n <InputGroup className=\"flex-nowrap\">\n <HardwareNumericStep\n id={hardware.id}\n hardwareValue={properties?.position ?? null}\n hardwareIsDisabled={props.disabled}\n hardwareIsReady={states.READY ?? false}\n hardwareIsMoving={states.MOVING ?? false}\n onMoveRequested={onMovePositionRequested}\n onAbortRequested={onAbortRequested}\n precision={\n options.precision ?? properties.display_digits ?? undefined\n }\n readOnly={options.readOnly}\n stepOnly={options.stepOnly}\n step={options.step}\n steps={options.steps}\n incIcon={options.incicon}\n decIcon={options.decicon}\n swapIncDec={options.swapincdec}\n horizontalArrows={options.horizontalarrows}\n largeArrows={options.largearrows}\n />\n {properties.unit && (\n <InputGroup.Text>{properties.unit}</InputGroup.Text>\n )}\n\n {!states.MOVING && options.extended && (\n <MotorOverlay\n hardware={hardware}\n disabled={props.disabled}\n readOnly={options.readOnly}\n states={states}\n />\n )}\n\n {states.MOVING && !props.disabled && !options.step && (\n <Button variant=\"danger\" onClick={onAbortRequested}>\n <i className=\"fa fa-times\" />\n </Button>\n )}\n </InputGroup>\n }\n headerMode={headerMode}\n />\n );\n}\n","import classNames from 'classnames';\nimport { Stack } from 'react-bootstrap';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport { MotorState } from './MotorState';\nimport { useMotorStates } from '.';\nimport type { MotorSchema } from '.';\nimport type { MotorDefaultOptions } from './options';\n\nfunction Content(props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>) {\n const { hardware, options = {} } = props;\n const states = useMotorStates(hardware.properties.state, hardware.user_tags);\n\n function normalizeNumber(value: number | null): string {\n if (value === null) {\n return '∅';\n }\n const digits =\n options.precision ?? hardware.properties.display_digits ?? undefined;\n if (digits !== undefined) {\n return value.toFixed(digits);\n }\n return `${value}`;\n }\n\n return (\n <Stack className=\"bg-light rounded-2 ps-2 p-1\" direction=\"horizontal\">\n <div\n className={classNames({\n 'hw-moving': states.MOVING,\n })}\n >\n {normalizeNumber(hardware.properties.position)}\n </div>\n {hardware.properties.unit && (\n <div className=\"ms-auto\">\n <small>\n <small>{hardware.properties.unit}</small>\n </small>\n </div>\n )}\n </Stack>\n );\n}\n\n/**\n * The default motor widget\n */\nexport default function MotorText(\n props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>\n) {\n const { hardware } = props;\n\n const widgetIcon = (\n <TypeIcon name=\"Motor\" icon=\"fam-hardware-motor\" online={hardware.online} />\n );\n\n const widgetState = <MotorState hardware={hardware} />;\n\n const headerMode = props.options ? props.options.header : 'top';\n if (headerMode === 'none') {\n return <Content {...props} />;\n }\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={<Content {...props} />}\n headerMode={headerMode}\n />\n );\n}\n","import { useMemo } from 'react';\nimport { useHardware } from '../../registry/hooks';\nimport type { Hardware, HardwareVariant } from '../utils/types';\nimport MotorDefault from './MotorDefault';\nimport MotorText from './MotorText';\nimport MotorState from './MotorState';\n\nexport interface MotorSchema extends Hardware {\n properties: {\n position: number | null;\n /**\n * Target of the actual motion.\n *\n * If there is no motion, it is `null`.\n */\n target: number | null;\n tolerance: number;\n acceleration: number;\n velocity: number;\n limits: [number, number];\n state: string[];\n unit: string;\n offset: number;\n sign: number;\n display_digits: number | null;\n };\n}\n\n/**\n * Exposes the standard supported motor states\n */\nexport interface MotorStates {\n // Axis is READY\n READY?: true;\n // Axis is MOVING\n MOVING?: true;\n // Error from controller\n FAULT?: true;\n // Hardware high limit active\n HIGHLIMIT?: true;\n // Hardware low limit active\n LOWLIMIT?: true;\n // Home signal active\n HOME?: true;\n // Axis power is off\n OFF?: true;\n // Axis cannot move\n DISABLED?: true;\n // The state of the motor is not handlable\n UNKNOWN?: true;\n // If none of the state are set, this flag is set, to simplify the logic\n NOT_READY?: true;\n}\n\n/**\n * Normalize the motor state exposed by the hardware.\n *\n * This does not exposes the custom states in a useful maner.\n *\n * Store states are changed depending of existing user tags\n *\n * - `auto_on`: This allow to move the motor even if `OFF` is enabled.\n * When `OFF` is enabled `READY` is turned to true.\n * - `auto_ready`: This allow to move the motor even if `NOT_READY` is enabled.\n *\n * TODO: An improvement would be to normalize that when redux is populated.\n * instead of storing a list.\n *\n * @param state: List of the controller state\n * @param userTags: List of the hardware user tags\n */\nexport function useMotorStates(\n state: string[] | undefined,\n userTags: string[] = []\n): MotorStates {\n return useMemo(() => {\n const autoReady = userTags.includes('auto_ready');\n const autoOn = userTags.includes('auto_on');\n\n if (state === undefined) {\n return { UNKNOWN: true };\n }\n if (state?.length === 0) {\n if (autoReady) {\n return { READY: true };\n }\n return { NOT_READY: true };\n }\n const newState = state.reduce((reduced: Record<string, boolean>, s) => {\n reduced[s] = true;\n return reduced;\n }, {});\n if (newState.READY === undefined) {\n if (autoOn && newState.OFF) {\n newState.READY = true;\n }\n }\n return newState;\n }, [state, userTags]);\n}\n\nexport function isMotorHardware(entity: Hardware): entity is MotorSchema {\n return entity.type === 'motor';\n}\n\n/**\n * Return a motor from it's hardware name.\n *\n * Return `null` if the name refers to nothing or a mismatching hardware.\n *\n * @param name: An hardware identifier\n */\nexport function useMotorHardware(name: string | null): MotorSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isMotorHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n\nconst Variants: HardwareVariant<MotorSchema> = {\n default: MotorDefault,\n text: MotorText,\n // Override base state\n state: MotorState,\n};\n\nexport default Variants;\n","import motor from './Motor.json';\nimport halfMotor from './HalfMotor.json';\nimport unknownMotor from './MotorUnknown.json';\nimport notReadyMotor from './MotorNotReady.json';\nimport disconnectedMotor from './MotorDisconnected.json';\nimport powerOffMotor from './MotorPowerOff.json';\n\nexport const Mocks = {\n default: motor,\n halfMotor,\n unknownMotor,\n notReadyMotor,\n disconnectedMotor,\n powerOffMotor,\n};\n","export function createMotorMock(name: string, position: number) {\n return {\n id: name,\n name,\n type: 'motor',\n properties: {\n position,\n unit: 'mm',\n limits: [-100, 100],\n },\n online: true,\n };\n}\n","import {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { PropsWithChildren } from 'react';\nimport type { MotorSchema } from '..';\nimport type {\n Hardware,\n EditableHardware,\n HardwareChangeActions,\n} from '../../utils/types';\nimport { isEqual } from 'lodash';\n\ninterface Props {\n name?: string;\n minLimit?: number;\n maxLimit?: number;\n initialPosition?: number;\n initialVelocity?: number;\n useHardwareContext?: () => {\n actions: {\n updateHardware: (name: string, hardware: Hardware) => void;\n updateHardwareChangeActions: (\n name: string,\n actions: HardwareChangeActions\n ) => void;\n };\n };\n}\n\nexport default function MotorSimulator(props: Props) {\n const {\n name = 'omega',\n minLimit = -999_999_999,\n maxLimit = 999_999_999,\n initialPosition = 0,\n initialVelocity = 1000,\n useHardwareContext = () => {\n return null;\n },\n } = props;\n const [position, setPosition] = useState(initialPosition);\n const [state, setState] = useState(['READY']);\n const [target, setTarget] = useState<number | null>(null);\n const internalTimeRef = useRef(Date.now());\n\n const ctx = useHardwareContext();\n\n const updatePosition = () => {\n const now = Date.now();\n const deltaTime = (now - internalTimeRef.current) / 1000;\n let newPosition;\n internalTimeRef.current = now;\n if (target !== null && target !== position) {\n let newState;\n let newTarget;\n const deltaPosition = deltaTime * initialVelocity;\n if (deltaPosition > Math.abs(position - target)) {\n newPosition = target;\n newState = ['READY'];\n newTarget = null;\n } else {\n const direction = target > position ? 1 : -1;\n newPosition = position + direction * deltaPosition;\n newState = ['MOVING'];\n newTarget = target;\n }\n setPosition(newPosition);\n setState(newState);\n setTarget(newTarget);\n }\n };\n\n const call = useCallback((name: string, value?: any) => {\n if (name === 'stop') {\n setTarget(null);\n setState(['READY']);\n return Promise.resolve();\n }\n if (name === 'move') {\n const pos = Number.parseFloat(value);\n setTarget(Number.isNaN(pos) ? null : pos);\n return Promise.resolve();\n }\n console.log('MotorSimulator: Unsupported call', name, value);\n return Promise.resolve();\n }, []);\n\n const setProperty = useCallback((name: string, value: any) => {\n console.log('MotorSimulator: Unsupported setProperty', name, value);\n return Promise.resolve();\n }, []);\n\n useEffect(() => {\n const timer = setInterval(() => {\n updatePosition();\n }, 500);\n return () => clearInterval(timer);\n });\n\n const actions: HardwareChangeActions = useMemo(() => {\n const actions = {\n setProperty,\n call,\n };\n ctx?.actions.updateHardwareChangeActions?.(name, actions);\n return actions;\n }, []);\n\n const rawHardware: EditableHardware<MotorSchema> = {\n id: name,\n name,\n alias: null,\n online: true,\n properties: {\n acceleration: 300,\n limits: [minLimit, maxLimit],\n position,\n offset: 0,\n sign: 1,\n state,\n tolerance: 0.0001,\n unit: 'mm',\n velocity: initialVelocity,\n target,\n display_digits: 3,\n },\n type: 'motor',\n actions,\n user_tags: [],\n locked: null,\n };\n\n const previousHardware = useRef<EditableHardware<MotorSchema> | null>(null);\n\n useEffect(() => {\n if (\n previousHardware.current !== null &&\n isEqual(previousHardware.current, rawHardware)\n ) {\n return;\n }\n previousHardware.current = rawHardware;\n ctx?.actions.updateHardware(name, rawHardware);\n }, [name, rawHardware]);\n\n return <></>;\n}\n","import { useRef, useEffect } from 'react';\nimport { map } from 'lodash';\nimport { Badge, Button, InputGroup, Form } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport type { MultipositionSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport default function Multiposition(\n props: HardwareWidgetProps<MultipositionSchema>\n) {\n const { hardware, options = {} } = props;\n const selectionRef = useRef<HTMLSelectElement>(null);\n\n useEffect(() => {\n if (!selectionRef.current) {\n console.error('selectionRef ref is unset');\n return;\n }\n selectionRef.current.value = hardware.properties.position;\n }, [hardware.properties.position]);\n\n function onMove(e: any) {\n console.debug('change', e);\n if (!selectionRef || !selectionRef.current) {\n console.error('selection ref is unset');\n return;\n }\n void hardware.actions.call('move', selectionRef.current.value);\n }\n\n function stop(e: any) {\n void hardware.actions.call('stop');\n }\n\n const opts = map(hardware.properties.positions, (p) => (\n <option key={p.position} title={p.description}>\n {p.position}\n </option>\n ));\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Multiposition\"\n icon=\"fam-hardware-multiposition\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={hardware.properties.state === 'READY' ? 'success' : 'warning'}\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <InputGroup>\n <Form.Control\n className=\"custom-select\"\n as=\"select\"\n ref={selectionRef}\n disabled={props.disabled}\n defaultValue={hardware.properties.position}\n >\n <option disabled>unknown</option>\n {opts}\n </Form.Control>\n {hardware.properties.state !== 'MOVING' && (\n <Button onClick={onMove} disabled={props.disabled}>\n Move\n </Button>\n )}\n\n {hardware.properties.state === 'MOVING' && !props.disabled && (\n <Button variant=\"danger\" onClick={stop}>\n <i className=\"fa fa-times\" />\n </Button>\n )}\n </InputGroup>\n </div>\n </div>\n );\n}\n","import { Button, InputGroup, Dropdown } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport type { MultipositionSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport classNames from 'classnames';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport { HardwareTemplate } from '../..';\nimport { AnyHardwareState } from '../base/BaseState';\n\nfunction DropdownPositions(props: HardwareWidgetProps<MultipositionSchema>) {\n const { hardware } = props;\n const { properties } = hardware;\n const hardwareReady = properties.state === 'READY';\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n const position = properties.position;\n\n function moveTo(positionId: string) {\n void hardware.actions.call('move', positionId);\n }\n\n function createSelectableItem(\n positionSchema: MultipositionSchema['properties']['positions'][0]\n ) {\n const positionId = positionSchema.position;\n const selected = positionId === position;\n const icon = selected ? 'fa fa-fw fa-dot-circle-o' : 'fa fa-fw fa-circle-o';\n\n return (\n <Dropdown.Item\n key={positionId}\n disabled={disabled}\n onClick={() => {\n moveTo(positionId);\n }}\n title={positionSchema.description}\n >\n <i className={icon} />\n &nbsp; {positionId}\n </Dropdown.Item>\n );\n }\n\n return (\n <Dropdown>\n <Dropdown.Toggle disabled={disabled} variant=\"secondary\" />\n <Dropdown.Menu align=\"end\" popperConfig={{ strategy: 'fixed' }}>\n {properties.positions.map((m) => createSelectableItem(m))}\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport default function Multiposition(\n props: HardwareWidgetProps<MultipositionSchema>\n) {\n const { hardware, options = {} } = props;\n\n const hardwareIsMoving = hardware.properties?.state === 'MOVING';\n\n function stop(e: any) {\n void hardware.actions.call('stop');\n }\n\n const widgetIcon = (\n <TypeIcon\n name=\"Multiposition\"\n icon=\"fam-hardware-multiposition\"\n online={hardware.online}\n />\n );\n\n const widgetState = <AnyHardwareState hardware={hardware} />;\n\n // Actually we can't know when it goes\n const targetPosition = hardwareIsMoving ? 'Moving' : null;\n\n const position = hardware.properties?.position;\n\n function getWidgetContent() {\n return (\n <InputGroup>\n <ReadOnlyTextInput\n className={classNames({\n 'hw-moving': hardwareIsMoving,\n })}\n value={targetPosition ?? position ?? 'Unknown'}\n />\n {!hardwareIsMoving && !props.disabled && (\n <DropdownPositions {...props} />\n )}\n {hardwareIsMoving && !props.disabled && (\n <Button variant=\"danger\" onClick={stop}>\n <i className=\"fa fa-fw fa-times\" />\n </Button>\n )}\n </InputGroup>\n );\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport MultipositionDefault from './Multiposition';\nimport MultipositionDefault2 from './MultipositionDefault2';\n\nexport interface MultipositionSchema extends Hardware {\n properties: {\n position: string;\n positions: {\n position: string;\n description: string;\n target: {\n axis: string;\n destination: number;\n tolerance: number;\n }[];\n }[];\n state: string;\n };\n}\n\nconst Variants: HardwareVariant<MultipositionSchema> = {\n default: MultipositionDefault,\n default2: MultipositionDefault2,\n};\n\nexport default Variants;\n","import defaultjson from './Multiposition.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function MultipositionSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [position, setPosition] = useState('empty');\n const [state, setState] = useState('READY');\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'move') {\n setState('MOVING');\n setPosition('unknown');\n await delay(2000);\n setState('READY');\n setPosition(value);\n return;\n }\n if (name === 'stop') {\n setPosition('unknown');\n await delay(2000);\n return;\n }\n console.log('MultipositionSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log('MultipositionSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = {\n position,\n state,\n positions: [\n { position: 'empty', description: 'No filter', target: [] },\n { position: 'gold2', description: 'Gold filter 2mm', target: [] },\n { position: 'silver3', description: 'Silver filter 3mm', target: [] },\n ],\n };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"multiposition\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { HardwareState } from '../utils/State';\nimport type { OpticSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function OpticState(props: { hardware: OpticSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n READY: 'success',\n MOVING: 'warning',\n INVALID: 'danger',\n UNKNOWN: 'danger',\n DISABLED: 'secondary',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<OpticSchema>) {\n const { hardware } = props;\n return <OpticState hardware={hardware} />;\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { KeyboardEvent } from 'react';\nimport classNames from 'classnames';\nimport { Dropdown, InputGroup, Form } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { OpticState } from './OpticState';\nimport type { OpticSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nexport interface OpticWidgetOptions extends HardwareWidgetOptions {\n readonly?: boolean;\n digits?: number;\n allowtuning?: boolean;\n}\n\nfunction MultiPositionMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n options: OpticWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options = {} } = props;\n const { properties } = hardware;\n const { state } = properties;\n const hardwareMoving = state === 'MOVING';\n const hardwareReady = state === 'READY';\n const magnification = hardwareMoving\n ? properties.target_magnification || 0\n : properties.magnification || 0;\n const availableMagnifications = properties.available_magnifications;\n const magnifications = [...(availableMagnifications ?? [])];\n magnifications.sort((a, b) => {\n if (a > b) return 1;\n if (b > a) return -1;\n return 0;\n });\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n const digits = options.digits || 2;\n\n function moveHardwareMagnification(value: number) {\n if (hardware.actions) {\n void hardware.actions.call('move', value);\n } else {\n console.error('Change request was triggered with:', value);\n }\n }\n\n function createSelectableItem(index: number, itemMagnification: number) {\n const selected = magnification === itemMagnification;\n const icon = selected ? 'fa fa-fw fa-dot-circle-o' : 'fa fa-fw fa-circle-o';\n return (\n <Dropdown.Item\n key={`id${index}`}\n disabled={disabled}\n onClick={() => {\n moveHardwareMagnification(itemMagnification);\n }}\n >\n <i className={icon} />\n &nbsp; × {itemMagnification}\n </Dropdown.Item>\n );\n }\n\n return (\n <>\n <ReadOnlyTextInput\n value={magnification.toFixed(digits)}\n className={classNames({\n 'hw-moving': hardwareMoving,\n })}\n />\n <Dropdown>\n <Dropdown.Toggle disabled={!hardwareReady} variant=\"secondary\" />\n <Dropdown.Menu popperConfig={{ strategy: 'fixed' }}>\n {magnifications.map((m, index) => createSelectableItem(index, m))}\n </Dropdown.Menu>\n </Dropdown>\n </>\n );\n}\n\nfunction FixedMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n options: OpticWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options = {} } = props;\n const magnification = hardware.properties.magnification || 0;\n const digits = options.digits || 2;\n const allowtuning = !!options.allowtuning;\n\n return (\n <>\n <ReadOnlyTextInput value={magnification.toFixed(digits)} />\n {allowtuning && (\n <Dropdown>\n <Dropdown.Toggle variant=\"secondary\" />\n <Dropdown.Menu popperConfig={{ strategy: 'fixed' }}>\n <InputGroup>\n <InputGroup.Text>×</InputGroup.Text>\n <InputMagnification {...props} />\n </InputGroup>\n </Dropdown.Menu>\n </Dropdown>\n )}\n </>\n );\n}\n\nfunction InputMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n disabled: boolean;\n options: OpticWidgetOptions;\n mode?: string;\n}) {\n const { hardware, options = {} } = props;\n const magnification = hardware.properties.magnification || 0;\n const { state } = hardware.properties;\n const hardwareReady = state === 'READY';\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n\n const [rangeMin, rangeMax] = hardware.properties.magnification_range || [\n null,\n null,\n ];\n\n const formRef = useRef<HTMLInputElement>(null);\n const rangeRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = options.digits || 2;\n\n function setHardwareMagnification(value: number) {\n if (hardware.actions) {\n if (props.mode === 'move') {\n void hardware.actions.call('move', value);\n } else {\n void hardware.actions.setProperty('magnification', value);\n }\n } else {\n console.error('Change request was triggered with:', value);\n }\n }\n\n function onKeyDown(event: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n return;\n }\n if (event.key === 'Enter') {\n setEdited(false);\n const { value } = formRef.current;\n const valueAsFloat = Number.parseFloat(value);\n\n if (rangeMin !== null && valueAsFloat < rangeMin) {\n return;\n }\n if (rangeMax !== null && valueAsFloat > rangeMax) {\n return;\n }\n setHardwareMagnification(valueAsFloat);\n } else if (event.key === 'Escape') {\n formRef.current.value = magnification.toFixed(digits);\n if (rangeRef.current) {\n rangeRef.current.value = magnification.toString();\n }\n setEdited(false);\n } else {\n console.log(event.key);\n }\n }\n\n function updateEdit(value: number) {\n if (value !== magnification && !edited) {\n setEdited(true);\n }\n if (value === magnification && edited) {\n setEdited(false);\n }\n }\n\n function onInputChange(event: any) {\n if (!formRef || !formRef.current) {\n console.error('formRef is not set');\n return;\n }\n const value = Number.parseFloat(formRef.current.value);\n updateEdit(value);\n if (rangeRef.current) {\n rangeRef.current.value = value.toString();\n }\n }\n\n function onRangeChange(event: any) {\n if (!formRef || !formRef.current) {\n console.error('formRef is not set');\n return;\n }\n if (!rangeRef || !rangeRef.current) {\n console.error('rangeRef is not set');\n return;\n }\n const value = Number.parseFloat(rangeRef.current.value);\n updateEdit(value);\n formRef.current.value = value.toFixed(digits);\n }\n\n function onRangeAccepted() {\n if (!rangeRef || !rangeRef.current) {\n console.error('rangeRef is not set');\n return;\n }\n const value = Number.parseFloat(rangeRef.current.value);\n setHardwareMagnification(value);\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.error('formRef is not set');\n return;\n }\n if (!edited) {\n formRef.current.value = magnification.toFixed(digits);\n }\n if (rangeRef.current) {\n rangeRef.current.value = magnification.toString();\n }\n }, [digits, edited, magnification]);\n\n return (\n <>\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={magnification.toFixed(digits)}\n onChange={onInputChange}\n disabled={disabled}\n step={10 ** -digits}\n onKeyDown={onKeyDown}\n />\n {rangeMin !== null && rangeMax !== null && (\n <Form.Control\n ref={rangeRef}\n disabled={disabled}\n type=\"range\"\n min={rangeMin}\n max={rangeMax}\n step={10 ** -digits}\n onChange={onRangeChange}\n onMouseUp={onRangeAccepted}\n defaultValue={magnification}\n />\n )}\n </>\n );\n}\n\nfunction RangeMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n options: OpticWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options = {} } = props;\n const { properties } = hardware;\n const hardwareMoving = properties.state === 'MOVING';\n const hardwareReady = properties.state === 'READY';\n const magnification = hardwareMoving\n ? properties.target_magnification || 0\n : properties.magnification || 0;\n const digits = props.options.digits || 2;\n\n return (\n <>\n <ReadOnlyTextInput\n value={magnification.toFixed(digits)}\n className={classNames({\n 'hw-moving': hardwareMoving,\n })}\n />\n <Dropdown>\n <Dropdown.Toggle disabled={!hardwareReady} variant=\"secondary\" />\n <Dropdown.Menu popperConfig={{ strategy: 'fixed' }}>\n <InputGroup>\n <InputGroup.Text>×</InputGroup.Text>\n <InputMagnification {...props} mode=\"move\" />\n </InputGroup>\n </Dropdown.Menu>\n </Dropdown>\n </>\n );\n}\n\nfunction OffMagnification(props: {\n hardware: EditableHardware<OpticSchema>;\n options: OpticWidgetOptions;\n}) {\n return (\n <Form.Control\n className=\"border-light\"\n type=\"text\"\n disabled\n defaultValue=\"Missing\"\n />\n );\n}\n\nexport default function Optic(\n props: HardwareWidgetProps<OpticSchema, OpticWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Optic\" icon=\"fam-hardware-optic\" online={hardware.online} />\n );\n\n const widgetState = <OpticState hardware={hardware} />;\n\n function getWidgetContent() {\n function getOpticClass() {\n if (!hardware.online) {\n return OffMagnification;\n }\n if (hardware.properties.available_magnifications) {\n return MultiPositionMagnification;\n }\n if (hardware.properties.magnification_range) {\n return RangeMagnification;\n }\n return FixedMagnification;\n }\n\n const Class = getOpticClass();\n\n return (\n <InputGroup>\n <InputGroup.Text className=\"border-light\">×</InputGroup.Text>\n <Class {...props} />\n </InputGroup>\n );\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Optic from './Optic';\nimport OpticState from './OpticState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface OpticSchema extends Hardware {\n properties: {\n state: string;\n magnification: number;\n available_magnifications: number[] | null;\n /**\n * Target of the actual motion.\n *\n * If there is no motion, it is `null `.\n */\n target_magnification: number | null;\n magnification_range: [number, number] | null;\n };\n}\n\nexport function isOpticHardware(entity: Hardware): entity is OpticSchema {\n return entity.type === 'optic';\n}\n\nconst Variants: HardwareVariant<OpticSchema> = {\n default: Optic,\n // Override base state\n state: OpticState,\n};\n\nexport default Variants;\n","import defaultjson from './Optic.json';\nimport fixedjson from './Optic.json';\nimport offjson from './Optic.json';\nimport rangejson from './Optic.json';\n\nexport const Mocks = {\n default: defaultjson,\n fixed: fixedjson,\n off: offjson,\n range: rangejson,\n};\n","/* eslint no-await-in-loop: \"off\" */\nimport { useState } from 'react';\nimport type { OpticSchema } from '..';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\ninterface Props {\n kind: 'fixed' | 'range' | 'multi';\n}\n\nexport default function OpticSimulator(props: PropsWithSimulator<Props>) {\n const { name, alias, kind, useHardwareContext } = props;\n\n function getInitial() {\n if (kind === 'fixed') {\n return {\n available_magnifications: null,\n magnification_range: null,\n };\n }\n if (kind === 'range') {\n return {\n available_magnifications: null,\n magnification_range: [5, 10] as [number, number],\n };\n }\n if (kind === 'multi') {\n return {\n available_magnifications: [5, 7.5, 10],\n magnification_range: null,\n };\n }\n return { available_magnifications: null, magnification_range: null };\n }\n\n const [properties, setProperties] = useState<OpticSchema['properties']>({\n state: 'READY',\n magnification: 10,\n target_magnification: null,\n ...getInitial(),\n });\n\n async function move(magnification: number) {\n let pos = properties.magnification;\n setProperties((p) => {\n return {\n ...p,\n state: 'MOVING',\n target_magnification: magnification,\n };\n });\n await delay(100);\n const speed = 0.2 * (pos < magnification ? 1 : -1);\n\n function setMagnification(pos: number) {\n setProperties((p) => {\n return {\n ...p,\n magnification: pos,\n };\n });\n }\n\n while (Math.abs(magnification - pos) >= Math.abs(speed) * 1.01) {\n pos += speed;\n setMagnification(pos);\n await delay(100);\n }\n\n setProperties((p) => {\n return {\n ...p,\n state: 'READY',\n magnification,\n target_magnification: null,\n };\n });\n }\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'move') {\n await move(value as number);\n return;\n }\n console.log('OpticSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n if (name === 'magnification') {\n setProperties((p) => {\n return {\n ...p,\n magnifications: value,\n };\n });\n return;\n }\n console.log('OpticSimulator: Unsupported setProperty', name, value);\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"optic\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { HardwareState } from '../utils/State';\nimport type { ProcedureSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function ProcedureState(props: { hardware: ProcedureSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n STANDBY: 'success',\n DISABLED: 'secondary',\n OFFLINE: 'secondary',\n RUNNING: 'warning',\n ABORTING: 'warning',\n AWAITING_USER_INPUT: 'warning',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<ProcedureSchema>\n) {\n const { hardware } = props;\n return <ProcedureState hardware={hardware} />;\n}\n","import type { MouseEvent } from 'react';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { Button, ButtonGroup, Container } from 'react-bootstrap';\nimport { ProcedureState } from './ProcedureState';\nimport type { ProcedureSchema } from '.';\n\nfunction Actions(props: {\n hardware: EditableHardware<ProcedureSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const disabled = props.disabled || !hardware.online;\n const waitingUserInput = hardware.properties.state === 'AWAITING_USER_INPUT';\n const aborting = hardware.properties.state === 'ABORTING';\n const isRunning =\n hardware.properties.state === 'RUNNING' || waitingUserInput || aborting;\n\n function doStart(event: MouseEvent) {\n void hardware.actions.call('start');\n }\n\n function doAbort(event: MouseEvent) {\n void hardware.actions.call('abort');\n }\n\n return (\n <ButtonGroup size=\"lg\" className=\"w-100\">\n <Button\n onClick={doStart}\n disabled={disabled || isRunning}\n variant=\"primary\"\n >\n Start\n </Button>\n <Button\n onClick={doAbort}\n disabled={disabled || !isRunning}\n variant=\"primary\"\n >\n Abort\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function ProcedureManage(\n props: HardwareWidgetProps<ProcedureSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon name=\"Procedure\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ProcedureState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <Actions hardware={hardware} disabled={!props.operator} />\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { Container, Badge } from 'react-bootstrap';\nimport { ProcedureState } from './ProcedureState';\nimport type { ProcedureSchema } from '.';\n\nfunction State(props: { hardware: EditableHardware<ProcedureSchema> }) {\n const { hardware } = props;\n const awaitingUserInput = hardware.properties.state === 'AWAITING_USER_INPUT';\n const aborting = hardware.properties.state === 'ABORTING';\n const isRunning = hardware.properties.state === 'RUNNING';\n\n if (aborting) {\n return (\n <Badge bg=\"warning\">\n <i className=\"fa-solid fa-heart-crack fa-beat\" /> ABORTING\n </Badge>\n );\n }\n\n if (isRunning) {\n return (\n <Badge bg=\"info\">\n <i className=\"fa-solid fa-heart fa-beat\" /> RUNNING\n </Badge>\n );\n }\n\n if (awaitingUserInput) {\n return (\n <Badge bg=\"warning\" title=\"A user input is expected\">\n <i className=\"fa-solid fa-user fa-beat\" /> AWAITING INPUT\n </Badge>\n );\n }\n\n return <FinishedState hardware={hardware} />;\n}\n\nfunction FinishedState(props: { hardware: EditableHardware<ProcedureSchema> }) {\n const { hardware } = props;\n const { previous_run_state: runState, previous_run_exception: runException } =\n hardware.properties;\n\n const variants: { [state: string]: [string, string | null] } = {\n NONE: ['secondary', null],\n ABORTED: ['warning', 'fa-heart-crack'],\n FAILED: ['danger', null],\n SUCCESSED: ['success', null],\n UNKNOWN: ['danger', null],\n };\n\n const definition = variants[runState] || variants.UNKNOWN;\n const [variant, icon] = definition;\n\n return (\n <Badge bg={variant} title={runException ?? undefined}>\n {icon && (\n <>\n <i className={`fa-solid ${icon}`} />{' '}\n </>\n )}\n {runState}\n </Badge>\n );\n}\n\nexport default function ProcedureExecution(\n props: HardwareWidgetProps<ProcedureSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon name=\"Procedure\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ProcedureState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <div>\n <h3>\n <State hardware={hardware} />\n </h3>\n </div>\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { MouseEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { Button, ButtonGroup, Container, Badge } from 'react-bootstrap';\nimport { ProcedureState } from './ProcedureState';\nimport type { ProcedureSchema } from '.';\n\nfunction Actions(props: {\n hardware: EditableHardware<ProcedureSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const disabled = props.disabled || !hardware.online;\n const waitingUserInput = hardware.properties.state === 'AWAITING_USER_INPUT';\n\n function doValidate(event: MouseEvent) {\n void hardware.actions.call('validate');\n }\n\n return (\n <ButtonGroup size=\"lg\" className=\"w-100\">\n <Button\n onClick={doValidate}\n disabled={disabled || !waitingUserInput}\n variant=\"primary\"\n >\n Validate\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function ProcedureValidate(\n props: HardwareWidgetProps<ProcedureSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon name=\"Procedure\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ProcedureState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <Actions hardware={hardware} disabled={!props.operator} />\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport ProcedureManage from './ProcedureManage';\nimport ProcedureExecution from './ProcedureExecution';\nimport ProcedureValidate from './ProcedureValidate';\nimport ProcedureState from './ProcedureState';\n\nexport interface ProcedureSchema extends Hardware {\n properties: {\n state: string;\n previous_run_state: string;\n previous_run_exception: string | null;\n parameters: Record<string, any>;\n };\n}\n\nconst Variants: HardwareVariant<ProcedureSchema> = {\n default: ProcedureManage,\n manage: ProcedureManage,\n execution: ProcedureExecution,\n validate: ProcedureValidate,\n // Override base state\n state: ProcedureState,\n};\n\nexport default Variants;\n\nexport interface HardwareFromProcedure {\n __type__: 'hardware';\n name: string;\n}\n\nexport interface ScanFromProcedure {\n __type__: 'scan';\n mmh3: number;\n node?: string;\n key?: string;\n}\n\nexport interface ExceptionFromProcedure {\n __type__: 'exception';\n class: string;\n message: string;\n traceback: Record<string, any>;\n}\n","import standby from './ProcedureStandBy.json';\n\nexport const Mocks = {\n standby,\n};\n","import type { ShutterSchema } from '.';\nimport { HardwareState } from '../utils/State';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function ShutterState(props: {\n hardware: ShutterSchema;\n useReadyState?: boolean;\n}) {\n const { hardware } = props;\n function getState() {\n if (!hardware.online) {\n return 'OFFLINE';\n }\n const s = hardware.properties.state;\n if (props.useReadyState && (s === 'OPEN' || s === 'CLOSED')) {\n return 'READY';\n }\n return s;\n }\n\n const state = getState();\n\n function getVariant() {\n switch (state) {\n case 'READY':\n return 'success';\n case 'OPEN':\n return 'success';\n case 'CLOSED':\n return 'danger';\n case 'DISABLED':\n return 'secondary';\n case 'MOVING':\n case 'STANDBY':\n case 'OFFLINE':\n return 'warning';\n case 'FAULT':\n return 'fatal';\n default:\n return 'fatal';\n }\n }\n\n return <HardwareState state={state} minWidth={6} variant={getVariant()} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<ShutterSchema>\n) {\n const { hardware } = props;\n return <ShutterState hardware={hardware} useReadyState />;\n}\n","import { Button, OverlayTrigger, Popover, ButtonGroup } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { ShutterState } from './ShutterState';\nimport type { ShutterSchema } from '.';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\n\nfunction ShutterOverlay(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware } = props;\n function reset() {\n void hardware.actions.call('reset');\n }\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <div className=\"d-grid gap-2\">\n <Button onClick={reset} disabled={props.disabled}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Shutter Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport default function ShutterDefault(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Shutter\"\n icon=\"fam-hardware-shutter\"\n online={hardware.online}\n />\n );\n\n const widgetState = <ShutterState hardware={hardware} />;\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function getAction(s: string) {\n if (s === 'OPEN') {\n return ['Close', 'close'];\n }\n if (s === 'CLOSED') {\n return ['Open', 'open'];\n }\n if (s === 'DISABLED' || s === 'STANDBY' || s === 'FAULT') {\n return ['Closed', ''];\n }\n if (s === 'MOVING') {\n return ['...', ''];\n }\n return ['Unknown', ''];\n }\n\n const state = getState();\n const [label, action] = getAction(state);\n const variants: { [name: string]: string } = {\n OPEN: 'danger',\n CLOSED: 'success',\n MOVING: 'warning',\n DISABLED: 'secondary',\n STANDBY: 'danger',\n FAULT: 'fatal',\n UNKNOWN: 'warning',\n };\n const variant = variants[state] || 'danger';\n\n function onClick() {\n void hardware.actions.call(action);\n }\n\n const widgetContent = (\n <ButtonGroup className=\"d-flex flex-nowrap\">\n <Button\n variant={variant}\n onClick={onClick}\n disabled={props.disabled || action === ''}\n >\n {label}\n </Button>\n\n {options.extended && <ShutterOverlay {...props} />}\n </ButtonGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import {\n InputGroup,\n Button,\n ButtonGroup,\n Dropdown,\n Container,\n Row,\n Col,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport type { ShutterSchema } from '.';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { ShutterState } from './ShutterState';\nimport TypeIcon from '../utils/TypeIcon';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nfunction DropdownShutter(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n function requestOpen() {\n void hardware.actions.call('open');\n }\n\n function requestClose() {\n void hardware.actions.call('close');\n }\n\n const state = hardware.properties?.state ?? 'UNKNOWN';\n const hardwareMoving = state === 'MOVING';\n const hardwareDisabled = state === 'DISABLED' || hardwareMoving;\n\n return (\n <Dropdown>\n <Dropdown.Toggle\n variant=\"secondary\"\n disabled={props.disabled || hardwareDisabled}\n />\n <Dropdown.Menu popperConfig={{ strategy: 'fixed' }}>\n <Container>\n <Row>\n <Col className=\"text-center\">Actions</Col>\n </Row>\n <Row>\n <Col>\n <ButtonGroup>\n <Button\n variant={hardwareMoving ? 'warning' : 'secondary'}\n onClick={() => {\n requestOpen();\n }}\n disabled={props.disabled || hardwareDisabled}\n title=\"Open the shutter\"\n >\n Open\n </Button>\n <Button\n variant={hardwareMoving ? 'warning' : 'secondary'}\n onClick={() => {\n requestClose();\n }}\n disabled={props.disabled || hardwareDisabled}\n title=\"Close the shutter\"\n >\n Close\n </Button>\n </ButtonGroup>\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport default function ShutterProtected(\n props: HardwareWidgetProps<ShutterSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Shutter\"\n icon=\"fam-hardware-shutter\"\n online={hardware.online}\n />\n );\n\n const widgetState = <ShutterState hardware={hardware} useReadyState />;\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function getValue(s: string) {\n if (s === 'OPEN' || s === 'CLOSED') {\n return s;\n }\n if (s === 'DISABLED' || s === 'STANDBY' || s === 'FAULT') {\n return 'CLOSED';\n }\n if (s === 'MOVING') {\n return '...';\n }\n return 'UNKNOWN';\n }\n\n function capitalize(s: string) {\n return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n }\n\n const state = getState();\n const value = getValue(state);\n const hardwareDisabled = state === 'DISABLED' || state === 'MOVING';\n\n const variants: { [name: string]: string } = {\n OPEN: 'success',\n CLOSED: 'danger',\n MOVING: 'warning',\n DISABLED: 'secondary',\n STANDBY: 'success',\n FAULT: 'fatal',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state];\n const valueName = capitalize(value);\n\n const widgetContent = (\n <InputGroup className=\"d-flex flex-nowrap\">\n <ReadOnlyTextInput\n variant={variant}\n className=\"text-center\"\n style={{ minWidth: '10em' }}\n value={valueName}\n />\n <DropdownShutter {...props} />\n </InputGroup>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport ShutterDefault from './ShutterDefault';\nimport ShutterProtected from './ShutterProtected';\nimport ShutterState from './ShutterState';\n\nexport interface ShutterSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n valid: boolean;\n open_text: string;\n closed_text: string;\n };\n}\n\nconst Variants: HardwareVariant<ShutterSchema> = {\n default: ShutterDefault,\n protected: ShutterProtected,\n // Override default state\n state: ShutterState,\n};\n\nexport default Variants;\n","import defaultjson from './BeamShutter.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function ShutterSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [state, setState] = useState('OPEN');\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'open') {\n setState('MOVING');\n await delay(2000);\n setState('OPEN');\n return;\n }\n if (name === 'close') {\n setState('MOVING');\n await delay(2000);\n setState('CLOSED');\n return;\n }\n console.log('ShutterSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log('ShutterSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = {\n state,\n closed_text: '',\n open_text: '',\n status: `Shutter is ${state}`,\n valid: true,\n };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"shutter\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { useMemo } from 'react';\nimport { useMotorHardware } from '../motor';\nimport type { MotorSchema } from '../motor';\nimport type { SlitSchema } from '.';\nimport { HardwareState } from '../utils/State';\nimport type { HardwareWidgetProps } from '../utils/types';\n\ninterface ResolvedSlit {\n vgap: MotorSchema['properties']['state'] | null;\n voffset: MotorSchema['properties']['state'] | null;\n hgap: MotorSchema['properties']['state'] | null;\n hoffset: MotorSchema['properties']['state'] | null;\n}\n\nfunction useResolvedSlit(hardware: SlitSchema): ResolvedSlit {\n const { properties } = hardware;\n\n const vgapId = properties.vgap.slice(9);\n const vgap = useMotorHardware(vgapId);\n\n const hgapId = properties.hgap.slice(9);\n const hgap = useMotorHardware(hgapId);\n\n const voffsetId = properties.voffset.slice(9);\n const voffset = useMotorHardware(voffsetId);\n\n const hoffsetId = properties.hoffset.slice(9);\n const hoffset = useMotorHardware(hoffsetId);\n\n return useMemo(() => {\n return {\n vgap: vgap?.properties?.state ?? null,\n hgap: hgap?.properties?.state ?? null,\n voffset: voffset?.properties?.state ?? null,\n hoffset: hoffset?.properties?.state ?? null,\n };\n }, [vgap, hgap, voffset, hoffset]);\n}\n\nexport function SlitState(props: { hardware: SlitSchema }) {\n const { hardware } = props;\n\n const info = useResolvedSlit(hardware);\n\n const [state, variant, description] = useMemo(() => {\n if (\n info.vgap === null &&\n info.hgap === null &&\n info.voffset === null &&\n info.hoffset === null\n ) {\n return ['OFFLINE', 'secondary', 'No motor online'];\n }\n\n const states = new Set([\n ...(info.vgap ?? []),\n ...(info.hgap ?? []),\n ...(info.voffset ?? []),\n ...(info.hoffset ?? []),\n ]);\n\n if (states.has('MOVING')) {\n return ['MOVING', 'warning', 'A motor is moving'];\n }\n if (states.has('OFF')) {\n return ['OFF', 'secondary', 'A motor is off'];\n }\n return ['READY', 'success', 'The slit is ready'];\n }, [info]);\n\n return (\n <HardwareState\n state={state}\n description={description}\n variant={variant}\n minWidth={6}\n />\n );\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<SlitSchema>) {\n const { hardware } = props;\n return <SlitState hardware={hardware} />;\n}\n","import type {\n HardwareWidgetProps,\n EditableHardware,\n HardwareChangeActions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { Container, Row, Col, InputGroup, Dropdown } from 'react-bootstrap';\nimport type { SlitDefaultOptions, SlitSchema } from '.';\nimport { useMotorHardware } from '../motor';\nimport type { MotorSchema } from '../motor';\nimport { SlitState } from './SlitState';\nimport MotorDefault from '../motor/MotorDefault';\nimport { useHardwareChangeActions } from '../../registry/hooks';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport { useMemo } from 'react';\nimport classNames from 'classnames';\n\ninterface ResolvedSlit {\n vgap: EditableHardware<MotorSchema> | null;\n voffset: EditableHardware<MotorSchema> | null;\n hgap: EditableHardware<MotorSchema> | null;\n hoffset: EditableHardware<MotorSchema> | null;\n}\n\nfunction useResolvedSlit(hardware: SlitSchema): ResolvedSlit {\n const { properties } = hardware;\n\n const vgapId = properties.vgap.slice(9);\n const vgap = useMotorHardware(vgapId);\n const vgapActions = useHardwareChangeActions(vgapId);\n\n const hgapId = properties.hgap.slice(9);\n const hgap = useMotorHardware(hgapId);\n const hgapActions = useHardwareChangeActions(hgapId);\n\n const voffsetId = properties.voffset.slice(9);\n const voffset = useMotorHardware(voffsetId);\n const voffsetActions = useHardwareChangeActions(voffsetId);\n\n const hoffsetId = properties.hoffset.slice(9);\n const hoffset = useMotorHardware(hoffsetId);\n const hoffsetActions = useHardwareChangeActions(hoffsetId);\n\n function merge(motor: MotorSchema | null, actions: HardwareChangeActions) {\n if (motor === null) {\n return null;\n }\n return { ...motor, actions };\n }\n\n return {\n vgap: merge(vgap, vgapActions),\n hgap: merge(hgap, hgapActions),\n voffset: merge(voffset, voffsetActions),\n hoffset: merge(hoffset, hoffsetActions),\n } as ResolvedSlit;\n}\n\nfunction DropdownSlit(\n props: HardwareWidgetProps<SlitSchema, SlitDefaultOptions> & {\n resolved: ResolvedSlit;\n }\n) {\n const { hardware, schema, operator, disabled, resolved } = props;\n\n return (\n <Dropdown>\n <Dropdown.Toggle variant=\"secondary\" />\n <Dropdown.Menu align=\"end\" popperConfig={{ strategy: 'fixed' }}>\n <Container>\n <Row className=\"flex-nowrap\">\n <Col sm={1} className=\"d-flex\">\n <i\n className=\"fa fa-fw fa-square\"\n title=\"Gap\"\n style={{ alignSelf: 'center' }}\n />\n </Col>\n <Col sm={5}>\n {resolved.hgap && (\n <MotorDefault\n hardware={resolved.hgap}\n options={{ header: 'none' }}\n schema={schema}\n disabled={disabled}\n operator={operator}\n />\n )}\n </Col>\n <Col sm={1} className=\"d-flex\">\n <span style={{ alignSelf: 'center' }}>×</span>\n </Col>\n <Col sm={5}>\n {resolved.vgap && (\n <MotorDefault\n hardware={resolved.vgap}\n options={{ header: 'none' }}\n schema={schema}\n disabled={disabled}\n operator={operator}\n />\n )}\n </Col>\n </Row>\n <Row className=\"flex-nowrap\">\n <Col sm={1} className=\"d-flex\">\n <i\n className=\"fa fa-fw fa-arrows-up-down-left-right \"\n title=\"Offset\"\n style={{ alignSelf: 'center' }}\n />\n </Col>\n <Col sm={5}>\n {resolved.hoffset && (\n <MotorDefault\n hardware={resolved.hoffset}\n options={{ header: 'none' }}\n schema={schema}\n disabled={disabled}\n operator={operator}\n />\n )}\n </Col>\n <Col sm={1} className=\"d-flex\">\n <span style={{ alignSelf: 'center' }}>;</span>\n </Col>\n <Col sm={5}>\n {resolved.voffset && (\n <MotorDefault\n hardware={resolved.voffset}\n options={{ header: 'none' }}\n schema={schema}\n disabled={disabled}\n operator={operator}\n />\n )}\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nfunction Widget(props: HardwareWidgetProps<SlitSchema, SlitDefaultOptions>) {\n const { hardware, options = {} } = props;\n const resolved = useResolvedSlit(hardware);\n const { readonly: readOnly = false } = options;\n\n function normalizePosition(motor: MotorSchema | null): string {\n const position = motor?.properties?.position ?? null;\n if (position === null) {\n return '∅';\n }\n const digits =\n options.precision ?? motor?.properties?.display_digits ?? undefined;\n if (digits !== undefined) {\n return position.toFixed(digits);\n }\n return `${position}`;\n }\n\n const [gap, gapUnit, gapMoving, offset, offsetUnit, offsetMoving] =\n useMemo(() => {\n const gap = `${normalizePosition(resolved.hgap)} × ${normalizePosition(\n resolved.vgap\n )}`;\n\n const gapUnit =\n resolved.hgap?.properties.unit ?? resolved.vgap?.properties.unit ?? '?';\n\n const gapStates = new Set([\n ...(resolved.hgap?.properties.state ?? []),\n ...(resolved.vgap?.properties.state ?? []),\n ]);\n const gapMoving = gapStates.has('MOVING');\n\n const offset = `${normalizePosition(\n resolved.hoffset\n )} ; ${normalizePosition(resolved.voffset)}`;\n\n const offsetUnit =\n resolved.hoffset?.properties.unit ??\n resolved.voffset?.properties.unit ??\n '?';\n\n const offsetStates = new Set([\n ...(resolved.hoffset?.properties.state ?? []),\n ...(resolved.voffset?.properties.state ?? []),\n ]);\n const offsetMoving = offsetStates.has('MOVING');\n\n return [gap, gapUnit, gapMoving, offset, offsetUnit, offsetMoving];\n }, [resolved.hgap, resolved.hoffset, resolved.vgap, resolved.voffset]);\n\n return (\n <InputGroup className=\"w-100 flex-nowrap\">\n <InputGroup.Text title=\"Gap (horizontal and vertical)\">\n <i className=\"fa fa-fw fa-square fa-2x\" />\n </InputGroup.Text>\n <ReadOnlyTextInput\n value={gap}\n title=\"Gap\"\n className={classNames({ 'hw-moving': gapMoving })}\n />\n <InputGroup.Text>{gapUnit}</InputGroup.Text>\n <InputGroup.Text title=\"Offset (horizontal and vertical)\">\n <i className=\"fa fa-fw fa-arrows-up-down-left-right fa-2x\" />\n </InputGroup.Text>\n <ReadOnlyTextInput\n value={offset}\n title=\"Offset\"\n className={classNames({ 'hw-moving': offsetMoving })}\n />\n <InputGroup.Text>{offsetUnit}</InputGroup.Text>\n {!readOnly && <DropdownSlit {...props} resolved={resolved} />}\n </InputGroup>\n );\n}\n\nexport default function SlitDefault(\n props: HardwareWidgetProps<SlitSchema, SlitDefaultOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Slit\" icon=\"fam-hardware-motor\" online={hardware.online} />\n );\n\n const widgetState = <SlitState hardware={hardware} />;\n\n const widgetContent = <Widget {...props} />;\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type {\n Hardware,\n HardwareVariant,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport SlitDefault from './SlitDefault';\nimport SlitState from './SlitState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface SlitSchema extends Hardware {\n properties: {\n state: string;\n type: 'vertical' | 'horizontal' | 'both';\n hgap: string;\n vgap: string;\n hoffset: string;\n voffset: string;\n };\n}\n\nexport interface SlitDefaultOptions extends HardwareWidgetOptions {\n /** Number of decimals to show */\n precision?: number;\n /** Setup the widget to be read only */\n readonly?: boolean;\n}\n\nconst Variants: HardwareVariant<SlitSchema> = {\n default: SlitDefault,\n // Override default state\n state: SlitState,\n};\n\nexport default Variants;\n","import slit from './Slit.json';\nimport horizontal from './HSlit.json';\nimport vertical from './VSlit.json';\n\nexport const Mocks = {\n default: slit,\n horizontal,\n vertical,\n};\n","import { map } from 'lodash';\n\nimport {\n Badge,\n Button,\n InputGroup,\n Form,\n OverlayTrigger,\n Popover,\n Container,\n Row,\n Col,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { PumpSchema } from '.';\n\ninterface PumpWidgetOptions extends HardwareWidgetOptions {\n // Unit of pressure\n unit?: string;\n // Precision to show, default 3\n precision?: number;\n}\n\nfunction PumpOverlay(\n props: HardwareWidgetProps<PumpSchema, PumpWidgetOptions>\n) {\n const { hardware } = props;\n const toggle = () => {\n void hardware.actions.call(\n hardware.properties.state === 'ON' ? 'off' : 'on'\n );\n };\n\n const attrs = {\n Voltage: `${hardware.properties.voltage.toFixed(0)} V`,\n Current: `${(hardware.properties.current * 1000).toFixed(2)} mA`,\n };\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popid\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n\n <h6>Properties</h6>\n <Container>\n {map(attrs, (prop, name) => (\n <Row key={name}>\n <Col>{name}:</Col>\n <Col>{prop}</Col>\n </Row>\n ))}\n </Container>\n\n <div className=\"d-grid gap-2\">\n <Button\n disabled={props.disabled}\n onClick={toggle}\n variant={\n hardware.properties.state === 'ON' ? 'danger' : 'success'\n }\n >\n {hardware.properties.state === 'ON' ? 'Off' : 'On'}\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button title=\"Pump Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Pump(props: HardwareWidgetProps<PumpSchema, PumpWidgetOptions>) {\n const { hardware, options = {} } = props;\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Pump\"\n icon=\"fam-hardware-pump\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge bg={hardware.properties.state === 'ON' ? 'success' : 'danger'}>\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <InputGroup>\n <Form.Control\n value={hardware.properties.pressure.toExponential(\n options.precision || 3\n )}\n disabled\n />\n {(hardware.properties.unit || options.unit) && (\n <InputGroup.Text>\n {hardware.properties.unit || options.unit}\n </InputGroup.Text>\n )}\n <PumpOverlay {...props} />\n </InputGroup>\n </div>\n </div>\n );\n}\n\nexport default Pump;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Pump from './Pump';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface PumpSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n pressure: number;\n voltage: number;\n current: number;\n unit?: string; // FIXME: The server implementation is missing\n };\n}\n\nconst Variants: HardwareVariant<PumpSchema> = {\n default: Pump,\n};\n\nexport default Variants;\n","import defaultjson from './Pump.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { PusherSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function PusherState(props: { hardware: PusherSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n RETRACTED: 'success',\n IN_TOUCH: 'warning',\n MOVING_IN: 'warning',\n MOVING_OUT: 'warning',\n UNKNOWN: 'danger',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(props: HardwareWidgetProps<PusherSchema>) {\n const { hardware } = props;\n return <PusherState hardware={hardware} />;\n}\n","import { Button, ButtonGroup } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n EditableHardware,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { PusherState } from './PusherState';\nimport type { PusherSchema } from '.';\nimport { useState } from 'react';\n\nfunction PusherBlock(props: {\n hardware: EditableHardware<PusherSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n className: string;\n}) {\n const { className, hardware, options = {} } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n const isInTouch = state === 'IN_TOUCH';\n const disabled = !isInTouch || props.disabled;\n\n function ButtonPush(props: { distance: number }) {\n const { distance } = props;\n const [pushing, setPushing] = useState(false);\n return (\n <Button\n variant=\"secondary\"\n onClick={() => {\n setPushing(true);\n hardware.actions.call('push', distance).finally(() => {\n setPushing(false);\n });\n }}\n disabled={disabled}\n >\n <span className=\"text-nowrap\">\n <i\n className={\n pushing\n ? 'fa-solid fa-fw fa-cog fa-spin'\n : 'fa fa-fw fa-arrow-left'\n }\n />{' '}\n {distance}\n </span>\n </Button>\n );\n }\n return (\n <div\n className={className}\n style={{\n display: 'grid',\n gridTemplateRows: 'min-content min-content min-content',\n gridTemplateColumns: 'min-content min-content min-content',\n gridGap: '1px',\n }}\n >\n <ButtonPush distance={5} />\n <ButtonPush distance={0.5} />\n <ButtonPush distance={0.05} />\n <ButtonPush distance={2} />\n <ButtonPush distance={0.2} />\n <ButtonPush distance={0.02} />\n <ButtonPush distance={1} />\n <ButtonPush distance={0.1} />\n <ButtonPush distance={0.01} />\n </div>\n );\n}\n\nfunction RawPusher(props: {\n hardware: EditableHardware<PusherSchema>;\n options: HardwareWidgetOptions;\n disabled: boolean;\n}) {\n const { hardware, options, disabled } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n const isRetracted = state === 'RETRACTED';\n const isInTouch = state === 'IN_TOUCH';\n const [movingIn, setMovingIn] = useState(false);\n const [movingOut, setMovingOut] = useState(false);\n\n const location = isRetracted ? 'ms-auto' : isInTouch ? 'ms-0' : 'mx-auto';\n\n return (\n <div\n style={{\n display: 'grid',\n gridTemplateRows: 'min-content min-content',\n gridTemplateColumns: 'min-content auto',\n gridGap: '1px',\n }}\n >\n <i\n className={`${\n isInTouch ? 'fas fa-dizzy' : 'fa fa-smile'\n } fa-3x my-auto`}\n />\n <PusherBlock className={location} {...props} />\n <span />\n <ButtonGroup className=\"mx-auto\" style={{ width: '12em' }}>\n <Button\n onClick={() => {\n setMovingIn(true);\n hardware.actions.call('move_in').finally(() => {\n setMovingIn(false);\n });\n }}\n disabled={isInTouch || disabled || movingIn || movingOut}\n style={{ width: '5em' }}\n >\n <span className=\"text-nowrap\">\n <i\n className={\n movingIn\n ? 'fa-solid fa-fw fa-cog fa-spin'\n : 'fa fa-fw fa-arrow-left'\n }\n />{' '}\n In\n </span>\n </Button>\n <Button\n onClick={() => {\n setMovingOut(true);\n hardware.actions.call('move_out').finally(() => {\n setMovingOut(false);\n });\n }}\n disabled={isRetracted || disabled || movingIn || movingOut}\n style={{ width: '5em' }}\n >\n <span className=\"text-nowrap\">\n Out{' '}\n <i\n className={\n movingOut\n ? 'fa-solid fa-fw fa-cog fa-spin'\n : 'fa fa-fw fa-arrow-right'\n }\n />\n </span>\n </Button>\n </ButtonGroup>\n </div>\n );\n}\n\nexport default function Pusher(\n props: HardwareWidgetProps<PusherSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Pusher\"\n icon=\"fa-hand-point-right\"\n online={hardware.online}\n />\n );\n\n const widgetState = <PusherState hardware={hardware} />;\n\n function getWidgetContent() {\n return <RawPusher {...props} />;\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Pusher from './Pusher';\nimport PusherState from './PusherState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface PusherSchema extends Hardware {\n properties: {\n state: string;\n };\n}\n\nconst Variants: HardwareVariant<PusherSchema> = {\n default: Pusher,\n // Override base state\n state: PusherState,\n};\n\nexport default Variants;\n","import defaultjson from './Pusher.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function PusherSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [state, setState] = useState('RETRACTED');\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'move_in') {\n setState('MOVING_IN');\n await delay(2000);\n setState('IN_TOUCH');\n return;\n }\n if (name === 'move_out') {\n setState('MOVING_OUT');\n await delay(2000);\n setState('RETRACTED');\n return;\n }\n if (name === 'push') {\n await delay(100);\n return;\n }\n console.log('PusherSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log('PusherSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = { state };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"pusher\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import { HardwareState } from '../utils/State';\nimport type { ServiceSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function ServiceState(props: { hardware: ServiceSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n STOPPED: 'danger',\n STARTING: 'warning',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'warning',\n EXITED: 'secondary',\n FATAL: 'fatal',\n UNKNOWN: 'fatal',\n OFFLINE: 'secondary',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<ServiceSchema>\n) {\n const { hardware } = props;\n return <ServiceState hardware={hardware} />;\n}\n","import { Form, Button, InputGroup } from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { ServiceState } from './ServiceState';\nimport type { ServiceSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nexport default function ServiceDefault(\n props: HardwareWidgetProps<ServiceSchema, HardwareWidgetOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Shutter\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ServiceState hardware={hardware} />;\n\n function requestStart() {\n void hardware.actions.call('start');\n }\n\n function requestRestart() {\n void hardware.actions.call('restart');\n }\n\n function requestStop() {\n void hardware.actions.call('stop');\n }\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function capitalize(s: string) {\n return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n }\n\n const state = getState();\n const label = capitalize(state);\n const variants: { [name: string]: string } = {\n STOPPED: 'danger',\n STARTING: 'warning',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'warning',\n EXITED: 'secondary',\n FATAL: 'fatal',\n UNKNOWN: 'secondary',\n OFFLINE: 'secondary',\n };\n const variant = variants[state] || 'danger';\n\n function getStartAction() {\n const restartEnabled = state === 'RUNNING' || state === 'STARTING';\n return {\n icon: restartEnabled ? 'fa fa-refresh fa-wp' : 'fa fa-play fa-wp',\n variant: props.disabled ? '' : 'success',\n callback: state === 'RUNNING' ? requestRestart : requestStart,\n disabled: props.disabled,\n title: !props.operator\n ? 'You dont have the control to the session'\n : restartEnabled\n ? 'Restart the service'\n : 'Start the serStaticTextInputvice',\n };\n }\n\n function getStopAction() {\n const stopEnabled = state === 'RUNNING' || state === 'STARTING';\n return {\n icon: 'fa fa-stop fa-wp',\n variant: props.disabled ? '' : !stopEnabled ? 'secondary' : 'danger',\n callback: requestStop,\n disabled: props.disabled,\n title: !props.operator\n ? 'You dont have the control to the session'\n : 'Stop the service',\n };\n }\n\n const startAction = getStartAction();\n const stopAction = getStopAction();\n\n const widgetContent = (\n <InputGroup className=\"d-flex flex-nowrap\">\n <ReadOnlyTextInput\n variant={variant}\n className=\"text-center\"\n style={{ minWidth: '8em' }}\n value={label}\n />\n <Button\n style={{ width: '2.5em' }}\n variant=\"light\"\n className={`px-0 text-${startAction.variant}`}\n onClick={startAction.callback}\n disabled={startAction.disabled}\n title={startAction.title}\n >\n <i className={`${startAction.icon}`} />\n </Button>\n <Button\n style={{ width: '2.5em' }}\n variant=\"light\"\n className={`px-0 text-${stopAction.variant}`}\n onClick={stopAction.callback}\n disabled={stopAction.disabled}\n title={stopAction.title}\n >\n <i className={`${stopAction.icon}`} />\n </Button>\n </InputGroup>\n );\n\n const headerMode = props.options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import {\n InputGroup,\n Button,\n Popover,\n Row,\n Col,\n OverlayTrigger,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport TypeIcon from '../utils/TypeIcon';\nimport { ServiceState } from './ServiceState';\nimport type { ServiceSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nexport interface ServiceProectedOptions extends HardwareWidgetOptions {\n /** Direction to drop the menu */\n dropDirection?: string;\n}\n\nfunction DropdownService(\n props: HardwareWidgetProps<ServiceSchema, ServiceProectedOptions>\n) {\n const { hardware, options = {} } = props;\n function requestStart() {\n void hardware.actions.call('start');\n }\n\n function requestRestart() {\n void hardware.actions.call('restart');\n }\n\n function requestStop() {\n void hardware.actions.call('stop');\n }\n\n const state = hardware.properties?.state ?? 'UNKNOWN';\n const hardwareDisabled = state === 'STOPPING' || state === 'STARTING';\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n placement={options.dropDirection === 'up' ? 'top' : 'bottom'}\n overlay={\n <Popover id=\"service-protected-overlay\">\n <Popover.Body>\n <Row>\n <Col className=\"text-center\">Actions</Col>\n </Row>\n <Row>\n <Col>\n {state === 'RUNNING' && (\n <Button\n className=\"me-1 text-success border-secondary\"\n variant=\"light\"\n onClick={() => {\n requestRestart();\n }}\n disabled={props.disabled}\n title=\"Restart the service\"\n >\n <i className=\"fa fa-refresh fa-wp me-1\" />\n Restart\n </Button>\n )}\n {state !== 'RUNNING' && (\n <Button\n className=\"me-1 text-success border-secondary\"\n variant=\"light\"\n onClick={() => {\n requestStart();\n }}\n disabled={props.disabled}\n title=\"Start the service\"\n >\n <i className=\"fa fa-play fa-wp me-1\" />\n Start\n </Button>\n )}\n <Button\n className={`text-${\n state !== 'STOPPED' ? 'danger' : 'primary'\n } border-secondary`}\n variant=\"light\"\n onClick={() => {\n requestStop();\n }}\n disabled={props.disabled}\n title=\"Stop the service\"\n >\n <i className=\"fa fa-stop fa-wp me-1\" />\n Stop\n </Button>\n </Col>\n </Row>\n </Popover.Body>\n </Popover>\n }\n >\n <Button disabled={props.disabled || hardwareDisabled}>\n <i\n className={`fa fa-caret-${\n options.dropDirection === 'up' ? 'up' : 'down'\n }`}\n />\n </Button>\n </OverlayTrigger>\n );\n}\n\nexport default function ServiceProtected(\n props: HardwareWidgetProps<ServiceSchema, ServiceProectedOptions>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon name=\"Shutter\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <ServiceState hardware={hardware} />;\n\n function getState() {\n if (!hardware.properties) {\n return 'UNKNOWN';\n }\n return hardware.properties.state;\n }\n\n function capitalize(s: string) {\n return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();\n }\n\n const state = getState();\n const hardwareDisabled = state === 'STOPPING' || state === 'STARTING';\n\n const variants: { [name: string]: string } = {\n STOPPED: 'danger',\n STARTING: 'warning',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'warning',\n EXITED: 'secondary',\n FATAL: 'fatal',\n UNKNOWN: 'fatal',\n OFFLINE: 'secondary',\n };\n const variant = variants[state];\n const valueName = capitalize(state);\n\n const widgetContent = (\n <InputGroup className=\"d-flex flex-nowrap\">\n <ReadOnlyTextInput\n variant={variant}\n style={{ minWidth: '10em' }}\n value={valueName}\n className=\"text-center\"\n />\n <DropdownService {...props} />\n </InputGroup>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport ServiceDefault from './ServiceDefault';\nimport ServiceProtected from './ServiceProtected';\nimport ServiceState from './ServiceState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface ServiceSchema extends Hardware {\n properties: {\n state:\n | 'STOPPED'\n | 'STARTING'\n | 'RUNNING'\n | 'BACKOFF'\n | 'STOPPING'\n | 'EXITED'\n | 'FATAL'\n | 'UNKNOWN';\n };\n}\n\nconst Variants: HardwareVariant<ServiceSchema> = {\n default: ServiceDefault,\n protected: ServiceProtected,\n // Override base state\n state: ServiceState,\n};\n\nexport default Variants;\n","import defaultjson from './Service.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { TomoFlatMotionSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoFlatMotionState(props: { hardware: TomoFlatMotionSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n UNKNOWN: 'danger',\n READY: 'success',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoFlatMotionSchema>\n) {\n const { hardware } = props;\n return <TomoFlatMotionState hardware={hardware} />;\n}\n","import type {\n HardwareWidgetProps,\n HardwareChangeActions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport {\n Container,\n Row,\n Col,\n ButtonGroup,\n Button,\n InputGroup,\n Form,\n} from 'react-bootstrap';\nimport { TomoFlatMotionState } from './TomoFlatMotionState';\nimport type { TomoFlatMotionStep, TomoFlatMotionSchema } from '.';\nimport { useMotorHardware } from '../motor';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\nimport { Fragment } from 'react';\nimport { useMemo } from 'react';\nimport { useEffect } from 'react';\nimport { useRef, useState } from 'react';\n\nfunction AxisName(props: { motion: TomoFlatMotionStep; disabled?: boolean }) {\n const { motion } = props;\n const axisRef = motion.axisRef;\n const axisId = axisRef.slice(9);\n const axis = useMotorHardware(axisId);\n const name = axis?.alias ?? axis?.name ?? axis?.id ?? axisId;\n return <div className=\"my-auto\">{name}</div>;\n}\n\nfunction DropAxis(props: {\n actions: HardwareChangeActions;\n motion: TomoFlatMotionStep;\n disabled?: boolean;\n}) {\n const { motion, actions, disabled } = props;\n const axisRef = motion.axisRef;\n\n function requestDropAxis() {\n void actions.call('update_axis', { axis_ref: axisRef });\n }\n\n return (\n <Button variant=\"danger\" onClick={requestDropAxis} disabled={disabled}>\n <i className=\"fa fa-trash\" />\n </Button>\n );\n}\n\nfunction AxisOnOff(props: {\n actions: HardwareChangeActions;\n axisRef: string;\n motion: TomoFlatMotionStep[];\n disabled?: boolean;\n}) {\n const { motion, actions, axisRef, disabled } = props;\n\n const isUsed = useMemo(() => {\n for (const m of motion) {\n if (m.axisRef === axisRef) {\n return true;\n }\n }\n return false;\n }, [motion, axisRef]);\n\n const axisId = axisRef.slice(9);\n const axis = useMotorHardware(axisId);\n const name = axis?.alias ?? axis?.name ?? axis?.id ?? axisId;\n\n function requestAppendAxis() {\n void actions.call('update_axis', {\n axis_ref: axisRef,\n relative_position: 0,\n });\n }\n\n return (\n <Button\n className=\"ms-1\"\n variant={isUsed ? 'primary' : 'secondary'}\n onClick={() => {\n if (!isUsed) requestAppendAxis();\n }}\n title={\n isUsed\n ? 'This axis is already part of the motion'\n : 'Use this axis in the motion'\n }\n disabled={disabled}\n >\n {name}\n </Button>\n );\n}\n\nfunction InputAxisMotion(props: {\n actions: HardwareChangeActions;\n motion: TomoFlatMotionStep;\n disabled?: boolean;\n}) {\n const { motion, actions } = props;\n const axisRef = motion.axisRef;\n const position = motion.absolute_position ?? motion.relative_position ?? 0;\n\n const axisId = axisRef.slice(9);\n const axis = useMotorHardware(axisId);\n const disabled = props.disabled || !axis?.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n const unit = axis?.properties?.unit ?? '';\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n const newPosition = Number.parseFloat(formRef.current.value);\n void actions.call('update_axis', {\n axis_ref: axisRef,\n absolute_position:\n motion.absolute_position !== null ? newPosition : null,\n relative_position:\n motion.relative_position !== null ? newPosition : null,\n });\n } else if (e.key === 'Escape') {\n formRef.current.value = position.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== position && !edited) {\n setEdited(true);\n }\n if (exp === position && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = position.toFixed(digits);\n }\n }, [edited, position]);\n\n return (\n <InputGroup className=\"w-100\">\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={position.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>{unit}</InputGroup.Text>\n </InputGroup>\n );\n}\n\nfunction MotionKind(props: {\n actions: HardwareChangeActions;\n motion: TomoFlatMotionStep;\n disabled?: boolean;\n}) {\n const { actions, motion, disabled } = props;\n\n function requestAbsoluteMotion() {\n void actions.call('update_axis', {\n axis_ref: motion.axisRef,\n absolute_position: motion.absolute_position ?? motion.relative_position,\n });\n }\n\n function requestRelativeMotion() {\n void actions.call('update_axis', {\n axis_ref: motion.axisRef,\n relative_position: motion.absolute_position ?? motion.relative_position,\n });\n }\n\n return (\n <ButtonGroup>\n <Button\n onClick={requestAbsoluteMotion}\n variant={motion.absolute_position !== null ? 'primary' : 'secondary'}\n disabled={disabled}\n >\n Abs\n </Button>\n <Button\n onClick={requestRelativeMotion}\n variant={motion.relative_position !== null ? 'primary' : 'secondary'}\n disabled={disabled}\n >\n Rel\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function TomoFlatMotionDefault(\n props: HardwareWidgetProps<TomoFlatMotionSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { properties } = hardware;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoFlatMotion\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoFlatMotionState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <Row className=\"mt-1\">\n <Col xs={3}>Move in parallel</Col>\n <Col xs={9}>{properties.move_in_parallel ? 'true' : 'false'}</Col>\n </Row>\n <Row className=\"mt-1\">\n <Col xs={3}>Switch power on/off</Col>\n <Col xs={9}>{properties.power_onoff ? 'true' : 'false'}</Col>\n </Row>\n <Row className=\"mt-1\">\n <Col xs={3}>Settle time</Col>\n <Col xs={9}>\n {properties.settle_time.toFixed(2)} <span title=\"seconds\">s</span>\n </Col>\n </Row>\n <Row className=\"mt-1\">\n <Col xs={3}>Available axes</Col>\n <Col xs={9}>\n {properties.available_axes.map((axisRef) => {\n return (\n <AxisOnOff\n key={axisRef}\n axisRef={axisRef}\n motion={properties.motion}\n actions={hardware.actions}\n disabled={disabled}\n />\n );\n })}\n </Col>\n </Row>\n <Row className=\"mt-1\">\n <Col xs={3}>Actual motion</Col>\n <Col xs={9}>\n <div\n style={{\n display: 'grid',\n gridGap: 5,\n gridTemplateColumns: 'min-content min-content auto min-content',\n }}\n >\n <div>Axis</div>\n <div>Kind</div>\n <div>Displacement</div>\n <div />\n {properties.motion.map((motion, imotion) => {\n return (\n <Fragment key={`motion${imotion}`}>\n <AxisName motion={motion} />\n <MotionKind\n motion={motion}\n actions={hardware.actions}\n disabled={disabled}\n />\n <InputAxisMotion\n motion={motion}\n actions={hardware.actions}\n disabled={disabled}\n />\n <DropAxis\n motion={motion}\n actions={hardware.actions}\n disabled={disabled}\n />\n </Fragment>\n );\n })}\n </div>\n </Col>\n </Row>\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type {\n HardwareWidgetProps,\n HardwareChangeActions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { InputGroup, Form, Stack, Alert } from 'react-bootstrap';\nimport { TomoFlatMotionState } from './TomoFlatMotionState';\nimport type { TomoFlatMotionStep, TomoFlatMotionSchema } from '.';\nimport { useMotorHardware } from '../motor';\nimport { useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\n\nfunction InputAxisMotion(props: {\n actions: HardwareChangeActions;\n motion: TomoFlatMotionStep;\n disabled?: boolean;\n}) {\n const { motion, actions } = props;\n const axisRef = motion.axisRef;\n const position = motion.absolute_position ?? motion.relative_position ?? 0;\n\n const axisId = axisRef.slice(9);\n const axis = useMotorHardware(axisId);\n const disabled = props.disabled || !axis?.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n const unit = axis?.properties?.unit ?? '';\n const name = axis?.alias ?? axis?.name ?? axis?.id ?? 'none';\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n const newPosition = Number.parseFloat(formRef.current.value);\n void actions.call('update_axis', {\n axis_ref: axisRef,\n absolute_position:\n motion.absolute_position !== null ? newPosition : null,\n relative_position:\n motion.relative_position !== null ? newPosition : null,\n });\n } else if (e.key === 'Escape') {\n formRef.current.value = position.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== position && !edited) {\n setEdited(true);\n }\n if (exp === position && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = position.toFixed(digits);\n }\n }, [edited, position]);\n\n function getKind(): [string, string, string] {\n if (motion.absolute_position !== null) {\n return ['ABS', 'warning', 'Absolute displacement'];\n }\n if (motion.relative_position !== null) {\n return ['REL', 'none', 'Relative displacement'];\n }\n return ['ERR', 'danger', 'Unknown motion kind'];\n }\n const [kind, kindVariant, kindTitle] = getKind();\n\n return (\n <InputGroup className=\"w-100 flex-nowrap\">\n <InputGroup.Text\n title=\"Displacement to apply on this axis to take a flat\"\n style={{ width: '5em' }}\n >\n {name}\n </InputGroup.Text>\n <InputGroup.Text\n className={`bg-${kindVariant}`}\n title={kindTitle}\n style={{ width: '3em' }}\n >\n {kind}\n </InputGroup.Text>\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={position.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>{unit}</InputGroup.Text>\n </InputGroup>\n );\n}\n\nexport default function TomoFlatMotionSmall(\n props: HardwareWidgetProps<TomoFlatMotionSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { properties } = hardware;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoFlatMotion\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoFlatMotionState hardware={hardware} />;\n\n const widgetContent = (\n <>\n {properties.motion.length === 0 && (\n <Alert variant=\"danger\" className=\"mb-0\">\n No flat motion defined\n </Alert>\n )}\n {properties.motion.length > 0 && (\n <Stack direction=\"vertical\">\n {properties.motion.map((motion, imotion) => {\n return (\n <InputAxisMotion\n key={motion.axisRef}\n actions={hardware.actions}\n motion={motion}\n disabled={disabled}\n />\n );\n })}\n </Stack>\n )}\n </>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import TomoFlatMotionDefault from './TomoFlatMotionDefault';\nimport TomoFlatMotionSmall from './TomoFlatMotionSmall';\nimport TomoFlatMotionState from './TomoFlatMotionState';\nimport type { Hardware, HardwareVariant } from '../utils/types';\nimport { useHardware } from '../../registry/hooks';\n\nexport interface TomoFlatMotionStep {\n /** Axis reference, following the pattern `hardware:my_axis` */\n axisRef: string;\n absolute_position: number | null;\n relative_position: number | null;\n}\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoFlatMotionSchema extends Hardware {\n properties: {\n state: 'READY';\n available_axes: string[];\n motion: TomoFlatMotionStep[];\n move_in_parallel: boolean;\n power_onoff: boolean;\n settle_time: number;\n };\n}\n\nconst Variants: HardwareVariant<TomoFlatMotionSchema> = {\n default: TomoFlatMotionDefault,\n small: TomoFlatMotionSmall,\n // Override base state\n state: TomoFlatMotionState,\n};\n\nexport default Variants;\n\nexport function isTomoFlatMotionHardware(\n entity: Hardware\n): entity is TomoFlatMotionSchema {\n return entity.type === 'tomoflatmotion';\n}\n\nexport function useTomoFlatMotionHardware(\n name: string | null\n): TomoFlatMotionSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoFlatMotionHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import defaultjson from './TomoFlatMotion.json';\nimport sy from './sy.json';\nimport sy2 from './sy2.json';\n\nexport const Mocks = {\n default: defaultjson,\n sy,\n sy2,\n};\n","import { useState } from 'react';\nimport type { TomoFlatMotionSchema } from '..';\nimport { Simulator } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function TomoFlatMotionSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n\n const [properties, setProperties] = useState<\n TomoFlatMotionSchema['properties']\n >({\n state: 'READY',\n settle_time: 2,\n power_onoff: false,\n move_in_parallel: true,\n available_axes: ['hardware:sy', 'hardware:sy2'],\n motion: [\n {\n axisRef: 'hardware:sy',\n absolute_position: null,\n relative_position: 1,\n },\n ],\n });\n\n function updateAxes(\n props: TomoFlatMotionSchema['properties'],\n axis: {\n axis_ref: string;\n relative_position?: number;\n absolute_position?: number;\n }\n ): TomoFlatMotionSchema['properties'] {\n const motion: TomoFlatMotionSchema['properties']['motion'] = [];\n let inList = false;\n props.motion.forEach((m) => {\n if (m.axisRef === axis.axis_ref) {\n inList = true;\n if (\n axis.relative_position === undefined &&\n axis.absolute_position === undefined\n ) {\n return;\n }\n motion.push({\n axisRef: axis.axis_ref,\n relative_position: axis.relative_position ?? null,\n absolute_position: axis.absolute_position ?? null,\n });\n return;\n }\n motion.push(m);\n });\n if (!inList) {\n motion.push({\n axisRef: axis.axis_ref,\n relative_position: axis.relative_position ?? null,\n absolute_position: axis.absolute_position ?? null,\n });\n }\n return {\n ...props,\n motion,\n };\n }\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'update_axis') {\n setProperties((p) => {\n return updateAxes(p, value);\n });\n return;\n }\n console.log('TomoFlatMotionSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n console.log(\n 'TomoFlatMotionSimulator: Unsupported setProperty',\n name,\n value\n );\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"tomoflatmotion\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { Button } from 'react-bootstrap';\nimport type { TomoReferencePositionSchema } from '.';\n\nexport default function TomoReferencePositionDefault(\n props: HardwareWidgetProps<TomoReferencePositionSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { actions } = hardware;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoReferencePositionSchema\"\n icon=\"fam-hardware-motor\"\n online={hardware.online}\n />\n );\n\n function moveToReference() {\n void actions.call('move_to_reference');\n }\n\n const widgetState = <></>;\n\n const widgetContent = (\n <Button\n className=\"w-100\"\n onClick={() => {\n moveToReference();\n }}\n disabled={disabled}\n >\n Back to parking position\n </Button>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoReferencePositionDefault from './TomoReferencePositionDefault';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoReferencePositionSchema extends Hardware {\n properties: Record<string, never>;\n}\n\nexport function isTomoReferencePositionHardware(\n entity: Hardware\n): entity is TomoReferencePositionSchema {\n return entity.type === 'tomoreferenceposition';\n}\n\nconst Variants: HardwareVariant<TomoReferencePositionSchema> = {\n default: TomoReferencePositionDefault,\n};\n\nexport default Variants;\n","import { HardwareState } from '../utils/State';\nimport type { TomoDetectorSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoDetectorState(props: { hardware: TomoDetectorSchema }) {\n const { hardware } = props;\n const { online, locked = null } = hardware;\n const state = online\n ? (locked !== null ? 'LOCKED' : hardware.properties.state) || 'UNKNOWN'\n : 'OFFLINE';\n\n const variants: { [state: string]: string } = {\n UNKNOWN: 'danger',\n READY: 'success',\n OFFLINE: 'secondary',\n INVALID: 'danger',\n MOUNTING: 'warning',\n UNMOUNTING: 'warning',\n LOCKED: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoDetectorSchema>\n) {\n const { hardware } = props;\n return <TomoDetectorState hardware={hardware} />;\n}\n","import {\n InputGroup,\n Dropdown,\n Container,\n Row,\n Col,\n ButtonGroup,\n Button,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { TomoDetectorSchema } from '.';\nimport { TomoDetectorState } from './TomoDetectorState';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport Qty from 'js-quantities';\nimport { useMemo } from 'react';\nimport { HardwareInputNumber } from '../..';\n\ninterface TomoDetectorSamplePixelSizeOptions extends HardwareWidgetOptions {\n /* The unit to be used to display the pixel size.\n\n FIXME: If undefined it is actually serialized as `null`. In the future,\n this should be instead converted to `undefined`.\n */\n display_unit?: string | null;\n}\n\n/**\n * Widget to select the mouse mode for the tomo view\n */\nfunction SelectPixelSizeMode(\n props: HardwareWidgetProps<\n TomoDetectorSchema,\n TomoDetectorSamplePixelSizeOptions\n > & { style: { [key: string]: any } }\n) {\n const { hardware, options = {} } = props;\n function requestMode(value: string) {\n if (hardware.actions) {\n void hardware.actions.setProperty('sample_pixel_size_mode', value);\n } else {\n console.error('Change request was triggered with:', value);\n }\n return null;\n }\n const mode = hardware.properties.sample_pixel_size_mode;\n\n return (\n <Dropdown style={props.style}>\n <ButtonGroup>\n <Button\n variant={mode === 'USER' ? 'primary' : 'secondary'}\n onClick={() => {\n requestMode('USER');\n }}\n disabled={props.disabled}\n title=\"Use a fixed pixel size defined by the user\"\n >\n USER\n </Button>\n <Button\n variant={mode === 'AUTO' ? 'primary' : 'secondary'}\n onClick={() => {\n requestMode('AUTO');\n }}\n disabled={props.disabled}\n title=\"Compute the pixel size automatically based on the beamline geometry\"\n >\n AUTO\n </Button>\n </ButtonGroup>\n </Dropdown>\n );\n}\n\nfunction InputUserPixelSize(\n props: HardwareWidgetProps<\n TomoDetectorSchema,\n TomoDetectorSamplePixelSizeOptions\n >\n) {\n const { hardware, options = {} } = props;\n const userSamplePixelSize = hardware.properties.user_sample_pixel_size || 0;\n const { state } = hardware.properties;\n const hardwareReady = state === 'READY';\n\n function requestUserSamplePixelSize(value: number) {\n if (hardware.actions) {\n void hardware.actions.setProperty('user_sample_pixel_size', value);\n } else {\n console.error('Change request was triggered with:', value);\n }\n return null;\n }\n\n return (\n <HardwareInputNumber\n hardwareValue={userSamplePixelSize}\n onMoveRequested={requestUserSamplePixelSize}\n hardwareIsDisabled={false}\n hardwareIsReady={hardwareReady}\n hardwareIsMoving={false}\n readOnly={hardware.properties.sample_pixel_size_mode !== 'USER'}\n />\n );\n}\n\nfunction DropdownPixelSize(\n props: HardwareWidgetProps<\n TomoDetectorSchema,\n TomoDetectorSamplePixelSizeOptions\n >\n) {\n const { hardware, options = {} } = props;\n const hardwareReady = hardware.properties.state === 'READY';\n return (\n <Dropdown>\n <Dropdown.Toggle disabled={props.disabled} variant=\"secondary\" />\n <Dropdown.Menu popperConfig={{ strategy: 'fixed' }}>\n <Container>\n <Row>\n <Col className=\"text-center\">Mode</Col>\n </Row>\n <Row>\n <Col>\n <SelectPixelSizeMode {...props} style={{ width: '100%' }} />\n </Col>\n </Row>\n <Row>\n <Col className=\"text-center mt-1\">User pixel size</Col>\n </Row>\n <Row>\n <Col>\n <InputGroup>\n <InputUserPixelSize {...props} />\n <InputGroup.Text>um</InputGroup.Text>\n </InputGroup>\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nfunction useFormattedQuantity(\n value: number | null,\n unit: string,\n displayUnit: string\n): [string, string] {\n return useMemo(() => {\n function normUnit(u: string): string {\n if (u === 'um') {\n return 'μm';\n }\n return u;\n }\n function normValue(v: number): string {\n return v.toFixed(2).replace(/\\.?0+$/, '');\n }\n if (value === null || value === undefined) {\n return ['∅', ''];\n }\n if (unit === displayUnit) {\n return [normValue(value), normUnit(displayUnit)];\n }\n const q = Qty(value, unit);\n return [normValue(q.to(displayUnit).scalar), normUnit(displayUnit)];\n }, [value, unit, displayUnit]);\n}\n\nexport default function TomoDetectorSamplePixelSize(\n props: HardwareWidgetProps<\n TomoDetectorSchema,\n TomoDetectorSamplePixelSizeOptions\n >\n) {\n const { hardware, options = {} } = props;\n const displayUnit = options.display_unit ?? 'um';\n const widgetIcon = (\n <TypeIcon name=\"TomoDetector\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <TomoDetectorState hardware={hardware} />;\n\n const [formattedValue, unit] = useFormattedQuantity(\n hardware.properties.sample_pixel_size,\n 'um',\n displayUnit\n );\n\n const widgetContent = (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text\n className=\"justify-content-center\"\n style={{ minWidth: '4em' }}\n >\n {hardware.properties.sample_pixel_size_mode}\n </InputGroup.Text>\n <ReadOnlyTextInput\n value={formattedValue}\n title={`${hardware.properties.sample_pixel_size} um`}\n />\n <InputGroup.Text>{unit}</InputGroup.Text>\n <DropdownPixelSize {...props} />\n </InputGroup>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import {\n InputGroup,\n Dropdown,\n Container,\n Row,\n Col,\n ButtonGroup,\n Button,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n HardwareChangeActions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { TomoDetectorSchema } from '.';\nimport { TomoDetectorState } from './TomoDetectorState';\nimport type { LimaSchema } from '../lima';\nimport { isLimaHardware } from '../lima';\nimport { useHardware } from '../../registry/hooks';\nimport { useHardwareChangeActions } from '../../registry/hooks';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport { HardwareInputNumber } from '../..';\n\n/**\n * Widget to select the acquisition mode\n */\nfunction AcquisitionMode(\n props: HardwareWidgetProps<TomoDetectorSchema, HardwareWidgetOptions> &\n HardwareWidgetOptions & { style: { [key: string]: any } }\n) {\n const { hardware, options = {} } = props;\n function requestMode(value: string) {\n if (hardware.actions) {\n void hardware.actions.setProperty('acq_mode', value);\n } else {\n console.error('Change request was triggered with:', value);\n }\n return null;\n }\n const mode = hardware.properties.acq_mode;\n\n return (\n <Dropdown style={props.style}>\n <ButtonGroup>\n <Button\n variant={mode === 'SINGLE' ? 'primary' : 'secondary'}\n onClick={() => {\n requestMode('SINGLE');\n }}\n disabled={props.disabled}\n title=\"Do acquisition in a single shot\"\n >\n SINGLE\n </Button>\n <Button\n variant={mode === 'ACCUMULATION' ? 'primary' : 'secondary'}\n onClick={() => {\n requestMode('ACCUMULATION');\n }}\n disabled={props.disabled}\n title=\"Do acqisition in multiple sub frame with accumulation\"\n >\n ACCU\n </Button>\n </ButtonGroup>\n </Dropdown>\n );\n}\n\nfunction InputAccMaxExpoTime(props: {\n hardware: LimaSchema;\n actions: HardwareChangeActions;\n}) {\n const { hardware, actions } = props;\n const value = hardware.properties.acc_max_expo_time || 0;\n const { state } = hardware.properties;\n const hardwareReady = state === 'READY';\n\n function requestUpdate(value: number) {\n void actions.setProperty('acc_max_expo_time', value);\n return null;\n }\n\n return (\n <HardwareInputNumber\n hardwareValue={value}\n onMoveRequested={requestUpdate}\n hardwareIsDisabled={false}\n hardwareIsReady={hardwareReady}\n hardwareIsMoving={false}\n readOnly={hardware.properties.state !== 'READY'}\n />\n );\n}\n\nfunction useLimaHardware(id: string): LimaSchema | null {\n const lima = useHardware(id);\n if (lima !== null && isLimaHardware(lima)) {\n return lima;\n }\n return null;\n}\n\nfunction DropdownAcquisitionMode(\n props: HardwareWidgetProps<TomoDetectorSchema, HardwareWidgetOptions>\n) {\n const { hardware } = props;\n const { properties } = hardware;\n const limaId = properties.detector?.slice(9) ?? '';\n const lima = useLimaHardware(limaId);\n const limaActions = useHardwareChangeActions(limaId);\n\n return (\n <Dropdown>\n <Dropdown.Toggle disabled={props.disabled} variant=\"secondary\" />\n <Dropdown.Menu popperConfig={{ strategy: 'fixed' }}>\n <Container>\n <Row>\n <Col className=\"text-center\">Acquisition mode</Col>\n </Row>\n <Row>\n <Col>\n <AcquisitionMode {...props} style={{ width: '100%' }} />\n </Col>\n </Row>\n <Row>\n <Col className=\"text-center mt-1\">Max sub frame exposition</Col>\n </Row>\n <Row>\n <Col>\n {lima && (\n <InputGroup>\n <InputAccMaxExpoTime hardware={lima} actions={limaActions} />\n <InputGroup.Text>um</InputGroup.Text>\n </InputGroup>\n )}\n </Col>\n </Row>\n </Container>\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport default function TomoDetectorAcquisitionMode(\n props: HardwareWidgetProps<TomoDetectorSchema, HardwareWidgetOptions>\n) {\n const { hardware } = props;\n const widgetIcon = (\n <TypeIcon name=\"TomoDetector\" icon=\"fa-cog\" online={hardware.online} />\n );\n\n const widgetState = <TomoDetectorState hardware={hardware} />;\n\n const widgetContent = (\n <InputGroup className=\"flex-nowrap\">\n <ReadOnlyTextInput value={hardware.properties.acq_mode} />\n <DropdownAcquisitionMode {...props} />\n </InputGroup>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoDetectorSamplePixelSize from './TomoDetectorSamplePixelSize';\nimport TomoDetectorAcquisitionMode from './TomoDetectorAcquisitionMode';\nimport TomoDetectorState from './TomoDetectorState';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoDetectorSchema extends Hardware {\n properties: {\n state: string;\n user_sample_pixel_size: number | null;\n sample_pixel_size_mode: string;\n sample_pixel_size: number | null;\n field_of_view: number;\n detector: string;\n optic: string;\n source_distance: number | null;\n acq_mode: 'MANUAL' | 'SINGLE' | 'ACCUMULATION';\n };\n}\n\nconst Variants: HardwareVariant<TomoDetectorSchema> = {\n samplepixelsize: TomoDetectorSamplePixelSize,\n acquisitionmode: TomoDetectorAcquisitionMode,\n // Override base state\n state: TomoDetectorState,\n};\n\nexport default Variants;\n\nexport function isTomoDetectorHardware(\n entity: Hardware\n): entity is TomoDetectorSchema {\n return entity.type === 'tomodetector';\n}\n\nexport function useTomoDetectorHardware(\n name: string | null\n): TomoDetectorSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoDetectorHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import defaultjson from './TomoDetector.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { TomoDetectorsSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoDetectorsState(props: { hardware: TomoDetectorsSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n READY: 'success',\n MOUNTING: 'warning',\n UNMOUNTING: 'warning',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoDetectorsSchema>\n) {\n const { hardware } = props;\n return <TomoDetectorsState hardware={hardware} />;\n}\n","import classNames from 'classnames';\nimport { Dropdown, InputGroup } from 'react-bootstrap';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { TomoDetectorsState } from './TomoDetectorsState';\nimport type { TomoDetectorsSchema } from '.';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\n\nfunction getHardwareIdFromRef(ref: string | undefined) {\n if (!ref) {\n return null;\n }\n if (!ref.startsWith('hardware:')) {\n // FIXME: Handle user error, the content is not of hardware kind\n return null;\n }\n return ref.slice(9);\n}\n\nfunction DropdownDetectors(props: HardwareWidgetProps<TomoDetectorsSchema>) {\n const { hardware } = props;\n const { properties } = hardware;\n const { detectors } = properties;\n const activeDetectorId = getHardwareIdFromRef(properties.active_detector);\n const targetDetectorId = getHardwareIdFromRef(properties.target_detector);\n const hardwareReady = properties.state === 'READY';\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n\n function mountDetector(detectorId: string | null) {\n if (hardware.actions) {\n void hardware.actions.call('mount', detectorId);\n } else {\n console.error('Change request was triggered with:', detectorId);\n }\n }\n\n function createSelectableItem(detectorRef: string) {\n const detectorId = getHardwareIdFromRef(detectorRef);\n const selected = detectorId === (targetDetectorId || activeDetectorId);\n const icon = selected ? 'fa fa-fw fa-dot-circle-o' : 'fa fa-fw fa-circle-o';\n\n return (\n <Dropdown.Item\n key={detectorRef}\n disabled={disabled}\n onClick={() => {\n mountDetector(detectorId);\n }}\n >\n <i className={icon} />\n &nbsp; {detectorId}\n </Dropdown.Item>\n );\n }\n\n return (\n <Dropdown>\n <Dropdown.Toggle disabled={disabled} variant=\"secondary\" />\n <Dropdown.Menu popperConfig={{ strategy: 'fixed' }}>\n {detectors.map((m) => createSelectableItem(m))}\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport default function TomoDetectors(\n props: HardwareWidgetProps<TomoDetectorsSchema>\n) {\n const { hardware, options = {} } = props;\n const widgetIcon = (\n <TypeIcon\n name=\"Optic\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoDetectorsState hardware={hardware} />;\n\n const { properties } = hardware;\n const hardwareMounting = properties.state === 'MOUNTING';\n const activeDetectorId = getHardwareIdFromRef(properties.active_detector);\n const targetDetectorId = getHardwareIdFromRef(properties.target_detector);\n\n function getWidgetContent() {\n return (\n <InputGroup>\n <ReadOnlyTextInput\n className={classNames({\n 'hw-moving': hardwareMounting,\n })}\n value={targetDetectorId || activeDetectorId || 'No detector'}\n />\n <DropdownDetectors {...props} />\n </InputGroup>\n );\n }\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={getWidgetContent()}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoDetectors from './TomoDetectors';\nimport TomoDetectorsState from './TomoDetectorsState';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoDetectorsSchema extends Hardware {\n properties: {\n state: string;\n detectors: string[];\n active_detector: string;\n target_detector?: string; // FIXME: The server implementation is missing\n };\n}\n\nconst Variants: HardwareVariant<TomoDetectorsSchema> = {\n default: TomoDetectors,\n // Override base state\n state: TomoDetectorsState,\n};\n\nexport default Variants;\n\nexport function isTomoDetectorsHardware(\n entity: Hardware\n): entity is TomoDetectorsSchema {\n return entity.type === 'tomodetectors';\n}\n\nexport function useTomoDetectorsHardware(\n name: string | null\n): TomoDetectorsSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoDetectorsHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import defaultjson from './TomoDetectors.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { HardwareState } from '../utils/State';\nimport type { TomoImagingSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoImagingState(props: { hardware: TomoImagingSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n READY: 'success',\n BLOCKED: 'secondary',\n ACQUIRING: 'warning',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware } = props;\n return <TomoImagingState hardware={hardware} />;\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { MouseEvent, ChangeEvent, KeyboardEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport {\n Button,\n ButtonGroup,\n InputGroup,\n Container,\n Row,\n Col,\n Form,\n} from 'react-bootstrap';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\n\nfunction UpdateMode(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const updateOnMove = hardware.properties.update_on_move;\n const disabled = props.disabled || !hardware.online;\n\n function setUpdateModeOff(event: MouseEvent) {\n void hardware.actions.setProperty('update_on_move', false);\n }\n\n function setUpdateModeAuto(event: MouseEvent) {\n void hardware.actions.setProperty('update_on_move', true);\n }\n\n return (\n <ButtonGroup className=\"me-2\">\n <InputGroup.Text>Update mode</InputGroup.Text>\n <Button\n onClick={setUpdateModeAuto}\n disabled={disabled}\n variant={updateOnMove ? 'primary' : 'secondary'}\n >\n Auto\n </Button>\n <Button\n onClick={setUpdateModeOff}\n disabled={disabled}\n variant={updateOnMove ? 'secondary' : 'primary'}\n >\n Off\n </Button>\n </ButtonGroup>\n );\n}\n\nfunction ExposureTime(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const exposureTime = hardware.properties.exposure_time ?? 0;\n const disabled = props.disabled || !hardware.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 2;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n void hardware.actions.setProperty(\n 'exposure_time',\n Number.parseFloat(formRef.current.value)\n );\n } else if (e.key === 'Escape') {\n formRef.current.value = exposureTime.toFixed(digits);\n setEdited(false);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== exposureTime && !edited) {\n setEdited(true);\n }\n if (exp === exposureTime && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = exposureTime.toFixed(digits);\n }\n }, [edited, exposureTime]);\n\n return (\n <InputGroup className=\"me-2\">\n <InputGroup.Text>Exposure time</InputGroup.Text>\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={exposureTime.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>s</InputGroup.Text>\n </InputGroup>\n );\n}\n\nfunction TakeActions(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const disabled = props.disabled || !hardware.online;\n\n function takeProj(event: MouseEvent) {\n void hardware.actions.call('take_proj');\n }\n\n function takeDark(event: MouseEvent) {\n void hardware.actions.call('take_dark');\n }\n\n function takeFlat(event: MouseEvent) {\n void hardware.actions.call('take_flat');\n }\n\n return (\n <ButtonGroup size=\"lg\" className=\"me-2\">\n <InputGroup.Text>Take</InputGroup.Text>\n <Button onClick={takeProj} disabled={disabled} variant=\"primary\">\n Proj\n </Button>\n <Button onClick={takeFlat} disabled={disabled} variant=\"primary\">\n Flat\n </Button>\n <Button onClick={takeDark} disabled={disabled} variant=\"primary\">\n Dark\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function TomoImagingDefault(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <Container>\n <Row className=\"mt-1\">\n <Col>\n <UpdateMode hardware={hardware} disabled={props.disabled} />\n </Col>\n </Row>\n <Row className=\"mt-1\">\n <Col>\n <ExposureTime hardware={hardware} disabled={props.disabled} />\n </Col>\n </Row>\n <Row className=\"mt-1\">\n <Col>\n <TakeActions hardware={hardware} disabled={props.disabled} />\n </Col>\n </Row>\n </Container>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { InputGroup, Form } from 'react-bootstrap';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\nimport { useHardware } from '../../registry/hooks';\nimport { limaGuessSubframes, isLimaHardware } from '../lima';\nimport { isTomoDetectorHardware } from '../tomodetector';\n\nfunction ExposureTime(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const exposureTime = hardware.properties.exposure_time ?? 0;\n const disabled = props.disabled || !hardware.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n void hardware.actions.setProperty(\n 'exposure_time',\n Number.parseFloat(formRef.current.value)\n );\n } else if (e.key === 'Escape') {\n formRef.current.value = exposureTime.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== exposureTime && !edited) {\n setEdited(true);\n }\n if (exp === exposureTime && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = exposureTime.toFixed(digits);\n }\n }, [edited, exposureTime]);\n\n return (\n <InputGroup className=\"w-100\">\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={exposureTime.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>s</InputGroup.Text>\n </InputGroup>\n );\n}\n\nfunction AccumulationIfOne(props: { exposureTime: number }) {\n const { exposureTime } = props;\n const hardware = useHardware(\n 'ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector'\n );\n const hardwareTomo = useHardware(\n 'ACTIVE_TOMOCONFIG.ref.detectors.active_detector'\n );\n if (hardware === null || hardwareTomo === null) {\n return <></>;\n }\n if (!isLimaHardware(hardware) || !isTomoDetectorHardware(hardwareTomo)) {\n return <></>;\n }\n const accMaxExpoTime = hardware.properties.acc_max_expo_time;\n const acqMode = hardwareTomo.properties.acq_mode;\n if (!accMaxExpoTime || acqMode !== 'ACCUMULATION') {\n return <></>;\n }\n const [nbSubFrames, accExpoTime] = limaGuessSubframes(\n exposureTime,\n accMaxExpoTime\n );\n return (\n <div className=\"text-center\" title=\"Decompisiton of the accumulation\">\n {nbSubFrames} × {accExpoTime.toFixed(3)}\n </div>\n );\n}\n\nexport default function TomoImagingExposureTime(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <>\n <ExposureTime hardware={hardware} disabled={props.disabled} />\n <AccumulationIfOne exposureTime={hardware.properties.exposure_time} />\n </>\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { InputGroup, Form } from 'react-bootstrap';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\n\nfunction SettleTime(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const settleTime = hardware.properties.settle_time || 0;\n const disabled = props.disabled || !hardware.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n void hardware.actions.setProperty(\n 'settle_time',\n Number.parseFloat(formRef.current.value)\n );\n } else if (e.key === 'Escape') {\n formRef.current.value = settleTime.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== settleTime && !edited) {\n setEdited(true);\n }\n if (exp === settleTime && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = settleTime.toFixed(digits);\n }\n }, [edited, settleTime]);\n\n return (\n <InputGroup className=\"w-100\">\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={settleTime.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>s</InputGroup.Text>\n </InputGroup>\n );\n}\n\nexport default function TomoImagingSettleTime(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <SettleTime hardware={hardware} disabled={props.disabled} />\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import { useState } from 'react';\nimport type { MouseEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { Button, ButtonGroup } from 'react-bootstrap';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\nimport classNames from 'classnames';\n\n/**\n * Button with an active icon during a processing.\n *\n * The implementation aim to have a fixed width with or without\n * the processing.\n */\nfunction ProcessingButton(props: {\n text: string;\n processing: boolean;\n disabled: boolean;\n onClick: (event: MouseEvent) => void;\n title?: string;\n}) {\n const { text, processing, disabled, onClick, title } = props;\n return (\n <Button\n onClick={onClick}\n disabled={disabled}\n variant=\"primary\"\n className={classNames({ 'ps-4': !processing, 'pe-4': !processing })}\n title={title}\n >\n {processing && <i className=\"fa-solid fa-cog fa-spin me-1\" />}\n {text}\n </Button>\n );\n}\n\nfunction TakeActions(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const [doDark, setDoDark] = useState(false);\n const [doFlat, setDoFlat] = useState(false);\n const [doProj, setDoProj] = useState(false);\n const disabled =\n props.disabled || !hardware.online || doDark || doFlat || doProj;\n\n function takeProj(event: MouseEvent) {\n setDoProj(true);\n hardware.actions.call('take_proj').finally(() => {\n setDoProj(false);\n });\n }\n\n function takeDark(event: MouseEvent) {\n setDoDark(true);\n void hardware.actions.call('take_dark').finally(() => {\n setDoDark(false);\n });\n }\n\n function takeFlat(event: MouseEvent) {\n setDoFlat(true);\n void hardware.actions.call('take_flat').finally(() => {\n setDoFlat(false);\n });\n }\n\n return (\n <ButtonGroup size=\"lg\" className=\"w-100\">\n <ProcessingButton\n onClick={takeProj}\n disabled={disabled}\n processing={doProj}\n text=\"Proj\"\n title=\"Take a projection\"\n />\n <ProcessingButton\n onClick={takeFlat}\n disabled={disabled}\n processing={doFlat}\n text=\"Flat\"\n title=\"Take a flat\"\n />\n <ProcessingButton\n onClick={takeDark}\n disabled={disabled}\n processing={doDark}\n text=\"Dark\"\n title=\"Take a dark\"\n />\n </ButtonGroup>\n );\n}\n\nexport default function TomoImagingActions(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <TakeActions hardware={hardware} disabled={props.disabled} />\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { MouseEvent } from 'react';\nimport { Button, ButtonGroup } from 'react-bootstrap';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { TomoImagingState } from './TomoImagingState';\nimport type { TomoImagingSchema } from '.';\n\nfunction UpdateMode(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const updateOnMove = hardware.properties.update_on_move;\n const disabled = props.disabled || !hardware.online;\n\n function setUpdateModeOff(event: MouseEvent) {\n void hardware.actions.setProperty('update_on_move', false);\n }\n\n function setUpdateModeAuto(event: MouseEvent) {\n void hardware.actions.setProperty('update_on_move', true);\n }\n\n return (\n <ButtonGroup className=\"w-100\">\n <Button\n onClick={setUpdateModeAuto}\n disabled={disabled}\n variant={updateOnMove ? 'primary' : 'secondary'}\n >\n Auto\n </Button>\n <Button\n onClick={setUpdateModeOff}\n disabled={disabled}\n variant={updateOnMove ? 'secondary' : 'primary'}\n >\n Off\n </Button>\n </ButtonGroup>\n );\n}\n\nexport default function TomoImagingUpdateMode(\n props: HardwareWidgetProps<TomoImagingSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <TomoImagingState hardware={hardware} />;\n\n const widgetContent = (\n <UpdateMode hardware={hardware} disabled={props.disabled} />\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoImagingDefault from './TomoImagingDefault';\nimport TomoImagingExposureTime from './TomoImagingExposureTime';\nimport TomoImagingSettleTime from './TomoImagingSettleTime';\nimport TomoImagingActions from './TomoImagingActions';\nimport TomoImagingUpdateMode from './TomoImagingUpdateMode';\nimport TomoImagingState from './TomoImagingState';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoImagingSchema extends Hardware {\n properties: {\n state: string;\n update_on_move: boolean;\n exposure_time: number;\n settle_time: number;\n };\n}\n\nconst Variants: HardwareVariant<TomoImagingSchema> = {\n default: TomoImagingDefault,\n exposuretime: TomoImagingExposureTime,\n settletime: TomoImagingSettleTime,\n actions: TomoImagingActions,\n updatemode: TomoImagingUpdateMode,\n // Override base state\n state: TomoImagingState,\n};\n\nexport default Variants;\n","import defaultjson from './TomoImaging.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function TomoImagingSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [properties, setProperties] = useState({\n state: 'READY',\n update_on_move: true,\n exposure_time: 1,\n settle_time: 0,\n });\n\n function setState(state: string) {\n setProperties((p) => {\n return { ...p, state };\n });\n }\n\n async function call(name: string, value?: any): Promise<void> {\n if (name === 'take_dark') {\n setState('ACQUIRING');\n await delay(2000);\n setState('READY');\n return;\n }\n if (name === 'take_flat') {\n setState('ACQUIRING');\n await delay(2000);\n setState('READY');\n return;\n }\n if (name === 'take_proj') {\n setState('ACQUIRING');\n await delay(2000);\n setState('READY');\n return;\n }\n console.log('TomoImagingSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n setProperties((p) => {\n return { ...p, [name]: value };\n });\n }\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"tomoimaging\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoSampleStageSchema extends Hardware {\n properties: {\n sx: string;\n sy: string;\n sz: string;\n somega: string;\n sampx: string;\n sampy: string;\n sampu: string;\n sampv: string;\n x_axis_focal_pos: number | null;\n detector_center: [number | null, number | null];\n };\n}\n\nconst Variants: HardwareVariant<TomoSampleStageSchema> = {};\n\nexport default Variants;\n\nexport function isTomoSampleStageHardware(\n entity: Hardware\n): entity is TomoSampleStageSchema {\n return entity.type === 'tomosamplestage';\n}\n\nexport function useTomoSampleStageHardware(\n name: string | null\n): TomoSampleStageSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoSampleStageHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import { useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, KeyboardEvent } from 'react';\nimport type { HardwareWidgetProps, EditableHardware } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { InputGroup, Form } from 'react-bootstrap';\nimport type { TomoConfigSchema } from '.';\n\nfunction LatencyTime(props: {\n hardware: EditableHardware<TomoConfigSchema>;\n disabled: boolean;\n}) {\n const { hardware } = props;\n const valueFromHardware = hardware.properties.latency_time || 0;\n const disabled = props.disabled || !hardware.online;\n\n const formRef = useRef<HTMLInputElement>(null);\n const [edited, setEdited] = useState(false);\n const digits = 3;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (e.key === 'Enter') {\n setEdited(false);\n void hardware.actions.setProperty('latency_time', formRef.current.value);\n } else if (e.key === 'Escape') {\n formRef.current.value = valueFromHardware.toFixed(digits);\n setEdited(false);\n } else {\n console.log(e.key);\n }\n }\n\n function onChange(event: ChangeEvent<HTMLInputElement>) {\n const { value } = event.target;\n if (value === undefined) {\n return;\n }\n const exp = Number.parseFloat(value);\n if (exp !== valueFromHardware && !edited) {\n setEdited(true);\n }\n if (exp === valueFromHardware && edited) {\n setEdited(false);\n }\n }\n\n useEffect(() => {\n if (!formRef || !formRef.current) {\n console.log('formRef not yet defined');\n } else if (!edited) {\n formRef.current.value = valueFromHardware.toFixed(digits);\n }\n }, [edited, valueFromHardware]);\n\n return (\n <InputGroup className=\"w-100\">\n <Form.Control\n className={edited ? 'form-control-edited' : ''}\n type=\"number\"\n ref={formRef}\n defaultValue={valueFromHardware.toFixed(digits)}\n onChange={onChange}\n disabled={disabled}\n onKeyDown={onKeyDown}\n />\n <InputGroup.Text>s</InputGroup.Text>\n </InputGroup>\n );\n}\n\nexport default function TomoConfigLatencyTime(\n props: HardwareWidgetProps<TomoConfigSchema>\n) {\n const { hardware, options = {} } = props;\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoImaging\"\n icon=\"fam-hardware-camera\"\n online={hardware.online}\n />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <LatencyTime hardware={hardware} disabled={props.disabled} />\n );\n\n const headerMode = options.header || 'top';\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport TomoConfigLatencyTime from './LatencyTime';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoConfigSchema extends Hardware {\n properties: {\n sample_stage: string;\n sxbeam: string;\n detectors: string;\n holotomo: string;\n latency_time: number;\n };\n}\n\nconst Variants: HardwareVariant<TomoConfigSchema> = {\n latencytime: TomoConfigLatencyTime,\n};\n\nexport default Variants;\n\nexport function isTomoConfigHardware(\n entity: Hardware\n): entity is TomoConfigSchema {\n return entity.type === 'tomoconfig';\n}\n\nexport function useTomoConfigHardware(\n name: string | null\n): TomoConfigSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoConfigHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import { HardwareState } from '../utils/State';\nimport type { TomoHoloSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function TomoHoloState(props: { hardware: TomoHoloSchema }) {\n const { hardware } = props;\n const state = hardware.online ? hardware.properties.state : 'OFFLINE';\n const variants: { [state: string]: string } = {\n READY: 'success',\n MOVING: 'warning',\n STABILIZING: 'warning',\n INVALID: 'danger',\n INVALID_DETECTOR_BINNING_CHANGED: 'danger',\n INVALID_DETECTOR_DISTANCE_CHANGED: 'danger',\n INVALID_DETECTOR_CHANGED: 'danger',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <HardwareState state={state} minWidth={6} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<TomoHoloSchema>\n) {\n const { hardware } = props;\n return <TomoHoloState hardware={hardware} />;\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport { useHardware } from '../../registry/hooks';\nimport TomoHoloState from './TomoHoloState';\n\nexport interface TomoHoloDistance {\n z1: number;\n position: number;\n pixel_size: number;\n}\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface TomoHoloSchema extends Hardware {\n properties: {\n state: string;\n settle_time: number;\n pixel_size: number | null;\n nb_distances: number;\n distances: TomoHoloDistance[];\n };\n}\n\nconst Variants: HardwareVariant<TomoHoloSchema> = {\n // Override base state\n state: TomoHoloState,\n};\n\nexport default Variants;\n\nexport function isTomoHoloHardware(entity: Hardware): entity is TomoHoloSchema {\n return entity.type === 'tomoholo';\n}\n\nexport function useTomoHoloHardware(\n name: string | null\n): TomoHoloSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isTomoHoloHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import {\n Badge,\n Button,\n ButtonGroup,\n OverlayTrigger,\n Popover,\n} from 'react-bootstrap';\nimport type {\n HardwareWidgetProps,\n HardwareWidgetOptions,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { ValveSchema } from '.';\n\nfunction ValveOverlay(props: HardwareWidgetProps<ValveSchema>) {\n const { hardware } = props;\n const reset = () => {\n void hardware.actions.call('reset');\n };\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n rootClose\n overlay={\n <Popover id=\"popover\">\n <Popover.Header>{hardware.name} Details</Popover.Header>\n <Popover.Body>\n <h6>Status</h6>\n <pre>{hardware.properties.status}</pre>\n <div className=\"d-grid gap-2\">\n <Button disabled={props.disabled} onClick={reset}>\n Reset\n </Button>\n </div>\n </Popover.Body>\n </Popover>\n }\n >\n <Button className=\"flex-grow-0\" title=\"Valve Details\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Valve(props: HardwareWidgetProps<ValveSchema>) {\n const { hardware, options = {} } = props;\n const onClick = () => {\n void hardware.actions.call(\n hardware.properties.state === 'OPEN' ? 'close' : 'open'\n );\n };\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Valve\"\n icon=\"fam-hardware-valve\"\n online={hardware.online}\n />\n <div className=\"name\">{hardware.name}</div>\n <Badge\n bg={\n hardware.properties.state === 'OPEN' ||\n hardware.properties.state === 'RUNNING'\n ? 'success'\n : 'danger'\n }\n >\n {hardware.properties.state}\n </Badge>\n </div>\n <div className=\"hw-content\">\n <ButtonGroup className=\"d-flex\">\n <Button\n variant={\n hardware.properties.state === 'OPEN' ? 'danger' : 'success'\n }\n onClick={onClick}\n disabled={props.disabled}\n >\n {hardware.properties.state === 'OPEN' ? 'Close' : 'Open'}\n </Button>\n <ValveOverlay {...props} />\n </ButtonGroup>\n </div>\n </div>\n );\n}\n\nexport default Valve;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Valve from './Valve';\n\n/**\n * Hardware as exposed by Redux\n */\nexport interface ValveSchema extends Hardware {\n properties: {\n state: string;\n status: string;\n };\n}\n\nconst Variants: HardwareVariant<ValveSchema> = {\n default: Valve,\n};\n\nexport default Variants;\n","import defaultjson from './Valve.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import debug from 'debug';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\n\nconst logger = debug('daiquiri.components.hardware.NoObject');\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function NoObject(props: NoObjectProps) {\n if (props.options.emptyifnone) {\n logger(\n 'Component id:\"%s\" name:\"%s\" not displayed cause setup with emptyifnone.',\n props.id,\n props.name\n );\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <span title={`Object '${props.name}' is missing`}>Missing</span>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n };\n}\n\nexport default function LoadingObject(props: NoObjectProps) {\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <span title={`Object '${props.name}' is loading`}>\n <i className=\"fa-solid fa-spinner fa-spin-pulse\" />\n </span>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import debug from 'debug';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\n\nconst logger = debug('daiquiri.components.hardware.MissingObject');\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function MissingObject(props: NoObjectProps) {\n if (props.options.emptyifnone) {\n logger(\n 'Component id:\"%s\" name:\"%s\" not displayed cause setup with emptyifnone.',\n props.id,\n props.name\n );\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <span title={`Object '${props.name}' is missing`}>Missing</span>\n );\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\nimport { Button, OverlayTrigger, Popover } from 'react-bootstrap';\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n properties?: { message?: string };\n options: {\n header?: string;\n };\n}\n\nexport default function ErrorObject(props: NoObjectProps) {\n const { properties = {} } = props;\n const { message = 'Unknown error' } = properties;\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <OverlayTrigger\n trigger={['focus', 'hover']}\n placement=\"bottom\"\n rootClose\n overlay={\n <Popover id=\"error\" style={{ maxWidth: 500 }}>\n <Popover.Header>Error</Popover.Header>\n <Popover.Body>\n <ul>\n <li>{message}</li>\n </ul>\n </Popover.Body>\n </Popover>\n }\n >\n <Button variant=\"danger\" size=\"sm\" className=\"w-100\">\n <i className=\"fa fa-exclamation-triangle\" /> Error\n </Button>\n </OverlayTrigger>\n );\n\n <span title={`${message}`}>Error</span>;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import debug from 'debug';\n\nimport TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\nimport { Button, OverlayTrigger, Popover } from 'react-bootstrap';\n\nconst logger = debug('daiquiri.components.hardware.MissingComponentObject');\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n type?: string;\n options: {\n variant?: string;\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function MissingComponentObject(props: NoObjectProps) {\n const { options } = props;\n const { variant = 'default' } = options;\n if (options.emptyifnone) {\n logger(\n 'Component id:\"%s\" name:\"%s\" not displayed cause setup with emptyifnone.',\n props.id,\n props.name\n );\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = (\n <OverlayTrigger\n trigger={['focus', 'hover']}\n placement=\"bottom\"\n rootClose\n overlay={\n <Popover id=\"error\" style={{ maxWidth: 500 }}>\n <Popover.Header>Error</Popover.Header>\n <Popover.Body>\n <ul>\n <li>\n No component available for object id '{props.name}' (type '\n {props.type}' and/or variant '{variant}' are not registred)\n </li>\n </ul>\n </Popover.Body>\n </Popover>\n }\n >\n <Button variant=\"danger\" size=\"sm\" className=\"w-100\">\n <i className=\"fa fa-exclamation-triangle\" /> Error\n </Button>\n </OverlayTrigger>\n );\n\n const headerMode = options ? options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import TypeIcon from './TypeIcon';\nimport HardwareTemplate from './HardwareTemplate';\nimport type { Hardware } from './types';\n\ninterface NoObjectProps {\n id: string;\n name?: string;\n options: {\n header?: string;\n emptyifnone?: boolean;\n };\n}\n\nexport default function NoObject(props: NoObjectProps) {\n if (props.options.emptyifnone) {\n return <></>;\n }\n\n const widgetIcon = (\n <TypeIcon name=\"NoObject\" icon=\"fam-hardware-any\" online={false} />\n );\n\n const widgetState = <></>;\n\n const widgetContent = <></>;\n\n const headerMode = props.options ? props.options.header : 'top';\n\n const hardware: Hardware = {\n id: props.id,\n name: props.name ?? '',\n alias: null,\n user_tags: [],\n online: false,\n locked: null,\n properties: {},\n type: '',\n };\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={widgetContent}\n headerMode={headerMode}\n />\n );\n}\n","import type { PropsWithChildren } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\ninterface Props {\n className?: string;\n}\n\nexport default function FullSizer(props: PropsWithChildren<Props>) {\n const [state, setState] = useState<Record<string, number>>({});\n const containerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (containerRef.current) {\n const view = containerRef.current;\n setState({\n width: view.clientWidth,\n height: view.clientHeight,\n });\n }\n }, []);\n\n return (\n <div\n ref={containerRef}\n style={{ width: '100%', height: '100%' }}\n className={props.className}\n >\n {state.width > 0 && (\n <div\n className=\"full-sizer\"\n style={{\n width: `${state.width}px`,\n height: `${state.height}px`,\n overflow: 'scroll',\n }}\n >\n {props.children}\n </div>\n )}\n </div>\n );\n}\n","import type { PropsWithChildren } from 'react';\nimport { Fragment } from 'react';\nimport FullSizer from '../components/FullSizer';\n\nfunction PanelHeader(\n props: PropsWithChildren<{\n style?: Record<string, any>;\n }>\n) {\n return (\n <div className=\"panel-header\" style={props.style}>\n {props.children}\n </div>\n );\n}\n\nfunction PanelContents(\n props: PropsWithChildren<{\n style?: Record<string, any>;\n className?: string;\n }>\n) {\n return (\n <div className={`panel-contents ${props.className}`} style={props.style}>\n {props.children}\n </div>\n );\n}\n\ninterface Props {\n style?: Record<string, any>;\n scroll?: boolean;\n className?: string;\n}\n\nfunction Panel(props: PropsWithChildren<Props>) {\n const Wrap = props.scroll ? FullSizer : Fragment;\n\n return (\n <div className={`panel ${props.className ?? ''}`} style={props.style}>\n <Wrap>{props.children}</Wrap>\n </div>\n );\n}\n\nPanel.Header = PanelHeader;\nPanel.Contents = PanelContents;\n\nexport default Panel;\n","import { Children, cloneElement, isValidElement } from 'react';\nimport type { PropsWithChildren } from 'react';\nimport Panel from '../layout/Panel';\nimport type { AnyYamlNode, YamlNode, YamlRoot } from './model';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlWrapperMap: Record<string, React.ComponentType<any>> = {};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerYamlType(\n name: string,\n component: React.ComponentType<any>\n) {\n yamlWrapperMap[name] = component;\n}\n\n/**\n * Render a Yaml node using registred component from the node type\n */\nexport function renderYamlNode(\n yamlNode: AnyYamlNode,\n key: number | string,\n panel = true\n) {\n // Allow null nodes to be ignored (useful for templating)\n if (!yamlNode) return <></>;\n const { type } = yamlNode;\n const Comp =\n type && type in yamlWrapperMap\n ? yamlWrapperMap[type]\n : yamlWrapperMap.component;\n return <Comp yamlNode={yamlNode} key={key} panel={panel} />;\n}\n\ninterface OptionalPanelProps {\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n panel: boolean;\n key?: number | string;\n}\n\n/**\n * Wrap the children into a panel if it is requested by the options\n */\nexport function OptionalPanel({\n children,\n key,\n panel,\n options,\n}: PropsWithChildren<OptionalPanelProps>) {\n return panel ? (\n <Panel key={key} style={options.style} scroll={options.scroll}>\n <Panel.Contents>{children}</Panel.Contents>\n </Panel>\n ) : (\n <>\n {Children.map(children, (child: React.ReactNode) =>\n isValidElement(child)\n ? cloneElement(child, { key, ...child.props })\n : undefined\n )}\n </>\n );\n}\n\nexport function assertOnRemainingKeys(\n yamlNode: YamlNode | undefined,\n remainingContent: Record<string, any>\n) {\n const { _parentNode, _indexFromParent, ...remainingContent2 } =\n remainingContent;\n if (yamlNode) {\n if (Object.keys(remainingContent2).length > 0) {\n throw new UnknownKeysError(yamlNode, Object.keys(remainingContent2));\n }\n }\n}\n\nexport class LayoutError extends Error {\n public readonly yamlNode: YamlNode;\n public constructor(message: string, yamlNode: YamlNode) {\n super(message);\n this.yamlNode = yamlNode;\n }\n}\n\nexport class UnknownKeysError extends LayoutError {\n public readonly keys: string[];\n public constructor(yamlNode: YamlNode, unknownKeys: string[]) {\n super(`Unexpected keys: ${unknownKeys.join(', ')}`, yamlNode);\n this.keys = unknownKeys;\n }\n}\n\nexport class MissingKeysError extends LayoutError {\n public readonly keys: string[];\n public constructor(yamlNode: YamlNode, missingKeys: string[]) {\n super(`Keys ${missingKeys.join(', ')} are missing`, yamlNode);\n this.keys = missingKeys;\n }\n}\n\nexport class KeyError extends LayoutError {\n public readonly key: string;\n public readonly keyMessage: string;\n public constructor(yamlNode: YamlNode, key: string, message: string) {\n super(`Key ${key} error: ${message}`, yamlNode);\n this.key = key;\n this.keyMessage = message;\n }\n}\n\n/**\n * Returns the root of the YamlNode\n */\nexport function getYamlRoot(node: YamlNode): YamlRoot {\n let n = node;\n while (n._parentNode) {\n n = n._parentNode;\n }\n return n as YamlRoot;\n}\n\n/**\n * Returns a list of nodes from the root to this node.\n */\nexport function getYamlHierarchy(\n node: YamlNode\n): { node: YamlNode; indexFromParent: number | null }[] {\n const path: { node: YamlNode; indexFromParent: number | null }[] = [];\n let n: YamlNode | null = node;\n while (n) {\n path.push({\n node: n,\n indexFromParent: n._indexFromParent,\n });\n n = n._parentNode;\n }\n path.reverse();\n return path;\n}\n\n/**\n * Create links between layout node in order to simplify further processing\n * (mainly error handling).\n */\nexport function normalizeLayout<R extends YamlNode>(\n node: R,\n parentNode: YamlNode | null = null,\n indexFromParent: number | null = null\n): R {\n if (node._parentNode) {\n throw new Error(\n 'Attribute _parentNode was already defined by the yml layout.'\n );\n }\n const newNode = {\n ...node,\n _parentNode: parentNode,\n _indexFromParent: indexFromParent,\n };\n if (node.children) {\n // NOTE: use a map from a real array\n const children = [...node.children];\n Object.freeze(children);\n newNode.children = children.map((c, i) => normalizeLayout(c, newNode, i));\n }\n Object.freeze(newNode);\n return newNode;\n}\n","import type { YamlNode } from '../model';\nimport { KeyError, MissingKeysError, UnknownKeysError } from '../utils';\n\ntype Defined<T> = T extends undefined ? never : T;\n\nexport function assertKeyExpected<T>(\n yamlNode: YamlNode | undefined,\n key: string,\n value: T\n): asserts value is Defined<T> {\n if (yamlNode) {\n if (value === undefined) {\n throw new MissingKeysError(yamlNode, [key]);\n }\n }\n}\n\nexport function assertString(\n yamlNode: YamlNode,\n key: string,\n value: any\n): asserts value is string {\n if (typeof value !== 'string') {\n throw new KeyError(yamlNode, key, 'A string is expected');\n }\n}\n\nexport function assertBoolean(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is boolean {\n if (typeof value !== 'boolean') {\n throw new KeyError(yamlNode, key, 'A boolean is expected');\n }\n}\n\nexport function assertNumber(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number {\n if (typeof value !== 'number') {\n throw new KeyError(yamlNode, key, 'A number is expected');\n }\n}\n\nexport function assertOptionalBoolean(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is boolean | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'boolean') {\n throw new KeyError(yamlNode, key, 'An optional boolean is expected');\n }\n}\n\nexport function assertOptionalString(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'string') {\n throw new KeyError(yamlNode, key, 'An optional string is expected');\n }\n}\n\nexport function assertStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] {\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'A list of string is expected');\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(yamlNode, key, 'A list of string is expected');\n }\n });\n}\n\nexport function assertOptionalStringOrStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string | string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value === 'string') {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional string or list of string is expected'\n );\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional string or list of string is expected'\n );\n }\n });\n}\n\nexport function assertOptionalStringList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'An optional list of string is expected');\n }\n value.forEach((v) => {\n if (typeof v !== 'string') {\n throw new KeyError(\n yamlNode,\n key,\n 'A optional list of string is expected'\n );\n }\n });\n}\n\nexport function assertOptionalNumber(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number | undefined {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'number') {\n throw new KeyError(yamlNode, key, 'An optional number is expected');\n }\n}\n\nexport function assertOptionalNumberList(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is string[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional list of numbers is expected'\n );\n }\n value.forEach((v) => {\n if (typeof v !== 'number') {\n throw new KeyError(\n yamlNode,\n key,\n 'An optional list of numbers is expected'\n );\n }\n });\n}\n\nexport function assertNoUnknownKeys(\n yamlNode: YamlNode | undefined,\n remainingContent: Record<string, any>\n) {\n const { _parentNode, _indexFromParent, ...remainingContent2 } =\n remainingContent;\n if (yamlNode) {\n if (Object.keys(remainingContent2).length > 0) {\n throw new UnknownKeysError(yamlNode, Object.keys(remainingContent2));\n }\n }\n}\n\nexport function assertDataCollectionId(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is number | 'last' {\n if (value === 'last') {\n return;\n }\n if (typeof value === 'number') {\n return;\n }\n throw new KeyError(yamlNode, key, '\"last\" or a number is expected');\n}\n\nexport function assertOptionalBackend(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is 'plotly' | 'h5web' | undefined {\n if (value === undefined) {\n return;\n }\n if (value === 'h5web') {\n return;\n }\n if (value === 'plotly') {\n return;\n }\n throw new KeyError(yamlNode, key, '\"h5web\" or \"plotly\" string is expected');\n}\n","import type { YamlComponent } from '@esrf/daiquiri-lib';\nimport { Alert } from 'react-bootstrap';\nimport { assertOptionalString, assertNoUnknownKeys } from './asserts';\n\nexport default function Yaml(props: YamlComponent) {\n const { providers = {}, yamlNode, message, ...unknownOptions } = props;\n assertOptionalString(yamlNode, 'message', message);\n assertNoUnknownKeys(yamlNode, unknownOptions);\n\n return (\n <Alert variant=\"warning\" className=\"mb-0\">\n {message ?? 'TODO'}\n </Alert>\n );\n}\n","import type { YamlComponent } from '@esrf/daiquiri-lib';\n\nexport default function Yaml(props: YamlComponent) {\n return <></>;\n}\n","import type { PropsWithChildren } from 'react';\nimport React, { Component } from 'react';\nimport { Container, Alert, Button } from 'react-bootstrap';\nimport {\n KeyError,\n MissingKeysError,\n UnknownKeysError,\n getYamlHierarchy,\n getYamlRoot,\n LayoutError,\n} from './utils';\n\nfunction DefaultErrorMessage(props: {\n message: string;\n error: Error | undefined;\n}) {\n return (\n <Alert variant=\"danger\">\n {props.message}\n <br />\n <pre>{props.error?.stack}</pre>\n </Alert>\n );\n}\n\nfunction LayoutErrorMessage(props: {\n message: string;\n error: Error | undefined;\n}) {\n const { error } = props;\n if (!(error instanceof LayoutError)) {\n return <></>;\n }\n function formatPreview(\n error: MissingKeysError | UnknownKeysError | KeyError,\n indent = 3\n ) {\n const path = getYamlHierarchy(error.yamlNode);\n const lines: string[] = [];\n let actualIndentation = '';\n for (let i = 1; i < path.length; i++) {\n const { node, indexFromParent } = path[i];\n lines.push(`${actualIndentation}children:`);\n actualIndentation += ' '.repeat(indent);\n if (indexFromParent === 1) {\n lines.push(`${actualIndentation}- type: ...`);\n } else if (indexFromParent ?? 0 > 1) {\n lines.push(\n `${actualIndentation}...`,\n `${actualIndentation}...`,\n `${actualIndentation}# children number ${indexFromParent ?? 0 + 1}`\n );\n }\n lines.push(`${actualIndentation}- type: ${node.type}`);\n actualIndentation += ' '.repeat(2);\n }\n if (error instanceof UnknownKeysError) {\n error.keys.forEach((k) => {\n lines.push(\n `${actualIndentation}${k}: ... ${' '.repeat(\n 50 - actualIndentation.length - k.length\n )}<-- unexpected key`\n );\n });\n } else if (error instanceof MissingKeysError) {\n error.keys.forEach((k) => {\n lines.push(\n `${actualIndentation}???: ${' '.repeat(\n 50 - actualIndentation.length - k.length\n )}<-- key **${k}** is expected`\n );\n });\n } else if (error instanceof KeyError) {\n lines.push(\n `${actualIndentation}${error.key}: ${' '.repeat(\n 50 - actualIndentation.length - error.key.length\n )}<-- ${error.keyMessage}`\n );\n }\n return lines.join('\\n');\n }\n const layoutRoot = getYamlRoot(error.yamlNode);\n const layoutName = layoutRoot.name;\n\n if (error instanceof UnknownKeysError) {\n const key = error.keys.length === 1 ? 'key' : 'keys';\n return (\n <Alert variant=\"danger\">\n Unexpected {key}{' '}\n {error.keys.map((k, i) => {\n return (\n <>\n {i !== 0 && ', '}\n <b>{k}</b>\n </>\n );\n })}{' '}\n from the layout name <b>{layoutName}</b>.\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n if (error instanceof MissingKeysError) {\n const key = error.keys.length === 1 ? 'Key' : 'Keys';\n return (\n <Alert variant=\"danger\">\n Expected {key}{' '}\n {error.keys.map((k, i) => {\n return (\n <>\n {i !== 0 && ', '}\n <b>{k}</b>\n </>\n );\n })}{' '}\n from the layout name <b>{layoutName}</b>.\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n if (error instanceof KeyError) {\n return (\n <Alert variant=\"danger\">\n Error on key <b>{error.key}</b> from the layout name <b>{layoutName}</b>\n .\n <br />\n <pre className=\"mt-3\">{formatPreview(error)}</pre>\n <br />\n </Alert>\n );\n }\n return <DefaultErrorMessage {...props} />;\n}\n\ninterface State {\n hasError: boolean;\n message: string;\n error?: Error;\n}\n\ninterface Props {\n resetKey?: any;\n unhandledComponentDidCatch?: (\n error: Error,\n setStateCallback: (data: Record<string, any>) => void\n ) => void;\n UnhandledErrorComponent?: React.ComponentType<any>;\n}\n\nconst INITIAL_STATE = {\n hasError: false,\n message: '',\n error: undefined,\n};\n\nexport default class ErrorBoundary extends Component<\n PropsWithChildren<Props>,\n State\n> {\n public constructor(props: Props) {\n super(props);\n this.state = INITIAL_STATE;\n }\n\n public static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n private readonly reload = () => {\n window.location.reload();\n };\n\n public componentDidCatch(error: Error) {\n if (\n error instanceof LayoutError ||\n !this.props.unhandledComponentDidCatch\n ) {\n this.setState({\n hasError: true,\n message: error.message,\n error,\n });\n return;\n }\n\n this.props.unhandledComponentDidCatch?.(error, (data) => {\n this.setState({\n hasError: true,\n message: error.message,\n error,\n ...data,\n });\n });\n }\n\n // https://github.com/bvaughn/react-error-boundary/blob/23a4d779744f3079dfe0960acaa4bdfd5dede87b/src/ErrorBoundary.ts#L53\n public componentDidUpdate(prevProps: Props, prevState: State) {\n if (\n this.state.hasError &&\n prevState.error !== undefined &&\n prevProps.resetKey !== this.props.resetKey\n ) {\n this.setState(INITIAL_STATE);\n }\n }\n\n public render() {\n if (this.state.hasError) {\n const { UnhandledErrorComponent } = this.props;\n const { hasError, ...props } = this.state;\n return (\n <Container className=\"mt-2\">\n <h4>Something went wrong</h4>\n {this.state.error instanceof LayoutError && (\n <LayoutErrorMessage\n message={this.state.message}\n error={this.state.error}\n />\n )}\n {!(this.state.error instanceof LayoutError) && (\n <>\n {UnhandledErrorComponent ? (\n <UnhandledErrorComponent {...props} />\n ) : (\n <DefaultErrorMessage\n message={this.state.message}\n error={this.state.error}\n />\n )}\n </>\n )}\n <p>\n This error has been logged. Please{' '}\n <Button size=\"sm\" onClick={this.reload}>\n <i className=\"fa fa-refresh\" /> Reload\n </Button>{' '}\n the application\n </p>\n </Container>\n );\n }\n return this.props.children;\n }\n}\n","import { map } from 'lodash';\nimport { Row } from 'react-bootstrap';\nimport { renderYamlNode } from './utils';\nimport { assertNoUnknownKeys } from './components/asserts';\nimport type { AnyYamlNode } from './model';\n\ninterface Props {\n yamlNode: AnyYamlNode;\n panel: boolean;\n}\n\nexport default function YamlRow({ yamlNode, panel }: Props) {\n const { type, style, children, ...unknownOptions } = yamlNode;\n assertNoUnknownKeys(yamlNode, unknownOptions);\n return (\n <Row className=\"ymllayout-row gx-0\" style={style}>\n {map(children, (node, key) => renderYamlNode(node, key, panel))}\n </Row>\n );\n}\n","import { map } from 'lodash';\nimport { Col } from 'react-bootstrap';\nimport classNames from 'classnames';\nimport { renderYamlNode } from './utils';\nimport {\n assertNoUnknownKeys,\n assertOptionalNumber,\n} from './components/asserts';\nimport type { AnyYamlNode } from './model';\n\ninterface Props {\n yamlNode: AnyYamlNode;\n panel: boolean;\n}\n\nexport default function YamlCol({ yamlNode, panel }: Props) {\n const { type, style, xs, children, ...unknownOptions } = yamlNode;\n assertNoUnknownKeys(yamlNode, unknownOptions);\n assertOptionalNumber(yamlNode, 'xs', xs);\n return (\n <Col\n className={classNames('yamymllayout-col', { col: !!xs })}\n style={style}\n xs={xs}\n >\n {map(yamlNode.children, (node, key) => renderYamlNode(node, key, panel))}\n </Col>\n );\n}\n","import { Alert } from 'react-bootstrap';\nimport type { YamlNode } from '../model';\nimport { KeyError, MissingKeysError } from '../utils';\nimport {\n assertNoUnknownKeys,\n assertOptionalBoolean,\n assertOptionalString,\n} from './asserts';\nimport type { YamlComponent } from '../model';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlHardwareComponent: Record<\n string,\n React.ComponentType<any>\n> = {};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerHardwareComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n yamlHardwareComponent[name] = component;\n}\n\nexport interface HardwareDesc {\n id: string;\n}\n\nexport type HardwareListDesc = HardwareDesc[];\n\nexport interface HardwareGroupProps {\n fetched: boolean;\n fetchedGroups: boolean;\n ids?: HardwareListDesc;\n groupid?: string;\n actions?: {\n fetch: () => void;\n fetchGroups: () => void;\n };\n even?: boolean;\n nowrap: boolean;\n}\n\nfunction assertHardwareDesc(\n yamlNode: YamlNode,\n value: any\n): asserts value is HardwareDesc {\n if (value === undefined) {\n // FIXME: That's not a nice exception in this case, the rendering will be bad\n throw new MissingKeysError(yamlNode, ['id']);\n }\n if (typeof value.id !== 'string') {\n // FIXME: That's not a nice exception in this case, the rendering will be bad\n throw new KeyError(yamlNode, 'id', 'A string is expected');\n }\n}\n\nfunction assertOptionalHardwareListDesc(\n yamlNode: YamlNode,\n key: string,\n value: any\n): asserts value is HardwareListDesc | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'A option list is expected');\n }\n\n value.forEach((hardwareDesc, i) => {\n try {\n assertHardwareDesc(yamlNode, hardwareDesc);\n } catch {\n // FIXME: For now we catch it, but assertHardwareDesc could do a better job\n throw new KeyError(\n yamlNode,\n key,\n `The hardware description ${i} is wrong`\n );\n }\n });\n}\n\nexport default function YamlHardwareGroup(props: YamlComponent) {\n const {\n providers = {},\n yamlNode,\n ids,\n groupid,\n even,\n nowrap,\n ...unknownOptions\n } = props;\n assertOptionalHardwareListDesc(yamlNode, 'ids', ids);\n assertOptionalString(yamlNode, 'groupid', groupid);\n assertOptionalBoolean(yamlNode, 'even', even);\n assertOptionalBoolean(yamlNode, 'nowrap', nowrap);\n assertNoUnknownKeys(yamlNode, unknownOptions);\n\n if (!yamlHardwareComponent.HardwareGroup) {\n return (\n <Alert variant=\"warning\">No `HardwareGroup` component registered</Alert>\n );\n }\n\n const HardwareGroup = yamlHardwareComponent.HardwareGroup;\n return (\n <HardwareGroup\n providers={providers}\n ids={ids}\n groupid={groupid}\n nowrap={nowrap || false}\n even={even || false}\n />\n );\n}\n","import type { YamlComponent } from '@esrf/daiquiri-lib';\nimport { Alert } from 'react-bootstrap';\nimport {\n assertString,\n assertOptionalBoolean,\n assertOptionalString,\n assertOptionalNumber,\n} from './asserts';\nimport { yamlHardwareComponent } from './HardwareGroup';\n\nexport default function Yaml(props: YamlComponent) {\n const {\n providers = {},\n yamlNode,\n id,\n variant,\n header,\n width,\n colWidth,\n emptyifnone,\n ...unknownOptions\n } = props;\n assertString(yamlNode, 'id', id);\n assertOptionalString(yamlNode, 'variant', variant);\n assertOptionalString(yamlNode, 'header', header);\n assertOptionalNumber(yamlNode, 'width', width);\n assertOptionalNumber(yamlNode, 'colWidth', colWidth);\n assertOptionalBoolean(yamlNode, 'emptyifnone', emptyifnone);\n // FIXME: Each hardware variant/kind have it's own options\n // And the hardware kind can change dynamically\n // We could try to normalize that in the future\n // assertNoUnknownKeys(yamlNode, unknownOptions);\n const options = {\n variant,\n header,\n width,\n colWidth,\n emptyifnone,\n ...unknownOptions,\n };\n\n if (!yamlHardwareComponent.HardwareGroup) {\n return <Alert variant=\"warning\">No `Hardware` component registered</Alert>;\n }\n\n const Hardware = yamlHardwareComponent.Hardware;\n\n return <Hardware providers={providers} id={id} options={options} />;\n}\n","import React, { Suspense } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport type { YamlNode } from './model';\nimport YamlHardwareGroup from './components/HardwareGroup';\nimport YamlHardware from './components/Hardware';\nimport YamlTodo from './components/Todo';\nimport YamlNone from './components/None';\n\nexport const componentMap: Record<string, React.ComponentType<any>> = {\n hardwaregroup: YamlHardwareGroup,\n hardware: YamlHardware,\n todo: YamlTodo,\n none: YamlNone,\n};\n\nexport function registerComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n componentMap[name] = component;\n}\n\nexport function registerComponents(\n map: Record<string, React.ComponentType<any>>\n) {\n Object.entries(map).forEach(([key, component]) =>\n registerComponent(key, component)\n );\n}\n\ninterface YamlComponentNode extends YamlNode {\n type: string;\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n title?: string;\n}\n\nexport default function YamlComponent(props: {\n yamlNode: YamlComponentNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n const { type, style, scroll, title, ...remainingContent } = yamlNode;\n if (!(type in componentMap)) {\n return (\n <Panel>\n <Panel.Contents>\n <Alert variant=\"warning\">Unknown component &quot;{type}&quot;</Alert>\n </Panel.Contents>\n </Panel>\n );\n }\n const Comp = componentMap[yamlNode.type];\n if (panel) {\n return (\n <Panel style={style} scroll={scroll}>\n <Suspense fallback={<p>Loading...</p>}>\n {title && <Panel.Header>{title}</Panel.Header>}\n <Panel.Contents>\n <Comp {...remainingContent} yamlNode={yamlNode} />\n </Panel.Contents>\n </Suspense>\n </Panel>\n );\n }\n return (\n <Suspense fallback={<p>Loading...</p>}>\n <Comp {...remainingContent} yamlNode={yamlNode} />\n </Suspense>\n );\n}\n","import { map } from 'lodash';\nimport { Container } from 'react-bootstrap';\nimport { renderYamlNode } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n };\n panel: boolean;\n}\n\nexport default function YamlContainer({ yamlNode, panel }: Props) {\n const options = yamlNode.options || {};\n return (\n <Container className=\"ymllayout-container\" {...options}>\n {map(yamlNode.children, (node, key) => renderYamlNode(node, key, panel))}\n </Container>\n );\n}\n","import type { ReactElement, CSSProperties } from 'react';\nimport { map } from 'lodash';\nimport Panel from '../layout/Panel';\nimport { renderYamlNode } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n title?: string;\n };\n panel: boolean;\n}\n\nexport default function YamlPanel(props: Props): ReactElement {\n const { yamlNode } = props;\n const options = yamlNode.options || {};\n const contentsStyle: CSSProperties = {};\n if (options.centerContent) {\n contentsStyle.margin = 'auto';\n }\n\n return (\n <Panel className=\"ymllayout-panel\" {...options}>\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents style={contentsStyle}>\n {map(yamlNode.children, (node, key) =>\n renderYamlNode(node, key, false)\n )}\n </Panel.Contents>\n </Panel>\n );\n}\n","import { each } from 'lodash';\nimport { Tab, Tabs } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport { renderYamlNode } from './utils';\n\nconst hash = () => {\n return (\n Math.random().toString(36).slice(2, 15) +\n Math.random().toString(36).slice(2, 15)\n );\n};\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: Record<string, any>;\n title: string;\n };\n panel: boolean;\n}\n\nexport default function YamlTabs({ yamlNode, panel }: Props) {\n const tabs: React.ReactElement[] = [];\n each(yamlNode.children, (t, i) => {\n tabs.push(\n <Tab key={i} eventKey={hash()} title={t.title}>\n {renderYamlNode(t, 0, false)}\n </Tab>\n );\n });\n\n return panel ? (\n <Panel className=\"ymllayout-tabs\">\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents>\n <Tabs mountOnEnter>{tabs}</Tabs>\n </Panel.Contents>\n </Panel>\n ) : (\n <Tabs>{tabs}</Tabs>\n );\n}\n","import { map } from 'lodash';\nimport Panel from '../layout/Panel';\nimport type { ReactNode } from 'react';\nimport { assertOnRemainingKeys, renderYamlNode } from './utils';\nimport type { YamlNode } from './model';\nimport React from 'react';\n\ninterface YamlFormHeaderNode extends YamlNode {\n type: 'formheader';\n title?: string;\n}\n\ninterface YamlFormRowNode extends YamlNode {\n type: string;\n title: string;\n component?: string;\n stateinheader?: boolean;\n titlealign?: string;\n id?: string;\n variant?: string;\n options?: Record<string, any>;\n even: boolean;\n}\n\ninterface YamlFormNode extends YamlNode {\n children: (YamlFormHeaderNode | YamlFormRowNode)[];\n title?: string;\n [key: string]: any;\n}\n\nfunction Header(props: { node: YamlFormHeaderNode; row: number }) {\n const { node } = props;\n const { type, title, ...remainingContent } = node;\n assertOnRemainingKeys(node, remainingContent);\n return (\n <div className=\"ymllayout-form-header\" style={{ gridColumn: '1 / 3' }}>\n <h3>{title}</h3>\n </div>\n );\n}\n\n/**\n * Render the title of a row.\n *\n * It supports a fixed title, and can display formatted hardware id and state.\n */\nfunction RowTitle(props: {\n node: YamlFormRowNode;\n state: ReactNode | null;\n row: number;\n}) {\n const { node, state, row } = props;\n const { title } = node;\n\n function getId() {\n if (node.id) {\n return node.id;\n }\n return undefined;\n }\n\n function getText() {\n if (title !== undefined) {\n return title;\n }\n if (node.type === 'hardware') {\n const id = getId();\n const idContent = {\n _parentNode: node._parentNode,\n _indexFromParent: node._indexFromParent,\n type: 'hardware',\n id,\n variant: 'name',\n emptyifnone: true,\n };\n return renderYamlNode(idContent, 'a', false);\n }\n return '';\n }\n const text = getText();\n\n return (\n <div\n style={{\n textAlign: 'center',\n }}\n >\n <h5\n style={{\n margin: '0px',\n whiteSpace: 'nowrap',\n }}\n >\n {text}\n </h5>\n {state && <div style={{ position: 'relative', top: -5 }}>{state}</div>}\n </div>\n );\n}\n\nfunction Row(props: { node: YamlFormRowNode; row: number }) {\n const { node, row } = props;\n const {\n titlealign,\n title,\n stateinheader = false,\n variant,\n id,\n ...remainingContent\n } = node;\n let newContent;\n let state;\n if (remainingContent.type === 'hardware') {\n newContent = {\n ...remainingContent,\n id,\n variant,\n };\n if (stateinheader) {\n const stateContent = {\n ...remainingContent,\n id,\n variant: 'state',\n emptyifnone: true,\n };\n state = renderYamlNode(stateContent, 'k', false);\n } else {\n state = null;\n }\n } else {\n newContent = remainingContent;\n state = null;\n }\n return (\n <>\n <div\n style={{\n gridColumn: 1,\n alignSelf: titlealign ?? 'center',\n }}\n >\n <RowTitle node={node} state={state} row={row} />\n </div>\n <div style={{ gridColumn: 2, alignSelf: 'center' }}>\n {renderYamlNode(newContent, 'k', false)}\n </div>\n </>\n );\n}\n\nexport default function YamlForm(props: {\n yamlNode: YamlFormNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n const { type, children, options = {}, title, ...remainingContent } = yamlNode;\n assertOnRemainingKeys(yamlNode, remainingContent);\n\n return (\n <Panel className=\"ymllayout-form\" {...options}>\n {yamlNode.title && <Panel.Header>{yamlNode.title}</Panel.Header>}\n <Panel.Contents className=\"full-sizer\" style={{ overflow: 'auto' }}>\n <div\n style={{\n display: 'grid',\n gridTemplateColumns: 'min-content auto',\n }}\n >\n {map(children, (content, key) => {\n if (content.type === 'formheader') {\n return (\n <Header\n node={content as YamlFormHeaderNode}\n key={key}\n row={key}\n />\n );\n }\n if (content.type === 'none') {\n return <React.Fragment key={key} />;\n }\n return (\n <Row node={content as YamlFormRowNode} key={key} row={key} />\n );\n })}\n </div>\n </Panel.Contents>\n </Panel>\n );\n}\n","import { map } from 'lodash';\nimport { renderYamlNode } from './utils';\nimport type { YamlNode } from './model';\n\ninterface YamlGridNode extends YamlNode {\n children: YamlGridCellNode[];\n title?: string;\n columns?: string;\n rows?: string;\n}\n\ninterface YamlGridCellNode extends YamlNode {\n columnSpan?: number;\n rowSpan?: number;\n}\n\nexport default function YamlGrid(props: {\n yamlNode: YamlGridNode;\n panel: boolean;\n}) {\n const { yamlNode, panel } = props;\n return (\n <div\n className=\"ymllayout-grid\"\n style={{\n gridTemplateColumns: yamlNode.columns,\n gridTemplateRows: yamlNode.rows,\n }}\n >\n {map(yamlNode.children, (content, key) => {\n const { columnSpan = 1, rowSpan = 1, ...remainingContent } = content;\n const gridColumn = columnSpan > 1 ? `span ${columnSpan}` : undefined;\n const gridRow = rowSpan > 1 ? `span ${rowSpan}` : undefined;\n return (\n <div\n key={key}\n className=\"ymllayout-grid-cell\"\n style={{\n gridColumn,\n gridRow,\n }}\n >\n {renderYamlNode(remainingContent, key, panel)}\n </div>\n );\n })}{' '}\n </div>\n );\n}\n","import React from 'react';\nimport { OptionalPanel } from './utils';\n\ninterface Props {\n yamlNode: {\n children: any[];\n options?: {\n [name: string]: any;\n scroll?: boolean;\n style?: Record<string, any>;\n };\n label?: string;\n };\n panel: boolean;\n}\n\nexport default function YamlLabel({ yamlNode, panel }: Props) {\n const options = yamlNode.options || {};\n return (\n <OptionalPanel panel={panel} options={options}>\n <div>{yamlNode.label}</div>\n </OptionalPanel>\n );\n}\n","import { useMemo } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport ErrorBoundary from './ErrorBoundary';\nimport YamlRow from './Row';\nimport YamlCol from './Col';\nimport YamlComponent from './Component';\nimport YamlContainer from './Container';\nimport YamlPanel from './Panel';\nimport YamlTabs from './Tabs';\nimport YamlForm from './Form';\nimport YamlGrid from './Grid';\nimport YamlLabel from './Label';\nimport { renderYamlNode, registerYamlType, normalizeLayout } from './utils';\nimport type { YamlRoot } from './model';\n\nexport const yamlMap = {\n row: YamlRow,\n col: YamlCol,\n container: YamlContainer,\n component: YamlComponent,\n panel: YamlPanel,\n tabs: YamlTabs,\n form: YamlForm,\n grid: YamlGrid,\n label: YamlLabel,\n};\n\nObject.entries(yamlMap).forEach(([type, YamlComponent]) => {\n registerYamlType(type, YamlComponent);\n});\n\ninterface Props {\n testid: string;\n layout: YamlRoot;\n className?: string;\n unhandledComponentDidCatch?: (\n error: Error,\n setStateCallback: (data: Record<string, any>) => void\n ) => void;\n UnhandledErrorComponent?: React.ComponentType<any>;\n}\n\nexport default function Main(props: Props) {\n const layout = useMemo(() => {\n return normalizeLayout(props.layout);\n }, [props.layout]);\n\n if (layout.error) {\n return (\n <div\n className={`${props.className ?? ''} ymllayout-main`}\n data-testid={props.testid}\n >\n <Panel>\n <Panel.Header>Layout Error</Panel.Header>\n <Panel.Contents>\n <p>File: {layout.name}</p>\n <Alert variant=\"warning\">\n <pre className=\"mb-0\">{layout.error}</pre>\n </Alert>\n </Panel.Contents>\n </Panel>\n </div>\n );\n }\n\n return (\n <div\n className={`${props.className ?? ''} ymllayout-main`}\n data-testid={props.testid}\n >\n <ErrorBoundary\n resetKey={layout}\n unhandledComponentDidCatch={props.unhandledComponentDidCatch}\n UnhandledErrorComponent={props.UnhandledErrorComponent}\n >\n {layout.children?.map((node, key) => renderYamlNode(node, key))}\n </ErrorBoundary>\n </div>\n );\n}\n","import { Col, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type { Monitor } from './types';\nimport { useHardware } from '../registry/hooks';\n\nexport const dynamicOp = (op: string, a1: any, b1: any) => {\n const operators: { [op: string]: (a: any, b: any) => boolean } = {\n '>': (a, b) => a > b,\n '<': (a, b) => a < b,\n '>=': (a, b) => a >= b,\n '<=': (a, b) => a <= b,\n '==': (a, b) => a === b,\n '!=': (a, b) => a !== b,\n in: (a, b) => b.indexOf(a) > -1,\n };\n\n if (op in operators) return operators[op](a1, b1);\n return undefined;\n};\n\nfunction rsplit(s: string, separator: string, limits?: number): string[] {\n const split = s.split(separator);\n return limits\n ? [split.slice(0, -limits).join(separator)].concat(split.slice(-limits))\n : split;\n}\n\nexport function useValue(valuePath: string | undefined): unknown {\n const path = valuePath !== undefined ? rsplit(valuePath, '.', 1) : [null, ''];\n const obj = useHardware(path[0]);\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n return undefined;\n }\n if (path[1] === null) {\n return undefined;\n }\n if (!Array.isArray(obj.properties[path[1]])) {\n return obj.properties[path[1]];\n }\n return obj.properties[path[1]][0];\n}\n\nexport function useUnit(unitPath?: string): string | undefined {\n const isFixedUnit = unitPath !== undefined && !unitPath.includes('.');\n const path = unitPath !== undefined ? rsplit(unitPath, '.', 1) : [null, ''];\n const obj = useHardware(path[0]);\n if (isFixedUnit) {\n // That's a fixed unit defined as an option\n return unitPath;\n }\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n // The unit is maybe not yet there\n return undefined;\n }\n if (path[1] === null) {\n return undefined;\n }\n return `${obj.properties[path[1]]}`;\n}\n\nexport function MonitorHardware(props: { monitor: Monitor }) {\n const { monitor } = props;\n\n let value = useValue(monitor.value) ?? '-';\n const unit = useUnit(monitor.unit);\n const overlay = useValue(monitor.overlay);\n\n const flt = Number.parseFloat(`${value}`);\n if (!Number.isNaN(flt)) {\n const str = String(flt);\n if (str.length > 5) {\n value = flt.toPrecision(5);\n }\n }\n\n let checkClass;\n if (monitor.comparator && monitor.comparison) {\n const check = dynamicOp(monitor.comparator, value, monitor.comparison);\n checkClass = check ? 'valid' : 'invalid';\n }\n\n if (!Number.isNaN(flt)) {\n if (unit !== undefined) {\n value = `${value} ${unit}`;\n }\n }\n\n if (overlay) {\n const overlayStr = `${overlay}`;\n\n return (\n <OverlayTrigger\n key={monitor.name}\n placement=\"bottom\"\n overlay={\n <Tooltip id=\"tooltipid\" className=\"monitor-panel-tooltip\">\n {overlayStr.includes('\\n') ? <pre>{overlayStr}</pre> : overlayStr}\n </Tooltip>\n }\n >\n <Col className=\"monitor-panel-item\">\n <h1>{monitor.name}</h1>\n <div className={checkClass}>{`${value}`}</div>\n </Col>\n </OverlayTrigger>\n );\n }\n\n return (\n <Col key={monitor.name} className=\"monitor-panel-item\">\n <h1>{monitor.name}</h1>\n <div className={checkClass}>{`${value}`}</div>\n </Col>\n );\n}\n","import { map } from 'lodash';\nimport type { ComponentType, PropsWithChildren } from 'react';\nimport classNames from 'classnames';\nimport { Row, Col, Container } from 'react-bootstrap';\nimport { MonitorHardware } from './MonitorHardware';\nimport type { Monitor } from './types';\n\ninterface MonitorMapping {\n [name: string]: ComponentType<any>;\n}\n\nexport const monitorMap: MonitorMapping = {\n hardware: MonitorHardware,\n};\n\nexport function registerMonitorComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n monitorMap[name] = component;\n}\n\nfunction YmlError(props: { monitor: Monitor; message: string }) {\n return (\n <Col\n className=\"monitor-panel-item bg-fatal\"\n title={`Error from yaml configuration: ${props.message}`}\n >\n <h1>{props.monitor.name}</h1>\n <div>Parsing error</div>\n </Col>\n );\n}\n\nexport interface MonitorPanelProps {\n monitors: Monitor[];\n margin?: 'start' | null;\n bg?: 'light' | null;\n}\n\nexport function MonitorPanel(props: MonitorPanelProps) {\n const properties = map(props.monitors, (monitor, i) => {\n const type = monitor.type ?? 'hardware';\n const Comp = monitorMap[type];\n if (Comp === undefined) {\n return (\n <YmlError\n key={`m${i}`}\n monitor={monitor}\n message={`Type ${type} unsupported`}\n />\n );\n }\n return <Comp key={`m${i}`} monitor={monitor} />;\n });\n\n return (\n <div\n className={classNames(\n { 'ms-auto': props.margin === 'start' },\n 'me-auto',\n 'monitor-panel',\n { 'monitor-panel-light': props.bg === 'light' }\n )}\n >\n <Container fluid>\n <Row className=\"flex-nowrap\">{properties}</Row>\n </Container>\n </div>\n );\n}\n\ninterface MonitorPanelItemProps {}\n\nexport function MonitorPanelItem(\n props: PropsWithChildren<MonitorPanelItemProps>\n) {\n return <Col className=\"monitor-panel-item\">{props.children}</Col>;\n}\n"],"names":["AnyHardwareState","props","hardware","online","locked","state","variant","jsx","Badge","DefaultState","Name","options","getName","getLabel","getTitle","name","title","Info","getValue","propertyName","result","segment","Fragment","OnlineStatus","activeMessage","inactiveMessage","message","TypeIcon","icon","jsxs","HardwareTemplate","headerMode","label","Form","OverlayTrigger","Popover","error","Button","DeviceState","Property","widgetIcon","widgetState","getUnit","unitName","unit","widgetContent","InputGroup","Variants","BaseState","BaseName","BaseInfo","BaseProperty","Variants$R","Mocks","defaultjson","HardwareState","style","HardwareMultiState","states","variants","descriptions","minWidth","mainState","renderTooltip","Tooltip","s","i","desc","Row","Col","AirBearingState","RawAirBearing","disabled","_a","isOn","isOff","ButtonGroup","AirBearing","getWidgetContent","ReadOnlyTextInput","value","className","defaultClasses","ActionButton","DropdownAirBearing","requestOn","requestOff","hardwareDisabled","movingOn","movingOff","Dropdown","Container","AirBearingProtected","Variants$P","delay","ms","resolve","Simulator","alias","type","setProperty","call","properties","useHardwareContext","ctx","actions","useMemo","_b","previousHardware","useRef","useEffect","isEqual","AirBearingSimulator","setState","useState","formatEng","scalar","powerPrefix","q","subtrhnd","pow10","prefix","ucfirst","str","toHoursMins","seconds","min","mins","hours","toEnergy","wavelength","round","digits","FrontendOverlay","reset","itlks","ring","getPropertyState","key","map","prop","Frontend","onClick","Variants$N","GaugeOverlay","toggle","Gauge","Variants$L","defaultjson2","NumericStep","forwardRef","ref","stepSizeRef","focusTimeoutRef","currentStep","setCurrentStep","retakeFocus","setRetakeFocus","onStep","up","ref2","val","multiplier","stepSize","onStepProp","step","overlay","incIcon","decIcon","swapIncDec","onKeyDown","onBlur","horizontalArrows","largeArrows","stepOnly","rest","onKeyDown2","e","onBlur2","steps","hasIncDec","classNames","NumericStep$1","HardwareNumericStep","valueRef","edited","setEdited","setError","updateRef","newValue","onChange","promise","Laser","requestPowerChange","requestStateChange","Variants$J","LaserHeatingOverlay","LaserHeating","pending","setPending","requestExposureChange","requestMeasure","Variants$H","Light","sliderRef","requestIntensityChange","debounceIntensityChange","useCallback","_debounce","Variants$F","LimaState","finalState","Content","Stack","LimaDefault","width","height","TomoDetectorSize","doingAction","setDoingAction","DropdownLimaTransformation","rotation","flipX","flipY","LimaTransformationFlags","flipH","flipV","noTransformation","LimaTransformation","LONGEST_MODE_WIDTH","DropdownBinning","hardwareReady","binningMode","SelectableItem","selectedMode","LimaBinningControl","bh","bv","b","setBinning","supportedBinningMode","limaBinningModeSupported","readOnly","LimaBinning","LimaRoiImageControl","LimaMaxSizeControl","struct","LimaLimaVersionControl","LimaModelControl","LimaRoiShapeWidget","imageMaxDim","roi","binning","maxw","maxh","getPercentageCoef","coef","pdw","pdh","getPercentageRoi","x","y","w","h","getPercentageText","px","py","pw","ph","tx","ty","LimaRoiShape","runtimeHooks","registerRuntimeHook","hooks","useHardware","id","useHardwareChangeActions","isLimaHardware","entity","useLimaHardware","limaGuessSubframes","exposureTime","accMaxExpoTime","nbSubFrames","accExpoTime","LimaSize","LimaImageRoi","LimaDescription","LimaShape","Variants$D","semver","flipjson","rotjson","roicenter","squaredetector","LimaSimulator","cameraPixelSize","setProperties","changeBinning","pixelSize","size","changeBinningMode","changeRotation","changeFlipX","flip","changeFlipY","p","RenderInput","inputProps","inputRef","referenceElementRef","onAddSelection","onRemoveSelection","otherInputProps","fieldRef","clearInput","setValue","addSelection","removeSelection","selected","option","Hint","node","withExtraProps","extraProps","wrappedComponent","WithExtraProps","props2","props3","RenderMenu","results","menuProps","selectedItems","opt","Highlighter","availableItems","MenuItem","Menu","MeasurementGroup","enabled","setSelection","added","removed","counter","selection","promises","setActive","Typeahead","shouldSelect","Variants$B","MeasurementGroupSimulator","enable","c","disable","UNKNOWN","AVAILABLE_STATES","MotorState","priority","n1","n2","s1","s2","orderedStates","splitCustomStates","elems","n","HardwareInputNumber","normalizeNumber","MotorOverlay","onMoveVelocityRequested","target","onMoveAccelerationRequested","MotorDefault","user_tags","onAbortRequested","onMovePositionRequested","useMotorStates","MotorText","userTags","autoReady","autoOn","newState","reduced","isMotorHardware","useMotorHardware","Variants$z","motor","halfMotor","unknownMotor","notReadyMotor","disconnectedMotor","powerOffMotor","createMotorMock","position","MotorSimulator","minLimit","maxLimit","initialPosition","initialVelocity","setPosition","setTarget","internalTimeRef","updatePosition","now","deltaTime","newPosition","newTarget","deltaPosition","direction","pos","timer","rawHardware","Multiposition","selectionRef","onMove","stop","opts","DropdownPositions","moveTo","positionId","createSelectableItem","positionSchema","m","hardwareIsMoving","targetPosition","MultipositionDefault","MultipositionDefault2","Variants$x","MultipositionSimulator","OpticState","MultiPositionMagnification","hardwareMoving","magnification","magnifications","a","moveHardwareMagnification","index","itemMagnification","FixedMagnification","allowtuning","InputMagnification","rangeMin","rangeMax","formRef","rangeRef","setHardwareMagnification","event","valueAsFloat","updateEdit","onInputChange","onRangeChange","onRangeAccepted","RangeMagnification","OffMagnification","Optic","getOpticClass","Class","isOpticHardware","Variants$v","fixedjson","offjson","rangejson","OpticSimulator","kind","getInitial","move","speed","setMagnification","ProcedureState","Actions","waitingUserInput","aborting","isRunning","doStart","doAbort","ProcedureManage","State","awaitingUserInput","FinishedState","runState","runException","definition","ProcedureExecution","doValidate","ProcedureValidate","Variants$t","standby","ShutterState","getState","getVariant","ShutterOverlay","ShutterDefault","getAction","action","DropdownShutter","requestOpen","requestClose","ShutterProtected","capitalize","valueName","Variants$r","ShutterSimulator","useResolvedSlit","vgapId","vgap","hgapId","hgap","voffsetId","voffset","hoffsetId","hoffset","_c","_d","SlitState","info","description","vgapActions","hgapActions","voffsetActions","hoffsetActions","merge","DropdownSlit","schema","operator","resolved","Widget","normalizePosition","gap","gapUnit","gapMoving","offset","offsetUnit","offsetMoving","_e","_f","_g","_h","SlitDefault","Variants$p","slit","horizontal","vertical","PumpOverlay","attrs","Pump","Variants$n","PusherState","PusherBlock","ButtonPush","distance","pushing","setPushing","RawPusher","isRetracted","isInTouch","movingIn","setMovingIn","movingOut","setMovingOut","location","Pusher","Variants$l","PusherSimulator","ServiceState","ServiceDefault","requestStart","requestRestart","requestStop","getStartAction","restartEnabled","getStopAction","stopEnabled","startAction","stopAction","DropdownService","ServiceProtected","Variants$j","TomoFlatMotionState","AxisName","motion","axisId","axis","DropAxis","axisRef","requestDropAxis","AxisOnOff","isUsed","requestAppendAxis","InputAxisMotion","exp","MotionKind","requestAbsoluteMotion","requestRelativeMotion","TomoFlatMotionDefault","imotion","getKind","kindVariant","kindTitle","TomoFlatMotionSmall","Alert","Variants$h","isTomoFlatMotionHardware","useTomoFlatMotionHardware","sy","sy2","TomoFlatMotionSimulator","updateAxes","inList","TomoReferencePositionDefault","moveToReference","isTomoReferencePositionHardware","Variants$f","TomoDetectorState","SelectPixelSizeMode","requestMode","mode","InputUserPixelSize","userSamplePixelSize","requestUserSamplePixelSize","DropdownPixelSize","useFormattedQuantity","displayUnit","normUnit","u","normValue","v","Qty","TomoDetectorSamplePixelSize","formattedValue","AcquisitionMode","InputAccMaxExpoTime","requestUpdate","lima","DropdownAcquisitionMode","limaId","limaActions","TomoDetectorAcquisitionMode","Variants$d","isTomoDetectorHardware","useTomoDetectorHardware","TomoDetectorsState","getHardwareIdFromRef","DropdownDetectors","detectors","activeDetectorId","targetDetectorId","mountDetector","detectorId","detectorRef","TomoDetectors","hardwareMounting","Variants$b","isTomoDetectorsHardware","useTomoDetectorsHardware","TomoImagingState","UpdateMode","updateOnMove","setUpdateModeOff","setUpdateModeAuto","ExposureTime","TakeActions","takeProj","takeDark","takeFlat","TomoImagingDefault","AccumulationIfOne","hardwareTomo","acqMode","TomoImagingExposureTime","SettleTime","settleTime","TomoImagingSettleTime","ProcessingButton","text","processing","doDark","setDoDark","doFlat","setDoFlat","doProj","setDoProj","TomoImagingActions","TomoImagingUpdateMode","Variants$9","TomoImagingSimulator","Variants$7","isTomoSampleStageHardware","useTomoSampleStageHardware","LatencyTime","valueFromHardware","TomoConfigLatencyTime","Variants$5","isTomoConfigHardware","useTomoConfigHardware","TomoHoloState","Variants$3","isTomoHoloHardware","useTomoHoloHardware","ValveOverlay","Valve","Variants$1","logger","debug","NoObject","LoadingObject","MissingObject","ErrorObject","MissingComponentObject","FullSizer","containerRef","view","PanelHeader","PanelContents","Panel","Wrap","yamlWrapperMap","registerYamlType","component","renderYamlNode","yamlNode","panel","Comp","OptionalPanel","children","Children","child","isValidElement","cloneElement","assertOnRemainingKeys","remainingContent","_parentNode","_indexFromParent","remainingContent2","UnknownKeysError","LayoutError","unknownKeys","MissingKeysError","missingKeys","KeyError","getYamlRoot","getYamlHierarchy","path","normalizeLayout","parentNode","indexFromParent","newNode","assertKeyExpected","assertString","assertBoolean","assertNumber","assertOptionalBoolean","assertOptionalString","assertStringList","assertOptionalStringOrStringList","assertOptionalStringList","assertOptionalNumber","assertOptionalNumberList","assertNoUnknownKeys","assertDataCollectionId","assertOptionalBackend","Yaml","providers","unknownOptions","DefaultErrorMessage","LayoutErrorMessage","formatPreview","indent","lines","actualIndentation","k","layoutName","INITIAL_STATE","ErrorBoundary","Component","data","prevProps","prevState","UnhandledErrorComponent","hasError","YamlRow","YamlCol","xs","yamlHardwareComponent","registerHardwareComponent","assertHardwareDesc","assertOptionalHardwareListDesc","hardwareDesc","YamlHardwareGroup","ids","groupid","even","nowrap","HardwareGroup","header","colWidth","emptyifnone","Hardware","componentMap","YamlHardware","YamlTodo","YamlNone","registerComponent","registerComponents","YamlComponent","scroll","Suspense","YamlContainer","YamlPanel","contentsStyle","hash","YamlTabs","tabs","each","t","Tab","Tabs","Header","RowTitle","row","getId","getText","idContent","titlealign","stateinheader","newContent","stateContent","YamlForm","content","React","YamlGrid","columnSpan","rowSpan","gridColumn","gridRow","YamlLabel","yamlMap","Main","layout","dynamicOp","op","a1","b1","operators","rsplit","separator","limits","split","useValue","valuePath","obj","useUnit","unitPath","isFixedUnit","MonitorHardware","monitor","flt","checkClass","overlayStr","monitorMap","registerMonitorComponent","YmlError","MonitorPanel","MonitorPanelItem"],"mappings":"gkBAKO,SAASA,GAAiBC,EAA+B,CACxD,KAAA,CAAE,SAAAC,CAAa,EAAAD,EACf,CAAE,OAAAE,EAAQ,OAAAC,EAAS,IAAA,EAASF,EAC5BG,EAAQF,GACTC,IAAW,KAAO,SAAWF,EAAS,WAAW,QAAU,UAC5D,UAcEI,EAX6C,CACjD,MAAO,UACP,QAAS,UACT,OAAQ,UACR,SAAU,YACV,QAAS,SACT,MAAO,SACP,OAAQ,SACR,OAAQ,SAAA,EAGqBD,CAAK,GAAK,UAEzC,OAAQE,EAAAA,IAAAC,EAAAA,MAAA,CAAM,GAAIF,EAAU,SAAMD,CAAA,CAAA,CACpC,CAEA,SAAwBI,GAAaR,EAAuC,CACpE,KAAA,CAAE,SAAAC,CAAa,EAAAD,EACd,OAAAM,MAACP,IAAiB,SAAAE,CAAoB,CAAA,CAC/C,CCrBA,SAAwBQ,GACtBT,EACA,CACM,KAAA,CAAE,SAAAC,EAAU,QAAAS,CAAY,EAAAV,EAC9B,SAASW,GAAU,CACjB,OAAIV,EAAS,KACJA,EAAS,KAEXA,EAAS,EAClB,CAEA,SAASW,GAAW,CACd,OAAAF,EAAQ,eAAiB,OACpBA,EAAQ,aAEbT,EAAS,MACJA,EAAS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