@esrf/daiquiri-lib 5.2.0 → 5.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/components/ReadOnlyTextInput.tsx","../src/hardware/base/BaseProperty.tsx","../src/monitorpanel/MonitorPanelItem.tsx","../src/hardware/base/BaseMonitor.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/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/hardware/beamviewer/Beamviewer.tsx","../src/hardware/beamviewer/index.ts","../src/hardware/beamviewer/mocks/index.ts","../src/hardware/beamviewer/mocks/Simulator.tsx","../src/hardware/energymanager/EnergyManagerState.tsx","../src/hardware/energymanager/EnergyManagerDefault.tsx","../src/hardware/energymanager/EnergyManagerMonitor.tsx","../src/hardware/energymanager/index.ts","../src/hardware/energymanager/mocks/index.ts","../src/hardware/energymanager/mocks/Simulator.tsx","../src/utils/formatting.ts","../src/hardware/frontend/Frontend.tsx","../src/hardware/frontend/FrontendMonitor.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/components/InfiniteKnob360.tsx","../src/hardware/motor/MotorRotation.tsx","../src/hardware/motor/MotorMonitor.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/MultipositionState.tsx","../src/hardware/multiposition/Multiposition.tsx","../src/components/DropdownButton2.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/ShutterMonitor.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/TomoFlatMotionSampleLocation.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/utils/units.ts","../src/hardware/utils/hardware.ts","../src/hardware/tomodetector/TomoDetectorFieldOfView.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/components/QuantityInputNumberOrNull.tsx","../src/components/QuantityInputNumber.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/components/GaugeIndicator.tsx","../src/layout/Panel.tsx","../src/yaml-layout/components/None.tsx","../src/yaml-layout/components/Label.tsx","../src/yaml-layout/containers/Row.tsx","../src/yaml-layout/containers/Col.tsx","../src/yaml-layout/containers/Container.tsx","../src/yaml-layout/containers/Panel.tsx","../src/yaml-layout/containers/Tabs.tsx","../src/yaml-layout/containers/Form.tsx","../src/yaml-layout/containers/Grid.tsx","../src/yaml-layout/registry.ts","../src/yaml-layout/Component.tsx","../src/yaml-layout/utils.tsx","../src/yaml-layout/asserts.ts","../src/yaml-layout/components/Todo.tsx","../src/hardware/registry.ts","../src/components/HardwareState.tsx","../src/components/ModalDialog.tsx","../src/components/ConditionalWrap.tsx","../src/components/ButtonTriggerModal.tsx","../src/monitorpanel/MonitorHardwareProperty.tsx","../src/components/Synoptic.tsx","../src/yaml-layout/ErrorBoundary.tsx","../src/yaml-layout/Main.tsx","../src/monitorpanel/MonitorPanel.tsx","../src/monitorpanel/MonitorHardware.tsx"],"sourcesContent":["import type { AnyHardware } 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: AnyHardware }) {\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: 'secondary',\n MOVING: 'transient',\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 { 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 { 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';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\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 className=\"flex-nowrap\">\n <ReadOnlyTextInput value={getValue()} />\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 { forwardRef } from 'react';\nimport type { PropsWithChildren } from 'react';\nimport { Col } from 'react-bootstrap';\n\ninterface MonitorPanelItemProps {\n className?: string;\n style?: Record<string, unknown>;\n}\n\n/**\n * Component for any item displayed in the monitor panel.\n *\n * The implementation with `forwardRef` and `...rest` allow\n * to use it inside a `OverlayTrigger`\n *\n * @param rest: Passthough to allow to wrap the component inside\n * OverlayTrigger. It contains callbacks.\n */\nexport const MonitorPanelItem = forwardRef<\n HTMLDivElement,\n PropsWithChildren<MonitorPanelItemProps>\n>(({ className = '', style, children, ...rest }, ref) => {\n return (\n <Col\n ref={ref}\n {...rest}\n className={`monitor-panel-item ${className}`}\n style={style}\n >\n {children}\n </Col>\n );\n});\n","import type {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\nimport { AnyHardwareState } from './BaseState';\n\nfunction BaseMonitor(\n props: HardwareWidgetProps<AnySchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n\n const name = options.name ?? hardware.alias ?? hardware.name ?? hardware.id;\n\n return (\n <MonitorPanelItem>\n <h1>{name}</h1>\n <AnyHardwareState hardware={hardware} />\n </MonitorPanelItem>\n );\n}\n\nexport default BaseMonitor;\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';\nimport BaseMonitor from './BaseMonitor';\n\nconst Variants: HardwareVariant<AnySchema> = {\n state: BaseState,\n name: BaseName,\n info: BaseInfo,\n property: BaseProperty,\n // To be used as 'monitor' in the application header\n monitor: BaseMonitor,\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 State(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 MultiState(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 <State\n state=\"NO_STATE\"\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 <State\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 { State } 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: 'success',\n OFF: 'danger',\n MOVING_ON: 'transient',\n MOVING_OFF: 'transient',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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 {\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: 'success',\n OFF: 'danger',\n MOVING_ON: 'transient',\n MOVING_OFF: 'transient',\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 type AirBearingSchema = Hardware<{\n state: string;\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","import { Fragment, useState } from 'react';\nimport { map } from 'lodash';\n\nimport {\n Container,\n Row,\n Col,\n Badge,\n Button,\n OverlayTrigger,\n Popover,\n Form,\n} from 'react-bootstrap';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { BeamviewerSchema } from '.';\n\nfunction BeamviewerOverlay(props: HardwareWidgetProps<BeamviewerSchema>) {\n const [current, setCurrent] = useState();\n const [errorMsg, setErrorMsg] = useState<string>();\n const { hardware, options = {} } = props;\n\n function read() {\n const promise = hardware.actions.call('read');\n if (promise !== undefined) {\n console.log('pending');\n promise\n .then((resp: any) => {\n setCurrent(resp);\n setErrorMsg(undefined);\n })\n .catch((error: any) => {\n setErrorMsg(`${error}`);\n });\n }\n return promise;\n }\n\n function onChangeRange(value: any) {\n return hardware.actions.setProperty('diode_range', value);\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 <Container>\n <Row>\n <Col sm={6} className=\"text-nowrap\">\n Diode Range:\n </Col>\n <Col>\n <Form.Control\n size=\"sm\"\n as=\"select\"\n disabled={props.disabled}\n onChange={(e) => {\n onChangeRange(e.target.value);\n }}\n defaultValue={hardware.properties.diode_range}\n >\n {map(hardware.properties.diode_ranges, (r) => (\n <option value={r} key={r}>\n {r}\n </option>\n ))}\n </Form.Control>\n </Col>\n </Row>\n <Row>\n <Col sm={6}>Current:</Col>\n <Col>\n {errorMsg && (\n <i\n className=\"fa-solid fa-triangle-exclamation me-1\"\n title={errorMsg}\n />\n )}\n {!errorMsg && <>{current}</>}\n <Button\n size=\"sm\"\n disabled={props.disabled}\n onClick={() => {\n void read();\n }}\n >\n Read\n </Button>\n </Col>\n </Row>\n </Container>\n </Popover.Body>\n </Popover>\n }\n >\n <Button title=\"Beamviewer Details\" className=\"float-end\" size=\"sm\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Beamviewer(props: HardwareWidgetProps<BeamviewerSchema>) {\n const { hardware, options = {} } = props;\n interface Property {\n name: string;\n prop: 'screen' | 'led' | 'foil';\n success: string;\n toggle: boolean;\n button: string;\n test?: boolean;\n }\n\n const properties: Property[] = [\n {\n name: 'Screen',\n prop: 'screen',\n success: 'OUT',\n toggle: hardware.properties.screen === 'IN',\n button: hardware.properties.screen === 'IN' ? 'Out' : 'In',\n },\n {\n name: 'Led',\n prop: 'led',\n success: 'OFF',\n toggle: hardware.properties.led === 'ON',\n button: hardware.properties.led === 'ON' ? 'Off' : 'On',\n },\n {\n name: 'Foil',\n prop: 'foil',\n success: 'OUT',\n toggle: hardware.properties.foil === 'IN',\n button: hardware.properties.foil === 'IN' ? 'Out' : 'In',\n test: hardware.properties.foil !== 'NONE',\n },\n ];\n\n function toggle(prop: string, value: any) {\n hardware.actions.call(prop, value);\n }\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Beamviewer\"\n icon=\"fam-hardware-beamviewer\"\n online={hardware.online}\n />\n <div className=\"name me-auto\">{hardware.name}</div>\n <BeamviewerOverlay {...props} />\n </div>\n <div className=\"hw-content\">\n <Container style={{ minWidth: '150px' }}>\n {map(properties, (p) => (\n <Fragment key={p.name}>\n {(p.test === true || p.test === undefined) && (\n <Row className=\"align-items-center mb-1\">\n <Col sm={4}>{p.name}</Col>\n <Col sm={4}>\n <Badge\n className=\"ms-1\"\n bg={\n hardware.properties[p.prop] === p.success\n ? 'success'\n : 'danger'\n }\n >\n {hardware.properties[p.prop]}\n </Badge>\n </Col>\n <Col sm={4}>\n <Button\n size=\"sm\"\n className=\"ms-1\"\n disabled={props.disabled}\n onClick={(e) => toggle(p.prop, !p.toggle)}\n >\n {p.button}\n </Button>\n </Col>\n </Row>\n )}\n </Fragment>\n ))}\n </Container>\n </div>\n </div>\n );\n}\n\nexport default Beamviewer;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Beamviewer from './Beamviewer';\n\n/**\n * Hardware as exposed by Redux\n */\nexport type BeamviewerSchema = Hardware<{\n /**\n * Tango state of the Lima camera monitoring the beam\n */\n state: string;\n foil: 'IN' | 'OUT' | 'NONE' | 'UNKNOWN';\n led: 'ON' | 'OFF' | 'UNKNOWN';\n screen: 'IN' | 'OUT' | 'UNKNOWN';\n diode_ranges: string[];\n diode_range: string;\n}>;\n\nconst Variants: HardwareVariant<BeamviewerSchema> = {\n default: Beamviewer,\n};\n\nexport default Variants;\n","import defaultjson from './Beamviewer.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","/* eslint no-await-in-loop: \"off\" */\nimport { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nconst diodeRanges = ['1mA', '100uA', '10uA', '1uA', '100nA', '10nA'];\n\nexport default function BeamviewerSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [led, setLed] = useState('OFF');\n const [screen, setScreen] = useState('OUT');\n const [foil, setFoil] = useState('NONE');\n const [diodeRange, setDiodeRange] = useState('1uA');\n\n async function call(name: string, value?: any): Promise<any> {\n if (name === 'read') {\n const current = Math.random();\n if (current < 0.1) {\n throw new Error('Dummy error');\n }\n return current;\n }\n if (name === 'led') {\n setLed(value ? 'ON' : 'OFF');\n return null;\n }\n if (name === 'screen') {\n setScreen(value ? 'IN' : 'OUT');\n return null;\n }\n if (name === 'foil') {\n setFoil(value ? 'IN' : 'OUT');\n return null;\n }\n console.log('BeamviewerSimulator: Unsupported call', name, value);\n return null;\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n if (name === 'diode_range') {\n setDiodeRange(value);\n return;\n }\n console.log('BeamviewerSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = {\n state: 'ON',\n led,\n screen,\n foil,\n diode_range: diodeRange,\n diode_ranges: diodeRanges,\n };\n\n console.log(properties);\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 { State } from '../utils/State';\nimport type { EnergyManagerSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function EnergyManagerState(props: { hardware: EnergyManagerSchema }) {\n const { hardware } = props;\n const { energy = null } = hardware.properties ?? {};\n const energyState =\n energy !== null || Number.isFinite(energy) ? 'VALID' : 'INVALID';\n const state = hardware.online ? energyState : 'OFFLINE';\n const variants: { [state: string]: string } = {\n VALID: 'success',\n INVALID: 'danger',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State state={state} minWidth={7} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<EnergyManagerSchema>\n) {\n const { hardware } = props;\n return <EnergyManagerState hardware={hardware} />;\n}\n","import { Button, InputGroup, Dropdown } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport type { EnergyManagerSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport { HardwareTemplate } from '../..';\nimport { EnergyManagerState } from './EnergyManagerState';\nimport { useMemo } from 'react';\n\nfunction DropdownSources(props: HardwareWidgetProps<EnergyManagerSchema>) {\n const { hardware, disabled = false } = props;\n const { properties } = hardware;\n const { source = null, available_source_names: sourceNames = [] } =\n properties;\n\n const selectedSource = source?.slice('hardware:'.length);\n\n function selectSource(sourceName: string) {\n void hardware.actions.setProperty('source', `hardware:${sourceName}`);\n }\n\n function createSelectableItem(sourceName: string) {\n const selected = selectedSource === sourceName;\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={sourceName}\n disabled={disabled}\n onClick={() => {\n selectSource(sourceName);\n }}\n title={`Select the source ${sourceName}`}\n >\n <i className={icon} />\n &nbsp; {sourceName}\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 {sourceNames.map((s) => createSelectableItem(s))}\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport function EnergyManagerDefault(\n props: HardwareWidgetProps<EnergyManagerSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { properties = {} } = hardware;\n const { energy, unit, source } = properties;\n\n const widgetIcon = (\n <TypeIcon\n name=\"Energymanager\"\n icon=\"fam-hardware-multiposition\"\n online={hardware.online}\n />\n );\n\n const widgetState = <EnergyManagerState hardware={hardware} />;\n\n function formatEnergy(energy: undefined | number | null) {\n if (energy === undefined) {\n return 'Unknown';\n }\n if (energy === null) {\n return '∅';\n }\n if (Number.isFinite(energy)) {\n return energy.toFixed(2);\n }\n // inf and nan\n return '∅';\n }\n\n const sourceName = useMemo(() => {\n if (source === undefined) {\n return 'Unknown';\n }\n const sourceName = source.slice('hardware:'.length);\n if (sourceName === '') {\n return 'No source';\n }\n return sourceName;\n }, [source]);\n\n function getWidgetContent() {\n return (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text>{sourceName}</InputGroup.Text>\n <ReadOnlyTextInput value={formatEnergy(energy)} />\n {!disabled && <DropdownSources {...props} />}\n {unit && <InputGroup.Text>{unit}</InputGroup.Text>}\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 { useMemo } from 'react';\nimport type {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport type { EnergyManagerSchema } from '.';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\nimport { Badge } from 'react-bootstrap';\n\nexport function EnergyManagerMonitor(\n props: HardwareWidgetProps<EnergyManagerSchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const { source, energy, unit } = properties;\n\n function formatEnergy(\n energy: undefined | number | null,\n unit: string | undefined\n ) {\n if (energy === undefined || unit === undefined) {\n return 'Unknown';\n }\n if (energy === null) {\n return '∅';\n }\n if (Number.isFinite(energy)) {\n return `${energy.toFixed(2)} ${unit}`;\n }\n // inf and nan\n return '∅';\n }\n\n const sourceName = useMemo(() => {\n if (source === undefined) {\n return 'Unknown';\n }\n const sourceName = source.slice('hardware:'.length);\n if (sourceName === '') {\n return 'No source';\n }\n return sourceName;\n }, [source]);\n\n const text = formatEnergy(energy, unit);\n const bgVariant = text !== '∅' ? 'success' : 'danger';\n return (\n <MonitorPanelItem>\n <h1>{options.name ?? sourceName}</h1>\n <Badge bg={bgVariant}>{text}</Badge>\n </MonitorPanelItem>\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport { EnergyManagerDefault } from './EnergyManagerDefault';\nimport { EnergyManagerMonitor } from './EnergyManagerMonitor';\nimport { EnergyManagerState } from './EnergyManagerState';\n\nexport type EnergyManagerSchema = Hardware<{\n energy: number | null;\n unit: string;\n available_source_names: string[];\n source: string;\n}>;\n\nconst Variants: HardwareVariant<EnergyManagerSchema> = {\n default: EnergyManagerDefault,\n // Override base state\n state: EnergyManagerState,\n // Override default monitor\n monitor: EnergyManagerMonitor,\n};\n\nexport default Variants;\n","import defaultjson from './EnergyManager.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useMemo, useState } from 'react';\nimport { Simulator } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nconst ENERGIES: Record<string, number | null> = {\n pink_beam: 1.2,\n dcm: 15.6,\n dcm_off: null,\n};\n\nexport default function EnergyManagerSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [source, setSource] = useState<string>('pink_beam');\n\n async function call(name: string, value?: any): Promise<void> {\n console.log('MultipositionSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n if (name === 'source') {\n const shortName = value.slice('hardware:'.length);\n setSource(shortName);\n return;\n }\n console.log('EnergyManagerSimulator: Unsupported setProperty', name, value);\n }\n\n const sourceNames = useMemo(() => {\n return Object.keys(ENERGIES).map((key) => {\n return key;\n });\n }, []);\n\n const properties = {\n energy: ENERGIES[source] ?? null,\n unit: 'keV',\n source: `hardware:${source}`,\n available_source_names: sourceNames,\n };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"energymanager\"\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 { Badge, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport type { FrontendSchema } from '.';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\n\nfunction getValidityStyle(state: string) {\n switch (state) {\n case 'OPEN':\n case 'RUNNING':\n return 'success';\n }\n return 'danger';\n}\n\nfunction FrontendMonitor(\n props: HardwareWidgetProps<FrontendSchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const { state = 'OFFLINE', status } = properties;\n\n const name = options.name ?? hardware.alias ?? hardware.name;\n\n const checkClass = getValidityStyle(state);\n\n const widget = (\n <MonitorPanelItem>\n <h1>{name}</h1>\n <Badge bg={checkClass}>{`${state}`}</Badge>\n </MonitorPanelItem>\n );\n\n if (status) {\n const overlayStr = `${status}`;\n return (\n <OverlayTrigger\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 {widget}\n </OverlayTrigger>\n );\n }\n\n return widget;\n}\n\nexport default FrontendMonitor;\n","import type { HardwareVariant } from '../utils/types';\nimport type { Hardware } from '../utils/types';\nimport Frontend from './Frontend';\nimport FrontendMonitor from './FrontendMonitor';\n\nexport type FrontendSchema = Hardware<{\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\nconst Variants: HardwareVariant<FrontendSchema> = {\n default: Frontend,\n // Override default monitor\n monitor: FrontendMonitor,\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 type GaugeSchema = Hardware<{\n state: string;\n status: string;\n pressure: number;\n unit?: string; // FIXME: The server implementation is missing\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 { State } 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 <State\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 type LaserSchema = Hardware<{\n state: string;\n power: number;\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 { State } 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 <State\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 type LaserHeatingSchema = Hardware<{\n state: string;\n exposure_time: number;\n background_mode: 'ON' | 'OFF' | 'ALWAYS';\n fit_wavelength: number[];\n current_calibration: string;\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 type LightSchema = Hardware<{\n state: string;\n temperature: number;\n intensity: number;\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 { State } 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 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: 'transient',\n READY: 'success',\n OFFLINE: 'secondary',\n LOCKED: 'warning',\n };\n const variant = variants[finalState] ?? variants.UNKNOWN;\n return <State 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 { binning, binning_mode: binningMode = 'SUM' } = properties;\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 if (binning === undefined) {\n return (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text title=\"Binning applied to the detector\">\n <i className=\"fa fa-fw fam-binning-2d fa-2x\" />\n </InputGroup.Text>\n <ReadOnlyTextInput value=\"? × ?\" />\n </InputGroup>\n );\n }\n\n const [bh, bv] = binning ?? [0, 0];\n const b = bh === bv ? bh : 0;\n\n return (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text title=\"Binning applied to the detector\">\n <i className=\"fa fa-fw fam-binning-2d fa-2x\" />\n </InputGroup.Text>\n <ReadOnlyTextInput value={`${binning[0]} × ${binning[1]}`} />\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 {\n AnyHardware,\n Hardware,\n HardwareChangeActions,\n HardwareSchemaDescription,\n} from '../hardware/utils/types';\n\ninterface RuntimeHooks {\n useHardware?: (id: string | null) => AnyHardware | null;\n useHardwareChangeActions?: (name: string | null) => HardwareChangeActions;\n useHardwareSchema?: (\n hardware: { id: string; type: string } | null\n ) => HardwareSchemaDescription | null;\n useOperator?: () => boolean;\n useScanRunning?: () => boolean;\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 if (hooks.useHardwareSchema) {\n if (runtimeHooks.useHardwareSchema) {\n console.warn('useHardwareSchema hook was already registered');\n }\n runtimeHooks.useHardwareSchema = hooks.useHardwareSchema;\n }\n if (hooks.useOperator) {\n if (runtimeHooks.useOperator) {\n console.warn('useOperator hook was already registered');\n }\n runtimeHooks.useOperator = hooks.useOperator;\n }\n if (hooks.useScanRunning) {\n if (runtimeHooks.useScanRunning) {\n console.warn('useScanRunning hook was already registered');\n }\n runtimeHooks.useScanRunning = hooks.useScanRunning;\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): AnyHardware | 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\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 useHardwareSchema(\n hardware: { id: string; type: string } | null\n): HardwareSchemaDescription | null {\n if (!runtimeHooks.useHardwareSchema) {\n throw new Error('No `useHardwareSchema` hook registered');\n }\n return runtimeHooks.useHardwareSchema(hardware);\n}\n\n/**\n * True if the actual user can control the beamline (like moving motors)\n */\nexport function useOperator(): boolean {\n if (!runtimeHooks.useOperator) {\n throw new Error('No `useOperator` hook registered');\n }\n return runtimeHooks.useOperator();\n}\n\n/**\n * True if a scan is actually running\n */\nexport function useScanRunning(): boolean {\n if (!runtimeHooks.useScanRunning) {\n throw new Error('No `useScanRunning` hook registered');\n }\n return runtimeHooks.useScanRunning();\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\nexport interface LimaProperties extends Record<string, unknown> {\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/**\n * Hardware as exposed by Redux\n */\nexport type LimaSchema = Hardware<LimaProperties>;\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 { LimaProperties } 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<LimaProperties>({\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: LimaProperties,\n binning: [number, number]\n ): LimaProperties {\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: LimaProperties,\n binningMode: 'SUM' | 'MEAN'\n ): LimaProperties {\n return {\n ...props,\n binning_mode: binningMode,\n };\n }\n\n function changeRotation(\n props: LimaProperties,\n rotation: 0 | 90 | 180 | 270\n ): LimaProperties {\n return {\n ...props,\n rotation,\n };\n }\n\n function changeFlipX(props: LimaProperties, flip: boolean): LimaProperties {\n return {\n ...props,\n flip: [flip, props.flip[1]],\n };\n }\n function changeFlipY(props: LimaProperties, flip: boolean): LimaProperties {\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 Alert,\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';\nimport HardwareTemplate from '../utils/HardwareTemplate';\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\nfunction WidgetContent(props: HardwareWidgetProps<MeasurementGroupSchema>) {\n const { hardware, disabled = false } = props;\n const { online } = hardware;\n\n if (!online) {\n return <Alert>Offline</Alert>;\n }\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 return (\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 );\n}\n\nexport default function MeasurementGroup(\n props: HardwareWidgetProps<MeasurementGroupSchema>\n) {\n const { hardware, options = {}, disabled = false } = props;\n\n function setActive() {\n return hardware.actions.call('set_active');\n }\n\n const active = false;\n\n const headerMode = options.header ?? 'top';\n\n const widgetIcon = (\n <TypeIcon name=\"Measurement Group\" icon=\"fa-list-ol\" online />\n );\n\n const widgetState = (\n <>\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 </>\n );\n\n const widgetContent = <WidgetContent {...props} />;\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 MeasurementGroup from './MeasurementGroup';\n\nexport interface MeasurementGroupProperties extends Record<string, unknown> {\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/**\n * Hardware as exposed by Redux\n */\nexport type MeasurementGroupSchema = Hardware<MeasurementGroupProperties>;\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 { MeasurementGroupProperties } from '..';\n\nexport default function MeasurementGroupSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [properties, setProperties] = useState<MeasurementGroupProperties>({\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 { MultiState } 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: 'transient',\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?.reason ?? ' an object'}`;\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 <MultiState\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, hardware } = props;\n const { properties } = hardware;\n function onMoveVelocityRequested(target: number) {\n return hardware.actions.setProperty('velocity', target);\n }\n\n function onMoveAccelerationRequested(target: number) {\n return 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>{hardware.name} details</Popover.Header>\n <Popover.Body>\n <Form.Group>\n <Form.Label>Velocity</Form.Label>\n <HardwareInputNumber\n hardwareValue={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={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 { useState } from 'react';\nimport type {\n InteractiveHookEvent,\n InteractiveHookResult,\n} from '@vallsv/rc-knob';\nimport { Knob, Value, Pointer, Scale, Range, Label } from '@vallsv/rc-knob';\n\n/**\n * FIXME: Have to be replaced by\n */\nconst sassVariables = {\n background: 'hsl(0 0% 98%)',\n backgroundD10: 'hsl(0 0% 88%)',\n disabled0: 'hsl(0, 0%, 93%)',\n disabledD10: 'hsl(0, 0%, 83%)',\n danger: 'rgb(220, 53, 69)',\n // Edited by the user, but not yet validated\n edited: 'hsl(45, 100%, 71.4%)',\n transient: '#4285eb',\n text: 'black',\n textD10: 'black',\n};\n\nconst Origin: Record<string, number> = {\n up: 0,\n right: -90,\n down: 180,\n left: 90,\n};\n\ninterface Props {\n size: number;\n value?: number | null;\n target?: number | null;\n min?: number; // TODO: to be implemented\n max?: number; // TODO: to be implemented\n disabled?: boolean;\n readOnly?: boolean;\n origin?: 'up' | 'down' | 'left' | 'right';\n direction?: 'clockwise' | 'anticlockwise';\n onChange?: (value: number) => void;\n onInteractiveChange?: (value: number) => void;\n className: string;\n}\n\n/**\n * Widget to handle cyclic angle value in degree displayed as an infinite knob\n */\nexport default function InfiniteKnob360(props: Props) {\n const {\n size,\n value = null,\n target = null,\n min = null,\n max = null,\n disabled = false,\n readOnly = false,\n origin = 'up',\n direction = 'clockwise',\n onChange = (angle: number) => {},\n onInteractiveChange = null,\n className,\n } = props;\n const [editedValue, setEditedValue] = useState<number | null>(null);\n function onKnobEnd() {\n setEditedValue(null);\n }\n\n function onKnobInteractiveChange(angle: number) {\n setEditedValue(angle);\n if (onInteractiveChange) {\n onInteractiveChange(angle);\n }\n }\n\n const tickSize = 8;\n const tickMargin = 5;\n const pointerMargin = 12;\n const outerTickRadius = size * 0.5;\n const outerKnobRadius = outerTickRadius - tickMargin - tickSize;\n const pointerSize = 4;\n const pointerPosRadius = outerKnobRadius - pointerMargin - pointerSize / 2;\n const editable = !disabled && !readOnly;\n const shadowWidth = 5;\n const localTarget = editedValue !== null ? editedValue : target;\n\n function interactiveHook(e: InteractiveHookEvent): InteractiveHookResult {\n if (e.mouseRadius < outerKnobRadius / 3) {\n return { readOnly: true };\n }\n if (e.ctrlKey) {\n return { steps: 8 };\n }\n if (\n outerTickRadius - tickSize - tickMargin <= e.mouseRadius &&\n e.mouseRadius <= outerTickRadius + tickMargin\n ) {\n return { steps: 8 };\n }\n return {};\n }\n\n function getUnreachableRange(): [number, number] | null {\n if (value === null) {\n // if the hardware is offline\n return null;\n }\n if (min === null || max === null) {\n return null;\n }\n const range = max - min;\n if (range >= 360) {\n return null;\n }\n return [(max - 360) / 360, (max - 360 + 360 - range) / 360];\n }\n\n const unrachableRange = getUnreachableRange();\n\n const angleRange = direction === 'clockwise' ? 360 : -360;\n const angleOffset = Origin[origin] + (direction === 'clockwise' ? 0 : 360);\n\n return (\n <Knob\n size={size}\n value={value}\n angleOffset={angleOffset}\n angleRange={angleRange}\n min={0}\n max={360}\n multiRotation\n onChange={onChange}\n onInteractiveChange={onKnobInteractiveChange}\n interactiveHook={interactiveHook}\n onEnd={onKnobEnd}\n readOnly={!editable}\n tracking={false}\n useMouseWheel={false}\n className={className}\n >\n <defs>\n <radialGradient\n id=\"knob-shadow\"\n cx={size / 2}\n cy={size / 2}\n fx={size * 0.75}\n fy={size * 0.75}\n r={outerKnobRadius + shadowWidth}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop\n offset={outerKnobRadius / (outerKnobRadius + shadowWidth)}\n stopColor={sassVariables.backgroundD10}\n stopOpacity=\"0.1\"\n />\n <stop\n offset={1}\n stopColor={sassVariables.backgroundD10}\n stopOpacity=\"0\"\n />\n </radialGradient>\n <linearGradient\n id=\"knob-enabled\"\n x1={0}\n y1={size / 2 - outerKnobRadius}\n x2={0}\n y2={size / 2 + outerKnobRadius}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop offset=\"0%\" stopColor={sassVariables.backgroundD10} />\n <stop offset=\"30%\" stopColor={sassVariables.background} />\n <stop offset=\"70%\" stopColor={sassVariables.background} />\n <stop offset=\"100%\" stopColor={sassVariables.backgroundD10} />\n </linearGradient>\n <linearGradient\n id=\"knob-disabled\"\n x1={0}\n y1={size / 2 - outerKnobRadius}\n x2={0}\n y2={size / 2 + outerKnobRadius}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop offset=\"0%\" stopColor={sassVariables.disabledD10} />\n <stop offset=\"30%\" stopColor={sassVariables.disabled0} />\n <stop offset=\"70%\" stopColor={sassVariables.disabled0} />\n <stop offset=\"100%\" stopColor={sassVariables.disabledD10} />\n </linearGradient>\n </defs>\n <circle\n r={outerKnobRadius + shadowWidth}\n cx={size / 2}\n cy={size / 2}\n fill=\"url(#knob-shadow)\"\n />\n <circle\n r={outerKnobRadius}\n cx={size / 2}\n cy={size / 2}\n fill={editable ? 'url(#knob-enabled)' : 'url(#knob-disabled)'}\n />\n {unrachableRange && (\n <Range\n percentageFrom={unrachableRange[0]}\n percentageTo={unrachableRange[1]}\n radius={outerTickRadius}\n color={sassVariables.danger}\n arcWidth={tickSize}\n />\n )}\n <Scale\n steps={8}\n tickWidth={2}\n tickHeight={tickSize}\n radius={outerTickRadius}\n color={sassVariables.textD10}\n />\n <Scale\n steps={32}\n tickWidth={1}\n tickHeight={tickSize / 2}\n radius={outerTickRadius}\n color={sassVariables.textD10}\n />\n <Label\n percentage={0.1}\n radius={outerTickRadius + 6}\n label=\"+\"\n style={{ fontSize: '80%', fontWeight: 'bold' }}\n />\n <Label\n percentage={-0.1}\n radius={outerTickRadius + 6}\n label=\"-\"\n style={{ fontSize: '80%', fontWeight: 'bold' }}\n />\n {localTarget !== null && value !== null && (\n <Range\n percentageFrom={value / 360}\n percentageTo={localTarget / 360}\n radius={pointerPosRadius + pointerSize * 1.5}\n color={\n editedValue !== null\n ? sassVariables.edited\n : sassVariables.transient\n }\n arcWidth={pointerSize}\n />\n )}\n {localTarget !== null && (\n <Pointer\n percentage={localTarget / 360}\n width={pointerSize}\n height={pointerSize}\n radius={pointerPosRadius}\n type=\"circle\"\n color={\n editedValue !== null\n ? sassVariables.edited\n : sassVariables.transient\n }\n />\n )}\n <Pointer\n percentage={0}\n width={2.5}\n height={tickSize}\n radius={outerTickRadius - tickSize * 1.5}\n type=\"circle\"\n color={sassVariables.text}\n />\n {value !== null && (\n <Pointer\n percentage={value / 360}\n width={pointerSize}\n height={pointerSize}\n radius={pointerPosRadius}\n type=\"circle\"\n color={sassVariables.text}\n />\n )}\n <Value\n value={editedValue !== null ? editedValue : value}\n decimalPlace={1}\n marginBottom={size / 2}\n className=\"knob-text\"\n />\n </Knob>\n );\n}\n","import { useDebouncedCallback } from '@react-hookz/web';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { MotorSchema } from '.';\nimport { isMotorClockWise, motorLimits, useMotorStates } from '.';\nimport { MotorState } from './MotorState';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport type { MotorDefaultOptions } from './options';\nimport InfiniteKnob360 from '../../components/InfiniteKnob360';\n\nexport default function MotorRotation(\n props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>\n) {\n const { hardware, options = {} } = props;\n\n // This have to be debounced as workaround cause it can be called twice\n const moveHardware = useDebouncedCallback(\n (value: number) => {\n hardware.actions.call('move', value);\n },\n [hardware.actions],\n 100\n );\n\n const states = useMotorStates(hardware.properties.state, hardware.user_tags);\n const target = states.MOVING ? hardware.properties.target : undefined;\n const isClockWise = isMotorClockWise(hardware, options);\n\n const widgetIcon = (\n <TypeIcon\n name=\"Motor\"\n icon=\"fam-hardware-motor-r\"\n online={hardware.online}\n />\n );\n const limits = motorLimits(hardware);\n\n const widgetState = <MotorState hardware={hardware} />;\n\n const widgetContent = (\n <InfiniteKnob360\n className=\"mx-auto my-auto\"\n size={100}\n value={hardware.properties.position}\n min={limits[0]}\n max={limits[1]}\n target={target}\n onChange={moveHardware}\n disabled={props.disabled}\n readOnly={options.readOnly || !states.READY}\n origin=\"down\"\n direction={isClockWise ? 'clockwise' : 'anticlockwise'}\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 {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport { type MotorStates, useMotorStates, type MotorSchema } from '.';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\nimport { Badge } from 'react-bootstrap';\n\nfunction getStyle(online: boolean, states: MotorStates) {\n if (!online) {\n return 'secondary';\n }\n if (states.FAULT) {\n return 'danger';\n }\n if (states.MOVING) {\n return 'transient';\n }\n return 'secondary';\n}\n\nfunction MotorMonitor(\n props: HardwareWidgetProps<MotorSchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n const { online = false, properties = {} } = hardware;\n const { state, position, unit = null, display_digits } = properties;\n const states = useMotorStates(state, []);\n\n const name = options.name ?? hardware.alias ?? hardware.name ?? hardware.id;\n\n const bgVariant = getStyle(online, states);\n\n function getText() {\n let text = '';\n if (position !== undefined) {\n if (position === null) {\n text = 'null';\n } else if (Number.isFinite(position)) {\n text += position.toFixed(display_digits ?? 2);\n } else {\n text = `${position}`;\n }\n }\n if (unit !== null && unit !== '') {\n text = `${text} ${unit}`;\n }\n return text;\n }\n\n const text = getText();\n\n return (\n <MonitorPanelItem>\n <h1>{name}</h1>\n <Badge bg={bgVariant}>{text}</Badge>\n </MonitorPanelItem>\n );\n}\n\nexport default MotorMonitor;\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 MotorRotation from './MotorRotation';\nimport MotorState from './MotorState';\nimport MotorMonitor from './MotorMonitor';\n\nexport type MotorSchema = Hardware<{\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 * 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 rotation: MotorRotation,\n // Override base state\n state: MotorState,\n // Override base monitor\n monitor: MotorMonitor,\n};\n\n/**\n * True if the motor positon is clock wise.\n *\n * This is based on dial metadata, and user sign.\n */\nexport function isMotorClockWise(\n hardware: MotorSchema,\n options?: { clockwise?: boolean }\n): boolean {\n if (options?.clockwise !== undefined) {\n return options.clockwise;\n }\n const inverted = hardware.properties.sign < 0;\n const anticlockwiseTag = hardware.user_tags.includes('dial.anticlockwise');\n const clockwiseTag = hardware.user_tags.includes('dial.clockwise');\n if (clockwiseTag && anticlockwiseTag) {\n console.error(\n \"Both tags 'dial.clockwise' and 'dial.anticlockwise' are defined\"\n );\n }\n const clockwise = clockwiseTag || !anticlockwiseTag;\n return clockwise !== inverted;\n}\n\n/**\n * Normalize the limits as finite values or `undefined`.\n */\nexport function motorLimits(\n hardware: MotorSchema\n): [number | undefined, number | undefined] {\n const limits = hardware.properties?.limits;\n if (limits === undefined || limits === null) {\n return [undefined, undefined];\n }\n const [min, max] = limits;\n\n return [\n Number.isFinite(min) ? min : undefined,\n Number.isFinite(max) ? max : undefined,\n ];\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 { useCallback, useEffect, useMemo, useRef, useState } 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 type { MultipositionSchema } from '.';\nimport { Badge } from 'react-bootstrap';\n\nexport default function MultipositionState(props: {\n hardware: MultipositionSchema;\n}) {\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 OFFLINE: 'secondary',\n READY: 'success',\n MOVING: 'transient',\n ERROR: 'danger',\n UNKNOWN: 'fatal',\n LOCKED: 'warning',\n };\n\n const variant = variantMapping[state] || 'success';\n\n return <Badge bg={variant}>{state}</Badge>;\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';\nimport MultipositionState from './MultipositionState';\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 <MultipositionState hardware={hardware} />\n </div>\n <div className=\"hw-content\">\n <InputGroup className=\"flex-nowrap\">\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 { forwardRef } from 'react';\nimport { Dropdown, DropdownMenu, DropdownToggle } from 'react-bootstrap';\nimport type { DropdownButtonProps } from 'react-bootstrap';\n\n/**\n * Extra properties passed to the toggle component.\n *\n * FIXME: Would be nice to remove it at some point\n */\ninterface DropdownButtonProps2 {\n style?: Record<string, unknown>;\n className?: string;\n popperConfig?: Record<string, unknown>;\n}\n\n/**\n * Same as DropdownButton, but propagate the `style` and the `className` into\n * the toggle button.\n *\n * TODO: Try to request this change upstream.\n */\nconst DropdownButton2 = forwardRef<\n HTMLDivElement,\n DropdownButtonProps & DropdownButtonProps2\n>(\n (\n {\n title,\n children,\n bsPrefix,\n rootCloseEvent,\n variant,\n size,\n menuRole,\n renderMenuOnMount,\n disabled,\n href,\n id,\n menuVariant,\n flip,\n style,\n className,\n popperConfig,\n ...props\n },\n ref\n ) => (\n <Dropdown ref={ref} {...props}>\n <DropdownToggle\n id={id}\n href={href}\n size={size}\n variant={variant}\n disabled={disabled}\n childBsPrefix={bsPrefix}\n style={style}\n className={className}\n >\n {title}\n </DropdownToggle>\n <DropdownMenu\n popperConfig={popperConfig}\n role={menuRole}\n renderOnMount={renderMenuOnMount}\n rootCloseEvent={rootCloseEvent}\n variant={menuVariant}\n flip={flip}\n >\n {children}\n </DropdownMenu>\n </Dropdown>\n )\n);\n\nDropdownButton2.displayName = 'DropdownButton2';\nexport default DropdownButton2;\n","import {\n Button,\n InputGroup,\n Dropdown,\n Badge,\n Col,\n Row,\n Form,\n Container,\n CloseButton,\n} from 'react-bootstrap';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { MultipositionSchema } from '.';\nimport type {\n HardwareWidgetOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport { HardwareTemplate } from '../..';\nimport MultipositionState from './MultipositionState';\nimport DropdownButton2 from '../../components/DropdownButton2';\nimport { useMemo, useState } from 'react';\n\nexport interface MultipositionDefault2Options extends HardwareWidgetOptions {\n /**\n * Display a search input\n */\n search?: boolean;\n}\n\n/**\n * Information related to a specific position.\n */\ntype Position = MultipositionSchema['properties']['positions'][0];\n\nfunction PositionItem(props: {\n currentPositionId: string | null;\n position: Position;\n disabled: boolean;\n onSelect: (positionId: string) => void;\n filter: string;\n}) {\n const { currentPositionId, position, disabled, onSelect, filter } = props;\n const positionId = position.position;\n const selected = positionId === currentPositionId;\n const icon = selected ? 'fa fa-fw fa-dot-circle-o' : 'fa fa-fw fa-circle-o';\n\n const containsFilter = useMemo(() => {\n if (filter === '') {\n return true;\n }\n const f = filter.toLowerCase();\n return (\n position.position?.toLowerCase().includes(f) ||\n position.description?.toLowerCase().includes(f)\n );\n }, [filter, position]);\n\n if (!containsFilter) {\n return <></>;\n }\n\n return (\n <Dropdown.Item\n key={position.position}\n disabled={disabled}\n onClick={() => {\n onSelect(positionId);\n }}\n title={position.description}\n >\n <Row className=\"gx-0 nowrap\">\n <Col sm=\"1\">\n <i className={icon} />\n </Col>\n <Col sm=\"2\">\n <Badge\n className=\"small w-100\"\n bg={selected ? 'primary' : 'secondary'}\n >\n <span className=\"secondary\">\n <span className=\"text-truncate w-50\">{positionId}</span>\n </span>\n </Badge>\n </Col>\n </Row>\n <Row className=\"gx-0 nowrap\">\n <Col sm=\"1\" />\n <Col sm=\"11\">\n <Row className=\"gx-0\">\n <Col sm=\"12\" className=\"text-truncate text-start\">\n {position.description}\n </Col>\n </Row>\n </Col>\n </Row>\n </Dropdown.Item>\n );\n}\n\nfunction getPosition(\n positionId: string | null,\n positions: Position[]\n): Position | null {\n if (positionId === null) {\n return null;\n }\n for (const p of positions) {\n if (positionId === p.position) {\n return p;\n }\n }\n return null;\n}\n\nfunction Header(props: {\n positionId: string | null;\n targetPositionId: string | null;\n hardware: MultipositionSchema;\n}) {\n const { positionId, targetPositionId, hardware } = props;\n const { properties = {} } = hardware;\n const { positions = [] } = properties;\n\n function getBadge() {\n if (targetPositionId) {\n return <Badge bg=\"transient\">{targetPositionId}</Badge>;\n }\n if (positionId) {\n return <Badge>{positionId}</Badge>;\n }\n return <Badge bg=\"warning\">unknown</Badge>;\n }\n\n const badge = getBadge();\n const description = useMemo(() => {\n if (targetPositionId) {\n // In the future we will be able to tell where it goes\n return 'Moving...';\n }\n const position = getPosition(positionId, positions);\n if (position === null) {\n return 'Position not described';\n }\n return position.description ?? '';\n }, [targetPositionId, positionId, positions]);\n\n return (\n <>\n {badge}\n <div\n className=\"text-truncate text-start ms-2 flex-grow-1 flex-shrink-1\"\n title={description}\n style={{ flex: '1 1 0', minWidth: 0 }}\n >\n {description}\n </div>\n </>\n );\n}\n\nexport default function Multiposition(\n props: HardwareWidgetProps<MultipositionSchema, MultipositionDefault2Options>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const hardwareReady = properties.state === 'READY';\n const hardwareIsMoving = properties?.state === 'MOVING';\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n\n function moveTo(positionId: string) {\n void hardware.actions.call('move', positionId);\n }\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 = <MultipositionState hardware={hardware} />;\n\n // In the future we will be able to know the target\n // for now, use 'moving' as place holder\n const targetPositionId = hardwareIsMoving ? 'moving' : null;\n\n function normalizePositionId(): string | null {\n const p = hardware.properties?.position ?? null;\n if (p === 'unknown') {\n // BLISS <= 2.3\n return null;\n }\n return p;\n }\n\n const positionId = normalizePositionId();\n const [filter, setFilter] = useState('');\n\n function getWidgetContent() {\n return (\n <InputGroup className=\"flex-nowrap\" style={{ alignItems: 'stretch' }}>\n <DropdownButton2\n variant=\"secondary\"\n title={\n <Header\n positionId={positionId}\n targetPositionId={targetPositionId}\n hardware={hardware}\n />\n }\n disabled={disabled}\n popperConfig={{ strategy: 'fixed' }}\n className=\"flex-grow-1 d-flex flex-nowrap align-items-center\"\n style={{ flex: '1 1 0', minWidth: 0 }}\n >\n {options.search && (\n <Container className=\"d-flex justify-content-center align-items-center\">\n <i className=\"fa fa-search fa-fw flex-shrink\" />\n <Form.Control\n autoFocus\n className=\"mx-1 my-2 w-50\"\n style={{ marginLeft: 'auto', marginRight: 'auto' }}\n placeholder=\"Type to filter...\"\n onChange={(e) => setFilter(e.target.value)}\n value={filter}\n />\n <CloseButton\n disabled={filter === ''}\n onClick={() => {\n setFilter('');\n }}\n />\n </Container>\n )}\n {properties.positions.map((positionDesc) => (\n <PositionItem\n currentPositionId={positionId}\n position={positionDesc}\n onSelect={(positionId) => {\n moveTo(positionId);\n }}\n disabled={disabled}\n filter={filter}\n />\n ))}\n {options.search && filter !== '' && (\n <>\n <Dropdown.Divider />\n <Dropdown.Item\n onClick={(e) => {\n setFilter('');\n e.stopPropagation();\n }}\n >\n Display all the positions...\n </Dropdown.Item>\n </>\n )}\n </DropdownButton2>\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';\nimport MultipositionState from './MultipositionState';\n\nexport type MultipositionSchema = Hardware<{\n /**\n * Actual position\n */\n position:\n | string\n // Compatibility with BLISS <= 2.3\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n | 'unknown'\n // BLISS >= 2.4\n | null;\n\n /**\n * Actual state of the device.\n *\n * Can be any state of a motor.\n */\n state: 'MOVING' | 'OFF' | 'READY' | 'FAULT' | 'DISABLED' | 'UNKNOWN';\n\n /**\n * Described positions\n */\n positions: {\n /**\n * Identifier of the position\n */\n position: string;\n\n /**\n * Human readable description\n */\n description?: string;\n\n /**\n * Location of this position represented by a set of motor/position\n */\n target: {\n object: string;\n destination: number | string;\n tolerance?: number;\n }[];\n }[];\n}>;\n\nconst Variants: HardwareVariant<MultipositionSchema> = {\n state: MultipositionState,\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 { State } 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: 'transient',\n INVALID: 'danger',\n UNKNOWN: 'danger',\n DISABLED: 'secondary',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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\nexport interface OpticProperties extends Record<string, unknown> {\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/**\n * Hardware as exposed by Redux\n */\nexport type OpticSchema = Hardware<OpticProperties>;\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 { OpticProperties } 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<OpticProperties>({\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 { State } 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: 'transient',\n ABORTING: 'warning',\n AWAITING_USER_INPUT: 'warning',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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 EditableHardware,\n HardwareWidgetOptions,\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\ninterface ProcedureOptions extends HardwareWidgetOptions {\n /**\n * If true, execute the procedure in the BLISS session foreground.\n *\n * As result, the terminal first have to be available to\n * start the procedure, else it fails.\n *\n * Also, as it takes the prompt, it is visible by the users,\n * so they have to kill or to wait for the end before doing\n * anything else.\n */\n foreground?: boolean;\n}\n\nfunction Actions(props: {\n hardware: EditableHardware<ProcedureSchema>;\n disabled: boolean;\n options: ProcedureOptions;\n}) {\n const { hardware, options } = 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 if (options.foreground) {\n // FIXME: This function is a workaround, and only available in Daiquiri server\n void hardware.actions.call('run_foreground');\n } else {\n void hardware.actions.call('start');\n }\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, ProcedureOptions>\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\n hardware={hardware}\n disabled={!props.operator}\n options={options}\n />\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';\nimport { useHardware } from '../../registry/hooks';\n\nexport type ProcedureSchema = Hardware<{\n state: string;\n previous_run_state: string;\n previous_run_exception: string | null;\n parameters: Record<string, any>;\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 key?: string;\n}\n\nexport interface ExceptionFromProcedure {\n __type__: 'exception';\n class: string;\n message: string;\n traceback: Record<string, any>;\n}\n\nexport function isProcedureHardware(\n entity: Hardware\n): entity is ProcedureSchema {\n return entity.type === 'procedure';\n}\n\n/**\n * Return a procedure 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 useProcedureHardware(\n name: string | null\n): ProcedureSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isProcedureHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import standby from './ProcedureStandBy.json';\n\nexport const Mocks = {\n standby,\n};\n","import type { ShutterSchema } from '.';\nimport { State } 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 'OFFLINE':\n case 'DISABLED':\n return 'secondary';\n case 'MOVING':\n return 'transient';\n case 'STANDBY':\n return 'warning';\n case 'FAULT':\n return 'fatal';\n default:\n return 'fatal';\n }\n }\n\n return <State 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: 'transient',\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: 'transient',\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 { OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport type { ShutterSchema } from '.';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\nimport { ShutterState } from './ShutterState';\n\nfunction ShutterMonitor(\n props: HardwareWidgetProps<ShutterSchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const { state = 'OFFLINE', status } = properties;\n\n const name = options.name ?? hardware.alias ?? hardware.name;\n\n const widget = (\n <MonitorPanelItem>\n <h1>{name}</h1>\n <ShutterState hardware={hardware} />\n </MonitorPanelItem>\n );\n\n if (status) {\n const overlayStr = `${status}`;\n return (\n <OverlayTrigger\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 {widget}\n </OverlayTrigger>\n );\n }\n\n return widget;\n}\n\nexport default ShutterMonitor;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport ShutterDefault from './ShutterDefault';\nimport ShutterProtected from './ShutterProtected';\nimport ShutterState from './ShutterState';\nimport ShutterMonitor from './ShutterMonitor';\n\nexport type ShutterSchema = Hardware<{\n state: string;\n status: string;\n valid: boolean;\n open_text: string;\n closed_text: string;\n}>;\n\nconst Variants: HardwareVariant<ShutterSchema> = {\n default: ShutterDefault,\n protected: ShutterProtected,\n // Override default state\n state: ShutterState,\n // Override default monitor\n monitor: ShutterMonitor,\n};\n\nexport default Variants;\n","import defaultjson from './BeamShutter.json';\nimport closed from './BeamShutterClosed.json';\n\nexport const Mocks = {\n default: defaultjson,\n closed,\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 { State } 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 (!hardware.online) {\n return ['OFFLINE', 'secondary', 'No motor online'];\n }\n\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', 'transient', '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 }, [hardware.online, info]);\n\n return (\n <State\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, 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 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 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 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 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 type SlitSchema = Hardware<{\n state: string;\n type: 'vertical' | 'horizontal' | 'both';\n hgap: string;\n vgap: string;\n hoffset: string;\n voffset: string;\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 type PumpSchema = Hardware<{\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\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 { State } 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 LOST: 'warning',\n MOVING_IN: 'transient',\n MOVING_OUT: 'transient',\n UNKNOWN: 'danger',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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 { HardwareWidgetProps, EditableHardware } 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';\nimport type { PusherOptions } from './options';\n\n/**\n * Button which can execute an async action.\n *\n * The button allow to define an `icon`, located at the right\n * or at the left of the `text`. For that the property `iconLocation`\n * is provided.\n *\n * For each location the icon can differ, for example in the\n * case of an arrow. This for, the 2 properties `leftIcon` and\n * `rightIcon` can be used.\n */\nfunction ActionButton<T>(props: {\n text: string;\n icon?: string;\n leftIcon?: string;\n rightIcon?: string;\n iconLocation?: 'right' | 'left';\n onAction: () => Promise<T>;\n onActionChange?: (inAction: boolean) => void;\n disabled?: boolean;\n className?: string;\n style?: Record<string, unknown>;\n variant?: string;\n}) {\n const {\n text,\n icon,\n leftIcon = icon,\n rightIcon = icon,\n iconLocation = 'left',\n onAction,\n onActionChange,\n disabled = false,\n variant,\n style = {},\n className = '',\n } = props;\n const [inAction, setInAction] = useState(false);\n const iconAtRight = rightIcon && iconLocation === 'right';\n const iconAtLeft = leftIcon && iconLocation === 'left';\n\n return (\n <Button\n variant={variant}\n style={style}\n className={className}\n onClick={() => {\n onActionChange?.(true);\n setInAction(true);\n onAction().finally(() => {\n setInAction(false);\n onActionChange?.(false);\n });\n }}\n disabled={disabled}\n >\n <span className=\"text-nowrap\">\n {iconAtLeft && (\n <>\n <i\n className={inAction ? 'fa-solid fa-fw fa-cog fa-spin' : leftIcon}\n />{' '}\n </>\n )}\n {text}\n {iconAtRight && (\n <>\n {' '}\n <i\n className={inAction ? 'fa-solid fa-fw fa-cog fa-spin' : rightIcon}\n />\n </>\n )}\n </span>\n </Button>\n );\n}\n\nfunction PusherBlock(props: {\n hardware: EditableHardware<PusherSchema>;\n options: PusherOptions;\n disabled: boolean;\n className: string;\n leftToRight: boolean;\n style?: Record<string, any>;\n}) {\n const { className, hardware, options = {}, style = {}, leftToRight } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n const isInTouch = state === 'IN_TOUCH';\n const disabled = !isInTouch || props.disabled;\n\n function ButtonPush(props: {\n distance: number;\n style?: Record<string, unknown>;\n }) {\n const { distance, style } = props;\n return (\n <ActionButton\n text={`${distance}`}\n style={style}\n variant=\"secondary\"\n onAction={() => {\n return hardware.actions.call('push', distance);\n }}\n disabled={disabled}\n leftIcon=\"fa fa-fw fa-arrow-left\"\n rightIcon=\"fa fa-fw fa-arrow-right\"\n iconLocation={leftToRight ? 'right' : 'left'}\n />\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 ...style,\n }}\n >\n <ButtonPush\n distance={5}\n style={{\n gridColumn: leftToRight ? 3 : 1,\n gridRow: 1,\n }}\n />\n <ButtonPush\n distance={0.5}\n style={{\n gridColumn: 2,\n gridRow: 1,\n }}\n />\n <ButtonPush\n distance={0.05}\n style={{\n gridColumn: leftToRight ? 1 : 3,\n gridRow: 1,\n }}\n />\n <ButtonPush\n distance={2}\n style={{\n gridColumn: leftToRight ? 3 : 1,\n gridRow: 2,\n }}\n />\n <ButtonPush\n distance={0.2}\n style={{\n gridColumn: 2,\n gridRow: 2,\n }}\n />\n <ButtonPush\n distance={0.02}\n style={{\n gridColumn: leftToRight ? 1 : 3,\n gridRow: 2,\n }}\n />\n <ButtonPush\n distance={1}\n style={{\n gridColumn: leftToRight ? 3 : 1,\n gridRow: 3,\n }}\n />\n <ButtonPush\n distance={0.1}\n style={{\n gridColumn: 2,\n gridRow: 3,\n }}\n />\n <ButtonPush\n distance={0.01}\n style={{\n gridColumn: leftToRight ? 1 : 3,\n gridRow: 3,\n }}\n />\n </div>\n );\n}\n\nfunction RawPusher(props: {\n hardware: EditableHardware<PusherSchema>;\n options: PusherOptions;\n disabled: boolean;\n leftToRight: boolean;\n}) {\n const { hardware, options, disabled, leftToRight } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n const isRetracted = state === 'RETRACTED';\n const isInTouch = state === 'IN_TOUCH';\n const isLost = state === 'LOST';\n const [moving, setMoving] = useState(false);\n\n function getLocation() {\n if (isRetracted) {\n return leftToRight ? 'ms-0' : 'ms-auto';\n }\n if (isInTouch) {\n return leftToRight ? 'ms-auto' : 'ms-0';\n }\n return 'mx-auto';\n }\n\n const location = getLocation();\n\n return (\n <div\n style={{\n display: 'grid',\n gridTemplateRows: 'min-content min-content',\n gridTemplateColumns: leftToRight\n ? 'auto min-content'\n : 'min-content auto',\n gridGap: '1px',\n }}\n >\n <i\n className={`${\n isInTouch || isLost ? 'fas fa-dizzy' : 'fa fa-smile'\n } fa-3x my-auto`}\n style={{ gridColumn: leftToRight ? 2 : 1, gridRow: 1 }}\n />\n <PusherBlock\n className={location}\n {...props}\n style={{ gridColumn: leftToRight ? 1 : 2, gridRow: 1 }}\n />\n <ButtonGroup\n className=\"mx-auto\"\n style={{\n width: '12em',\n gridColumn: leftToRight ? 1 : 2,\n gridRow: 2,\n }}\n >\n {!leftToRight && (\n <ActionButton\n text=\"In\"\n onAction={() => {\n return hardware.actions.call('move_in');\n }}\n onActionChange={(inAction) => {\n setMoving(inAction);\n }}\n disabled={isInTouch || disabled || moving}\n style={{ width: '5em' }}\n iconLocation=\"left\"\n icon=\"fa fa-fw fa-arrow-left\"\n />\n )}\n <ActionButton\n text=\"Out\"\n onAction={() => {\n return hardware.actions.call('move_out');\n }}\n onActionChange={(inAction) => {\n setMoving(inAction);\n }}\n disabled={isRetracted || disabled || moving}\n style={{ width: '5em' }}\n leftIcon=\"fa fa-fw fa-arrow-left\"\n rightIcon=\"fa fa-fw fa-arrow-right\"\n />\n {leftToRight && (\n <ActionButton\n text=\"In\"\n onAction={() => {\n return hardware.actions.call('move_in');\n }}\n onActionChange={(inAction) => {\n setMoving(inAction);\n }}\n disabled={isInTouch || disabled || moving}\n style={{ width: '5em' }}\n iconLocation=\"right\"\n icon=\"fa fa-fw fa-arrow-right\"\n />\n )}\n </ButtonGroup>\n </div>\n );\n}\n\nexport default function Pusher(\n props: HardwareWidgetProps<PusherSchema, PusherOptions>\n) {\n const { hardware, options = {} } = props;\n const leftToRight = (options.orientation ?? 'left-right') === 'left-right';\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} leftToRight={leftToRight} />;\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 type PusherSchema = Hardware<{\n state: string;\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 { State } 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: 'transient',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'transient',\n EXITED: 'secondary',\n FATAL: 'fatal',\n UNKNOWN: 'fatal',\n OFFLINE: 'secondary',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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: 'transient',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'transient',\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: 'transient',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'transient',\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 type ServiceSchema = Hardware<{\n state:\n | 'STOPPED'\n | 'STARTING'\n | 'RUNNING'\n | 'BACKOFF'\n | 'STOPPING'\n | 'EXITED'\n | 'FATAL'\n | 'UNKNOWN';\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 { State } 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, string] } = {\n // Deprecated in bliss-tomo 2.9\n READY: ['success', 'Ready to be used'],\n // Available since bliss-tomo 2.9\n IN: ['success', 'The sample is in the beam'],\n OUT: ['danger', 'The sample is out of the beam'],\n MOVING_IN: ['transient', 'The sample moving in the beam'],\n MOVING_OUT: ['transient', 'The sample moving out of the beam'],\n // Available since bliss-tomo 2.11.x (introduced during 2.10.x)\n LOST: [\n 'warning',\n 'The motion was interrupted between IN and OUT positions',\n ],\n UNKNOWN: ['fatal', 'The device have an unknown state'],\n };\n const [variant, description] = variants[state] || variants.UNKNOWN;\n return (\n <State\n state={state}\n minWidth={6}\n variant={variant}\n description={description}\n />\n );\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 {\n type TomoFlatMotionStep,\n type TomoFlatMotionSchema,\n isTomoFlatMotionEditable,\n} 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 const editable = isTomoFlatMotionEditable(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 || !editable}\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 || !editable}\n />\n <InputAxisMotion\n motion={motion}\n actions={hardware.actions}\n disabled={disabled || !editable}\n />\n <DropAxis\n motion={motion}\n actions={hardware.actions}\n disabled={disabled || !editable}\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 {\n type TomoFlatMotionStep,\n type TomoFlatMotionSchema,\n isTomoFlatMotionEditable,\n} 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 const editable = isTomoFlatMotionEditable(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 || !editable}\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 type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { TomoFlatMotionState } from './TomoFlatMotionState';\nimport type { TomoFlatMotionSchema } from '.';\n\nexport default function TomoFlatMotionSmall(\n props: HardwareWidgetProps<TomoFlatMotionSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { properties } = hardware;\n const { state = 'UNKNOWN' } = properties;\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 const isMovingIn = state === 'MOVING_IN';\n const isMovingOut = state === 'MOVING_OUT';\n const isIn = state === 'IN';\n const isOut = state === 'OUT';\n\n function getLocation() {\n if (isIn) {\n return '1 / 3';\n }\n if (isOut) {\n return '3 / 5';\n }\n return '2 / 4';\n }\n const location = getLocation();\n\n const face = isIn ? 'fa-face-grin-beam-sweat' : 'fa-smile';\n const title = isIn\n ? 'The sample is in front of the beam'\n : isOut\n ? 'The sample is out of the beam'\n : '';\n\n const widgetContent = (\n <div\n style={{\n display: 'grid',\n gridGap: 0,\n gridTemplateColumns: '1fr 1fr 1fr 1fr 1fr 1fr',\n gridTemplateRows: '1fr',\n }}\n >\n <i\n className={`fa ${face} fa-3x my-auto mx-auto`}\n style={{ gridColumn: location, gridRow: 1 }}\n title={title}\n />\n </div>\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 TomoFlatMotionSampleLocation from './TomoFlatMotionSampleLocation';\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\nexport interface TomoFlatMotionProperties extends Record<string, unknown> {\n state:\n | 'READY'\n | 'IN'\n | 'OUT'\n | 'MOVING_IN'\n | 'MOVING_OUT'\n | 'LOST'\n | 'UNKNOWN';\n available_axes: string[];\n motion: TomoFlatMotionStep[];\n move_in_parallel: boolean;\n power_onoff: boolean;\n settle_time: number;\n}\n\n/**\n * Hardware as exposed by Redux\n */\nexport type TomoFlatMotionSchema = Hardware<TomoFlatMotionProperties>;\n\nconst Variants: HardwareVariant<TomoFlatMotionSchema> = {\n default: TomoFlatMotionDefault,\n small: TomoFlatMotionSmall,\n // Override base state\n state: TomoFlatMotionState,\n sample_location: TomoFlatMotionSampleLocation,\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\n/**\n * True if the configuration of the object is editable.\n *\n * Actually trying to edit the flat motion if the sample\n * is not IN is not allowed.\n */\nexport function isTomoFlatMotionEditable(\n hardware: TomoFlatMotionSchema\n): boolean {\n const { properties = {} } = hardware;\n const { state = 'UNKNOWN' } = properties;\n return [\n 'IN',\n // Compatibility with bliss-tomo 2.9\n 'READY',\n ].includes(state);\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 { TomoFlatMotionProperties } 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<TomoFlatMotionProperties>({\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: TomoFlatMotionProperties,\n axis: {\n axis_ref: string;\n relative_position?: number;\n absolute_position?: number;\n }\n ): TomoFlatMotionProperties {\n const motion: TomoFlatMotionProperties['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 { useState } from 'react';\nimport type { MouseEvent } from 'react';\nimport type {\n HardwareWidgetOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { Button } from 'react-bootstrap';\nimport type { TomoReferencePositionSchema } from '.';\n\nexport interface TomoReferencePositionDefaultOptions\n extends HardwareWidgetOptions {\n /**\n * If defined, this label is displayed in the button.\n */\n label?: string;\n}\n\nexport default function TomoReferencePositionDefault(\n props: HardwareWidgetProps<\n TomoReferencePositionSchema,\n TomoReferencePositionDefaultOptions\n >\n) {\n const { hardware, options = {}, disabled } = props;\n const { actions } = hardware;\n const { label } = options;\n const [errorMsg, setErrorMsg] = useState<string | undefined>(undefined);\n const [processing, setProcessing] = useState(false);\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoReferencePositionSchema\"\n icon=\"fam-hardware-motor\"\n online={hardware.online}\n />\n );\n\n function onClickToReference(event: MouseEvent) {\n setErrorMsg(undefined);\n setProcessing(true);\n actions\n .call('move_to_reference')\n .catch((error: any) => {\n setErrorMsg(`${error}`);\n })\n .finally(() => {\n setProcessing(false);\n });\n }\n\n const widgetState = <></>;\n\n const widgetContent = (\n <Button\n onClick={onClickToReference}\n variant={errorMsg === undefined ? 'secondary' : 'danger'}\n disabled={disabled || processing}\n className=\"w-100\"\n >\n {errorMsg && (\n <i className=\"fa-solid fa-triangle-exclamation me-1\" title={errorMsg} />\n )}\n {!errorMsg && processing && (\n <i className=\"fa-solid fa-cog fa-spin me-1\" />\n )}\n {label ?? 'Back to reference 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 type TomoReferencePositionSchema = Hardware<Record<string, never>>;\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 { State } 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: 'transient',\n UNMOUNTING: 'transient',\n LOCKED: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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(3).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 Qty from 'js-quantities';\n\n/**\n * Convert a quantity value into another unit.\n *\n * @param value: Value to convert\n * @param from: Unit of the input value\n * @param to: Unit of the result\n * @param pixelSize: If defined, a convertion can be done between distances and pixels\n * @returns The converted value. If the convertion fail, NaN is returned.\n */\nexport function convert(\n value: number,\n from: string,\n to: string,\n pixelSize?: Qty\n): number {\n if (from === to) {\n return value;\n }\n if (from === 'rad' && to === 'deg') {\n return (180 * value) / Math.PI;\n }\n if (from === 'deg' && to === 'rad') {\n return (Math.PI * value) / 180;\n }\n if (from === 'px') {\n if (pixelSize !== undefined) {\n const px = pixelSize.to('mm').scalar;\n return convert(value * px, 'mm', to, undefined);\n }\n return Number.NaN;\n }\n if (to === 'px') {\n if (pixelSize !== undefined) {\n const v = convert(value, from, 'mm', undefined);\n const px = pixelSize.to('mm').scalar;\n return v / px;\n }\n return Number.NaN;\n }\n try {\n return Qty(value, from).to(to).scalar;\n } catch {\n console.error(`Convertion ${from}->${to} is not provided`);\n return Number.NaN;\n }\n}\n\n/**\n * Convert the unit to a displayable unit.\n *\n * For example `um` became `μm`.\n */\nexport function formatedUnit(unit: string): string {\n if (unit.startsWith('u')) {\n return `μ${unit.slice(1)}`;\n }\n return unit;\n}\n","/**\n * Return a hardware id from a hardware reference.\n *\n * For example convert `hardware:foo` into `foo`.\n */\nexport function getHardwareIdFromRef(\n ref: string | undefined | null\n): string | null {\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","import { InputGroup } 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 { useMemo } from 'react';\nimport { convert, formatedUnit } from '../../utils/units';\nimport { useLimaHardware } from '../lima';\nimport { getHardwareIdFromRef } from '../utils/hardware';\n\nexport interface TomoDetectorFieldOfViewOptions extends HardwareWidgetOptions {\n /**\n * The unit to be used to display the field of view.\n */\n display_unit?: string;\n\n /**\n * Number of digits\n */\n digits?: number;\n}\n\nexport default function TomoDetectorFieldOfView(\n props: HardwareWidgetProps<TomoDetectorSchema, TomoDetectorFieldOfViewOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const { sample_pixel_size: samplePixelSize, detector = null } = properties;\n\n const hardwareDet = useLimaHardware(getHardwareIdFromRef(detector));\n const { properties: propertiesDet = {} } = hardwareDet ?? {};\n const { size } = propertiesDet;\n\n const displayUnit = options.display_unit ?? 'mm';\n const digits = options.digits ?? 3;\n\n const widgetIcon = (\n <TypeIcon name=\"TomoDetector\" icon=\"fa-eye\" online={hardware.online} />\n );\n\n const widgetState = <TomoDetectorState hardware={hardware} />;\n\n const formattedValue = useMemo(() => {\n if (\n samplePixelSize === null ||\n samplePixelSize === undefined ||\n size === null ||\n size === undefined\n ) {\n return '∅';\n }\n const w = convert(size[0] * samplePixelSize, 'um', displayUnit);\n const h = convert(size[1] * samplePixelSize, 'um', displayUnit);\n return `${w.toFixed(digits)} × ${h.toFixed(digits)}`;\n }, [samplePixelSize, size, displayUnit, digits]);\n\n const widgetContent = (\n <InputGroup className=\"flex-nowrap\">\n <ReadOnlyTextInput value={formattedValue} />\n <InputGroup.Text>{formatedUnit(displayUnit)}</InputGroup.Text>\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 TomoDetectorFieldOfView from './TomoDetectorFieldOfView';\nimport TomoDetectorAcquisitionMode from './TomoDetectorAcquisitionMode';\nimport TomoDetectorState from './TomoDetectorState';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport type TomoDetectorSchema = Hardware<{\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\nconst Variants: HardwareVariant<TomoDetectorSchema> = {\n samplepixelsize: TomoDetectorSamplePixelSize,\n acquisitionmode: TomoDetectorAcquisitionMode,\n fieldofview: TomoDetectorFieldOfView,\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 { State } 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: 'transient',\n UNMOUNTING: 'transient',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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';\nimport { getHardwareIdFromRef } from '../utils/hardware';\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 type TomoDetectorsSchema = Hardware<{\n state: string;\n detectors: string[];\n active_detector: string;\n target_detector?: string; // FIXME: The server implementation is missing\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 { State } 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: 'transient',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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 { useCallback, useMemo } from 'react';\nimport { useState } from 'react';\nimport { Form } from 'react-bootstrap';\nimport type Qty from 'js-quantities';\nimport { convert } from '../utils/units';\n\n/**\n * Input number displaying value with a display unit.\n *\n * `onChange` is only triggered when `Enter` is pressed.\n *\n * This was designed to be composed inside a `InputGroup`.\n */\nexport function QuantityInputNumberOrNull(props: {\n value: number | null;\n unit: string;\n displayUnit?: string;\n preferedDisplayUnit?: string;\n step?: number;\n pixelSize?: Qty;\n onAccepted?: (value: number | null) => void;\n onAborted?: () => void;\n decimals?: number;\n style?: Record<string, any>;\n className?: string;\n allowNullAsEmpty: boolean;\n disabled?: boolean;\n}) {\n const {\n style,\n className,\n value,\n decimals = 2,\n allowNullAsEmpty = false,\n disabled = false,\n } = props;\n const [editedValue, setEditedValue] = useState<string | undefined>(undefined);\n const editing = editedValue !== undefined;\n\n const displayUnit = useMemo(() => {\n if (\n props.preferedDisplayUnit !== undefined &&\n (props.pixelSize === undefined ||\n props.unit === 'px' ||\n props.preferedDisplayUnit === 'px')\n ) {\n return props.preferedDisplayUnit;\n }\n return props.displayUnit ?? props.unit;\n }, [\n props.displayUnit,\n props.unit,\n props.preferedDisplayUnit,\n props.pixelSize,\n ]);\n\n const convertFromDisplay = useCallback(\n (value: number | null) => {\n if (value === null || displayUnit === undefined) {\n return null;\n }\n return convert(value, displayUnit, props.unit, props.pixelSize);\n },\n [props.unit, displayUnit, props.pixelSize]\n );\n\n const convertToDisplay = useCallback(\n (value: number | null) => {\n if (value === null || displayUnit === undefined) {\n return null;\n }\n return convert(value, props.unit, displayUnit, props.pixelSize);\n },\n [props.unit, displayUnit, props.pixelSize]\n );\n\n function inputToDisplay(editedValue: string): number | null {\n if ((editedValue ?? '') === '') {\n return null;\n }\n return Number.parseFloat(editedValue);\n }\n\n function acceptEdition() {\n if (editedValue === undefined) {\n // This is unexpected\n return;\n }\n if (!allowNullAsEmpty && editedValue === '') {\n // We could display an error message\n return;\n }\n let v: number | null;\n try {\n v = inputToDisplay(editedValue);\n } catch {\n // The input have to be fixed first\n // We could display an error message\n return;\n }\n const i = convertFromDisplay(v);\n props.onAccepted?.(i);\n setEditedValue(undefined);\n }\n\n function abortEdition() {\n if (editedValue === undefined) {\n // This is unexpected\n return;\n }\n props.onAborted?.();\n setEditedValue(undefined);\n }\n\n const displayedValue = useMemo(() => {\n const v = convertToDisplay(value);\n if (v === null) {\n return '';\n }\n return v.toFixed(decimals);\n }, [value]);\n\n return (\n <Form.Control\n value={editedValue ?? displayedValue ?? undefined}\n className={className}\n step={props.step}\n type=\"number\"\n style={{\n ...style,\n backgroundColor: editing ? '#FFFF80' : undefined,\n }}\n disabled={disabled}\n onChange={(e) => {\n setEditedValue(e.target.value);\n }}\n onBlur={() => {\n abortEdition();\n }}\n onKeyDown={(e) => {\n if (/^[ a-z]$/i.test(e.key)) {\n e.preventDefault();\n return false;\n }\n e.stopPropagation();\n if (e.key === 'Enter') {\n acceptEdition();\n } else if (e.key === 'Escape') {\n abortEdition();\n }\n return true;\n }}\n />\n );\n}\n","import type Qty from 'js-quantities';\nimport { QuantityInputNumberOrNull } from './QuantityInputNumberOrNull';\n\n/**\n * Input number displaying value with a display unit.\n *\n * `onChange` is only triggered when `Enter` is pressed.\n *\n * This was designed to be composed inside a `InputGroup`.\n */\nexport function QuantityInputNumber(props: {\n value: number;\n unit: string;\n displayUnit?: string;\n preferedDisplayUnit?: string;\n step?: number;\n pixelSize?: Qty;\n onAccepted?: (value: number) => void;\n onAborted?: () => void;\n decimals?: number;\n style?: Record<string, any>;\n className?: string;\n disabled?: boolean;\n}) {\n const { onAccepted, ...otherProps } = props;\n return (\n <QuantityInputNumberOrNull\n {...otherProps}\n allowNullAsEmpty={false}\n // @ts-expect-error\n onAccepted={onAccepted}\n />\n );\n}\n","import 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';\nimport type { TomoImagingOptions } from './options';\nimport { formatedUnit } from '../../utils/units';\nimport { QuantityInputNumber } from '../../components/QuantityInputNumber';\n\nfunction ExposureTime(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n options: TomoImagingOptions;\n}) {\n const { hardware, options } = props;\n const exposureTime = hardware.properties.exposure_time ?? 0;\n const disabled = props.disabled || !hardware.online;\n const displayUnit = options.unit ?? 's';\n\n const digits = options.digits ?? 3;\n\n return (\n <InputGroup className=\"w-100\">\n <QuantityInputNumber\n value={exposureTime}\n unit=\"s\"\n displayUnit={options.unit ?? 's'}\n onAccepted={(value) => {\n void hardware.actions.setProperty('exposure_time', value);\n }}\n decimals={digits}\n disabled={disabled}\n />\n <InputGroup.Text>{formatedUnit(displayUnit)}</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, TomoImagingOptions>\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\n hardware={hardware}\n disabled={props.disabled}\n options={options}\n />\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';\nimport { useHardware } from '../../registry/hooks';\nimport { isLimaHardware } from '../lima';\nimport type { LimaSchema } from '../lima';\nimport type { HardwareWidgetOptions } from '../utils/types';\n\nexport interface TomoImagingActionsOptions extends HardwareWidgetOptions {\n /**\n * If true, the default, the sample location is restored after the action.\n */\n restore_sample?: boolean;\n}\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 disabled: boolean;\n onAction: () => Promise<void>;\n onStarted?: () => void;\n onTerminated?: () => void;\n title?: string;\n}) {\n const [processing, setProcessing] = useState(false);\n const [errorMsg, setErrorMsg] = useState<string | undefined>(undefined);\n\n const { text, disabled, onAction, onStarted, onTerminated, title } = props;\n\n function onClick(event: MouseEvent) {\n onStarted?.();\n setErrorMsg(undefined);\n setProcessing(true);\n onAction()\n .catch((error: any) => {\n setErrorMsg(`${error}`);\n })\n .finally(() => {\n setProcessing(false);\n onTerminated?.();\n });\n }\n\n return (\n <Button\n onClick={onClick}\n disabled={disabled || processing}\n variant={errorMsg === undefined ? 'primary' : 'danger'}\n className={classNames({ 'ps-4': !processing, 'pe-4': !processing })}\n title={title}\n >\n {errorMsg && (\n <i className=\"fa-solid fa-triangle-exclamation me-1\" title={errorMsg} />\n )}\n {!errorMsg && processing && (\n <i className=\"fa-solid fa-cog fa-spin me-1\" />\n )}\n {text}\n </Button>\n );\n}\n\nfunction useActiveLimaDetector(): LimaSchema | null {\n const hardware = useHardware(\n 'ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector'\n );\n if (hardware === null) {\n return null;\n }\n if (!isLimaHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n\nfunction TakeActions(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n restoreSample: boolean;\n}) {\n const { hardware, restoreSample } = props;\n const [processing, setProcessing] = useState(false);\n const disabled = props.disabled || !hardware.online || processing;\n\n const lima = useActiveLimaDetector();\n const limaOffline = !(lima?.properties.state !== 'OFFLINE');\n\n function onStarted() {\n setProcessing(true);\n }\n\n function onTerminated() {\n setProcessing(false);\n }\n\n function takeProj() {\n return hardware.actions.call('take_proj');\n }\n\n function takeDark() {\n return hardware.actions.call('take_dark');\n }\n\n function takeFlat() {\n return hardware.actions.call(\n restoreSample ? 'take_flat' : 'take_flat_and_stay'\n );\n }\n\n return (\n <ButtonGroup\n size=\"lg\"\n className=\"w-100\"\n title={\n limaOffline ? `The detector '${lima?.name}' is offline` : undefined\n }\n >\n <ProcessingButton\n onAction={takeProj}\n onStarted={onStarted}\n onTerminated={onTerminated}\n disabled={disabled || limaOffline}\n text=\"Proj\"\n title=\"Take a projection\"\n />\n <ProcessingButton\n onAction={takeFlat}\n onStarted={onStarted}\n onTerminated={onTerminated}\n disabled={disabled || limaOffline}\n text=\"Flat\"\n title=\"Take a flat\"\n />\n <ProcessingButton\n onAction={takeDark}\n onStarted={onStarted}\n onTerminated={onTerminated}\n disabled={disabled || limaOffline}\n text=\"Dark\"\n title=\"Take a dark\"\n />\n </ButtonGroup>\n );\n}\n\nexport default function TomoImagingActions(\n props: HardwareWidgetProps<TomoImagingSchema, TomoImagingActionsOptions>\n) {\n const { hardware, options = {} } = props;\n const { restore_sample: restoreSample = true } = options;\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\n hardware={hardware}\n disabled={props.disabled}\n restoreSample={restoreSample}\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 { 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 type TomoImagingSchema = Hardware<{\n state: string;\n update_on_move: boolean;\n exposure_time: number;\n settle_time: number;\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 type TomoSampleStageSchema = Hardware<{\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\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 type TomoConfigSchema = Hardware<{\n sample_stage: string;\n sxbeam: string;\n detectors: string;\n holotomo: string;\n latency_time: number;\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 { State } 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: 'transient',\n STABILIZING: 'transient',\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 <State 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 type TomoHoloSchema = Hardware<{\n state: string;\n settle_time: number;\n pixel_size: number | null;\n nb_distances: number;\n distances: TomoHoloDistance[];\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 type ValveSchema = Hardware<{\n state: string;\n status: string;\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 = <>No object</>;\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 { useMemo } from 'react';\nimport { Knob, Pointer, Power, Value } from '@vallsv/rc-knob';\n\nexport default function Gauge(props: {\n size: number;\n value: number | null;\n min: number;\n max: number;\n lowWarning?: number;\n hiWarning?: number;\n lowDanger?: number;\n hiDanger?: number;\n}) {\n const { size, value, min, max, lowWarning, hiWarning, lowDanger, hiDanger } =\n props;\n\n function toPercent(v: number | null): number | null {\n if (v === null) {\n return null;\n }\n return (v - min) / (max - min);\n }\n\n const geometry = useMemo(() => {\n const lowPercentDanger =\n lowDanger === undefined ? undefined : toPercent(lowDanger);\n const hiPercentDanger =\n hiDanger === undefined ? undefined : toPercent(hiDanger);\n const lowPercentWarning =\n lowWarning === undefined ? undefined : toPercent(lowWarning);\n const hiPercentWarning =\n hiWarning === undefined ? undefined : toPercent(hiWarning);\n return {\n lowPercentDanger,\n hiPercentDanger,\n lowPercentWarning,\n hiPercentWarning,\n };\n }, [min, max, lowWarning, hiWarning, lowDanger, hiDanger]);\n\n const valueClassName = useMemo(() => {\n if (value === null) {\n return 'value';\n }\n if (lowDanger !== undefined && value <= lowDanger) {\n return 'value value-danger';\n }\n if (hiDanger !== undefined && value >= hiDanger) {\n return 'value value-danger';\n }\n if (lowWarning !== undefined && value <= lowWarning) {\n return 'value value-warning';\n }\n if (hiWarning !== undefined && value >= hiWarning) {\n return 'value value-warning';\n }\n return 'value';\n }, [value, lowDanger, hiDanger, lowWarning, hiWarning]);\n\n const powerRadius = size / 2 - 15;\n const width0 = size / 10;\n const width100 = (size / 10) * 3;\n\n function getWidth(p: number): number {\n return width0 + (width100 - width0) * p;\n }\n\n return (\n <Knob\n size={size}\n angleOffset={240}\n angleRange={240}\n min={min}\n max={max}\n value={value}\n readOnly\n className=\"gauge\"\n >\n {geometry.lowPercentDanger && (\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range range-danger\"\n percentageFrom={0}\n percentageTo={geometry.lowPercentDanger}\n widthFrom={getWidth(0)}\n widthTo={getWidth(geometry.lowPercentDanger)}\n />\n )}\n {geometry.lowPercentWarning && (\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range range-warning\"\n percentageFrom={geometry.lowPercentDanger ?? 0}\n percentageTo={geometry.lowPercentWarning}\n widthFrom={getWidth(geometry.lowPercentDanger ?? 0)}\n widthTo={getWidth(geometry.lowPercentWarning)}\n />\n )}\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range\"\n percentageFrom={\n geometry.lowPercentWarning ?? geometry.lowPercentDanger ?? 0\n }\n percentageTo={\n geometry.hiPercentWarning ?? geometry.hiPercentDanger ?? 1\n }\n widthFrom={getWidth(\n geometry.lowPercentWarning ?? geometry.lowPercentDanger ?? 0\n )}\n widthTo={getWidth(\n geometry.hiPercentWarning ?? geometry.hiPercentDanger ?? 1\n )}\n />\n {geometry.hiPercentWarning && (\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range range-warning\"\n percentageFrom={geometry.hiPercentWarning}\n percentageTo={geometry.hiPercentDanger ?? 1}\n widthFrom={getWidth(geometry.hiPercentWarning)}\n widthTo={getWidth(geometry.hiPercentDanger ?? 1)}\n />\n )}\n {geometry.hiPercentDanger && (\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range range-danger\"\n percentageFrom={geometry.hiPercentDanger}\n percentageTo={1}\n widthFrom={getWidth(geometry.hiPercentDanger)}\n widthTo={getWidth(1)}\n />\n )}\n <circle r={size / 20} cx={size / 2} cy={size / 2} fill=\"black\" />\n <Pointer\n percentage={toPercent(value)}\n width={10}\n height={size / 2 - 15}\n radius={2}\n type=\"triangle\"\n color=\"black\"\n />\n <Value className={valueClassName} value={value} />\n </Knob>\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 type { YamlComponent } from '../model';\n\nexport default function Yaml(props: YamlComponent) {\n return <></>;\n}\n","import type { YamlComponent } from '../model';\nimport { assertNoUnknownKeys, assertString } from '../asserts';\n\nexport default function YamlLabel(props: YamlComponent) {\n const { providers = {}, yamlNode, label, ...unknownOptions } = props;\n assertString(yamlNode, 'label', label);\n assertNoUnknownKeys(yamlNode, unknownOptions);\n return <div>{label}</div>;\n}\n","import { map } from 'lodash';\nimport { Row } from 'react-bootstrap';\nimport { renderYamlNode } from '../utils';\nimport { assertNoUnknownKeys } from '../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 { assertNoUnknownKeys, assertOptionalNumber } from '../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 { 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', overflow: 'auto' }}>\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 type { ComponentType } from 'react';\nimport YamlTodo from './components/Todo';\nimport YamlNone from './components/None';\nimport YamlLabel from './components/Label';\nimport YamlRow from './containers/Row';\nimport YamlCol from './containers/Col';\nimport YamlContainer from './containers/Container';\nimport YamlPanel from './containers/Panel';\nimport YamlTabs from './containers/Tabs';\nimport YamlForm from './containers/Form';\nimport YamlGrid from './containers/Grid';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlContainers: Record<string, ComponentType<any>> = {\n row: YamlRow,\n col: YamlCol,\n container: YamlContainer,\n panel: YamlPanel,\n tabs: YamlTabs,\n form: YamlForm,\n grid: YamlGrid,\n};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerYamlContainer(\n name: string,\n component: ComponentType<any>\n) {\n if (yamlComponents[name]) {\n console.warn(\n `yaml registration: The type ${name} is already a component. The component will not be reachable anymore.`\n );\n }\n if (yamlContainers[name]) {\n console.warn(\n `yaml registration: The type ${name} is already a container. The previous container will be dropped.`\n );\n }\n yamlContainers[name] = component;\n}\n\nexport const yamlComponents: Record<string, ComponentType<any>> = {\n todo: YamlTodo,\n none: YamlNone,\n label: YamlLabel,\n};\n\n/**\n * Register a yaml component.\n *\n * Such component is wrapped inside a `Panel`.\n */\nexport function registerYamlComponent(\n name: string,\n component: ComponentType<any>\n) {\n if (yamlComponents[name]) {\n console.warn(\n `yaml registration: The type ${name} is already a component. The previous component will be dropped.`\n );\n }\n if (yamlContainers[name]) {\n console.warn(\n `yaml registration: The type ${name} is already a container. This component will not be used.`\n );\n }\n yamlComponents[name] = component;\n}\n\n/**\n * Register multiple yaml components.\n *\n * Such components are wrapped inside a `Panel`.\n */\nexport function registerYamlComponents(\n map: Record<string, ComponentType<any>>\n) {\n Object.entries(map).forEach(([key, component]) =>\n registerYamlComponent(key, component)\n );\n}\n","import React, { Suspense } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport type { YamlNode } from './model';\nimport { yamlComponents } from './registry';\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 yamlComponents)) {\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 = yamlComponents[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 { Children, cloneElement, isValidElement } from 'react';\nimport type { PropsWithChildren } from 'react';\nimport Panel from '../layout/Panel';\nimport type { AnyYamlNode, YamlNode, YamlRoot } from './model';\nimport { yamlContainers } from './registry';\nimport YamlComponent from './Component';\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 yamlContainers ? yamlContainers[type] : YamlComponent;\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 assertOptionalListOfType<Y>(\n yamlNode: YamlNode,\n key: string,\n value: unknown,\n isType: (value: Y) => boolean,\n typeName: string\n): asserts value is Y[] | 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 ${typeName} is expected`\n );\n }\n value.forEach((v) => {\n if (!isType(v)) {\n throw new KeyError(\n yamlNode,\n key,\n `An optional list of type ${typeName} 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\n/**\n * Assert function for generic 'args' as used in python\n * function with `*args`.\n *\n * The argument is validated as a list of unknown items.\n */\nexport function assertOptionalArgs(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is unknown[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'A list is expected');\n }\n}\n\n/**\n * Assert function for generic 'kwargs' as used in python\n * function with `**kwargs`.\n *\n * The argument is validated as a record from string to unknown values.\n */\nexport function assertOptionalKwargs(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is Record<string, unknown> | undefined {\n if (value === undefined) {\n return;\n }\n if (value === null || typeof value !== 'object') {\n throw new KeyError(yamlNode, key, 'A list is expected');\n }\n}\n\n/**\n * Type a schema from it;s typescript description.\n *\n * See `assertStringMappingRecord`\n */\nexport type Schema<T> = Record<\n keyof T,\n (yamlNode: YamlNode, key: string, value: unknown) => void\n>;\n\n/**\n * Assert function for generic record of string.\n *\n * Can be used as the basis of a specific assertion.\n *\n * The argument is validated as a record from string to unknown values.\n *\n * @param options: Parsing parameters\n */\nexport function assertStringMappingRecord<\n T extends Partial<Record<string, any>>\n>(\n yamlNode: YamlNode,\n key: string,\n value: unknown,\n options: {\n /** If true, the value can be `undefined` */\n optional?: boolean;\n /** Mapping from expected keys to the relative assert function */\n schema: Record<\n string,\n (yamlNode: YamlNode, key: string, value: unknown) => void\n >;\n }\n): asserts value is T {\n const { optional, schema } = options;\n if (optional && value === undefined) {\n return;\n }\n if (!value || typeof value !== 'object') {\n throw new KeyError(yamlNode, key, 'A mapping is expected');\n }\n const unexpectedKeys = Object.keys(value).filter((k) => {\n return typeof k === 'string' && !(k in schema);\n });\n if (unexpectedKeys.length > 0) {\n throw new UnknownKeysError(\n yamlNode,\n Object.keys(unexpectedKeys.map((k) => `${key}/${k}`))\n );\n }\n // Here we know that the value only contains expected keys\n const valueMap = value as Record<string, unknown>;\n Object.entries(schema).forEach(([k, assertFunc]) => {\n if (typeof k === 'string') {\n assertFunc(yamlNode, `${key}/${k}`, valueMap[k]);\n }\n });\n}\n","import type { YamlComponent } from '../model';\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 AirBearingVariants from './airbearing';\nimport BaseVariants from './base';\nimport BeamviewerVariants from './beamviewer';\nimport EnergyManagerVariants from './energymanager';\nimport FrontendVariants from './frontend';\nimport GaugeVariants from './gauge';\nimport LaserHeatingVariants from './laser';\nimport LaserVariants from './laserheating';\nimport LightVariants from './light';\nimport LimaVariants from './lima';\nimport MeasurementGroupVariants from './measurementgroup';\nimport MotorVariants from './motor';\nimport MultipositionVariants from './multiposition';\nimport OpticVariants from './optic';\nimport ProcedureVariants from './procedure';\nimport PumpVariants from './pump';\nimport PusherVariants from './pusher';\nimport ServiceVariants from './service';\nimport ShutterVariants from './shutter';\nimport TomoConfigVariants from './tomoconfig';\nimport TomoDetectorsVariants from './tomodetectors';\nimport TomoDetectorVariants from './tomodetector';\nimport TomoFlatMotionVariants from './tomoflatmotion';\nimport TomoImagingVariants from './tomoimaging';\nimport TomoReferencePositionVariants from './tomoreferenceposition';\nimport ValveVariants from './valve';\n\nimport type { AnySchema } from './utils/schema';\nimport type { HardwareComponentType, HardwareVariant } from './utils/types';\n\n/**\n * Storage for the hardware variant components.\n *\n * It is exported for listing in the documentation.\n */\nexport const hardwareMap: Record<string, HardwareVariant<AnySchema>> = {};\n\nconst initialVariants: Record<string, HardwareVariant<AnySchema>> = {\n airbearing: AirBearingVariants,\n base: BaseVariants,\n beamviewer: BeamviewerVariants,\n energymanager: EnergyManagerVariants,\n frontend: FrontendVariants,\n gauge: GaugeVariants,\n laser: LaserVariants,\n laserheating: LaserHeatingVariants,\n light: LightVariants,\n lima: LimaVariants,\n measurementgroup: MeasurementGroupVariants,\n motor: MotorVariants,\n multiposition: MultipositionVariants,\n optic: OpticVariants,\n procedure: ProcedureVariants,\n pump: PumpVariants,\n pusher: PusherVariants,\n service: ServiceVariants,\n shutter: ShutterVariants,\n tomoconfig: TomoConfigVariants,\n tomodetector: TomoDetectorVariants,\n tomodetectors: TomoDetectorsVariants,\n tomoflatmotion: TomoFlatMotionVariants,\n tomoimaging: TomoImagingVariants,\n tomoreferenceposition: TomoReferencePositionVariants,\n valve: ValveVariants,\n};\n\nObject.entries(initialVariants).forEach(([l, v]) => {\n hardwareMap[l] = { ...v };\n});\n\n/**\n * Register an hardware variant.\n */\nexport function registerHardwareVariant(\n type: string,\n variant: string,\n component: HardwareComponentType<AnySchema>\n) {\n if (!(type in hardwareMap)) {\n hardwareMap[type] = {};\n }\n if (variant in hardwareMap[type]) {\n console.warn(\n `Hardware variant ${type}/${variant} already existes. Overwrite.`\n );\n }\n hardwareMap[type][variant] = component;\n}\n\n/**\n * Return a hardware variant component.\n *\n * - Check first if a hardware type and variant\n * is registered, return it.\n * - Else, check if the 'base' type and variant\n * is registered, return it\n * - Else, return null\n *\n * @param type: Type of the hardware\n * @param variant: Variant requested\n */\nexport function getHardwareVariantComponent(\n type: string,\n variant: string\n): HardwareComponentType | null {\n if (type in hardwareMap) {\n const variants = hardwareMap[type];\n if (variant in variants) {\n return variants[variant];\n }\n }\n\n const baseVariants = hardwareMap.base;\n if (variant in baseVariants) {\n return baseVariants[variant];\n }\n\n return null;\n}\n","import { getHardwareVariantComponent } from '../hardware/registry';\nimport { AnyHardwareState } from '../hardware/base/BaseState';\nimport type {\n AnyHardware,\n HardwareChangeActions,\n} from '../hardware/utils/types';\nimport { State } from '../hardware/utils/State';\n\n/**\n * Component which display the state of a hardware.\n *\n * It is based on the type of the hardware, and fallback to the\n * `AnyHardwareState` component if no components are available.\n */\nexport function HardwareState(props: {\n hardware: AnyHardware | null;\n options?: { emptyifnone?: boolean };\n}) {\n const { hardware, options = {} } = props;\n const { emptyifnone = false } = options;\n\n if (hardware === null) {\n if (emptyifnone) {\n return <></>;\n }\n return <State state=\"NONE\" variant=\"danger\" description=\"No hardware\" />;\n }\n\n const { type } = hardware;\n\n // Special hardware types which will be used for asyn hardware update\n switch (type) {\n case 'missing':\n return (\n <State\n state=\"MISSING\"\n variant=\"danger\"\n description=\"Hardware not available\"\n />\n );\n case 'error':\n return (\n <State\n state=\"ERROR\"\n variant=\"danger\"\n description=\"Error to load the hardware\"\n />\n );\n case 'loading':\n return (\n <State\n state=\"LOADING\"\n variant=\"warning\"\n description=\"The hardware was requested\"\n />\n );\n }\n\n const Comp = getHardwareVariantComponent(type, 'state');\n if (!Comp) {\n return <AnyHardwareState hardware={hardware} />;\n }\n\n const actions: HardwareChangeActions = {\n setProperty: (name: string, value: any) => {\n return Promise.resolve();\n },\n call: (name: string, ...args: any[]) => {\n return Promise.resolve();\n },\n };\n\n return (\n <Comp\n hardware={{ ...hardware, actions }}\n options={{ name: hardware.name }}\n operator={false}\n disabled={false}\n />\n );\n}\n","import type { PropsWithChildren, ReactElement } from 'react';\nimport { Modal, Button } from 'react-bootstrap';\nimport type { OverlayProps } from 'react-bootstrap';\n\nexport interface ModalClassProps {\n target: OverlayProps['target'];\n show?: boolean;\n actions?: {\n onShow?: () => void;\n onClose?: () => void;\n };\n title: string;\n buttons?: ReactElement;\n otherButtons?: ReactElement;\n bodyClassName?: string;\n size?: 'sm' | 'lg' | 'xl';\n fullscreen?: true | string;\n}\n\ninterface Props extends ModalClassProps {\n cancelText?: string;\n footer?: boolean;\n showClose?: boolean;\n}\n\nexport default function ModalDialog(props: PropsWithChildren<Props>) {\n const {\n title,\n children,\n buttons,\n cancelText,\n footer = true,\n showClose = true,\n show = false,\n actions = {},\n otherButtons,\n bodyClassName,\n size = 'lg',\n fullscreen,\n } = props;\n\n const { onShow, onClose: onHide } = actions;\n\n return (\n <Modal\n fullscreen={fullscreen}\n size={size}\n aria-labelledby=\"modal-title\"\n centered\n onShow={onShow}\n onHide={onHide}\n show={show}\n >\n <Modal.Header closeButton>\n <Modal.Title id=\"modal-title\">{title}</Modal.Title>\n </Modal.Header>\n <Modal.Body className={bodyClassName}>{children}</Modal.Body>\n {footer && (\n <Modal.Footer>\n {otherButtons && (\n <div className=\"form-other-buttons\">{otherButtons}</div>\n )}\n {buttons}\n {showClose && (\n <Button onClick={onHide}>{cancelText || 'Close'}</Button>\n )}\n </Modal.Footer>\n )}\n </Modal>\n );\n}\n","export default function ConditionalWrap<C = JSX.Element>(props: {\n condition: any;\n wrap: (children: C) => C;\n children: C;\n}): C {\n return props.condition ? props.wrap(props.children) : props.children;\n}\n","import { forwardRef, useImperativeHandle, useRef, useState } from 'react';\nimport type { PropsWithChildren, ReactElement, ComponentType } from 'react';\nimport type { Placement } from 'react-bootstrap/types';\nimport { Button, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport ModalDialog from './ModalDialog';\nimport ConditionalWrap from './ConditionalWrap';\n\nimport type { ModalClassProps } from './ModalDialog';\n\ninterface Props {\n button?: ReactElement;\n buttons?: ReactElement;\n title: string;\n buttonProps?: object;\n showButton?: boolean;\n tooltip?: string;\n tooltipPlacement?: Placement;\n onClose?: () => void;\n modalClass?: ComponentType<ModalClassProps>;\n}\n\nexport interface ButtonTriggerModalRef {\n showModal: () => void;\n close: () => void;\n}\n\nconst ButtonTriggerModal = forwardRef<\n ButtonTriggerModalRef,\n PropsWithChildren<Props>\n>((props, ref) => {\n const [showModal, setShowModal] = useState(false);\n const { showButton = true } = props;\n const targetRef = useRef(null);\n\n function close() {\n setShowModal(false);\n if (props.onClose) {\n props.onClose();\n }\n }\n\n function onCloseModal() {\n close();\n }\n\n useImperativeHandle(ref, () => ({\n showModal: () => setShowModal(true),\n close: () => onCloseModal(),\n }));\n\n const ModalClass = props.modalClass || ModalDialog;\n return (\n <>\n {showButton && (\n <ConditionalWrap\n condition={props.tooltip}\n wrap={(children) => (\n <OverlayTrigger\n placement={props.tooltipPlacement || 'top'}\n overlay={<Tooltip id=\"tooltip1\">{props.tooltip}</Tooltip>}\n >\n {children}\n </OverlayTrigger>\n )}\n >\n <Button\n onClick={() => {\n setShowModal(true);\n }}\n {...props.buttonProps}\n ref={targetRef}\n >\n {props.button}\n </Button>\n </ConditionalWrap>\n )}\n <ModalClass\n target={targetRef}\n show={showModal}\n actions={{ onClose: onCloseModal }}\n title={props.title}\n buttons={props.buttons}\n >\n {props.children}\n </ModalClass>\n </>\n );\n});\n\nexport default ButtonTriggerModal;\n","import { Badge, Col, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type { Monitor } from './types';\nimport { useHardware } from '../registry/hooks';\nimport { MonitorPanelItem } from './MonitorPanelItem';\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\n/**\n * Drop the $ from the start of the name\n *\n * @todo: In the future this should be done earlier and\n * should raise a parsing error\n */\nfunction normalizeId(path: string | null): string | null {\n if (path === null) {\n return null;\n }\n if (!path.startsWith('$')) {\n return path;\n }\n return path.slice(1);\n}\n\nexport function useValue(valuePath: string | undefined): unknown {\n const path = valuePath !== undefined ? rsplit(valuePath, '.', 1) : [null, ''];\n const obj = useHardware(normalizeId(path[0]));\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n return undefined;\n }\n const propName = path[1];\n if (propName === null) {\n return undefined;\n }\n const value = obj.properties[propName];\n if (!Array.isArray(value)) {\n return value;\n }\n // FIXME: It only return the first element.\n // It would be better to allow to select the result\n return value[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(normalizeId(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 MonitorHardwareProperty(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 function checkValidity() {\n if (monitor.comparator && monitor.comparison) {\n const isValid = dynamicOp(monitor.comparator, value, monitor.comparison);\n return isValid ? 'success' : 'danger';\n }\n return 'secondary';\n }\n\n const bgVariant = checkValidity();\n\n if (!Number.isNaN(flt)) {\n if (unit !== undefined) {\n value = `${value} ${unit}`;\n }\n }\n\n const widget = (\n <MonitorPanelItem>\n <h1>{monitor.name}</h1>\n <Badge bg={bgVariant}>{`${value}`}</Badge>\n </MonitorPanelItem>\n );\n\n if (overlay) {\n const overlayStr = `${overlay}`;\n\n return (\n <OverlayTrigger\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 {widget}\n </OverlayTrigger>\n );\n }\n\n return widget;\n}\n","import type { RefObject } from 'react';\nimport {\n createRef,\n useRef,\n useEffect,\n useState,\n useMemo,\n useCallback,\n} from 'react';\nimport { SvgLoader, SvgProxy } from 'react-svgmt';\n\nimport ButtonTriggerModal from './ButtonTriggerModal';\nimport type { ButtonTriggerModalRef } from './ButtonTriggerModal';\nimport type { AnyHardware } from '../hardware/utils/types';\nimport { dynamicOp } from '../monitorpanel/MonitorHardwareProperty';\n\nfunction getText({\n value,\n unit,\n display_digits,\n}: {\n value: any;\n unit?: string;\n display_digits?: number;\n}) {\n let text = '';\n if (value !== undefined) {\n if (value === null) {\n text = 'null';\n } else if (Number.isFinite(value)) {\n text += value.toFixed(display_digits ?? 2);\n } else {\n text = `${value}`;\n }\n }\n if (unit !== null && unit !== '') {\n text = `${text} ${unit}`;\n }\n return text;\n}\n\nexport interface StateComparator {\n /** The state comparator */\n comparator: string;\n /** The state value to compare */\n comparison: string;\n /** Optionally, a color for this comparison */\n color?: string;\n}\n\nexport interface SynopticElementType {\n /** The svg element class name */\n name: string;\n /** Which property to use as the value, i.e. `s1b.position` */\n value?: string;\n /** How many digits to display */\n value_display_digits?: number;\n /** Optionally, Which property to use to display the state. If left blank, the aggregated state from each element in `ids` below will be used */\n state?: string;\n /** Optionally, a comparison, can be a single comparison for red/green or a list of comparisons with colors */\n state_comparison?: StateComparator | StateComparator[];\n /** A list of hardware object ids to display on click */\n ids?: string[];\n}\n\nexport interface SynopticType {\n /** A list of elements to be mapped to their classes in the svg */\n elements: SynopticElementType[];\n /** The synoptic file to load */\n synoptic: string;\n /** Whether to enable daiquiri `colorisation` of icons */\n color_icons: boolean;\n}\n\ninterface Props {\n fetchSVG: (image: string) => Promise<{ data: any }>;\n getHardwareGroupComponent: (ids: string[]) => JSX.Element;\n hardwareObjects: Record<string, AnyHardware>;\n synoptic: SynopticType;\n}\n\nexport default function Synoptic(props: Props) {\n const buttonRefs = useRef<Record<string, RefObject<ButtonTriggerModalRef>>>(\n {}\n );\n const [svg, setSvg] = useState<string | undefined>(undefined);\n const { synoptic, fetchSVG, getHardwareGroupComponent, hardwareObjects } =\n props;\n\n useEffect(() => {\n fetchSVG(synoptic.synoptic).then((resp) => {\n setSvg(resp.data);\n });\n }, [synoptic]);\n\n const onClick = useCallback(\n (name: string) => {\n if (name in buttonRefs.current) {\n buttonRefs.current?.[name].current?.showModal();\n }\n },\n [buttonRefs]\n );\n\n const groups = useMemo(\n () =>\n synoptic.elements.map((el) => {\n let state: boolean | undefined = false;\n let stateColor;\n const hasComponents = el.ids && el.ids?.length > 0;\n if (hasComponents) {\n state = true;\n el.ids?.forEach((id) => {\n if (id in hardwareObjects) {\n const obj = hardwareObjects[id];\n if (!obj.properties.state_ok) state = false;\n }\n });\n }\n if (el.state) {\n const path = el.state.split('.');\n const obj = hardwareObjects[path[0]];\n const obj_state = obj ? obj.properties[path[1]] : false;\n if (Array.isArray(el.state_comparison)) {\n state = undefined;\n el.state_comparison.forEach((comparison) => {\n const stateTest =\n dynamicOp(\n comparison?.comparator,\n comparison?.comparison,\n obj_state\n ) ?? false;\n if (stateTest) stateColor = comparison.color;\n });\n } else if (el.state_comparison) {\n state =\n dynamicOp(\n el.state_comparison?.comparator,\n el.state_comparison?.comparison,\n obj_state\n ) ?? false;\n } else {\n state = !!obj_state;\n }\n }\n\n let value = null;\n if (el.value) {\n const path = el.value.split('.');\n const obj = hardwareObjects[path[0]];\n if (obj) {\n value = getText({\n value: obj.properties[path[1]],\n unit: obj.properties.unit,\n display_digits: el.value_display_digits,\n });\n }\n }\n\n const cls = el.name.toLowerCase();\n return [\n <SvgProxy\n key={`${cls}state`}\n selector={`.${cls} .status`}\n class={`$ORIGINAL ${\n state !== undefined ? (state ? 'ok' : 'error') : ''\n }`}\n style={stateColor ? `fill: ${stateColor};` : ''}\n />,\n <SvgProxy key={`${cls}value`} selector={`.${cls} .value`}>\n {value}\n </SvgProxy>,\n <SvgProxy\n key={`${cls}handler`}\n selector={`.${cls} > rect`}\n onClick={() => onClick(cls)}\n />,\n <SvgProxy\n key={`${cls}comp`}\n class={`$ORIGINAL ${hasComponents ? 'active' : ''}`}\n selector={`.${cls}`}\n />,\n ];\n }),\n [synoptic, hardwareObjects]\n );\n\n const popups = useMemo(\n () =>\n synoptic.elements\n .filter((el) => el.ids && el.ids?.length > 0)\n .map((el) => {\n const cls = el.name.toLowerCase();\n const buttonRef = createRef<ButtonTriggerModalRef>();\n buttonRefs.current[cls] = buttonRef;\n\n return (\n <ButtonTriggerModal\n key={`${cls}pop`}\n ref={buttonRef}\n title={el.name}\n showButton={false}\n button={\n <>\n <i className=\"fa fa-plus\" />\n show\n </>\n }\n >\n {getHardwareGroupComponent(el.ids ?? [])}\n </ButtonTriggerModal>\n );\n }),\n [synoptic]\n );\n\n return (\n <div>\n <SvgLoader\n width=\"100%\"\n svgXML={svg}\n className={`synoptic ${synoptic.color_icons ? 'synoptic-color' : ''}`}\n >\n {groups}\n </SvgLoader>\n {popups}\n </div>\n );\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 { useMemo } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport ErrorBoundary from './ErrorBoundary';\nimport { renderYamlNode, normalizeLayout } from './utils';\nimport type { YamlRoot } from './model';\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 { map } from 'lodash';\nimport type { ComponentType } from 'react';\nimport classNames from 'classnames';\nimport { Row, Col, Container } from 'react-bootstrap';\nimport { MonitorHardwareProperty } from './MonitorHardwareProperty';\nimport { MonitorHardware } from './MonitorHardware';\nimport type { Monitor } from './types';\n\ninterface MonitorMapping {\n [name: string]: ComponentType<any>;\n}\n\nexport const monitorMap: MonitorMapping = {\n hardwareproperty: MonitorHardwareProperty,\n hardware: MonitorHardware,\n};\n\nexport function registerMonitorComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n monitorMap[name] = component;\n}\n\nexport function 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 ?? 'hardwareproperty';\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","import type { Monitor } from './types';\nimport { useHardware, useHardwareChangeActions } from '../registry/hooks';\nimport { YmlError } from './MonitorPanel';\nimport { getHardwareVariantComponent } from '../hardware/registry';\nimport { AnyHardwareState } from '../hardware/base/BaseState';\nimport { State } from '../hardware/utils/State';\n\n/**\n * Drop the $ from the start of the name\n *\n * @todo: In the future this should be done earlier and\n * should raise a parsing error\n */\nfunction normalizeId(id: unknown): string | null {\n if (id === undefined) {\n return null;\n }\n if (id === null) {\n return null;\n }\n if (typeof id !== 'string') {\n return null;\n }\n if (!id.startsWith('$')) {\n return id;\n }\n return id.slice(1);\n}\n\n/**\n * HardwareMonitor which provide callback to get the\n * component from the hardware type.\n */\nexport function MonitorHardware(props: { monitor: Monitor }) {\n const { monitor } = props;\n const { id } = monitor;\n\n const nid = normalizeId(id);\n const obj = useHardware(nid);\n const actions = useHardwareChangeActions(nid);\n\n if (id === undefined) {\n return <YmlError monitor={monitor} message=\"'id' is missing\" />;\n }\n\n if (typeof id !== 'string') {\n return <YmlError monitor={monitor} message=\"'id' is invalid\" />;\n }\n\n if (obj === null) {\n return (\n <State\n state=\"NONE\"\n variant=\"danger\"\n description={`hardware '${id}' was not found`}\n />\n );\n }\n\n const { type = 'none' } = obj;\n\n const hardware = {\n ...obj,\n actions,\n };\n\n const Comp = getHardwareVariantComponent(type, 'monitor');\n if (!Comp) {\n return <AnyHardwareState hardware={hardware} />;\n }\n\n return (\n <Comp\n hardware={hardware}\n options={{ name: monitor.name }}\n operator={false}\n disabled={false}\n />\n );\n}\n"],"names":["AnyHardwareState","props","hardware","online","locked","state","_a","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","ReadOnlyTextInput","value","style","className","defaultClasses","DeviceState","Property","widgetIcon","widgetState","getUnit","unitName","unit","widgetContent","InputGroup","MonitorPanelItem","forwardRef","children","rest","ref","Col","BaseMonitor","Variants","BaseState","BaseName","BaseInfo","BaseProperty","BaseVariants","Mocks","defaultjson","State","MultiState","states","variants","descriptions","minWidth","mainState","renderTooltip","Tooltip","s","i","desc","Row","AirBearingState","RawAirBearing","disabled","isOn","isOff","ButtonGroup","AirBearing","getWidgetContent","ActionButton","DropdownAirBearing","requestOn","requestOff","hardwareDisabled","movingOn","movingOff","Dropdown","Container","AirBearingProtected","AirBearingVariants","delay","ms","resolve","Simulator","alias","type","setProperty","call","properties","useHardwareContext","ctx","actions","useMemo","_b","previousHardware","useRef","useEffect","isEqual","AirBearingSimulator","setState","useState","BeamviewerOverlay","current","setCurrent","errorMsg","setErrorMsg","read","promise","resp","onChangeRange","e","map","r","Beamviewer","toggle","prop","p","BeamviewerVariants","diodeRanges","BeamviewerSimulator","led","setLed","screen","setScreen","foil","setFoil","diodeRange","setDiodeRange","EnergyManagerState","energy","energyState","DropdownSources","source","sourceNames","selectedSource","selectSource","sourceName","createSelectableItem","EnergyManagerDefault","formatEnergy","EnergyManagerMonitor","text","bgVariant","EnergyManagerVariants","ENERGIES","EnergyManagerSimulator","setSource","shortName","key","formatEng","scalar","powerPrefix","q","subtrhnd","pow10","prefix","ucfirst","str","toHoursMins","seconds","min","mins","hours","toEnergy","wavelength","round","digits","FrontendOverlay","reset","itlks","ring","getPropertyState","Frontend","onClick","getValidityStyle","FrontendMonitor","status","checkClass","widget","overlayStr","FrontendVariants","GaugeOverlay","Gauge","GaugeVariants","defaultjson2","NumericStep","stepSizeRef","focusTimeoutRef","currentStep","setCurrentStep","retakeFocus","setRetakeFocus","onStep","up","ref2","val","multiplier","stepSize","onStepProp","step","overlay","incIcon","decIcon","swapIncDec","onKeyDown","onBlur","horizontalArrows","largeArrows","stepOnly","onKeyDown2","onBlur2","steps","hasIncDec","classNames","NumericStep$1","HardwareNumericStep","valueRef","edited","setEdited","setError","updateRef","newValue","onChange","Laser","requestPowerChange","requestStateChange","LaserHeatingVariants","LaserHeatingOverlay","LaserHeating","pending","setPending","requestExposureChange","requestMeasure","LaserVariants","Light","sliderRef","requestIntensityChange","debounceIntensityChange","useCallback","_debounce","LightVariants","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","binning","setBinning","supportedBinningMode","limaBinningModeSupported","readOnly","bh","bv","b","LimaBinning","LimaRoiImageControl","LimaMaxSizeControl","struct","LimaLimaVersionControl","LimaModelControl","LimaRoiShapeWidget","imageMaxDim","roi","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","useHardwareSchema","useOperator","useScanRunning","isLimaHardware","entity","useLimaHardware","limaGuessSubframes","exposureTime","accMaxExpoTime","nbSubFrames","accExpoTime","LimaSize","LimaImageRoi","LimaDescription","LimaShape","LimaVariants","semver","flipjson","rotjson","roicenter","squaredetector","LimaSimulator","cameraPixelSize","setProperties","changeBinning","pixelSize","size","changeBinningMode","changeRotation","changeFlipX","flip","changeFlipY","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","WidgetContent","Alert","enabled","setSelection","added","removed","counter","selection","promises","Typeahead","shouldSelect","MeasurementGroup","setActive","MeasurementGroupVariants","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","sassVariables","Origin","InfiniteKnob360","max","origin","direction","angle","onInteractiveChange","editedValue","setEditedValue","onKnobEnd","onKnobInteractiveChange","tickSize","tickMargin","pointerMargin","outerTickRadius","outerKnobRadius","pointerSize","pointerPosRadius","editable","shadowWidth","localTarget","interactiveHook","getUnreachableRange","range","unrachableRange","angleRange","angleOffset","Knob","Range","Scale","Label","Pointer","Value","MotorRotation","moveHardware","useDebouncedCallback","isClockWise","isMotorClockWise","limits","motorLimits","getStyle","MotorMonitor","position","display_digits","getText","userTags","autoReady","autoOn","newState","reduced","isMotorHardware","useMotorHardware","inverted","anticlockwiseTag","clockwiseTag","MotorVariants","motor","halfMotor","unknownMotor","notReadyMotor","disconnectedMotor","powerOffMotor","createMotorMock","MotorSimulator","minLimit","maxLimit","initialPosition","initialVelocity","setPosition","setTarget","internalTimeRef","updatePosition","now","deltaTime","newPosition","newTarget","deltaPosition","pos","timer","rawHardware","MultipositionState","Multiposition","selectionRef","onMove","stop","opts","DropdownButton2","bsPrefix","rootCloseEvent","menuRole","renderMenuOnMount","href","menuVariant","popperConfig","DropdownToggle","DropdownMenu","DropdownButton2$1","PositionItem","currentPositionId","onSelect","filter","positionId","f","getPosition","positions","Header","targetPositionId","getBadge","badge","description","hardwareIsMoving","moveTo","normalizePositionId","setFilter","CloseButton","positionDesc","MultipositionDefault","MultipositionDefault2","MultipositionVariants","MultipositionSimulator","OpticState","MultiPositionMagnification","hardwareMoving","magnification","magnifications","a","moveHardwareMagnification","index","itemMagnification","m","FixedMagnification","allowtuning","InputMagnification","rangeMin","rangeMax","formRef","rangeRef","setHardwareMagnification","event","valueAsFloat","updateEdit","onInputChange","onRangeChange","onRangeAccepted","RangeMagnification","OffMagnification","Optic","getOpticClass","Class","isOpticHardware","OpticVariants","fixedjson","offjson","rangejson","OpticSimulator","kind","getInitial","move","speed","setMagnification","ProcedureState","Actions","waitingUserInput","aborting","isRunning","doStart","doAbort","ProcedureManage","awaitingUserInput","FinishedState","runState","runException","definition","ProcedureExecution","doValidate","ProcedureValidate","ProcedureVariants","isProcedureHardware","useProcedureHardware","standby","ShutterState","getState","getVariant","ShutterOverlay","ShutterDefault","getAction","action","DropdownShutter","requestOpen","requestClose","ShutterProtected","capitalize","valueName","ShutterMonitor","ShutterVariants","closed","ShutterSimulator","useResolvedSlit","vgapId","vgap","hgapId","hgap","voffsetId","_c","voffset","hoffsetId","_d","hoffset","SlitState","info","vgapActions","hgapActions","voffsetActions","hoffsetActions","merge","DropdownSlit","operator","resolved","Widget","normalizePosition","gap","gapUnit","gapMoving","offset","offsetUnit","offsetMoving","_e","_f","_g","_h","SlitDefault","Variants$f","slit","horizontal","vertical","PumpOverlay","attrs","Pump","PumpVariants","PusherState","leftIcon","rightIcon","iconLocation","onAction","onActionChange","inAction","setInAction","iconAtRight","iconAtLeft","PusherBlock","leftToRight","ButtonPush","distance","RawPusher","isRetracted","isInTouch","isLost","moving","setMoving","getLocation","location","Pusher","PusherVariants","PusherSimulator","ServiceState","ServiceDefault","requestStart","requestRestart","requestStop","getStartAction","restartEnabled","getStopAction","stopEnabled","startAction","stopAction","DropdownService","ServiceProtected","ServiceVariants","TomoFlatMotionState","AxisName","motion","axisId","axis","DropAxis","axisRef","requestDropAxis","AxisOnOff","isUsed","requestAppendAxis","InputAxisMotion","exp","MotionKind","requestAbsoluteMotion","requestRelativeMotion","TomoFlatMotionDefault","isTomoFlatMotionEditable","imotion","getKind","kindVariant","kindTitle","TomoFlatMotionSmall","isIn","isOut","face","TomoFlatMotionSampleLocation","TomoFlatMotionVariants","isTomoFlatMotionHardware","useTomoFlatMotionHardware","sy","sy2","TomoFlatMotionSimulator","updateAxes","inList","TomoReferencePositionDefault","processing","setProcessing","onClickToReference","isTomoReferencePositionHardware","TomoReferencePositionVariants","TomoDetectorState","SelectPixelSizeMode","requestMode","mode","InputUserPixelSize","userSamplePixelSize","requestUserSamplePixelSize","DropdownPixelSize","useFormattedQuantity","displayUnit","normUnit","u","normValue","v","Qty","TomoDetectorSamplePixelSize","formattedValue","convert","from","to","formatedUnit","getHardwareIdFromRef","TomoDetectorFieldOfView","samplePixelSize","detector","hardwareDet","propertiesDet","AcquisitionMode","InputAccMaxExpoTime","requestUpdate","lima","DropdownAcquisitionMode","limaId","limaActions","TomoDetectorAcquisitionMode","TomoDetectorVariants","isTomoDetectorHardware","useTomoDetectorHardware","TomoDetectorsState","DropdownDetectors","detectors","activeDetectorId","targetDetectorId","mountDetector","detectorId","detectorRef","TomoDetectors","hardwareMounting","TomoDetectorsVariants","isTomoDetectorsHardware","useTomoDetectorsHardware","TomoImagingState","UpdateMode","updateOnMove","setUpdateModeOff","setUpdateModeAuto","ExposureTime","TakeActions","takeProj","takeDark","takeFlat","TomoImagingDefault","QuantityInputNumberOrNull","decimals","allowNullAsEmpty","editing","convertFromDisplay","convertToDisplay","inputToDisplay","acceptEdition","abortEdition","displayedValue","QuantityInputNumber","onAccepted","otherProps","AccumulationIfOne","hardwareTomo","acqMode","TomoImagingExposureTime","SettleTime","settleTime","TomoImagingSettleTime","ProcessingButton","onStarted","onTerminated","useActiveLimaDetector","restoreSample","limaOffline","TomoImagingActions","TomoImagingUpdateMode","TomoImagingVariants","TomoImagingSimulator","Variants$5","isTomoSampleStageHardware","useTomoSampleStageHardware","LatencyTime","valueFromHardware","TomoConfigLatencyTime","TomoConfigVariants","isTomoConfigHardware","useTomoConfigHardware","TomoHoloState","Variants$2","isTomoHoloHardware","useTomoHoloHardware","ValveOverlay","Valve","ValveVariants","logger","debug","NoObject","LoadingObject","MissingObject","ErrorObject","MissingComponentObject","FullSizer","containerRef","view","lowWarning","hiWarning","lowDanger","hiDanger","toPercent","geometry","lowPercentDanger","hiPercentDanger","lowPercentWarning","hiPercentWarning","valueClassName","powerRadius","width0","width100","getWidth","Power","PanelHeader","PanelContents","Panel","Wrap","Yaml","YamlLabel","providers","yamlNode","unknownOptions","assertString","assertNoUnknownKeys","YamlRow","panel","renderYamlNode","YamlCol","xs","assertOptionalNumber","YamlContainer","YamlPanel","contentsStyle","hash","YamlTabs","tabs","each","t","Tab","Tabs","remainingContent","assertOnRemainingKeys","RowTitle","row","getId","idContent","titlealign","stateinheader","newContent","stateContent","YamlForm","content","React","YamlGrid","columnSpan","rowSpan","gridColumn","gridRow","yamlContainers","registerYamlContainer","component","yamlComponents","YamlTodo","YamlNone","registerYamlComponent","registerYamlComponents","YamlComponent","scroll","Comp","Suspense","_parentNode","_indexFromParent","remainingContent2","UnknownKeysError","LayoutError","__publicField","unknownKeys","MissingKeysError","missingKeys","KeyError","getYamlRoot","getYamlHierarchy","path","normalizeLayout","parentNode","indexFromParent","newNode","assertKeyExpected","assertBoolean","assertNumber","assertOptionalBoolean","assertOptionalString","assertStringList","assertOptionalStringOrStringList","assertOptionalStringList","assertOptionalNumberList","assertOptionalListOfType","isType","typeName","assertDataCollectionId","assertOptionalBackend","assertOptionalArgs","assertOptionalKwargs","assertStringMappingRecord","optional","schema","unexpectedKeys","k","valueMap","assertFunc","hardwareMap","initialVariants","l","registerHardwareVariant","getHardwareVariantComponent","baseVariants","HardwareState","emptyifnone","args","ModalDialog","buttons","cancelText","footer","showClose","show","otherButtons","bodyClassName","fullscreen","onShow","onHide","Modal","ConditionalWrap","ButtonTriggerModal","showModal","setShowModal","showButton","targetRef","close","onCloseModal","useImperativeHandle","ModalClass","ButtonTriggerModal$1","dynamicOp","op","a1","b1","operators","rsplit","separator","split","normalizeId","useValue","valuePath","obj","propName","useUnit","unitPath","isFixedUnit","MonitorHardwareProperty","monitor","flt","checkValidity","Synoptic","buttonRefs","svg","setSvg","synoptic","fetchSVG","getHardwareGroupComponent","hardwareObjects","groups","el","stateColor","hasComponents","obj_state","comparison","cls","SvgProxy","popups","buttonRef","createRef","SvgLoader","DefaultErrorMessage","LayoutErrorMessage","formatPreview","indent","lines","actualIndentation","layoutName","INITIAL_STATE","ErrorBoundary","Component","data","prevProps","prevState","UnhandledErrorComponent","hasError","Main","layout","monitorMap","MonitorHardware","registerMonitorComponent","YmlError","MonitorPanel","nid"],"mappings":"00BAKO,SAASA,GAAiBC,EAAkC,OAC3D,KAAA,CAAE,SAAAC,CAAa,EAAAD,EACf,CAAE,OAAAE,EAAQ,OAAAC,EAAS,IAAA,EAASF,EAC5BG,EAAQF,GACTC,IAAW,KAAO,UAAWE,EAAAJ,EAAS,aAAT,YAAAI,EAAqB,QAAU,UAC7D,UAcEC,EAX6C,CACjD,MAAO,UACP,QAAS,YACT,OAAQ,YACR,SAAU,YACV,QAAS,SACT,MAAO,SACP,OAAQ,SACR,OAAQ,SAAA,EAGqBF,CAAK,GAAK,UAEzC,OAAQG,EAAAA,IAAAC,EAAAA,MAAA,CAAM,GAAIF,EAAU,SAAMF,CAAA,CAAA,CACpC,CAEA,SAAwBK,GAAaT,EAAuC,CACpE,KAAA,CAAE,SAAAC,CAAa,EAAAD,EACd,OAAAO,MAACR,IAAiB,SAAAE,CAAoB,CAAA,CAC/C,CCrBA,SAAwBS,GACtBV,EACA,CACM,KAAA,CAAE,SAAAC,EAAU,QAAAU,CAAY,EAAAX,EAC9B,SAASY,GAAU,CACjB,OAAIX,EAAS,KACJA,EAAS,KAEXA,EAAS,EAClB,CAEA,SAASY,GAAW,CACd,OAAAF,EAAQ,eAAiB,OACpBA,EAAQ,aAEbV,EAAS,MACJA,EAAS,MAEdA,EAAS,KACJA,EAAS,KAEXA,EAAS,EAClB,CAEA,SAASa,GAAW,CACd,GAAAH,EAAQ,eAAiB,OACpB,MAAA,cAAcC,EAAS,CAAA,GAEhC,GAAIX,EAAS,MACJ,MAAA,cAAcA,EAAS,IAAI,EAGtC,CAEA,MAAMc,EAAOF,IACPG,EAAQF,IACP,OAAAP,EAAAA,IAAC,OAAK,CAAA,MAAAS,EAAe,SAAKD,CAAA,CAAA,CACnC,CCnCA,SAAwBE,GACtBjB,EACA,CACA,KAAM,CAAE,SAAAC,EAAU,QAAA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AAQ/T,EAAAA,IAAA6iC,GAAA,CAAS,QAAA3C,EAAkB,QAAQ,iBAAkB,CAAA,EAG/D,GAAIN,IAAQ,KAER,OAAA5/B,EAAA,IAAC4D,EAAA,CACC,MAAM,OACN,QAAQ,SACR,YAAa,aAAamQ,CAAE,iBAAA,CAAA,EAK5B,KAAA,CAAE,KAAA9N,EAAO,MAAW,EAAA25B,EAEpBlgC,EAAW,CACf,GAAGkgC,EACH,QAAAr5B,CAAA,EAGIg0B,EAAO8C,GAA4Bp3B,EAAM,SAAS,EACxD,OAAKs0B,EAKHv6B,EAAA,IAACu6B,EAAA,CACC,SAAA76B,EACA,QAAS,CAAE,KAAMwgC,EAAQ,IAAK,EAC9B,SAAU,GACV,SAAU,EAAA,CAAA,EARLlgC,MAACR,IAAiB,SAAAE,CAAoB,CAAA,CAWjD"}
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/components/ReadOnlyTextInput.tsx","../src/hardware/base/BaseProperty.tsx","../src/monitorpanel/MonitorPanelItem.tsx","../src/hardware/base/BaseMonitor.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/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/hardware/beamviewer/Beamviewer.tsx","../src/hardware/beamviewer/index.ts","../src/hardware/beamviewer/mocks/index.ts","../src/hardware/beamviewer/mocks/Simulator.tsx","../src/hardware/energymanager/EnergyManagerState.tsx","../src/hardware/energymanager/EnergyManagerDefault.tsx","../src/hardware/energymanager/EnergyManagerMonitor.tsx","../src/hardware/energymanager/index.ts","../src/hardware/energymanager/mocks/index.ts","../src/hardware/energymanager/mocks/Simulator.tsx","../src/utils/formatting.ts","../src/hardware/frontend/Frontend.tsx","../src/hardware/frontend/FrontendMonitor.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/components/InfiniteKnob360.tsx","../src/hardware/motor/MotorRotation.tsx","../src/hardware/motor/MotorMonitor.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/MultipositionState.tsx","../src/hardware/multiposition/Multiposition.tsx","../src/components/DropdownButton2.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/regulation/utils.ts","../src/hardware/regulation/RegulationDefault.tsx","../src/hardware/regulation/RegulationMonitor.tsx","../src/plotting/MultiCurveTooltip.tsx","../src/plotting/CurvePlot.tsx","../src/hardware/regulation/RegulationPlot.tsx","../src/hardware/regulation/index.ts","../src/hardware/regulation/mocks/index.ts","../src/hardware/regulation/mocks/Simulator.tsx","../src/hardware/shutter/ShutterState.tsx","../src/hardware/shutter/ShutterDefault.tsx","../src/hardware/shutter/ShutterProtected.tsx","../src/hardware/shutter/ShutterMonitor.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/TomoFlatMotionSampleLocation.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/utils/units.ts","../src/hardware/utils/hardware.ts","../src/hardware/tomodetector/TomoDetectorFieldOfView.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/components/QuantityInputNumberOrNull.tsx","../src/components/QuantityInputNumber.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/components/GaugeIndicator.tsx","../src/layout/Panel.tsx","../src/yaml-layout/components/None.tsx","../src/yaml-layout/components/Label.tsx","../src/yaml-layout/containers/Row.tsx","../src/yaml-layout/containers/Col.tsx","../src/yaml-layout/containers/Container.tsx","../src/yaml-layout/containers/Panel.tsx","../src/yaml-layout/containers/Tabs.tsx","../src/yaml-layout/containers/Form.tsx","../src/yaml-layout/containers/Grid.tsx","../src/yaml-layout/registry.ts","../src/yaml-layout/Component.tsx","../src/yaml-layout/utils.tsx","../src/yaml-layout/asserts.ts","../src/yaml-layout/components/Todo.tsx","../src/hardware/registry.ts","../src/components/HardwareState.tsx","../src/components/ModalDialog.tsx","../src/components/ConditionalWrap.tsx","../src/components/ButtonTriggerModal.tsx","../src/monitorpanel/MonitorHardwareProperty.tsx","../src/components/Synoptic.tsx","../src/yaml-layout/ErrorBoundary.tsx","../src/yaml-layout/Main.tsx","../src/monitorpanel/MonitorPanel.tsx","../src/monitorpanel/MonitorHardware.tsx"],"sourcesContent":["import type { AnyHardware } 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: AnyHardware }) {\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: 'secondary',\n MOVING: 'transient',\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 { 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 { 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';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\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 className=\"flex-nowrap\">\n <ReadOnlyTextInput value={getValue()} />\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 { forwardRef } from 'react';\nimport type { PropsWithChildren } from 'react';\nimport { Col } from 'react-bootstrap';\n\ninterface MonitorPanelItemProps {\n className?: string;\n style?: Record<string, unknown>;\n}\n\n/**\n * Component for any item displayed in the monitor panel.\n *\n * The implementation with `forwardRef` and `...rest` allow\n * to use it inside a `OverlayTrigger`\n *\n * @param rest: Passthough to allow to wrap the component inside\n * OverlayTrigger. It contains callbacks.\n */\nexport const MonitorPanelItem = forwardRef<\n HTMLDivElement,\n PropsWithChildren<MonitorPanelItemProps>\n>(({ className = '', style, children, ...rest }, ref) => {\n return (\n <Col\n ref={ref}\n {...rest}\n className={`monitor-panel-item ${className}`}\n style={style}\n >\n {children}\n </Col>\n );\n});\n","import type {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport type { AnySchema } from '../utils/schema';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\nimport { AnyHardwareState } from './BaseState';\n\nfunction BaseMonitor(\n props: HardwareWidgetProps<AnySchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n\n const name = options.name ?? hardware.alias ?? hardware.name ?? hardware.id;\n\n return (\n <MonitorPanelItem>\n <h1>{name}</h1>\n <AnyHardwareState hardware={hardware} />\n </MonitorPanelItem>\n );\n}\n\nexport default BaseMonitor;\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';\nimport BaseMonitor from './BaseMonitor';\n\nconst Variants: HardwareVariant<AnySchema> = {\n state: BaseState,\n name: BaseName,\n info: BaseInfo,\n property: BaseProperty,\n // To be used as 'monitor' in the application header\n monitor: BaseMonitor,\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 State(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 MultiState(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 <State\n state=\"NO_STATE\"\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 <State\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 { State } 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: 'success',\n OFF: 'danger',\n MOVING_ON: 'transient',\n MOVING_OFF: 'transient',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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 {\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: 'success',\n OFF: 'danger',\n MOVING_ON: 'transient',\n MOVING_OFF: 'transient',\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 type AirBearingSchema = Hardware<{\n state: string;\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","import { Fragment, useState } from 'react';\nimport { map } from 'lodash';\n\nimport {\n Container,\n Row,\n Col,\n Badge,\n Button,\n OverlayTrigger,\n Popover,\n Form,\n} from 'react-bootstrap';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { BeamviewerSchema } from '.';\n\nfunction BeamviewerOverlay(props: HardwareWidgetProps<BeamviewerSchema>) {\n const [current, setCurrent] = useState();\n const [errorMsg, setErrorMsg] = useState<string>();\n const { hardware, options = {} } = props;\n\n function read() {\n const promise = hardware.actions.call('read');\n if (promise !== undefined) {\n console.log('pending');\n promise\n .then((resp: any) => {\n setCurrent(resp);\n setErrorMsg(undefined);\n })\n .catch((error: any) => {\n setErrorMsg(`${error}`);\n });\n }\n return promise;\n }\n\n function onChangeRange(value: any) {\n return hardware.actions.setProperty('diode_range', value);\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 <Container>\n <Row>\n <Col sm={6} className=\"text-nowrap\">\n Diode Range:\n </Col>\n <Col>\n <Form.Control\n size=\"sm\"\n as=\"select\"\n disabled={props.disabled}\n onChange={(e) => {\n onChangeRange(e.target.value);\n }}\n defaultValue={hardware.properties.diode_range}\n >\n {map(hardware.properties.diode_ranges, (r) => (\n <option value={r} key={r}>\n {r}\n </option>\n ))}\n </Form.Control>\n </Col>\n </Row>\n <Row>\n <Col sm={6}>Current:</Col>\n <Col>\n {errorMsg && (\n <i\n className=\"fa-solid fa-triangle-exclamation me-1\"\n title={errorMsg}\n />\n )}\n {!errorMsg && <>{current}</>}\n <Button\n size=\"sm\"\n disabled={props.disabled}\n onClick={() => {\n void read();\n }}\n >\n Read\n </Button>\n </Col>\n </Row>\n </Container>\n </Popover.Body>\n </Popover>\n }\n >\n <Button title=\"Beamviewer Details\" className=\"float-end\" size=\"sm\">\n <i className=\"fa fa-ellipsis-h\" />\n </Button>\n </OverlayTrigger>\n );\n}\n\nfunction Beamviewer(props: HardwareWidgetProps<BeamviewerSchema>) {\n const { hardware, options = {} } = props;\n interface Property {\n name: string;\n prop: 'screen' | 'led' | 'foil';\n success: string;\n toggle: boolean;\n button: string;\n test?: boolean;\n }\n\n const properties: Property[] = [\n {\n name: 'Screen',\n prop: 'screen',\n success: 'OUT',\n toggle: hardware.properties.screen === 'IN',\n button: hardware.properties.screen === 'IN' ? 'Out' : 'In',\n },\n {\n name: 'Led',\n prop: 'led',\n success: 'OFF',\n toggle: hardware.properties.led === 'ON',\n button: hardware.properties.led === 'ON' ? 'Off' : 'On',\n },\n {\n name: 'Foil',\n prop: 'foil',\n success: 'OUT',\n toggle: hardware.properties.foil === 'IN',\n button: hardware.properties.foil === 'IN' ? 'Out' : 'In',\n test: hardware.properties.foil !== 'NONE',\n },\n ];\n\n function toggle(prop: string, value: any) {\n hardware.actions.call(prop, value);\n }\n\n return (\n <div className=\"hw-component\">\n <div className=\"hw-head\">\n <TypeIcon\n name=\"Beamviewer\"\n icon=\"fam-hardware-beamviewer\"\n online={hardware.online}\n />\n <div className=\"name me-auto\">{hardware.name}</div>\n <BeamviewerOverlay {...props} />\n </div>\n <div className=\"hw-content\">\n <Container style={{ minWidth: '150px' }}>\n {map(properties, (p) => (\n <Fragment key={p.name}>\n {(p.test === true || p.test === undefined) && (\n <Row className=\"align-items-center mb-1\">\n <Col sm={4}>{p.name}</Col>\n <Col sm={4}>\n <Badge\n className=\"ms-1\"\n bg={\n hardware.properties[p.prop] === p.success\n ? 'success'\n : 'danger'\n }\n >\n {hardware.properties[p.prop]}\n </Badge>\n </Col>\n <Col sm={4}>\n <Button\n size=\"sm\"\n className=\"ms-1\"\n disabled={props.disabled}\n onClick={(e) => toggle(p.prop, !p.toggle)}\n >\n {p.button}\n </Button>\n </Col>\n </Row>\n )}\n </Fragment>\n ))}\n </Container>\n </div>\n </div>\n );\n}\n\nexport default Beamviewer;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport Beamviewer from './Beamviewer';\n\n/**\n * Hardware as exposed by Redux\n */\nexport type BeamviewerSchema = Hardware<{\n /**\n * Tango state of the Lima camera monitoring the beam\n */\n state: string;\n foil: 'IN' | 'OUT' | 'NONE' | 'UNKNOWN';\n led: 'ON' | 'OFF' | 'UNKNOWN';\n screen: 'IN' | 'OUT' | 'UNKNOWN';\n diode_ranges: string[];\n diode_range: string;\n}>;\n\nconst Variants: HardwareVariant<BeamviewerSchema> = {\n default: Beamviewer,\n};\n\nexport default Variants;\n","import defaultjson from './Beamviewer.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","/* eslint no-await-in-loop: \"off\" */\nimport { useState } from 'react';\nimport { Simulator, delay } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nconst diodeRanges = ['1mA', '100uA', '10uA', '1uA', '100nA', '10nA'];\n\nexport default function BeamviewerSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [led, setLed] = useState('OFF');\n const [screen, setScreen] = useState('OUT');\n const [foil, setFoil] = useState('NONE');\n const [diodeRange, setDiodeRange] = useState('1uA');\n\n async function call(name: string, value?: any): Promise<any> {\n if (name === 'read') {\n const current = Math.random();\n if (current < 0.1) {\n throw new Error('Dummy error');\n }\n return current;\n }\n if (name === 'led') {\n setLed(value ? 'ON' : 'OFF');\n return null;\n }\n if (name === 'screen') {\n setScreen(value ? 'IN' : 'OUT');\n return null;\n }\n if (name === 'foil') {\n setFoil(value ? 'IN' : 'OUT');\n return null;\n }\n console.log('BeamviewerSimulator: Unsupported call', name, value);\n return null;\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n if (name === 'diode_range') {\n setDiodeRange(value);\n return;\n }\n console.log('BeamviewerSimulator: Unsupported setProperty', name, value);\n }\n\n const properties = {\n state: 'ON',\n led,\n screen,\n foil,\n diode_range: diodeRange,\n diode_ranges: diodeRanges,\n };\n\n console.log(properties);\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 { State } from '../utils/State';\nimport type { EnergyManagerSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\n\nexport function EnergyManagerState(props: { hardware: EnergyManagerSchema }) {\n const { hardware } = props;\n const { energy = null } = hardware.properties ?? {};\n const energyState =\n energy !== null || Number.isFinite(energy) ? 'VALID' : 'INVALID';\n const state = hardware.online ? energyState : 'OFFLINE';\n const variants: { [state: string]: string } = {\n VALID: 'success',\n INVALID: 'danger',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State state={state} minWidth={7} variant={variant} />;\n}\n\nexport default function DefaultState(\n props: HardwareWidgetProps<EnergyManagerSchema>\n) {\n const { hardware } = props;\n return <EnergyManagerState hardware={hardware} />;\n}\n","import { Button, InputGroup, Dropdown } from 'react-bootstrap';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport type { EnergyManagerSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport ReadOnlyTextInput from '../../components/ReadOnlyTextInput';\nimport { HardwareTemplate } from '../..';\nimport { EnergyManagerState } from './EnergyManagerState';\nimport { useMemo } from 'react';\n\nfunction DropdownSources(props: HardwareWidgetProps<EnergyManagerSchema>) {\n const { hardware, disabled = false } = props;\n const { properties } = hardware;\n const { source = null, available_source_names: sourceNames = [] } =\n properties;\n\n const selectedSource = source?.slice('hardware:'.length);\n\n function selectSource(sourceName: string) {\n void hardware.actions.setProperty('source', `hardware:${sourceName}`);\n }\n\n function createSelectableItem(sourceName: string) {\n const selected = selectedSource === sourceName;\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={sourceName}\n disabled={disabled}\n onClick={() => {\n selectSource(sourceName);\n }}\n title={`Select the source ${sourceName}`}\n >\n <i className={icon} />\n &nbsp; {sourceName}\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 {sourceNames.map((s) => createSelectableItem(s))}\n </Dropdown.Menu>\n </Dropdown>\n );\n}\n\nexport function EnergyManagerDefault(\n props: HardwareWidgetProps<EnergyManagerSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { properties = {} } = hardware;\n const { energy, unit, source } = properties;\n\n const widgetIcon = (\n <TypeIcon\n name=\"Energymanager\"\n icon=\"fam-hardware-multiposition\"\n online={hardware.online}\n />\n );\n\n const widgetState = <EnergyManagerState hardware={hardware} />;\n\n function formatEnergy(energy: undefined | number | null) {\n if (energy === undefined) {\n return 'Unknown';\n }\n if (energy === null) {\n return '∅';\n }\n if (Number.isFinite(energy)) {\n return energy.toFixed(2);\n }\n // inf and nan\n return '∅';\n }\n\n const sourceName = useMemo(() => {\n if (source === undefined) {\n return 'Unknown';\n }\n const sourceName = source.slice('hardware:'.length);\n if (sourceName === '') {\n return 'No source';\n }\n return sourceName;\n }, [source]);\n\n function getWidgetContent() {\n return (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text>{sourceName}</InputGroup.Text>\n <ReadOnlyTextInput value={formatEnergy(energy)} />\n {!disabled && <DropdownSources {...props} />}\n {unit && <InputGroup.Text>{unit}</InputGroup.Text>}\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 { useMemo } from 'react';\nimport type {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport type { EnergyManagerSchema } from '.';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\nimport { Badge } from 'react-bootstrap';\n\nexport function EnergyManagerMonitor(\n props: HardwareWidgetProps<EnergyManagerSchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const { source, energy, unit } = properties;\n\n function formatEnergy(\n energy: undefined | number | null,\n unit: string | undefined\n ) {\n if (energy === undefined || unit === undefined) {\n return 'Unknown';\n }\n if (energy === null) {\n return '∅';\n }\n if (Number.isFinite(energy)) {\n return `${energy.toFixed(2)} ${unit}`;\n }\n // inf and nan\n return '∅';\n }\n\n const sourceName = useMemo(() => {\n if (source === undefined) {\n return 'Unknown';\n }\n const sourceName = source.slice('hardware:'.length);\n if (sourceName === '') {\n return 'No source';\n }\n return sourceName;\n }, [source]);\n\n const text = formatEnergy(energy, unit);\n const bgVariant = text !== '∅' ? 'success' : 'danger';\n return (\n <MonitorPanelItem>\n <h1>{options.name ?? sourceName}</h1>\n <Badge bg={bgVariant}>{text}</Badge>\n </MonitorPanelItem>\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport { EnergyManagerDefault } from './EnergyManagerDefault';\nimport { EnergyManagerMonitor } from './EnergyManagerMonitor';\nimport { EnergyManagerState } from './EnergyManagerState';\n\nexport type EnergyManagerSchema = Hardware<{\n energy: number | null;\n unit: string;\n available_source_names: string[];\n source: string;\n}>;\n\nconst Variants: HardwareVariant<EnergyManagerSchema> = {\n default: EnergyManagerDefault,\n // Override base state\n state: EnergyManagerState,\n // Override default monitor\n monitor: EnergyManagerMonitor,\n};\n\nexport default Variants;\n","import defaultjson from './EnergyManager.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useMemo, useState } from 'react';\nimport { Simulator } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nconst ENERGIES: Record<string, number | null> = {\n pink_beam: 1.2,\n dcm: 15.6,\n dcm_off: null,\n};\n\nexport default function EnergyManagerSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [source, setSource] = useState<string>('pink_beam');\n\n async function call(name: string, value?: any): Promise<void> {\n console.log('MultipositionSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n if (name === 'source') {\n const shortName = value.slice('hardware:'.length);\n setSource(shortName);\n return;\n }\n console.log('EnergyManagerSimulator: Unsupported setProperty', name, value);\n }\n\n const sourceNames = useMemo(() => {\n return Object.keys(ENERGIES).map((key) => {\n return key;\n });\n }, []);\n\n const properties = {\n energy: ENERGIES[source] ?? null,\n unit: 'keV',\n source: `hardware:${source}`,\n available_source_names: sourceNames,\n };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"energymanager\"\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 { Badge, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport type { FrontendSchema } from '.';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\n\nfunction getValidityStyle(state: string) {\n switch (state) {\n case 'OPEN':\n case 'RUNNING':\n return 'success';\n }\n return 'danger';\n}\n\nfunction FrontendMonitor(\n props: HardwareWidgetProps<FrontendSchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const { state = 'OFFLINE', status } = properties;\n\n const name = options.name ?? hardware.alias ?? hardware.name;\n\n const checkClass = getValidityStyle(state);\n\n const widget = (\n <MonitorPanelItem>\n <h1>{name}</h1>\n <Badge bg={checkClass}>{`${state}`}</Badge>\n </MonitorPanelItem>\n );\n\n if (status) {\n const overlayStr = `${status}`;\n return (\n <OverlayTrigger\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 {widget}\n </OverlayTrigger>\n );\n }\n\n return widget;\n}\n\nexport default FrontendMonitor;\n","import type { HardwareVariant } from '../utils/types';\nimport type { Hardware } from '../utils/types';\nimport Frontend from './Frontend';\nimport FrontendMonitor from './FrontendMonitor';\n\nexport type FrontendSchema = Hardware<{\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\nconst Variants: HardwareVariant<FrontendSchema> = {\n default: Frontend,\n // Override default monitor\n monitor: FrontendMonitor,\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 type GaugeSchema = Hardware<{\n state: string;\n status: string;\n pressure: number;\n unit?: string; // FIXME: The server implementation is missing\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 { State } 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 <State\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 type LaserSchema = Hardware<{\n state: string;\n power: number;\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 { State } 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 <State\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 type LaserHeatingSchema = Hardware<{\n state: string;\n exposure_time: number;\n background_mode: 'ON' | 'OFF' | 'ALWAYS';\n fit_wavelength: number[];\n current_calibration: string;\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 type LightSchema = Hardware<{\n state: string;\n temperature: number;\n intensity: number;\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 { State } 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 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: 'transient',\n READY: 'success',\n OFFLINE: 'secondary',\n LOCKED: 'warning',\n };\n const variant = variants[finalState] ?? variants.UNKNOWN;\n return <State 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 { binning, binning_mode: binningMode = 'SUM' } = properties;\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 if (binning === undefined) {\n return (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text title=\"Binning applied to the detector\">\n <i className=\"fa fa-fw fam-binning-2d fa-2x\" />\n </InputGroup.Text>\n <ReadOnlyTextInput value=\"? × ?\" />\n </InputGroup>\n );\n }\n\n const [bh, bv] = binning ?? [0, 0];\n const b = bh === bv ? bh : 0;\n\n return (\n <InputGroup className=\"flex-nowrap\">\n <InputGroup.Text title=\"Binning applied to the detector\">\n <i className=\"fa fa-fw fam-binning-2d fa-2x\" />\n </InputGroup.Text>\n <ReadOnlyTextInput value={`${binning[0]} × ${binning[1]}`} />\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 {\n AnyHardware,\n Hardware,\n HardwareChangeActions,\n HardwareSchemaDescription,\n} from '../hardware/utils/types';\n\ninterface RuntimeHooks {\n useHardware?: (id: string | null) => AnyHardware | null;\n useHardwareChangeActions?: (name: string | null) => HardwareChangeActions;\n useHardwareSchema?: (\n hardware: { id: string; type: string } | null\n ) => HardwareSchemaDescription | null;\n useOperator?: () => boolean;\n useScanRunning?: () => boolean;\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 if (hooks.useHardwareSchema) {\n if (runtimeHooks.useHardwareSchema) {\n console.warn('useHardwareSchema hook was already registered');\n }\n runtimeHooks.useHardwareSchema = hooks.useHardwareSchema;\n }\n if (hooks.useOperator) {\n if (runtimeHooks.useOperator) {\n console.warn('useOperator hook was already registered');\n }\n runtimeHooks.useOperator = hooks.useOperator;\n }\n if (hooks.useScanRunning) {\n if (runtimeHooks.useScanRunning) {\n console.warn('useScanRunning hook was already registered');\n }\n runtimeHooks.useScanRunning = hooks.useScanRunning;\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): AnyHardware | 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\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 useHardwareSchema(\n hardware: { id: string; type: string } | null\n): HardwareSchemaDescription | null {\n if (!runtimeHooks.useHardwareSchema) {\n throw new Error('No `useHardwareSchema` hook registered');\n }\n return runtimeHooks.useHardwareSchema(hardware);\n}\n\n/**\n * True if the actual user can control the beamline (like moving motors)\n */\nexport function useOperator(): boolean {\n if (!runtimeHooks.useOperator) {\n throw new Error('No `useOperator` hook registered');\n }\n return runtimeHooks.useOperator();\n}\n\n/**\n * True if a scan is actually running\n */\nexport function useScanRunning(): boolean {\n if (!runtimeHooks.useScanRunning) {\n throw new Error('No `useScanRunning` hook registered');\n }\n return runtimeHooks.useScanRunning();\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\nexport interface LimaProperties extends Record<string, unknown> {\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/**\n * Hardware as exposed by Redux\n */\nexport type LimaSchema = Hardware<LimaProperties>;\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 { LimaProperties } 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<LimaProperties>({\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: LimaProperties,\n binning: [number, number]\n ): LimaProperties {\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: LimaProperties,\n binningMode: 'SUM' | 'MEAN'\n ): LimaProperties {\n return {\n ...props,\n binning_mode: binningMode,\n };\n }\n\n function changeRotation(\n props: LimaProperties,\n rotation: 0 | 90 | 180 | 270\n ): LimaProperties {\n return {\n ...props,\n rotation,\n };\n }\n\n function changeFlipX(props: LimaProperties, flip: boolean): LimaProperties {\n return {\n ...props,\n flip: [flip, props.flip[1]],\n };\n }\n function changeFlipY(props: LimaProperties, flip: boolean): LimaProperties {\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 Alert,\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';\nimport HardwareTemplate from '../utils/HardwareTemplate';\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\nfunction WidgetContent(props: HardwareWidgetProps<MeasurementGroupSchema>) {\n const { hardware, disabled = false } = props;\n const { online } = hardware;\n\n if (!online) {\n return <Alert>Offline</Alert>;\n }\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 return (\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 );\n}\n\nexport default function MeasurementGroup(\n props: HardwareWidgetProps<MeasurementGroupSchema>\n) {\n const { hardware, options = {}, disabled = false } = props;\n\n function setActive() {\n return hardware.actions.call('set_active');\n }\n\n const active = false;\n\n const headerMode = options.header ?? 'top';\n\n const widgetIcon = (\n <TypeIcon name=\"Measurement Group\" icon=\"fa-list-ol\" online />\n );\n\n const widgetState = (\n <>\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 </>\n );\n\n const widgetContent = <WidgetContent {...props} />;\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 MeasurementGroup from './MeasurementGroup';\n\nexport interface MeasurementGroupProperties extends Record<string, unknown> {\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/**\n * Hardware as exposed by Redux\n */\nexport type MeasurementGroupSchema = Hardware<MeasurementGroupProperties>;\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 { MeasurementGroupProperties } from '..';\n\nexport default function MeasurementGroupSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [properties, setProperties] = useState<MeasurementGroupProperties>({\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 { MultiState } 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: 'transient',\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?.reason ?? ' an object'}`;\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 <MultiState\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, hardware } = props;\n const { properties } = hardware;\n function onMoveVelocityRequested(target: number) {\n return hardware.actions.setProperty('velocity', target);\n }\n\n function onMoveAccelerationRequested(target: number) {\n return 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>{hardware.name} details</Popover.Header>\n <Popover.Body>\n <Form.Group>\n <Form.Label>Velocity</Form.Label>\n <HardwareInputNumber\n hardwareValue={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={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 { useState } from 'react';\nimport type {\n InteractiveHookEvent,\n InteractiveHookResult,\n} from '@vallsv/rc-knob';\nimport { Knob, Value, Pointer, Scale, Range, Label } from '@vallsv/rc-knob';\n\n/**\n * FIXME: Have to be replaced by\n */\nconst sassVariables = {\n background: 'hsl(0 0% 98%)',\n backgroundD10: 'hsl(0 0% 88%)',\n disabled0: 'hsl(0, 0%, 93%)',\n disabledD10: 'hsl(0, 0%, 83%)',\n danger: 'rgb(220, 53, 69)',\n // Edited by the user, but not yet validated\n edited: 'hsl(45, 100%, 71.4%)',\n transient: '#4285eb',\n text: 'black',\n textD10: 'black',\n};\n\nconst Origin: Record<string, number> = {\n up: 0,\n right: -90,\n down: 180,\n left: 90,\n};\n\ninterface Props {\n size: number;\n value?: number | null;\n target?: number | null;\n min?: number; // TODO: to be implemented\n max?: number; // TODO: to be implemented\n disabled?: boolean;\n readOnly?: boolean;\n origin?: 'up' | 'down' | 'left' | 'right';\n direction?: 'clockwise' | 'anticlockwise';\n onChange?: (value: number) => void;\n onInteractiveChange?: (value: number) => void;\n className: string;\n}\n\n/**\n * Widget to handle cyclic angle value in degree displayed as an infinite knob\n */\nexport default function InfiniteKnob360(props: Props) {\n const {\n size,\n value = null,\n target = null,\n min = null,\n max = null,\n disabled = false,\n readOnly = false,\n origin = 'up',\n direction = 'clockwise',\n onChange = (angle: number) => {},\n onInteractiveChange = null,\n className,\n } = props;\n const [editedValue, setEditedValue] = useState<number | null>(null);\n function onKnobEnd() {\n setEditedValue(null);\n }\n\n function onKnobInteractiveChange(angle: number) {\n setEditedValue(angle);\n if (onInteractiveChange) {\n onInteractiveChange(angle);\n }\n }\n\n const tickSize = 8;\n const tickMargin = 5;\n const pointerMargin = 12;\n const outerTickRadius = size * 0.5;\n const outerKnobRadius = outerTickRadius - tickMargin - tickSize;\n const pointerSize = 4;\n const pointerPosRadius = outerKnobRadius - pointerMargin - pointerSize / 2;\n const editable = !disabled && !readOnly;\n const shadowWidth = 5;\n const localTarget = editedValue !== null ? editedValue : target;\n\n function interactiveHook(e: InteractiveHookEvent): InteractiveHookResult {\n if (e.mouseRadius < outerKnobRadius / 3) {\n return { readOnly: true };\n }\n if (e.ctrlKey) {\n return { steps: 8 };\n }\n if (\n outerTickRadius - tickSize - tickMargin <= e.mouseRadius &&\n e.mouseRadius <= outerTickRadius + tickMargin\n ) {\n return { steps: 8 };\n }\n return {};\n }\n\n function getUnreachableRange(): [number, number] | null {\n if (value === null) {\n // if the hardware is offline\n return null;\n }\n if (min === null || max === null) {\n return null;\n }\n const range = max - min;\n if (range >= 360) {\n return null;\n }\n return [(max - 360) / 360, (max - 360 + 360 - range) / 360];\n }\n\n const unrachableRange = getUnreachableRange();\n\n const angleRange = direction === 'clockwise' ? 360 : -360;\n const angleOffset = Origin[origin] + (direction === 'clockwise' ? 0 : 360);\n\n return (\n <Knob\n size={size}\n value={value}\n angleOffset={angleOffset}\n angleRange={angleRange}\n min={0}\n max={360}\n multiRotation\n onChange={onChange}\n onInteractiveChange={onKnobInteractiveChange}\n interactiveHook={interactiveHook}\n onEnd={onKnobEnd}\n readOnly={!editable}\n tracking={false}\n useMouseWheel={false}\n className={className}\n >\n <defs>\n <radialGradient\n id=\"knob-shadow\"\n cx={size / 2}\n cy={size / 2}\n fx={size * 0.75}\n fy={size * 0.75}\n r={outerKnobRadius + shadowWidth}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop\n offset={outerKnobRadius / (outerKnobRadius + shadowWidth)}\n stopColor={sassVariables.backgroundD10}\n stopOpacity=\"0.1\"\n />\n <stop\n offset={1}\n stopColor={sassVariables.backgroundD10}\n stopOpacity=\"0\"\n />\n </radialGradient>\n <linearGradient\n id=\"knob-enabled\"\n x1={0}\n y1={size / 2 - outerKnobRadius}\n x2={0}\n y2={size / 2 + outerKnobRadius}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop offset=\"0%\" stopColor={sassVariables.backgroundD10} />\n <stop offset=\"30%\" stopColor={sassVariables.background} />\n <stop offset=\"70%\" stopColor={sassVariables.background} />\n <stop offset=\"100%\" stopColor={sassVariables.backgroundD10} />\n </linearGradient>\n <linearGradient\n id=\"knob-disabled\"\n x1={0}\n y1={size / 2 - outerKnobRadius}\n x2={0}\n y2={size / 2 + outerKnobRadius}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop offset=\"0%\" stopColor={sassVariables.disabledD10} />\n <stop offset=\"30%\" stopColor={sassVariables.disabled0} />\n <stop offset=\"70%\" stopColor={sassVariables.disabled0} />\n <stop offset=\"100%\" stopColor={sassVariables.disabledD10} />\n </linearGradient>\n </defs>\n <circle\n r={outerKnobRadius + shadowWidth}\n cx={size / 2}\n cy={size / 2}\n fill=\"url(#knob-shadow)\"\n />\n <circle\n r={outerKnobRadius}\n cx={size / 2}\n cy={size / 2}\n fill={editable ? 'url(#knob-enabled)' : 'url(#knob-disabled)'}\n />\n {unrachableRange && (\n <Range\n percentageFrom={unrachableRange[0]}\n percentageTo={unrachableRange[1]}\n radius={outerTickRadius}\n color={sassVariables.danger}\n arcWidth={tickSize}\n />\n )}\n <Scale\n steps={8}\n tickWidth={2}\n tickHeight={tickSize}\n radius={outerTickRadius}\n color={sassVariables.textD10}\n />\n <Scale\n steps={32}\n tickWidth={1}\n tickHeight={tickSize / 2}\n radius={outerTickRadius}\n color={sassVariables.textD10}\n />\n <Label\n percentage={0.1}\n radius={outerTickRadius + 6}\n label=\"+\"\n style={{ fontSize: '80%', fontWeight: 'bold' }}\n />\n <Label\n percentage={-0.1}\n radius={outerTickRadius + 6}\n label=\"-\"\n style={{ fontSize: '80%', fontWeight: 'bold' }}\n />\n {localTarget !== null && value !== null && (\n <Range\n percentageFrom={value / 360}\n percentageTo={localTarget / 360}\n radius={pointerPosRadius + pointerSize * 1.5}\n color={\n editedValue !== null\n ? sassVariables.edited\n : sassVariables.transient\n }\n arcWidth={pointerSize}\n />\n )}\n {localTarget !== null && (\n <Pointer\n percentage={localTarget / 360}\n width={pointerSize}\n height={pointerSize}\n radius={pointerPosRadius}\n type=\"circle\"\n color={\n editedValue !== null\n ? sassVariables.edited\n : sassVariables.transient\n }\n />\n )}\n <Pointer\n percentage={0}\n width={2.5}\n height={tickSize}\n radius={outerTickRadius - tickSize * 1.5}\n type=\"circle\"\n color={sassVariables.text}\n />\n {value !== null && (\n <Pointer\n percentage={value / 360}\n width={pointerSize}\n height={pointerSize}\n radius={pointerPosRadius}\n type=\"circle\"\n color={sassVariables.text}\n />\n )}\n <Value\n value={editedValue !== null ? editedValue : value}\n decimalPlace={1}\n marginBottom={size / 2}\n className=\"knob-text\"\n />\n </Knob>\n );\n}\n","import { useDebouncedCallback } from '@react-hookz/web';\n\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport type { MotorSchema } from '.';\nimport { isMotorClockWise, motorLimits, useMotorStates } from '.';\nimport { MotorState } from './MotorState';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport type { MotorDefaultOptions } from './options';\nimport InfiniteKnob360 from '../../components/InfiniteKnob360';\n\nexport default function MotorRotation(\n props: HardwareWidgetProps<MotorSchema, MotorDefaultOptions>\n) {\n const { hardware, options = {} } = props;\n\n // This have to be debounced as workaround cause it can be called twice\n const moveHardware = useDebouncedCallback(\n (value: number) => {\n hardware.actions.call('move', value);\n },\n [hardware.actions],\n 100\n );\n\n const states = useMotorStates(hardware.properties.state, hardware.user_tags);\n const target = states.MOVING ? hardware.properties.target : undefined;\n const isClockWise = isMotorClockWise(hardware, options);\n\n const widgetIcon = (\n <TypeIcon\n name=\"Motor\"\n icon=\"fam-hardware-motor-r\"\n online={hardware.online}\n />\n );\n const limits = motorLimits(hardware);\n\n const widgetState = <MotorState hardware={hardware} />;\n\n const widgetContent = (\n <InfiniteKnob360\n className=\"mx-auto my-auto\"\n size={100}\n value={hardware.properties.position}\n min={limits[0]}\n max={limits[1]}\n target={target}\n onChange={moveHardware}\n disabled={props.disabled}\n readOnly={options.readOnly || !states.READY}\n origin=\"down\"\n direction={isClockWise ? 'clockwise' : 'anticlockwise'}\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 {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport { type MotorStates, useMotorStates, type MotorSchema } from '.';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\nimport { Badge } from 'react-bootstrap';\n\nfunction getStyle(online: boolean, states: MotorStates) {\n if (!online) {\n return 'secondary';\n }\n if (states.FAULT) {\n return 'danger';\n }\n if (states.MOVING) {\n return 'transient';\n }\n return 'secondary';\n}\n\nfunction MotorMonitor(\n props: HardwareWidgetProps<MotorSchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n const { online = false, properties = {} } = hardware;\n const { state, position, unit = null, display_digits } = properties;\n const states = useMotorStates(state, []);\n\n const name = options.name ?? hardware.alias ?? hardware.name ?? hardware.id;\n\n const bgVariant = getStyle(online, states);\n\n function getText() {\n let text = '';\n if (position !== undefined) {\n if (position === null) {\n text = 'null';\n } else if (Number.isFinite(position)) {\n text += position.toFixed(display_digits ?? 2);\n } else {\n text = `${position}`;\n }\n }\n if (unit !== null && unit !== '') {\n text = `${text} ${unit}`;\n }\n return text;\n }\n\n const text = getText();\n\n return (\n <MonitorPanelItem>\n <h1>{name}</h1>\n <Badge bg={bgVariant}>{text}</Badge>\n </MonitorPanelItem>\n );\n}\n\nexport default MotorMonitor;\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 MotorRotation from './MotorRotation';\nimport MotorState from './MotorState';\nimport MotorMonitor from './MotorMonitor';\n\nexport type MotorSchema = Hardware<{\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 * 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 rotation: MotorRotation,\n // Override base state\n state: MotorState,\n // Override base monitor\n monitor: MotorMonitor,\n};\n\n/**\n * True if the motor positon is clock wise.\n *\n * This is based on dial metadata, and user sign.\n */\nexport function isMotorClockWise(\n hardware: MotorSchema,\n options?: { clockwise?: boolean }\n): boolean {\n if (options?.clockwise !== undefined) {\n return options.clockwise;\n }\n const inverted = hardware.properties.sign < 0;\n const anticlockwiseTag = hardware.user_tags.includes('dial.anticlockwise');\n const clockwiseTag = hardware.user_tags.includes('dial.clockwise');\n if (clockwiseTag && anticlockwiseTag) {\n console.error(\n \"Both tags 'dial.clockwise' and 'dial.anticlockwise' are defined\"\n );\n }\n const clockwise = clockwiseTag || !anticlockwiseTag;\n return clockwise !== inverted;\n}\n\n/**\n * Normalize the limits as finite values or `undefined`.\n */\nexport function motorLimits(\n hardware: MotorSchema\n): [number | undefined, number | undefined] {\n const limits = hardware.properties?.limits;\n if (limits === undefined || limits === null) {\n return [undefined, undefined];\n }\n const [min, max] = limits;\n\n return [\n Number.isFinite(min) ? min : undefined,\n Number.isFinite(max) ? max : undefined,\n ];\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 { useCallback, useEffect, useMemo, useRef, useState } 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 type { MultipositionSchema } from '.';\nimport { Badge } from 'react-bootstrap';\n\nexport default function MultipositionState(props: {\n hardware: MultipositionSchema;\n}) {\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 OFFLINE: 'secondary',\n READY: 'success',\n MOVING: 'transient',\n ERROR: 'danger',\n UNKNOWN: 'fatal',\n LOCKED: 'warning',\n };\n\n const variant = variantMapping[state] || 'success';\n\n return <Badge bg={variant}>{state}</Badge>;\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';\nimport MultipositionState from './MultipositionState';\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 <MultipositionState hardware={hardware} />\n </div>\n <div className=\"hw-content\">\n <InputGroup className=\"flex-nowrap\">\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 { forwardRef } from 'react';\nimport { Dropdown, DropdownMenu, DropdownToggle } from 'react-bootstrap';\nimport type { DropdownButtonProps } from 'react-bootstrap';\n\n/**\n * Extra properties passed to the toggle component.\n *\n * FIXME: Would be nice to remove it at some point\n */\ninterface DropdownButtonProps2 {\n style?: Record<string, unknown>;\n className?: string;\n popperConfig?: Record<string, unknown>;\n}\n\n/**\n * Same as DropdownButton, but propagate the `style` and the `className` into\n * the toggle button.\n *\n * TODO: Try to request this change upstream.\n */\nconst DropdownButton2 = forwardRef<\n HTMLDivElement,\n DropdownButtonProps & DropdownButtonProps2\n>(\n (\n {\n title,\n children,\n bsPrefix,\n rootCloseEvent,\n variant,\n size,\n menuRole,\n renderMenuOnMount,\n disabled,\n href,\n id,\n menuVariant,\n flip,\n style,\n className,\n popperConfig,\n ...props\n },\n ref\n ) => (\n <Dropdown ref={ref} {...props}>\n <DropdownToggle\n id={id}\n href={href}\n size={size}\n variant={variant}\n disabled={disabled}\n childBsPrefix={bsPrefix}\n style={style}\n className={className}\n >\n {title}\n </DropdownToggle>\n <DropdownMenu\n popperConfig={popperConfig}\n role={menuRole}\n renderOnMount={renderMenuOnMount}\n rootCloseEvent={rootCloseEvent}\n variant={menuVariant}\n flip={flip}\n >\n {children}\n </DropdownMenu>\n </Dropdown>\n )\n);\n\nDropdownButton2.displayName = 'DropdownButton2';\nexport default DropdownButton2;\n","import {\n Button,\n InputGroup,\n Dropdown,\n Badge,\n Col,\n Row,\n Form,\n Container,\n CloseButton,\n} from 'react-bootstrap';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { MultipositionSchema } from '.';\nimport type {\n HardwareWidgetOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport { HardwareTemplate } from '../..';\nimport MultipositionState from './MultipositionState';\nimport DropdownButton2 from '../../components/DropdownButton2';\nimport { useMemo, useState } from 'react';\n\nexport interface MultipositionDefault2Options extends HardwareWidgetOptions {\n /**\n * Display a search input\n */\n search?: boolean;\n}\n\n/**\n * Information related to a specific position.\n */\ntype Position = MultipositionSchema['properties']['positions'][0];\n\nfunction PositionItem(props: {\n currentPositionId: string | null;\n position: Position;\n disabled: boolean;\n onSelect: (positionId: string) => void;\n filter: string;\n}) {\n const { currentPositionId, position, disabled, onSelect, filter } = props;\n const positionId = position.position;\n const selected = positionId === currentPositionId;\n const icon = selected ? 'fa fa-fw fa-dot-circle-o' : 'fa fa-fw fa-circle-o';\n\n const containsFilter = useMemo(() => {\n if (filter === '') {\n return true;\n }\n const f = filter.toLowerCase();\n return (\n position.position?.toLowerCase().includes(f) ||\n position.description?.toLowerCase().includes(f)\n );\n }, [filter, position]);\n\n if (!containsFilter) {\n return <></>;\n }\n\n return (\n <Dropdown.Item\n key={position.position}\n disabled={disabled}\n onClick={() => {\n onSelect(positionId);\n }}\n title={position.description}\n >\n <Row className=\"gx-0 nowrap\">\n <Col sm=\"1\">\n <i className={icon} />\n </Col>\n <Col sm=\"2\">\n <Badge\n className=\"small w-100\"\n bg={selected ? 'primary' : 'secondary'}\n >\n <span className=\"secondary\">\n <span className=\"text-truncate w-50\">{positionId}</span>\n </span>\n </Badge>\n </Col>\n </Row>\n <Row className=\"gx-0 nowrap\">\n <Col sm=\"1\" />\n <Col sm=\"11\">\n <Row className=\"gx-0\">\n <Col sm=\"12\" className=\"text-truncate text-start\">\n {position.description}\n </Col>\n </Row>\n </Col>\n </Row>\n </Dropdown.Item>\n );\n}\n\nfunction getPosition(\n positionId: string | null,\n positions: Position[]\n): Position | null {\n if (positionId === null) {\n return null;\n }\n for (const p of positions) {\n if (positionId === p.position) {\n return p;\n }\n }\n return null;\n}\n\nfunction Header(props: {\n positionId: string | null;\n targetPositionId: string | null;\n hardware: MultipositionSchema;\n}) {\n const { positionId, targetPositionId, hardware } = props;\n const { properties = {} } = hardware;\n const { positions = [] } = properties;\n\n function getBadge() {\n if (targetPositionId) {\n return <Badge bg=\"transient\">{targetPositionId}</Badge>;\n }\n if (positionId) {\n return <Badge>{positionId}</Badge>;\n }\n return <Badge bg=\"warning\">unknown</Badge>;\n }\n\n const badge = getBadge();\n const description = useMemo(() => {\n if (targetPositionId) {\n // In the future we will be able to tell where it goes\n return 'Moving...';\n }\n const position = getPosition(positionId, positions);\n if (position === null) {\n return 'Position not described';\n }\n return position.description ?? '';\n }, [targetPositionId, positionId, positions]);\n\n return (\n <>\n {badge}\n <div\n className=\"text-truncate text-start ms-2 flex-grow-1 flex-shrink-1\"\n title={description}\n style={{ flex: '1 1 0', minWidth: 0 }}\n >\n {description}\n </div>\n </>\n );\n}\n\nexport default function Multiposition(\n props: HardwareWidgetProps<MultipositionSchema, MultipositionDefault2Options>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const hardwareReady = properties.state === 'READY';\n const hardwareIsMoving = properties?.state === 'MOVING';\n const disabled = props.disabled || !hardware.online || !hardwareReady;\n\n function moveTo(positionId: string) {\n void hardware.actions.call('move', positionId);\n }\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 = <MultipositionState hardware={hardware} />;\n\n // In the future we will be able to know the target\n // for now, use 'moving' as place holder\n const targetPositionId = hardwareIsMoving ? 'moving' : null;\n\n function normalizePositionId(): string | null {\n const p = hardware.properties?.position ?? null;\n if (p === 'unknown') {\n // BLISS <= 2.3\n return null;\n }\n return p;\n }\n\n const positionId = normalizePositionId();\n const [filter, setFilter] = useState('');\n\n function getWidgetContent() {\n return (\n <InputGroup className=\"flex-nowrap\" style={{ alignItems: 'stretch' }}>\n <DropdownButton2\n variant=\"secondary\"\n title={\n <Header\n positionId={positionId}\n targetPositionId={targetPositionId}\n hardware={hardware}\n />\n }\n disabled={disabled}\n popperConfig={{ strategy: 'fixed' }}\n className=\"flex-grow-1 d-flex flex-nowrap align-items-center\"\n style={{ flex: '1 1 0', minWidth: 0 }}\n >\n {options.search && (\n <Container className=\"d-flex justify-content-center align-items-center\">\n <i className=\"fa fa-search fa-fw flex-shrink\" />\n <Form.Control\n autoFocus\n className=\"mx-1 my-2 w-50\"\n style={{ marginLeft: 'auto', marginRight: 'auto' }}\n placeholder=\"Type to filter...\"\n onChange={(e) => setFilter(e.target.value)}\n value={filter}\n />\n <CloseButton\n disabled={filter === ''}\n onClick={() => {\n setFilter('');\n }}\n />\n </Container>\n )}\n {properties.positions.map((positionDesc) => (\n <PositionItem\n currentPositionId={positionId}\n position={positionDesc}\n onSelect={(positionId) => {\n moveTo(positionId);\n }}\n disabled={disabled}\n filter={filter}\n />\n ))}\n {options.search && filter !== '' && (\n <>\n <Dropdown.Divider />\n <Dropdown.Item\n onClick={(e) => {\n setFilter('');\n e.stopPropagation();\n }}\n >\n Display all the positions...\n </Dropdown.Item>\n </>\n )}\n </DropdownButton2>\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';\nimport MultipositionState from './MultipositionState';\n\nexport type MultipositionSchema = Hardware<{\n /**\n * Actual position\n */\n position:\n | string\n // Compatibility with BLISS <= 2.3\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n | 'unknown'\n // BLISS >= 2.4\n | null;\n\n /**\n * Actual state of the device.\n *\n * Can be any state of a motor.\n */\n state: 'MOVING' | 'OFF' | 'READY' | 'FAULT' | 'DISABLED' | 'UNKNOWN';\n\n /**\n * Described positions\n */\n positions: {\n /**\n * Identifier of the position\n */\n position: string;\n\n /**\n * Human readable description\n */\n description?: string;\n\n /**\n * Location of this position represented by a set of motor/position\n */\n target: {\n object: string;\n destination: number | string;\n tolerance?: number;\n }[];\n }[];\n}>;\n\nconst Variants: HardwareVariant<MultipositionSchema> = {\n state: MultipositionState,\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 { State } 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: 'transient',\n INVALID: 'danger',\n UNKNOWN: 'danger',\n DISABLED: 'secondary',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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\nexport interface OpticProperties extends Record<string, unknown> {\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/**\n * Hardware as exposed by Redux\n */\nexport type OpticSchema = Hardware<OpticProperties>;\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 { OpticProperties } 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<OpticProperties>({\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 { State } 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: 'transient',\n ABORTING: 'warning',\n AWAITING_USER_INPUT: 'warning',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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 EditableHardware,\n HardwareWidgetOptions,\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\ninterface ProcedureOptions extends HardwareWidgetOptions {\n /**\n * If true, execute the procedure in the BLISS session foreground.\n *\n * As result, the terminal first have to be available to\n * start the procedure, else it fails.\n *\n * Also, as it takes the prompt, it is visible by the users,\n * so they have to kill or to wait for the end before doing\n * anything else.\n */\n foreground?: boolean;\n}\n\nfunction Actions(props: {\n hardware: EditableHardware<ProcedureSchema>;\n disabled: boolean;\n options: ProcedureOptions;\n}) {\n const { hardware, options } = 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 if (options.foreground) {\n // FIXME: This function is a workaround, and only available in Daiquiri server\n void hardware.actions.call('run_foreground');\n } else {\n void hardware.actions.call('start');\n }\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, ProcedureOptions>\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\n hardware={hardware}\n disabled={!props.operator}\n options={options}\n />\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';\nimport { useHardware } from '../../registry/hooks';\n\nexport type ProcedureSchema = Hardware<{\n state: string;\n previous_run_state: string;\n previous_run_exception: string | null;\n parameters: Record<string, any>;\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 key?: string;\n}\n\nexport interface ExceptionFromProcedure {\n __type__: 'exception';\n class: string;\n message: string;\n traceback: Record<string, any>;\n}\n\nexport function isProcedureHardware(\n entity: Hardware\n): entity is ProcedureSchema {\n return entity.type === 'procedure';\n}\n\n/**\n * Return a procedure 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 useProcedureHardware(\n name: string | null\n): ProcedureSchema | null {\n const hardware = useHardware(name);\n if (hardware === null || !isProcedureHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n","import standby from './ProcedureStandBy.json';\n\nexport const Mocks = {\n standby,\n};\n","export function getStyle(state: string) {\n if (state === 'OFF') {\n return 'danger';\n }\n if (state === 'READY') {\n return 'success';\n }\n if (state === 'MOVING') {\n return 'transient';\n }\n\n return 'warning';\n}\n","import {\n Button,\n Form,\n InputGroup,\n OverlayTrigger,\n Tooltip as BSTooltip,\n} from 'react-bootstrap';\nimport type { ReactElement } from 'react';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { State } from '../utils/State';\nimport TypeIcon from '../utils/TypeIcon';\nimport type { RegulationSchema } from '.';\nimport HardwareNumericStep from '../../components/HardwareNumericStep';\nimport type { RegulationOptions } from './options';\nimport { getStyle } from './utils';\n\ninterface TooltipProps {\n tooltip: string;\n children: ReactElement;\n}\n\nfunction Tooltip({ tooltip, children }: TooltipProps) {\n return (\n <OverlayTrigger\n placement=\"top\"\n overlay={\n <BSTooltip id=\"tooltipid\" className=\"monitor-panel-tooltip\">\n {tooltip}\n </BSTooltip>\n }\n >\n {children}\n </OverlayTrigger>\n );\n}\n\nexport default function RegulationLoop(\n props: HardwareWidgetProps<RegulationSchema, RegulationOptions>\n) {\n const { hardware, options = {} } = props;\n const { showOutput = true, step, steps } = options;\n\n function requestFunctionChange(fn_name: string) {\n return hardware.actions.call(fn_name);\n }\n\n function requestSetpointChange(value: number) {\n return hardware.actions.setProperty('setpoint', value);\n }\n\n const state = hardware.properties.state;\n\n const widgetIcon = (\n <TypeIcon name=\"RegulationLoop\" icon=\"fa-repeat\" online={hardware.online} />\n );\n\n const widgetState = (\n <>\n <State state={state} minWidth={6} variant={getStyle(state)} />\n {!hardware.properties.is_softloop && (\n <Tooltip tooltip=\"Start/Stop Monitor\">\n <Button\n size=\"sm\"\n variant={hardware.properties.is_monitoring ? 'success' : 'warning'}\n style={{\n fontSize: '0.6rem',\n padding: '0.05rem 0.6rem',\n marginTop: '0.1rem',\n }}\n onClick={() => {\n void requestFunctionChange(\n hardware.properties.is_monitoring\n ? 'stop_monitor'\n : 'start_monitor'\n );\n }}\n >\n <i\n className={\n hardware.properties.is_monitoring\n ? 'fa fa-toggle-on'\n : 'fa fa-toggle-off'\n }\n />\n </Button>\n </Tooltip>\n )}\n <Tooltip tooltip=\"Stop Ramping\">\n <Button\n disabled={hardware.properties.state === 'OFF'}\n size=\"sm\"\n variant=\"danger\"\n className=\"ms-1\"\n style={{\n fontSize: '0.6rem',\n padding: '0.05rem 0.6rem',\n marginTop: '0.1rem',\n }}\n onClick={() => {\n void requestFunctionChange('stop_ramping');\n }}\n >\n <i className=\"fa fa-circle-exclamation\" />\n </Button>\n </Tooltip>\n </>\n );\n\n return (\n <HardwareTemplate\n hardware={hardware}\n widgetIcon={widgetIcon}\n widgetState={widgetState}\n widgetContent={\n <>\n <InputGroup className=\"flex-nowrap\">\n <HardwareNumericStep\n id={hardware.id}\n hardwareValue={hardware.properties.setpoint ?? null}\n hardwareIsDisabled={false}\n hardwareIsMoving={false}\n hardwareIsReady\n onMoveRequested={requestSetpointChange}\n onAbortRequested={() => null}\n precision={1}\n readOnly={false}\n step={step}\n steps={steps}\n incIcon={undefined}\n decIcon={undefined}\n swapIncDec={undefined}\n />\n {hardware.properties.input_unit && (\n <InputGroup.Text>\n {hardware.properties.input_unit}\n </InputGroup.Text>\n )}\n </InputGroup>\n <InputGroup>\n <InputGroup.Text>I</InputGroup.Text>\n <Form.Control\n type=\"number\"\n disabled\n value={hardware.properties.input_value?.toFixed(2)}\n />\n {hardware.properties.input_unit && (\n <InputGroup.Text>\n {props.hardware.properties.input_unit}\n </InputGroup.Text>\n )}\n {showOutput && (\n <>\n <InputGroup.Text>O</InputGroup.Text>\n <Form.Control\n type=\"number\"\n disabled\n value={hardware.properties.output_value?.toFixed(2)}\n />\n {hardware.properties.output_unit && (\n <InputGroup.Text>\n {props.hardware.properties.output_unit}\n </InputGroup.Text>\n )}\n </>\n )}\n </InputGroup>\n </>\n }\n />\n );\n}\n","import type {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport type { RegulationSchema } from '.';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\nimport { getStyle } from './utils';\nimport { Badge } from 'react-bootstrap';\n\nfunction RegulationLoopMonitor(\n props: HardwareWidgetProps<RegulationSchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const { state } = properties;\n\n const name = options.name ?? hardware.alias ?? hardware.name;\n const style = getStyle(state);\n\n let value: string | number = hardware.properties.input_value;\n if (Number.isFinite(value)) {\n value = value.toFixed(2);\n }\n\n return (\n <MonitorPanelItem>\n <h1>{name}</h1>\n <Badge bg={style}>\n {value} {hardware.properties.input_unit}\n </Badge>\n </MonitorPanelItem>\n );\n}\n\nexport default RegulationLoopMonitor;\n","import {\n TooltipMesh,\n useValueToIndexScale,\n useVisCanvasContext,\n} from '@h5web/lib';\nimport type { CurveData } from './CurvePlot';\n\nexport default function MultiCurveTooltipMesh({\n curves,\n}: {\n curves: CurveData[];\n}) {\n const abscissas = curves[0].x ?? [];\n const xToIndexScale = useValueToIndexScale(abscissas, true);\n\n const { abscissaConfig } = useVisCanvasContext();\n\n return (\n <TooltipMesh\n guides=\"both\"\n renderTooltip={(x) => {\n const xi = xToIndexScale(x);\n\n return (\n <div className=\"h5web-tooltip\">\n {abscissaConfig.label || 'x'}={abscissas[xi]}\n {curves.map((c) => (\n <div key={c.name}>\n <span\n style={{\n content: '',\n display: 'inline-block',\n width: '0.75em',\n height: '0.375rem',\n marginRight: '0.375rem',\n paddingBottom: '0.125rem',\n backgroundColor: c.color,\n transform: 'translateY(-1px)',\n }}\n data-keep-colors\n />\n <strong>{c.name}:</strong> {c.y[xi].toFixed(2)}\n </div>\n ))}\n </div>\n );\n }}\n />\n );\n}\n","import type { Domain } from '@h5web/lib';\nimport {\n DataCurve,\n getAxisValues,\n GlyphType,\n Pan,\n useCombinedDomain,\n useDomains,\n VisCanvas,\n Zoom,\n} from '@h5web/lib';\nimport '@h5web/lib/styles.css';\nimport MultiCurveTooltipMesh from './MultiCurveTooltip';\n\nconst COLORS = ['#1f77b4', '#ff7f0e', '#d62728', '#2ca02c'];\nconst DEFAULT_DOMAIN: Domain = [0.1, 1];\nconst POINT_SIZE = 6;\n\nexport interface PlotData {\n x: number[];\n y: number[];\n name: string;\n color?: string;\n}\n\nexport interface CurveData extends PlotData {\n color: string;\n}\n\ninterface Props {\n data: PlotData[];\n title?: string;\n xAxisTitle?: string;\n yAxisTitle?: string;\n}\n\nexport default function CurvePlot(props: Props) {\n const { data, xAxisTitle, yAxisTitle, title } = props;\n const curves: CurveData[] = data.flatMap((series, i) => {\n const x = series.x;\n let y = series.y;\n if (x.length < y.length) {\n y = y.slice(0, x.length);\n }\n return [\n {\n color: series.color ?? COLORS[i % COLORS.length],\n name: series.name,\n x: [...getAxisValues(x, y.length)],\n y,\n },\n ];\n });\n\n const xDomain =\n useCombinedDomain(useDomains(curves.map((c) => c.x))) || DEFAULT_DOMAIN;\n const yDomain =\n useCombinedDomain(useDomains(curves.map((c) => c.y))) || DEFAULT_DOMAIN;\n\n return (\n <VisCanvas\n title={title}\n abscissaConfig={{\n visDomain: xDomain,\n showGrid: true,\n label: xAxisTitle,\n }}\n ordinateConfig={{\n visDomain: yDomain,\n showGrid: true,\n label: yAxisTitle,\n }}\n raycasterThreshold={POINT_SIZE}\n >\n {curves.map((c) => (\n <DataCurve\n key={c.name}\n abscissas={c.x}\n ordinates={c.y}\n color={c.color}\n glyphSize={POINT_SIZE}\n glyphType={GlyphType.Circle}\n />\n ))}\n <Zoom />\n <Pan />\n <MultiCurveTooltipMesh curves={curves} />\n </VisCanvas>\n );\n}\n","import { useEffect, useRef, useState } from 'react';\nimport { Button, OverlayTrigger, Popover, Stack } from 'react-bootstrap';\nimport type { RegulationSchema } from '.';\nimport type { HardwareWidgetProps } from '../utils/types';\nimport CurvePlot from '../../plotting/CurvePlot';\nimport type { RegulationOptions } from './options';\n\nconst BUFFER_LENGTH = 100;\n\nfunction useRollingBuffer(capacity: number, name: string) {\n const [buffer, setBuffer] = useState<number[]>(\n // eslint-disable-next-line unicorn/no-new-array\n new Array(capacity).fill(null)\n );\n const currentIndex = useRef(0);\n\n function write(item: number) {\n setBuffer((prevBuffer) => {\n const newBuffer = [...prevBuffer];\n if (currentIndex.current === capacity - 1) {\n newBuffer.shift();\n newBuffer.push(item);\n } else {\n newBuffer[currentIndex.current] = item;\n currentIndex.current = (currentIndex.current + 1) % capacity;\n }\n return newBuffer;\n });\n }\n\n function read() {\n return buffer.filter((item) => item !== null);\n }\n\n return { read, write, name };\n}\n\nexport default function RegulationPlot(\n props: HardwareWidgetProps<RegulationSchema, RegulationOptions>\n) {\n const { hardware, options } = props;\n const { showOutput = true, plotHeight, plotWidth } = options;\n const timeBuffer = useRollingBuffer(BUFFER_LENGTH, 'Time');\n const inputBuffer = useRollingBuffer(BUFFER_LENGTH, 'Input');\n const outputBuffer = useRollingBuffer(BUFFER_LENGTH, 'Output');\n const setPointBuffer = useRollingBuffer(BUFFER_LENGTH, 'Setpoint');\n\n useEffect(() => {\n timeBuffer.write(Date.now());\n inputBuffer.write(hardware.properties.input_value);\n outputBuffer.write(hardware.properties.output_value);\n setPointBuffer.write(hardware.properties.setpoint);\n }, [hardware.properties]);\n\n const now = Date.now();\n const x = timeBuffer.read().map((value) => -(now - value) / 1000);\n const data = [inputBuffer, setPointBuffer].map((buffer) => ({\n name: buffer.name,\n x,\n y: buffer.read(),\n }));\n\n const outputData = [outputBuffer].map((buffer) => ({\n name: buffer.name,\n x,\n y: buffer.read(),\n }));\n\n const deadBandPlus = {\n x,\n y: x.map(\n () => hardware.properties.setpoint + (hardware.properties.deadband ?? 0)\n ),\n name: 'Deadband+',\n color: 'green',\n };\n const deadBandMinus = {\n x,\n y: x.map(\n () => hardware.properties.setpoint - (hardware.properties.deadband ?? 0)\n ),\n name: 'Deadband-',\n color: 'green',\n };\n\n return (\n <Stack className=\"bg-light rounded-2 ps-2 p-1\" direction=\"vertical\">\n <div\n className=\"h5web-plot\"\n style={{\n display: 'flex',\n height: plotHeight ?? '20rem',\n width: plotWidth,\n }}\n >\n <CurvePlot\n data={[...data, deadBandPlus, deadBandMinus]}\n title=\"Input\"\n xAxisTitle=\"Time (s)\"\n yAxisTitle={hardware.properties.input_unit}\n />\n {showOutput && (\n <CurvePlot\n data={outputData}\n title=\"Output\"\n xAxisTitle=\"Time (s)\"\n yAxisTitle={hardware.properties.output_unit}\n />\n )}\n </div>\n </Stack>\n );\n}\n\nexport function PopupRegulationPlot(\n props: HardwareWidgetProps<RegulationSchema, RegulationOptions>\n) {\n const { hardware, options } = props;\n const { showOutput = true, popupPlacement = 'right', plotWidth } = options;\n const overlay = (\n <Popover\n id={`regulation-plot-${hardware.name}`}\n style={{ maxWidth: plotWidth ?? showOutput ? 300 * 2 : 276 }}\n >\n <Popover.Header as=\"h3\">\n Regulation Plot for `{props.hardware.name}`\n </Popover.Header>\n <Popover.Body>\n <RegulationPlot {...props} />\n </Popover.Body>\n </Popover>\n );\n\n return (\n <OverlayTrigger\n trigger=\"click\"\n placement={popupPlacement}\n overlay={overlay}\n >\n <Button>{options.buttonTitle ?? 'Plot'}</Button>\n </OverlayTrigger>\n );\n}\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport RegulationLoop from './RegulationDefault';\nimport RegulationLoopMonitor from './RegulationMonitor';\nimport RegulationPlot, { PopupRegulationPlot } from './RegulationPlot';\n\n/**\n * Hardware as exposed by Redux\n */\nexport type RegulationSchema = Hardware<{\n state: string;\n is_monitoring: boolean;\n is_softloop: boolean;\n setpoint: number;\n input_value: number;\n output_value: number;\n input_unit: string;\n output_unit: string;\n deadband?: number;\n}>;\n\nconst Variants: HardwareVariant<RegulationSchema> = {\n default: RegulationLoop,\n plot: RegulationPlot,\n popupplot: PopupRegulationPlot,\n monitor: RegulationLoopMonitor,\n};\n\nexport default Variants;\n","import defaultjson from './Regulation.json';\n\nexport const Mocks = {\n default: defaultjson,\n};\n","import { useEffect, useRef, useState } from 'react';\nimport { Simulator } from '../../base/mocks/Simulator';\nimport type { PropsWithSimulator } from '../../base/mocks/Simulator';\n\nexport default function RegulationSimulator(props: PropsWithSimulator) {\n const { name, alias, useHardwareContext } = props;\n const [state, setState] = useState('READY');\n const [inputValue, setInputValue] = useState(0);\n const [outputValue, setOutputValue] = useState(0);\n const [setPoint, setSetPoint] = useState(10);\n const internalTimeRef = useRef(Date.now());\n\n const updatePID = () => {\n const now = Date.now();\n const deltaTime = (now - internalTimeRef.current) / 1000;\n let newInput;\n let newOutput;\n internalTimeRef.current = now;\n if (setPoint !== null && setPoint !== inputValue) {\n let newState;\n const deltaPosition = deltaTime * 2;\n const noise = Math.random() * 0.1 - 0.05;\n if (deltaPosition > Math.abs(inputValue - setPoint) + 0.05) {\n newInput = setPoint + noise;\n newState = 'READY';\n newOutput = -noise * 5;\n } else {\n const direction = setPoint > inputValue ? 1 : -1;\n newInput = inputValue + direction * deltaPosition;\n newOutput = 10 * direction;\n newState = 'MOVING';\n }\n setInputValue(newInput);\n setOutputValue(newOutput);\n setState(newState);\n }\n };\n\n async function call(name: string, value?: any): Promise<void> {\n console.log('RegulationSimulator: Unsupported call', name, value);\n }\n\n async function setProperty(name: string, value: any): Promise<void> {\n if (name === 'setpoint') {\n setSetPoint(value);\n }\n console.log('RegulationSimulator: Unsupported setProperty', name, value);\n }\n\n useEffect(() => {\n const timer = setInterval(() => {\n updatePID();\n }, 500);\n return () => clearInterval(timer);\n });\n\n const properties = {\n state,\n deadband: 0.05,\n input_unit: 'degC',\n input_value: inputValue,\n is_monitoring: true,\n output_unit: 'Volt',\n output_value: outputValue,\n setpoint: setPoint,\n };\n\n return (\n <Simulator\n name={name}\n alias={alias}\n type=\"regulation\"\n call={call}\n setProperty={setProperty}\n properties={properties}\n useHardwareContext={useHardwareContext}\n />\n );\n}\n","import type { ShutterSchema } from '.';\nimport { State } 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 'OFFLINE':\n case 'DISABLED':\n return 'secondary';\n case 'MOVING':\n return 'transient';\n case 'STANDBY':\n return 'warning';\n case 'FAULT':\n return 'fatal';\n default:\n return 'fatal';\n }\n }\n\n return <State 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: 'transient',\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: 'transient',\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 { OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type {\n HardwareMonitorOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport type { ShutterSchema } from '.';\nimport { MonitorPanelItem } from '../../monitorpanel/MonitorPanelItem';\nimport { ShutterState } from './ShutterState';\n\nfunction ShutterMonitor(\n props: HardwareWidgetProps<ShutterSchema, HardwareMonitorOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const { state = 'OFFLINE', status } = properties;\n\n const name = options.name ?? hardware.alias ?? hardware.name;\n\n const widget = (\n <MonitorPanelItem>\n <h1>{name}</h1>\n <ShutterState hardware={hardware} />\n </MonitorPanelItem>\n );\n\n if (status) {\n const overlayStr = `${status}`;\n return (\n <OverlayTrigger\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 {widget}\n </OverlayTrigger>\n );\n }\n\n return widget;\n}\n\nexport default ShutterMonitor;\n","import type { Hardware, HardwareVariant } from '../utils/types';\nimport ShutterDefault from './ShutterDefault';\nimport ShutterProtected from './ShutterProtected';\nimport ShutterState from './ShutterState';\nimport ShutterMonitor from './ShutterMonitor';\n\nexport type ShutterSchema = Hardware<{\n state: string;\n status: string;\n valid: boolean;\n open_text: string;\n closed_text: string;\n}>;\n\nconst Variants: HardwareVariant<ShutterSchema> = {\n default: ShutterDefault,\n protected: ShutterProtected,\n // Override default state\n state: ShutterState,\n // Override default monitor\n monitor: ShutterMonitor,\n};\n\nexport default Variants;\n","import defaultjson from './BeamShutter.json';\nimport closed from './BeamShutterClosed.json';\n\nexport const Mocks = {\n default: defaultjson,\n closed,\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 { State } 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 (!hardware.online) {\n return ['OFFLINE', 'secondary', 'No motor online'];\n }\n\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', 'transient', '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 }, [hardware.online, info]);\n\n return (\n <State\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, 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 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 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 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 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 type SlitSchema = Hardware<{\n state: string;\n type: 'vertical' | 'horizontal' | 'both';\n hgap: string;\n vgap: string;\n hoffset: string;\n voffset: string;\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 type PumpSchema = Hardware<{\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\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 { State } 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 LOST: 'warning',\n MOVING_IN: 'transient',\n MOVING_OUT: 'transient',\n UNKNOWN: 'danger',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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 { HardwareWidgetProps, EditableHardware } 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';\nimport type { PusherOptions } from './options';\n\n/**\n * Button which can execute an async action.\n *\n * The button allow to define an `icon`, located at the right\n * or at the left of the `text`. For that the property `iconLocation`\n * is provided.\n *\n * For each location the icon can differ, for example in the\n * case of an arrow. This for, the 2 properties `leftIcon` and\n * `rightIcon` can be used.\n */\nfunction ActionButton<T>(props: {\n text: string;\n icon?: string;\n leftIcon?: string;\n rightIcon?: string;\n iconLocation?: 'right' | 'left';\n onAction: () => Promise<T>;\n onActionChange?: (inAction: boolean) => void;\n disabled?: boolean;\n className?: string;\n style?: Record<string, unknown>;\n variant?: string;\n}) {\n const {\n text,\n icon,\n leftIcon = icon,\n rightIcon = icon,\n iconLocation = 'left',\n onAction,\n onActionChange,\n disabled = false,\n variant,\n style = {},\n className = '',\n } = props;\n const [inAction, setInAction] = useState(false);\n const iconAtRight = rightIcon && iconLocation === 'right';\n const iconAtLeft = leftIcon && iconLocation === 'left';\n\n return (\n <Button\n variant={variant}\n style={style}\n className={className}\n onClick={() => {\n onActionChange?.(true);\n setInAction(true);\n onAction().finally(() => {\n setInAction(false);\n onActionChange?.(false);\n });\n }}\n disabled={disabled}\n >\n <span className=\"text-nowrap\">\n {iconAtLeft && (\n <>\n <i\n className={inAction ? 'fa-solid fa-fw fa-cog fa-spin' : leftIcon}\n />{' '}\n </>\n )}\n {text}\n {iconAtRight && (\n <>\n {' '}\n <i\n className={inAction ? 'fa-solid fa-fw fa-cog fa-spin' : rightIcon}\n />\n </>\n )}\n </span>\n </Button>\n );\n}\n\nfunction PusherBlock(props: {\n hardware: EditableHardware<PusherSchema>;\n options: PusherOptions;\n disabled: boolean;\n className: string;\n leftToRight: boolean;\n style?: Record<string, any>;\n}) {\n const { className, hardware, options = {}, style = {}, leftToRight } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n const isInTouch = state === 'IN_TOUCH';\n const disabled = !isInTouch || props.disabled;\n\n function ButtonPush(props: {\n distance: number;\n style?: Record<string, unknown>;\n }) {\n const { distance, style } = props;\n return (\n <ActionButton\n text={`${distance}`}\n style={style}\n variant=\"secondary\"\n onAction={() => {\n return hardware.actions.call('push', distance);\n }}\n disabled={disabled}\n leftIcon=\"fa fa-fw fa-arrow-left\"\n rightIcon=\"fa fa-fw fa-arrow-right\"\n iconLocation={leftToRight ? 'right' : 'left'}\n />\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 ...style,\n }}\n >\n <ButtonPush\n distance={5}\n style={{\n gridColumn: leftToRight ? 3 : 1,\n gridRow: 1,\n }}\n />\n <ButtonPush\n distance={0.5}\n style={{\n gridColumn: 2,\n gridRow: 1,\n }}\n />\n <ButtonPush\n distance={0.05}\n style={{\n gridColumn: leftToRight ? 1 : 3,\n gridRow: 1,\n }}\n />\n <ButtonPush\n distance={2}\n style={{\n gridColumn: leftToRight ? 3 : 1,\n gridRow: 2,\n }}\n />\n <ButtonPush\n distance={0.2}\n style={{\n gridColumn: 2,\n gridRow: 2,\n }}\n />\n <ButtonPush\n distance={0.02}\n style={{\n gridColumn: leftToRight ? 1 : 3,\n gridRow: 2,\n }}\n />\n <ButtonPush\n distance={1}\n style={{\n gridColumn: leftToRight ? 3 : 1,\n gridRow: 3,\n }}\n />\n <ButtonPush\n distance={0.1}\n style={{\n gridColumn: 2,\n gridRow: 3,\n }}\n />\n <ButtonPush\n distance={0.01}\n style={{\n gridColumn: leftToRight ? 1 : 3,\n gridRow: 3,\n }}\n />\n </div>\n );\n}\n\nfunction RawPusher(props: {\n hardware: EditableHardware<PusherSchema>;\n options: PusherOptions;\n disabled: boolean;\n leftToRight: boolean;\n}) {\n const { hardware, options, disabled, leftToRight } = props;\n const { state } = hardware.properties ?? 'OFFLINE';\n const isRetracted = state === 'RETRACTED';\n const isInTouch = state === 'IN_TOUCH';\n const isLost = state === 'LOST';\n const [moving, setMoving] = useState(false);\n\n function getLocation() {\n if (isRetracted) {\n return leftToRight ? 'ms-0' : 'ms-auto';\n }\n if (isInTouch) {\n return leftToRight ? 'ms-auto' : 'ms-0';\n }\n return 'mx-auto';\n }\n\n const location = getLocation();\n\n return (\n <div\n style={{\n display: 'grid',\n gridTemplateRows: 'min-content min-content',\n gridTemplateColumns: leftToRight\n ? 'auto min-content'\n : 'min-content auto',\n gridGap: '1px',\n }}\n >\n <i\n className={`${\n isInTouch || isLost ? 'fas fa-dizzy' : 'fa fa-smile'\n } fa-3x my-auto`}\n style={{ gridColumn: leftToRight ? 2 : 1, gridRow: 1 }}\n />\n <PusherBlock\n className={location}\n {...props}\n style={{ gridColumn: leftToRight ? 1 : 2, gridRow: 1 }}\n />\n <ButtonGroup\n className=\"mx-auto\"\n style={{\n width: '12em',\n gridColumn: leftToRight ? 1 : 2,\n gridRow: 2,\n }}\n >\n {!leftToRight && (\n <ActionButton\n text=\"In\"\n onAction={() => {\n return hardware.actions.call('move_in');\n }}\n onActionChange={(inAction) => {\n setMoving(inAction);\n }}\n disabled={isInTouch || disabled || moving}\n style={{ width: '5em' }}\n iconLocation=\"left\"\n icon=\"fa fa-fw fa-arrow-left\"\n />\n )}\n <ActionButton\n text=\"Out\"\n onAction={() => {\n return hardware.actions.call('move_out');\n }}\n onActionChange={(inAction) => {\n setMoving(inAction);\n }}\n disabled={isRetracted || disabled || moving}\n style={{ width: '5em' }}\n leftIcon=\"fa fa-fw fa-arrow-left\"\n rightIcon=\"fa fa-fw fa-arrow-right\"\n />\n {leftToRight && (\n <ActionButton\n text=\"In\"\n onAction={() => {\n return hardware.actions.call('move_in');\n }}\n onActionChange={(inAction) => {\n setMoving(inAction);\n }}\n disabled={isInTouch || disabled || moving}\n style={{ width: '5em' }}\n iconLocation=\"right\"\n icon=\"fa fa-fw fa-arrow-right\"\n />\n )}\n </ButtonGroup>\n </div>\n );\n}\n\nexport default function Pusher(\n props: HardwareWidgetProps<PusherSchema, PusherOptions>\n) {\n const { hardware, options = {} } = props;\n const leftToRight = (options.orientation ?? 'left-right') === 'left-right';\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} leftToRight={leftToRight} />;\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 type PusherSchema = Hardware<{\n state: string;\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 { State } 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: 'transient',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'transient',\n EXITED: 'secondary',\n FATAL: 'fatal',\n UNKNOWN: 'fatal',\n OFFLINE: 'secondary',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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: 'transient',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'transient',\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: 'transient',\n RUNNING: 'success',\n BACKOFF: 'warning',\n STOPPING: 'transient',\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 type ServiceSchema = Hardware<{\n state:\n | 'STOPPED'\n | 'STARTING'\n | 'RUNNING'\n | 'BACKOFF'\n | 'STOPPING'\n | 'EXITED'\n | 'FATAL'\n | 'UNKNOWN';\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 { State } 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, string] } = {\n // Deprecated in bliss-tomo 2.9\n READY: ['success', 'Ready to be used'],\n // Available since bliss-tomo 2.9\n IN: ['success', 'The sample is in the beam'],\n OUT: ['danger', 'The sample is out of the beam'],\n MOVING_IN: ['transient', 'The sample moving in the beam'],\n MOVING_OUT: ['transient', 'The sample moving out of the beam'],\n // Available since bliss-tomo 2.11.x (introduced during 2.10.x)\n LOST: [\n 'warning',\n 'The motion was interrupted between IN and OUT positions',\n ],\n UNKNOWN: ['fatal', 'The device have an unknown state'],\n };\n const [variant, description] = variants[state] || variants.UNKNOWN;\n return (\n <State\n state={state}\n minWidth={6}\n variant={variant}\n description={description}\n />\n );\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 {\n type TomoFlatMotionStep,\n type TomoFlatMotionSchema,\n isTomoFlatMotionEditable,\n} 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 const editable = isTomoFlatMotionEditable(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 || !editable}\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 || !editable}\n />\n <InputAxisMotion\n motion={motion}\n actions={hardware.actions}\n disabled={disabled || !editable}\n />\n <DropAxis\n motion={motion}\n actions={hardware.actions}\n disabled={disabled || !editable}\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 {\n type TomoFlatMotionStep,\n type TomoFlatMotionSchema,\n isTomoFlatMotionEditable,\n} 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 const editable = isTomoFlatMotionEditable(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 || !editable}\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 type { HardwareWidgetProps } from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { TomoFlatMotionState } from './TomoFlatMotionState';\nimport type { TomoFlatMotionSchema } from '.';\n\nexport default function TomoFlatMotionSmall(\n props: HardwareWidgetProps<TomoFlatMotionSchema>\n) {\n const { hardware, options = {}, disabled } = props;\n const { properties } = hardware;\n const { state = 'UNKNOWN' } = properties;\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 const isMovingIn = state === 'MOVING_IN';\n const isMovingOut = state === 'MOVING_OUT';\n const isIn = state === 'IN';\n const isOut = state === 'OUT';\n\n function getLocation() {\n if (isIn) {\n return '1 / 3';\n }\n if (isOut) {\n return '3 / 5';\n }\n return '2 / 4';\n }\n const location = getLocation();\n\n const face = isIn ? 'fa-face-grin-beam-sweat' : 'fa-smile';\n const title = isIn\n ? 'The sample is in front of the beam'\n : isOut\n ? 'The sample is out of the beam'\n : '';\n\n const widgetContent = (\n <div\n style={{\n display: 'grid',\n gridGap: 0,\n gridTemplateColumns: '1fr 1fr 1fr 1fr 1fr 1fr',\n gridTemplateRows: '1fr',\n }}\n >\n <i\n className={`fa ${face} fa-3x my-auto mx-auto`}\n style={{ gridColumn: location, gridRow: 1 }}\n title={title}\n />\n </div>\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 TomoFlatMotionSampleLocation from './TomoFlatMotionSampleLocation';\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\nexport interface TomoFlatMotionProperties extends Record<string, unknown> {\n state:\n | 'READY'\n | 'IN'\n | 'OUT'\n | 'MOVING_IN'\n | 'MOVING_OUT'\n | 'LOST'\n | 'UNKNOWN';\n available_axes: string[];\n motion: TomoFlatMotionStep[];\n move_in_parallel: boolean;\n power_onoff: boolean;\n settle_time: number;\n}\n\n/**\n * Hardware as exposed by Redux\n */\nexport type TomoFlatMotionSchema = Hardware<TomoFlatMotionProperties>;\n\nconst Variants: HardwareVariant<TomoFlatMotionSchema> = {\n default: TomoFlatMotionDefault,\n small: TomoFlatMotionSmall,\n // Override base state\n state: TomoFlatMotionState,\n sample_location: TomoFlatMotionSampleLocation,\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\n/**\n * True if the configuration of the object is editable.\n *\n * Actually trying to edit the flat motion if the sample\n * is not IN is not allowed.\n */\nexport function isTomoFlatMotionEditable(\n hardware: TomoFlatMotionSchema\n): boolean {\n const { properties = {} } = hardware;\n const { state = 'UNKNOWN' } = properties;\n return [\n 'IN',\n // Compatibility with bliss-tomo 2.9\n 'READY',\n ].includes(state);\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 { TomoFlatMotionProperties } 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<TomoFlatMotionProperties>({\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: TomoFlatMotionProperties,\n axis: {\n axis_ref: string;\n relative_position?: number;\n absolute_position?: number;\n }\n ): TomoFlatMotionProperties {\n const motion: TomoFlatMotionProperties['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 { useState } from 'react';\nimport type { MouseEvent } from 'react';\nimport type {\n HardwareWidgetOptions,\n HardwareWidgetProps,\n} from '../utils/types';\nimport TypeIcon from '../utils/TypeIcon';\nimport HardwareTemplate from '../utils/HardwareTemplate';\nimport { Button } from 'react-bootstrap';\nimport type { TomoReferencePositionSchema } from '.';\n\nexport interface TomoReferencePositionDefaultOptions\n extends HardwareWidgetOptions {\n /**\n * If defined, this label is displayed in the button.\n */\n label?: string;\n}\n\nexport default function TomoReferencePositionDefault(\n props: HardwareWidgetProps<\n TomoReferencePositionSchema,\n TomoReferencePositionDefaultOptions\n >\n) {\n const { hardware, options = {}, disabled } = props;\n const { actions } = hardware;\n const { label } = options;\n const [errorMsg, setErrorMsg] = useState<string | undefined>(undefined);\n const [processing, setProcessing] = useState(false);\n\n const widgetIcon = (\n <TypeIcon\n name=\"TomoReferencePositionSchema\"\n icon=\"fam-hardware-motor\"\n online={hardware.online}\n />\n );\n\n function onClickToReference(event: MouseEvent) {\n setErrorMsg(undefined);\n setProcessing(true);\n actions\n .call('move_to_reference')\n .catch((error: any) => {\n setErrorMsg(`${error}`);\n })\n .finally(() => {\n setProcessing(false);\n });\n }\n\n const widgetState = <></>;\n\n const widgetContent = (\n <Button\n onClick={onClickToReference}\n variant={errorMsg === undefined ? 'secondary' : 'danger'}\n disabled={disabled || processing}\n className=\"w-100\"\n >\n {errorMsg && (\n <i className=\"fa-solid fa-triangle-exclamation me-1\" title={errorMsg} />\n )}\n {!errorMsg && processing && (\n <i className=\"fa-solid fa-cog fa-spin me-1\" />\n )}\n {label ?? 'Back to reference 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 type TomoReferencePositionSchema = Hardware<Record<string, never>>;\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 { State } 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: 'transient',\n UNMOUNTING: 'transient',\n LOCKED: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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(3).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 Qty from 'js-quantities';\n\n/**\n * Convert a quantity value into another unit.\n *\n * @param value: Value to convert\n * @param from: Unit of the input value\n * @param to: Unit of the result\n * @param pixelSize: If defined, a convertion can be done between distances and pixels\n * @returns The converted value. If the convertion fail, NaN is returned.\n */\nexport function convert(\n value: number,\n from: string,\n to: string,\n pixelSize?: Qty\n): number {\n if (from === to) {\n return value;\n }\n if (from === 'rad' && to === 'deg') {\n return (180 * value) / Math.PI;\n }\n if (from === 'deg' && to === 'rad') {\n return (Math.PI * value) / 180;\n }\n if (from === 'px') {\n if (pixelSize !== undefined) {\n const px = pixelSize.to('mm').scalar;\n return convert(value * px, 'mm', to, undefined);\n }\n return Number.NaN;\n }\n if (to === 'px') {\n if (pixelSize !== undefined) {\n const v = convert(value, from, 'mm', undefined);\n const px = pixelSize.to('mm').scalar;\n return v / px;\n }\n return Number.NaN;\n }\n try {\n return Qty(value, from).to(to).scalar;\n } catch {\n console.error(`Convertion ${from}->${to} is not provided`);\n return Number.NaN;\n }\n}\n\n/**\n * Convert the unit to a displayable unit.\n *\n * For example `um` became `μm`.\n */\nexport function formatedUnit(unit: string): string {\n if (unit.startsWith('u')) {\n return `μ${unit.slice(1)}`;\n }\n return unit;\n}\n","/**\n * Return a hardware id from a hardware reference.\n *\n * For example convert `hardware:foo` into `foo`.\n */\nexport function getHardwareIdFromRef(\n ref: string | undefined | null\n): string | null {\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","import { InputGroup } 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 { useMemo } from 'react';\nimport { convert, formatedUnit } from '../../utils/units';\nimport { useLimaHardware } from '../lima';\nimport { getHardwareIdFromRef } from '../utils/hardware';\n\nexport interface TomoDetectorFieldOfViewOptions extends HardwareWidgetOptions {\n /**\n * The unit to be used to display the field of view.\n */\n display_unit?: string;\n\n /**\n * Number of digits\n */\n digits?: number;\n}\n\nexport default function TomoDetectorFieldOfView(\n props: HardwareWidgetProps<TomoDetectorSchema, TomoDetectorFieldOfViewOptions>\n) {\n const { hardware, options = {} } = props;\n const { properties = {} } = hardware;\n const { sample_pixel_size: samplePixelSize, detector = null } = properties;\n\n const hardwareDet = useLimaHardware(getHardwareIdFromRef(detector));\n const { properties: propertiesDet = {} } = hardwareDet ?? {};\n const { size } = propertiesDet;\n\n const displayUnit = options.display_unit ?? 'mm';\n const digits = options.digits ?? 3;\n\n const widgetIcon = (\n <TypeIcon name=\"TomoDetector\" icon=\"fa-eye\" online={hardware.online} />\n );\n\n const widgetState = <TomoDetectorState hardware={hardware} />;\n\n const formattedValue = useMemo(() => {\n if (\n samplePixelSize === null ||\n samplePixelSize === undefined ||\n size === null ||\n size === undefined\n ) {\n return '∅';\n }\n const w = convert(size[0] * samplePixelSize, 'um', displayUnit);\n const h = convert(size[1] * samplePixelSize, 'um', displayUnit);\n return `${w.toFixed(digits)} × ${h.toFixed(digits)}`;\n }, [samplePixelSize, size, displayUnit, digits]);\n\n const widgetContent = (\n <InputGroup className=\"flex-nowrap\">\n <ReadOnlyTextInput value={formattedValue} />\n <InputGroup.Text>{formatedUnit(displayUnit)}</InputGroup.Text>\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 TomoDetectorFieldOfView from './TomoDetectorFieldOfView';\nimport TomoDetectorAcquisitionMode from './TomoDetectorAcquisitionMode';\nimport TomoDetectorState from './TomoDetectorState';\nimport { useHardware } from '../../registry/hooks';\n\n/**\n * Hardware as exposed by Redux\n */\nexport type TomoDetectorSchema = Hardware<{\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\nconst Variants: HardwareVariant<TomoDetectorSchema> = {\n samplepixelsize: TomoDetectorSamplePixelSize,\n acquisitionmode: TomoDetectorAcquisitionMode,\n fieldofview: TomoDetectorFieldOfView,\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 { State } 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: 'transient',\n UNMOUNTING: 'transient',\n UNKNOWN: 'fatal',\n OFFLINE: 'warning',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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';\nimport { getHardwareIdFromRef } from '../utils/hardware';\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 type TomoDetectorsSchema = Hardware<{\n state: string;\n detectors: string[];\n active_detector: string;\n target_detector?: string; // FIXME: The server implementation is missing\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 { State } 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: 'transient',\n UNKNOWN: 'fatal',\n };\n const variant = variants[state] || variants.UNKNOWN;\n return <State 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 { useCallback, useMemo } from 'react';\nimport { useState } from 'react';\nimport { Form } from 'react-bootstrap';\nimport type Qty from 'js-quantities';\nimport { convert } from '../utils/units';\n\n/**\n * Input number displaying value with a display unit.\n *\n * `onChange` is only triggered when `Enter` is pressed.\n *\n * This was designed to be composed inside a `InputGroup`.\n */\nexport function QuantityInputNumberOrNull(props: {\n value: number | null;\n unit: string;\n displayUnit?: string;\n preferedDisplayUnit?: string;\n step?: number;\n pixelSize?: Qty;\n onAccepted?: (value: number | null) => void;\n onAborted?: () => void;\n decimals?: number;\n style?: Record<string, any>;\n className?: string;\n allowNullAsEmpty: boolean;\n disabled?: boolean;\n}) {\n const {\n style,\n className,\n value,\n decimals = 2,\n allowNullAsEmpty = false,\n disabled = false,\n } = props;\n const [editedValue, setEditedValue] = useState<string | undefined>(undefined);\n const editing = editedValue !== undefined;\n\n const displayUnit = useMemo(() => {\n if (\n props.preferedDisplayUnit !== undefined &&\n (props.pixelSize === undefined ||\n props.unit === 'px' ||\n props.preferedDisplayUnit === 'px')\n ) {\n return props.preferedDisplayUnit;\n }\n return props.displayUnit ?? props.unit;\n }, [\n props.displayUnit,\n props.unit,\n props.preferedDisplayUnit,\n props.pixelSize,\n ]);\n\n const convertFromDisplay = useCallback(\n (value: number | null) => {\n if (value === null || displayUnit === undefined) {\n return null;\n }\n return convert(value, displayUnit, props.unit, props.pixelSize);\n },\n [props.unit, displayUnit, props.pixelSize]\n );\n\n const convertToDisplay = useCallback(\n (value: number | null) => {\n if (value === null || displayUnit === undefined) {\n return null;\n }\n return convert(value, props.unit, displayUnit, props.pixelSize);\n },\n [props.unit, displayUnit, props.pixelSize]\n );\n\n function inputToDisplay(editedValue: string): number | null {\n if ((editedValue ?? '') === '') {\n return null;\n }\n return Number.parseFloat(editedValue);\n }\n\n function acceptEdition() {\n if (editedValue === undefined) {\n // This is unexpected\n return;\n }\n if (!allowNullAsEmpty && editedValue === '') {\n // We could display an error message\n return;\n }\n let v: number | null;\n try {\n v = inputToDisplay(editedValue);\n } catch {\n // The input have to be fixed first\n // We could display an error message\n return;\n }\n const i = convertFromDisplay(v);\n props.onAccepted?.(i);\n setEditedValue(undefined);\n }\n\n function abortEdition() {\n if (editedValue === undefined) {\n // This is unexpected\n return;\n }\n props.onAborted?.();\n setEditedValue(undefined);\n }\n\n const displayedValue = useMemo(() => {\n const v = convertToDisplay(value);\n if (v === null) {\n return '';\n }\n return v.toFixed(decimals);\n }, [value]);\n\n return (\n <Form.Control\n value={editedValue ?? displayedValue ?? undefined}\n className={className}\n step={props.step}\n type=\"number\"\n style={{\n ...style,\n backgroundColor: editing ? '#FFFF80' : undefined,\n }}\n disabled={disabled}\n onChange={(e) => {\n setEditedValue(e.target.value);\n }}\n onBlur={() => {\n abortEdition();\n }}\n onKeyDown={(e) => {\n if (/^[ a-z]$/i.test(e.key)) {\n e.preventDefault();\n return false;\n }\n e.stopPropagation();\n if (e.key === 'Enter') {\n acceptEdition();\n } else if (e.key === 'Escape') {\n abortEdition();\n }\n return true;\n }}\n />\n );\n}\n","import type Qty from 'js-quantities';\nimport { QuantityInputNumberOrNull } from './QuantityInputNumberOrNull';\n\n/**\n * Input number displaying value with a display unit.\n *\n * `onChange` is only triggered when `Enter` is pressed.\n *\n * This was designed to be composed inside a `InputGroup`.\n */\nexport function QuantityInputNumber(props: {\n value: number;\n unit: string;\n displayUnit?: string;\n preferedDisplayUnit?: string;\n step?: number;\n pixelSize?: Qty;\n onAccepted?: (value: number) => void;\n onAborted?: () => void;\n decimals?: number;\n style?: Record<string, any>;\n className?: string;\n disabled?: boolean;\n}) {\n const { onAccepted, ...otherProps } = props;\n return (\n <QuantityInputNumberOrNull\n {...otherProps}\n allowNullAsEmpty={false}\n // @ts-expect-error\n onAccepted={onAccepted}\n />\n );\n}\n","import 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';\nimport type { TomoImagingOptions } from './options';\nimport { formatedUnit } from '../../utils/units';\nimport { QuantityInputNumber } from '../../components/QuantityInputNumber';\n\nfunction ExposureTime(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n options: TomoImagingOptions;\n}) {\n const { hardware, options } = props;\n const exposureTime = hardware.properties.exposure_time ?? 0;\n const disabled = props.disabled || !hardware.online;\n const displayUnit = options.unit ?? 's';\n\n const digits = options.digits ?? 3;\n\n return (\n <InputGroup className=\"w-100\">\n <QuantityInputNumber\n value={exposureTime}\n unit=\"s\"\n displayUnit={options.unit ?? 's'}\n onAccepted={(value) => {\n void hardware.actions.setProperty('exposure_time', value);\n }}\n decimals={digits}\n disabled={disabled}\n />\n <InputGroup.Text>{formatedUnit(displayUnit)}</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, TomoImagingOptions>\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\n hardware={hardware}\n disabled={props.disabled}\n options={options}\n />\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';\nimport { useHardware } from '../../registry/hooks';\nimport { isLimaHardware } from '../lima';\nimport type { LimaSchema } from '../lima';\nimport type { HardwareWidgetOptions } from '../utils/types';\n\nexport interface TomoImagingActionsOptions extends HardwareWidgetOptions {\n /**\n * If true, the default, the sample location is restored after the action.\n */\n restore_sample?: boolean;\n}\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 disabled: boolean;\n onAction: () => Promise<void>;\n onStarted?: () => void;\n onTerminated?: () => void;\n title?: string;\n}) {\n const [processing, setProcessing] = useState(false);\n const [errorMsg, setErrorMsg] = useState<string | undefined>(undefined);\n\n const { text, disabled, onAction, onStarted, onTerminated, title } = props;\n\n function onClick(event: MouseEvent) {\n onStarted?.();\n setErrorMsg(undefined);\n setProcessing(true);\n onAction()\n .catch((error: any) => {\n setErrorMsg(`${error}`);\n })\n .finally(() => {\n setProcessing(false);\n onTerminated?.();\n });\n }\n\n return (\n <Button\n onClick={onClick}\n disabled={disabled || processing}\n variant={errorMsg === undefined ? 'primary' : 'danger'}\n className={classNames({ 'ps-4': !processing, 'pe-4': !processing })}\n title={title}\n >\n {errorMsg && (\n <i className=\"fa-solid fa-triangle-exclamation me-1\" title={errorMsg} />\n )}\n {!errorMsg && processing && (\n <i className=\"fa-solid fa-cog fa-spin me-1\" />\n )}\n {text}\n </Button>\n );\n}\n\nfunction useActiveLimaDetector(): LimaSchema | null {\n const hardware = useHardware(\n 'ACTIVE_TOMOCONFIG.ref.detectors.active_detector.detector'\n );\n if (hardware === null) {\n return null;\n }\n if (!isLimaHardware(hardware)) {\n return null;\n }\n return hardware;\n}\n\nfunction TakeActions(props: {\n hardware: EditableHardware<TomoImagingSchema>;\n disabled: boolean;\n restoreSample: boolean;\n}) {\n const { hardware, restoreSample } = props;\n const [processing, setProcessing] = useState(false);\n const disabled = props.disabled || !hardware.online || processing;\n\n const lima = useActiveLimaDetector();\n const limaOffline = !(lima?.properties.state !== 'OFFLINE');\n\n function onStarted() {\n setProcessing(true);\n }\n\n function onTerminated() {\n setProcessing(false);\n }\n\n function takeProj() {\n return hardware.actions.call('take_proj');\n }\n\n function takeDark() {\n return hardware.actions.call('take_dark');\n }\n\n function takeFlat() {\n return hardware.actions.call(\n restoreSample ? 'take_flat' : 'take_flat_and_stay'\n );\n }\n\n return (\n <ButtonGroup\n size=\"lg\"\n className=\"w-100\"\n title={\n limaOffline ? `The detector '${lima?.name}' is offline` : undefined\n }\n >\n <ProcessingButton\n onAction={takeProj}\n onStarted={onStarted}\n onTerminated={onTerminated}\n disabled={disabled || limaOffline}\n text=\"Proj\"\n title=\"Take a projection\"\n />\n <ProcessingButton\n onAction={takeFlat}\n onStarted={onStarted}\n onTerminated={onTerminated}\n disabled={disabled || limaOffline}\n text=\"Flat\"\n title=\"Take a flat\"\n />\n <ProcessingButton\n onAction={takeDark}\n onStarted={onStarted}\n onTerminated={onTerminated}\n disabled={disabled || limaOffline}\n text=\"Dark\"\n title=\"Take a dark\"\n />\n </ButtonGroup>\n );\n}\n\nexport default function TomoImagingActions(\n props: HardwareWidgetProps<TomoImagingSchema, TomoImagingActionsOptions>\n) {\n const { hardware, options = {} } = props;\n const { restore_sample: restoreSample = true } = options;\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\n hardware={hardware}\n disabled={props.disabled}\n restoreSample={restoreSample}\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 { 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 type TomoImagingSchema = Hardware<{\n state: string;\n update_on_move: boolean;\n exposure_time: number;\n settle_time: number;\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 type TomoSampleStageSchema = Hardware<{\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\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 type TomoConfigSchema = Hardware<{\n sample_stage: string;\n sxbeam: string;\n detectors: string;\n holotomo: string;\n latency_time: number;\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 { State } 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: 'transient',\n STABILIZING: 'transient',\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 <State 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 type TomoHoloSchema = Hardware<{\n state: string;\n settle_time: number;\n pixel_size: number | null;\n nb_distances: number;\n distances: TomoHoloDistance[];\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 type ValveSchema = Hardware<{\n state: string;\n status: string;\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 = <>No object</>;\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 { useMemo } from 'react';\nimport { Knob, Pointer, Power, Value } from '@vallsv/rc-knob';\n\nexport default function Gauge(props: {\n size: number;\n value: number | null;\n min: number;\n max: number;\n lowWarning?: number;\n hiWarning?: number;\n lowDanger?: number;\n hiDanger?: number;\n}) {\n const { size, value, min, max, lowWarning, hiWarning, lowDanger, hiDanger } =\n props;\n\n function toPercent(v: number | null): number | null {\n if (v === null) {\n return null;\n }\n return (v - min) / (max - min);\n }\n\n const geometry = useMemo(() => {\n const lowPercentDanger =\n lowDanger === undefined ? undefined : toPercent(lowDanger);\n const hiPercentDanger =\n hiDanger === undefined ? undefined : toPercent(hiDanger);\n const lowPercentWarning =\n lowWarning === undefined ? undefined : toPercent(lowWarning);\n const hiPercentWarning =\n hiWarning === undefined ? undefined : toPercent(hiWarning);\n return {\n lowPercentDanger,\n hiPercentDanger,\n lowPercentWarning,\n hiPercentWarning,\n };\n }, [min, max, lowWarning, hiWarning, lowDanger, hiDanger]);\n\n const valueClassName = useMemo(() => {\n if (value === null) {\n return 'value';\n }\n if (lowDanger !== undefined && value <= lowDanger) {\n return 'value value-danger';\n }\n if (hiDanger !== undefined && value >= hiDanger) {\n return 'value value-danger';\n }\n if (lowWarning !== undefined && value <= lowWarning) {\n return 'value value-warning';\n }\n if (hiWarning !== undefined && value >= hiWarning) {\n return 'value value-warning';\n }\n return 'value';\n }, [value, lowDanger, hiDanger, lowWarning, hiWarning]);\n\n const powerRadius = size / 2 - 15;\n const width0 = size / 10;\n const width100 = (size / 10) * 3;\n\n function getWidth(p: number): number {\n return width0 + (width100 - width0) * p;\n }\n\n return (\n <Knob\n size={size}\n angleOffset={240}\n angleRange={240}\n min={min}\n max={max}\n value={value}\n readOnly\n className=\"gauge\"\n >\n {geometry.lowPercentDanger && (\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range range-danger\"\n percentageFrom={0}\n percentageTo={geometry.lowPercentDanger}\n widthFrom={getWidth(0)}\n widthTo={getWidth(geometry.lowPercentDanger)}\n />\n )}\n {geometry.lowPercentWarning && (\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range range-warning\"\n percentageFrom={geometry.lowPercentDanger ?? 0}\n percentageTo={geometry.lowPercentWarning}\n widthFrom={getWidth(geometry.lowPercentDanger ?? 0)}\n widthTo={getWidth(geometry.lowPercentWarning)}\n />\n )}\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range\"\n percentageFrom={\n geometry.lowPercentWarning ?? geometry.lowPercentDanger ?? 0\n }\n percentageTo={\n geometry.hiPercentWarning ?? geometry.hiPercentDanger ?? 1\n }\n widthFrom={getWidth(\n geometry.lowPercentWarning ?? geometry.lowPercentDanger ?? 0\n )}\n widthTo={getWidth(\n geometry.hiPercentWarning ?? geometry.hiPercentDanger ?? 1\n )}\n />\n {geometry.hiPercentWarning && (\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range range-warning\"\n percentageFrom={geometry.hiPercentWarning}\n percentageTo={geometry.hiPercentDanger ?? 1}\n widthFrom={getWidth(geometry.hiPercentWarning)}\n widthTo={getWidth(geometry.hiPercentDanger ?? 1)}\n />\n )}\n {geometry.hiPercentDanger && (\n <Power\n radiusFrom={powerRadius}\n radiusTo={powerRadius}\n className=\"range range-danger\"\n percentageFrom={geometry.hiPercentDanger}\n percentageTo={1}\n widthFrom={getWidth(geometry.hiPercentDanger)}\n widthTo={getWidth(1)}\n />\n )}\n <circle r={size / 20} cx={size / 2} cy={size / 2} fill=\"black\" />\n <Pointer\n percentage={toPercent(value)}\n width={10}\n height={size / 2 - 15}\n radius={2}\n type=\"triangle\"\n color=\"black\"\n />\n <Value className={valueClassName} value={value} />\n </Knob>\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 type { YamlComponent } from '../model';\n\nexport default function Yaml(props: YamlComponent) {\n return <></>;\n}\n","import type { YamlComponent } from '../model';\nimport { assertNoUnknownKeys, assertString } from '../asserts';\n\nexport default function YamlLabel(props: YamlComponent) {\n const { providers = {}, yamlNode, label, ...unknownOptions } = props;\n assertString(yamlNode, 'label', label);\n assertNoUnknownKeys(yamlNode, unknownOptions);\n return <div>{label}</div>;\n}\n","import { map } from 'lodash';\nimport { Row } from 'react-bootstrap';\nimport { renderYamlNode } from '../utils';\nimport { assertNoUnknownKeys } from '../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 { assertNoUnknownKeys, assertOptionalNumber } from '../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 { 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', overflow: 'auto' }}>\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 type { ComponentType } from 'react';\nimport YamlTodo from './components/Todo';\nimport YamlNone from './components/None';\nimport YamlLabel from './components/Label';\nimport YamlRow from './containers/Row';\nimport YamlCol from './containers/Col';\nimport YamlContainer from './containers/Container';\nimport YamlPanel from './containers/Panel';\nimport YamlTabs from './containers/Tabs';\nimport YamlForm from './containers/Form';\nimport YamlGrid from './containers/Grid';\n\n/**\n * Store the mapping from Yaml `type` to React component handling the\n * rendering of such Yaml node\n */\nexport const yamlContainers: Record<string, ComponentType<any>> = {\n row: YamlRow,\n col: YamlCol,\n container: YamlContainer,\n panel: YamlPanel,\n tabs: YamlTabs,\n form: YamlForm,\n grid: YamlGrid,\n};\n\n/**\n * Register the Yaml type with the component used to render this Yaml node.\n */\nexport function registerYamlContainer(\n name: string,\n component: ComponentType<any>\n) {\n if (yamlComponents[name]) {\n console.warn(\n `yaml registration: The type ${name} is already a component. The component will not be reachable anymore.`\n );\n }\n if (yamlContainers[name]) {\n console.warn(\n `yaml registration: The type ${name} is already a container. The previous container will be dropped.`\n );\n }\n yamlContainers[name] = component;\n}\n\nexport const yamlComponents: Record<string, ComponentType<any>> = {\n todo: YamlTodo,\n none: YamlNone,\n label: YamlLabel,\n};\n\n/**\n * Register a yaml component.\n *\n * Such component is wrapped inside a `Panel`.\n */\nexport function registerYamlComponent(\n name: string,\n component: ComponentType<any>\n) {\n if (yamlComponents[name]) {\n console.warn(\n `yaml registration: The type ${name} is already a component. The previous component will be dropped.`\n );\n }\n if (yamlContainers[name]) {\n console.warn(\n `yaml registration: The type ${name} is already a container. This component will not be used.`\n );\n }\n yamlComponents[name] = component;\n}\n\n/**\n * Register multiple yaml components.\n *\n * Such components are wrapped inside a `Panel`.\n */\nexport function registerYamlComponents(\n map: Record<string, ComponentType<any>>\n) {\n Object.entries(map).forEach(([key, component]) =>\n registerYamlComponent(key, component)\n );\n}\n","import React, { Suspense } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport type { YamlNode } from './model';\nimport { yamlComponents } from './registry';\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 yamlComponents)) {\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 = yamlComponents[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 { Children, cloneElement, isValidElement } from 'react';\nimport type { PropsWithChildren } from 'react';\nimport Panel from '../layout/Panel';\nimport type { AnyYamlNode, YamlNode, YamlRoot } from './model';\nimport { yamlContainers } from './registry';\nimport YamlComponent from './Component';\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 yamlContainers ? yamlContainers[type] : YamlComponent;\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 assertOptionalListOfType<Y>(\n yamlNode: YamlNode,\n key: string,\n value: unknown,\n isType: (value: Y) => boolean,\n typeName: string\n): asserts value is Y[] | 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 ${typeName} is expected`\n );\n }\n value.forEach((v) => {\n if (!isType(v)) {\n throw new KeyError(\n yamlNode,\n key,\n `An optional list of type ${typeName} 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\n/**\n * Assert function for generic 'args' as used in python\n * function with `*args`.\n *\n * The argument is validated as a list of unknown items.\n */\nexport function assertOptionalArgs(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is unknown[] | undefined {\n if (value === undefined) {\n return;\n }\n if (!Array.isArray(value)) {\n throw new KeyError(yamlNode, key, 'A list is expected');\n }\n}\n\n/**\n * Assert function for generic 'kwargs' as used in python\n * function with `**kwargs`.\n *\n * The argument is validated as a record from string to unknown values.\n */\nexport function assertOptionalKwargs(\n yamlNode: YamlNode,\n key: string,\n value: unknown\n): asserts value is Record<string, unknown> | undefined {\n if (value === undefined) {\n return;\n }\n if (value === null || typeof value !== 'object') {\n throw new KeyError(yamlNode, key, 'A list is expected');\n }\n}\n\n/**\n * Type a schema from it;s typescript description.\n *\n * See `assertStringMappingRecord`\n */\nexport type Schema<T> = Record<\n keyof T,\n (yamlNode: YamlNode, key: string, value: unknown) => void\n>;\n\n/**\n * Assert function for generic record of string.\n *\n * Can be used as the basis of a specific assertion.\n *\n * The argument is validated as a record from string to unknown values.\n *\n * @param options: Parsing parameters\n */\nexport function assertStringMappingRecord<\n T extends Partial<Record<string, any>>\n>(\n yamlNode: YamlNode,\n key: string,\n value: unknown,\n options: {\n /** If true, the value can be `undefined` */\n optional?: boolean;\n /** Mapping from expected keys to the relative assert function */\n schema: Record<\n string,\n (yamlNode: YamlNode, key: string, value: unknown) => void\n >;\n }\n): asserts value is T {\n const { optional, schema } = options;\n if (optional && value === undefined) {\n return;\n }\n if (!value || typeof value !== 'object') {\n throw new KeyError(yamlNode, key, 'A mapping is expected');\n }\n const unexpectedKeys = Object.keys(value).filter((k) => {\n return typeof k === 'string' && !(k in schema);\n });\n if (unexpectedKeys.length > 0) {\n throw new UnknownKeysError(\n yamlNode,\n Object.keys(unexpectedKeys.map((k) => `${key}/${k}`))\n );\n }\n // Here we know that the value only contains expected keys\n const valueMap = value as Record<string, unknown>;\n Object.entries(schema).forEach(([k, assertFunc]) => {\n if (typeof k === 'string') {\n assertFunc(yamlNode, `${key}/${k}`, valueMap[k]);\n }\n });\n}\n","import type { YamlComponent } from '../model';\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 AirBearingVariants from './airbearing';\nimport BaseVariants from './base';\nimport BeamviewerVariants from './beamviewer';\nimport EnergyManagerVariants from './energymanager';\nimport FrontendVariants from './frontend';\nimport GaugeVariants from './gauge';\nimport LaserHeatingVariants from './laser';\nimport LaserVariants from './laserheating';\nimport LightVariants from './light';\nimport LimaVariants from './lima';\nimport MeasurementGroupVariants from './measurementgroup';\nimport MotorVariants from './motor';\nimport MultipositionVariants from './multiposition';\nimport OpticVariants from './optic';\nimport ProcedureVariants from './procedure';\nimport PumpVariants from './pump';\nimport PusherVariants from './pusher';\nimport RegulationVariants from './regulation';\nimport ServiceVariants from './service';\nimport ShutterVariants from './shutter';\nimport TomoConfigVariants from './tomoconfig';\nimport TomoDetectorsVariants from './tomodetectors';\nimport TomoDetectorVariants from './tomodetector';\nimport TomoFlatMotionVariants from './tomoflatmotion';\nimport TomoImagingVariants from './tomoimaging';\nimport TomoReferencePositionVariants from './tomoreferenceposition';\nimport ValveVariants from './valve';\n\nimport type { AnySchema } from './utils/schema';\nimport type { HardwareComponentType, HardwareVariant } from './utils/types';\n\n/**\n * Storage for the hardware variant components.\n *\n * It is exported for listing in the documentation.\n */\nexport const hardwareMap: Record<string, HardwareVariant<AnySchema>> = {};\n\nconst initialVariants: Record<string, HardwareVariant<AnySchema>> = {\n airbearing: AirBearingVariants,\n base: BaseVariants,\n beamviewer: BeamviewerVariants,\n energymanager: EnergyManagerVariants,\n frontend: FrontendVariants,\n gauge: GaugeVariants,\n laser: LaserVariants,\n laserheating: LaserHeatingVariants,\n light: LightVariants,\n lima: LimaVariants,\n measurementgroup: MeasurementGroupVariants,\n motor: MotorVariants,\n multiposition: MultipositionVariants,\n optic: OpticVariants,\n procedure: ProcedureVariants,\n pump: PumpVariants,\n pusher: PusherVariants,\n regulation: RegulationVariants,\n service: ServiceVariants,\n shutter: ShutterVariants,\n tomoconfig: TomoConfigVariants,\n tomodetector: TomoDetectorVariants,\n tomodetectors: TomoDetectorsVariants,\n tomoflatmotion: TomoFlatMotionVariants,\n tomoimaging: TomoImagingVariants,\n tomoreferenceposition: TomoReferencePositionVariants,\n valve: ValveVariants,\n};\n\nObject.entries(initialVariants).forEach(([l, v]) => {\n hardwareMap[l] = { ...v };\n});\n\n/**\n * Register an hardware variant.\n */\nexport function registerHardwareVariant(\n type: string,\n variant: string,\n component: HardwareComponentType<AnySchema>\n) {\n if (!(type in hardwareMap)) {\n hardwareMap[type] = {};\n }\n if (variant in hardwareMap[type]) {\n console.warn(\n `Hardware variant ${type}/${variant} already existes. Overwrite.`\n );\n }\n hardwareMap[type][variant] = component;\n}\n\n/**\n * Return a hardware variant component.\n *\n * - Check first if a hardware type and variant\n * is registered, return it.\n * - Else, check if the 'base' type and variant\n * is registered, return it\n * - Else, return null\n *\n * @param type: Type of the hardware\n * @param variant: Variant requested\n */\nexport function getHardwareVariantComponent(\n type: string,\n variant: string\n): HardwareComponentType | null {\n if (type in hardwareMap) {\n const variants = hardwareMap[type];\n if (variant in variants) {\n return variants[variant];\n }\n }\n\n const baseVariants = hardwareMap.base;\n if (variant in baseVariants) {\n return baseVariants[variant];\n }\n\n return null;\n}\n","import { getHardwareVariantComponent } from '../hardware/registry';\nimport { AnyHardwareState } from '../hardware/base/BaseState';\nimport type {\n AnyHardware,\n HardwareChangeActions,\n} from '../hardware/utils/types';\nimport { State } from '../hardware/utils/State';\n\n/**\n * Component which display the state of a hardware.\n *\n * It is based on the type of the hardware, and fallback to the\n * `AnyHardwareState` component if no components are available.\n */\nexport function HardwareState(props: {\n hardware: AnyHardware | null;\n options?: { emptyifnone?: boolean };\n}) {\n const { hardware, options = {} } = props;\n const { emptyifnone = false } = options;\n\n if (hardware === null) {\n if (emptyifnone) {\n return <></>;\n }\n return <State state=\"NONE\" variant=\"danger\" description=\"No hardware\" />;\n }\n\n const { type } = hardware;\n\n // Special hardware types which will be used for asyn hardware update\n switch (type) {\n case 'missing':\n return (\n <State\n state=\"MISSING\"\n variant=\"danger\"\n description=\"Hardware not available\"\n />\n );\n case 'error':\n return (\n <State\n state=\"ERROR\"\n variant=\"danger\"\n description=\"Error to load the hardware\"\n />\n );\n case 'loading':\n return (\n <State\n state=\"LOADING\"\n variant=\"warning\"\n description=\"The hardware was requested\"\n />\n );\n }\n\n const Comp = getHardwareVariantComponent(type, 'state');\n if (!Comp) {\n return <AnyHardwareState hardware={hardware} />;\n }\n\n const actions: HardwareChangeActions = {\n setProperty: (name: string, value: any) => {\n return Promise.resolve();\n },\n call: (name: string, ...args: any[]) => {\n return Promise.resolve();\n },\n };\n\n return (\n <Comp\n hardware={{ ...hardware, actions }}\n options={{ name: hardware.name }}\n operator={false}\n disabled={false}\n />\n );\n}\n","import type { PropsWithChildren, ReactElement } from 'react';\nimport { Modal, Button } from 'react-bootstrap';\nimport type { OverlayProps } from 'react-bootstrap';\n\nexport interface ModalClassProps {\n target: OverlayProps['target'];\n show?: boolean;\n actions?: {\n onShow?: () => void;\n onClose?: () => void;\n };\n title: string;\n buttons?: ReactElement;\n otherButtons?: ReactElement;\n bodyClassName?: string;\n size?: 'sm' | 'lg' | 'xl';\n fullscreen?: true | string;\n}\n\ninterface Props extends ModalClassProps {\n cancelText?: string;\n footer?: boolean;\n showClose?: boolean;\n}\n\nexport default function ModalDialog(props: PropsWithChildren<Props>) {\n const {\n title,\n children,\n buttons,\n cancelText,\n footer = true,\n showClose = true,\n show = false,\n actions = {},\n otherButtons,\n bodyClassName,\n size = 'lg',\n fullscreen,\n } = props;\n\n const { onShow, onClose: onHide } = actions;\n\n return (\n <Modal\n fullscreen={fullscreen}\n size={size}\n aria-labelledby=\"modal-title\"\n centered\n onShow={onShow}\n onHide={onHide}\n show={show}\n >\n <Modal.Header closeButton>\n <Modal.Title id=\"modal-title\">{title}</Modal.Title>\n </Modal.Header>\n <Modal.Body className={bodyClassName}>{children}</Modal.Body>\n {footer && (\n <Modal.Footer>\n {otherButtons && (\n <div className=\"form-other-buttons\">{otherButtons}</div>\n )}\n {buttons}\n {showClose && (\n <Button onClick={onHide}>{cancelText || 'Close'}</Button>\n )}\n </Modal.Footer>\n )}\n </Modal>\n );\n}\n","export default function ConditionalWrap<C = JSX.Element>(props: {\n condition: any;\n wrap: (children: C) => C;\n children: C;\n}): C {\n return props.condition ? props.wrap(props.children) : props.children;\n}\n","import { forwardRef, useImperativeHandle, useRef, useState } from 'react';\nimport type { PropsWithChildren, ReactElement, ComponentType } from 'react';\nimport type { Placement } from 'react-bootstrap/types';\nimport { Button, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport ModalDialog from './ModalDialog';\nimport ConditionalWrap from './ConditionalWrap';\n\nimport type { ModalClassProps } from './ModalDialog';\n\ninterface Props {\n button?: ReactElement;\n buttons?: ReactElement;\n title: string;\n buttonProps?: object;\n showButton?: boolean;\n tooltip?: string;\n tooltipPlacement?: Placement;\n onClose?: () => void;\n modalClass?: ComponentType<ModalClassProps>;\n}\n\nexport interface ButtonTriggerModalRef {\n showModal: () => void;\n close: () => void;\n}\n\nconst ButtonTriggerModal = forwardRef<\n ButtonTriggerModalRef,\n PropsWithChildren<Props>\n>((props, ref) => {\n const [showModal, setShowModal] = useState(false);\n const { showButton = true } = props;\n const targetRef = useRef(null);\n\n function close() {\n setShowModal(false);\n if (props.onClose) {\n props.onClose();\n }\n }\n\n function onCloseModal() {\n close();\n }\n\n useImperativeHandle(ref, () => ({\n showModal: () => setShowModal(true),\n close: () => onCloseModal(),\n }));\n\n const ModalClass = props.modalClass || ModalDialog;\n return (\n <>\n {showButton && (\n <ConditionalWrap\n condition={props.tooltip}\n wrap={(children) => (\n <OverlayTrigger\n placement={props.tooltipPlacement || 'top'}\n overlay={<Tooltip id=\"tooltip1\">{props.tooltip}</Tooltip>}\n >\n {children}\n </OverlayTrigger>\n )}\n >\n <Button\n onClick={() => {\n setShowModal(true);\n }}\n {...props.buttonProps}\n ref={targetRef}\n >\n {props.button}\n </Button>\n </ConditionalWrap>\n )}\n <ModalClass\n target={targetRef}\n show={showModal}\n actions={{ onClose: onCloseModal }}\n title={props.title}\n buttons={props.buttons}\n >\n {props.children}\n </ModalClass>\n </>\n );\n});\n\nexport default ButtonTriggerModal;\n","import { Badge, Col, OverlayTrigger, Tooltip } from 'react-bootstrap';\nimport type { Monitor } from './types';\nimport { useHardware } from '../registry/hooks';\nimport { MonitorPanelItem } from './MonitorPanelItem';\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\n/**\n * Drop the $ from the start of the name\n *\n * @todo: In the future this should be done earlier and\n * should raise a parsing error\n */\nfunction normalizeId(path: string | null): string | null {\n if (path === null) {\n return null;\n }\n if (!path.startsWith('$')) {\n return path;\n }\n return path.slice(1);\n}\n\nexport function useValue(valuePath: string | undefined): unknown {\n const path = valuePath !== undefined ? rsplit(valuePath, '.', 1) : [null, ''];\n const obj = useHardware(normalizeId(path[0]));\n if (!obj) {\n return undefined;\n }\n if (!obj.properties) {\n return undefined;\n }\n const propName = path[1];\n if (propName === null) {\n return undefined;\n }\n const value = obj.properties[propName];\n if (!Array.isArray(value)) {\n return value;\n }\n // FIXME: It only return the first element.\n // It would be better to allow to select the result\n return value[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(normalizeId(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 MonitorHardwareProperty(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 function checkValidity() {\n if (monitor.comparator && monitor.comparison) {\n const isValid = dynamicOp(monitor.comparator, value, monitor.comparison);\n return isValid ? 'success' : 'danger';\n }\n return 'secondary';\n }\n\n const bgVariant = checkValidity();\n\n if (!Number.isNaN(flt)) {\n if (unit !== undefined) {\n value = `${value} ${unit}`;\n }\n }\n\n const widget = (\n <MonitorPanelItem>\n <h1>{monitor.name}</h1>\n <Badge bg={bgVariant}>{`${value}`}</Badge>\n </MonitorPanelItem>\n );\n\n if (overlay) {\n const overlayStr = `${overlay}`;\n\n return (\n <OverlayTrigger\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 {widget}\n </OverlayTrigger>\n );\n }\n\n return widget;\n}\n","import type { RefObject } from 'react';\nimport {\n createRef,\n useRef,\n useEffect,\n useState,\n useMemo,\n useCallback,\n} from 'react';\nimport { SvgLoader, SvgProxy } from 'react-svgmt';\n\nimport ButtonTriggerModal from './ButtonTriggerModal';\nimport type { ButtonTriggerModalRef } from './ButtonTriggerModal';\nimport type { AnyHardware } from '../hardware/utils/types';\nimport { dynamicOp } from '../monitorpanel/MonitorHardwareProperty';\n\nfunction getText({\n value,\n unit,\n display_digits,\n}: {\n value: any;\n unit?: string;\n display_digits?: number;\n}) {\n let text = '';\n if (value !== undefined) {\n if (value === null) {\n text = 'null';\n } else if (Number.isFinite(value)) {\n text += value.toFixed(display_digits ?? 2);\n } else {\n text = `${value}`;\n }\n }\n if (unit !== null && unit !== '') {\n text = `${text} ${unit}`;\n }\n return text;\n}\n\nexport interface StateComparator {\n /** The state comparator */\n comparator: string;\n /** The state value to compare */\n comparison: string;\n /** Optionally, a color for this comparison */\n color?: string;\n}\n\nexport interface SynopticElementType {\n /** The svg element class name */\n name: string;\n /** Which property to use as the value, i.e. `s1b.position` */\n value?: string;\n /** How many digits to display */\n value_display_digits?: number;\n /** Optionally, Which property to use to display the state. If left blank, the aggregated state from each element in `ids` below will be used */\n state?: string;\n /** Optionally, a comparison, can be a single comparison for red/green or a list of comparisons with colors */\n state_comparison?: StateComparator | StateComparator[];\n /** A list of hardware object ids to display on click */\n ids?: string[];\n}\n\nexport interface SynopticType {\n /** A list of elements to be mapped to their classes in the svg */\n elements: SynopticElementType[];\n /** The synoptic file to load */\n synoptic: string;\n /** Whether to enable daiquiri `colorisation` of icons */\n color_icons: boolean;\n}\n\ninterface Props {\n fetchSVG: (image: string) => Promise<{ data: any }>;\n getHardwareGroupComponent: (ids: string[]) => JSX.Element;\n hardwareObjects: Record<string, AnyHardware>;\n synoptic: SynopticType;\n}\n\nexport default function Synoptic(props: Props) {\n const buttonRefs = useRef<Record<string, RefObject<ButtonTriggerModalRef>>>(\n {}\n );\n const [svg, setSvg] = useState<string | undefined>(undefined);\n const { synoptic, fetchSVG, getHardwareGroupComponent, hardwareObjects } =\n props;\n\n useEffect(() => {\n fetchSVG(synoptic.synoptic).then((resp) => {\n setSvg(resp.data);\n });\n }, [synoptic]);\n\n const onClick = useCallback(\n (name: string) => {\n if (name in buttonRefs.current) {\n buttonRefs.current?.[name].current?.showModal();\n }\n },\n [buttonRefs]\n );\n\n const groups = useMemo(\n () =>\n synoptic.elements.map((el) => {\n let state: boolean | undefined = false;\n let stateColor;\n const hasComponents = el.ids && el.ids?.length > 0;\n if (hasComponents) {\n state = true;\n el.ids?.forEach((id) => {\n if (id in hardwareObjects) {\n const obj = hardwareObjects[id];\n if (!obj.properties.state_ok) state = false;\n }\n });\n }\n if (el.state) {\n const path = el.state.split('.');\n const obj = hardwareObjects[path[0]];\n const obj_state = obj ? obj.properties[path[1]] : false;\n if (Array.isArray(el.state_comparison)) {\n state = undefined;\n el.state_comparison.forEach((comparison) => {\n const stateTest =\n dynamicOp(\n comparison?.comparator,\n comparison?.comparison,\n obj_state\n ) ?? false;\n if (stateTest) stateColor = comparison.color;\n });\n } else if (el.state_comparison) {\n state =\n dynamicOp(\n el.state_comparison?.comparator,\n el.state_comparison?.comparison,\n obj_state\n ) ?? false;\n } else {\n state = !!obj_state;\n }\n }\n\n let value = null;\n if (el.value) {\n const path = el.value.split('.');\n const obj = hardwareObjects[path[0]];\n if (obj) {\n value = getText({\n value: obj.properties[path[1]],\n unit: obj.properties.unit,\n display_digits: el.value_display_digits,\n });\n }\n }\n\n const cls = el.name.toLowerCase();\n return [\n <SvgProxy\n key={`${cls}state`}\n selector={`.${cls} .status`}\n class={`$ORIGINAL ${\n state !== undefined ? (state ? 'ok' : 'error') : ''\n }`}\n style={stateColor ? `fill: ${stateColor};` : ''}\n />,\n <SvgProxy key={`${cls}value`} selector={`.${cls} .value`}>\n {value}\n </SvgProxy>,\n <SvgProxy\n key={`${cls}handler`}\n selector={`.${cls} > rect`}\n onClick={() => onClick(cls)}\n />,\n <SvgProxy\n key={`${cls}comp`}\n class={`$ORIGINAL ${hasComponents ? 'active' : ''}`}\n selector={`.${cls}`}\n />,\n ];\n }),\n [synoptic, hardwareObjects]\n );\n\n const popups = useMemo(\n () =>\n synoptic.elements\n .filter((el) => el.ids && el.ids?.length > 0)\n .map((el) => {\n const cls = el.name.toLowerCase();\n const buttonRef = createRef<ButtonTriggerModalRef>();\n buttonRefs.current[cls] = buttonRef;\n\n return (\n <ButtonTriggerModal\n key={`${cls}pop`}\n ref={buttonRef}\n title={el.name}\n showButton={false}\n button={\n <>\n <i className=\"fa fa-plus\" />\n show\n </>\n }\n >\n {getHardwareGroupComponent(el.ids ?? [])}\n </ButtonTriggerModal>\n );\n }),\n [synoptic]\n );\n\n return (\n <div>\n <SvgLoader\n width=\"100%\"\n svgXML={svg}\n className={`synoptic ${synoptic.color_icons ? 'synoptic-color' : ''}`}\n >\n {groups}\n </SvgLoader>\n {popups}\n </div>\n );\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 { useMemo } from 'react';\nimport { Alert } from 'react-bootstrap';\nimport Panel from '../layout/Panel';\nimport ErrorBoundary from './ErrorBoundary';\nimport { renderYamlNode, normalizeLayout } from './utils';\nimport type { YamlRoot } from './model';\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 { map } from 'lodash';\nimport type { ComponentType } from 'react';\nimport classNames from 'classnames';\nimport { Row, Col, Container } from 'react-bootstrap';\nimport { MonitorHardwareProperty } from './MonitorHardwareProperty';\nimport { MonitorHardware } from './MonitorHardware';\nimport type { Monitor } from './types';\n\ninterface MonitorMapping {\n [name: string]: ComponentType<any>;\n}\n\nexport const monitorMap: MonitorMapping = {\n hardwareproperty: MonitorHardwareProperty,\n hardware: MonitorHardware,\n};\n\nexport function registerMonitorComponent(\n name: string,\n component: React.ComponentType<any>\n) {\n monitorMap[name] = component;\n}\n\nexport function 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 ?? 'hardwareproperty';\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","import type { Monitor } from './types';\nimport { useHardware, useHardwareChangeActions } from '../registry/hooks';\nimport { YmlError } from './MonitorPanel';\nimport { getHardwareVariantComponent } from '../hardware/registry';\nimport { AnyHardwareState } from '../hardware/base/BaseState';\nimport { State } from '../hardware/utils/State';\n\n/**\n * Drop the $ from the start of the name\n *\n * @todo: In the future this should be done earlier and\n * should raise a parsing error\n */\nfunction normalizeId(id: unknown): string | null {\n if (id === undefined) {\n return null;\n }\n if (id === null) {\n return null;\n }\n if (typeof id !== 'string') {\n return null;\n }\n if (!id.startsWith('$')) {\n return id;\n }\n return id.slice(1);\n}\n\n/**\n * HardwareMonitor which provide callback to get the\n * component from the hardware type.\n */\nexport function MonitorHardware(props: { monitor: Monitor }) {\n const { monitor } = props;\n const { id } = monitor;\n\n const nid = normalizeId(id);\n const obj = useHardware(nid);\n const actions = useHardwareChangeActions(nid);\n\n if (id === undefined) {\n return <YmlError monitor={monitor} message=\"'id' is missing\" />;\n }\n\n if (typeof id !== 'string') {\n return <YmlError monitor={monitor} message=\"'id' is invalid\" />;\n }\n\n if (obj === null) {\n return (\n <State\n state=\"NONE\"\n variant=\"danger\"\n description={`hardware '${id}' was not found`}\n />\n );\n }\n\n const { type = 'none' } = obj;\n\n const hardware = {\n ...obj,\n actions,\n };\n\n const Comp = getHardwareVariantComponent(type, 'monitor');\n if (!Comp) {\n return <AnyHardwareState hardware={hardware} />;\n }\n\n return (\n <Comp\n hardware={hardware}\n options={{ name: monitor.name }}\n operator={false}\n disabled={false}\n />\n );\n}\n"],"names":["AnyHardwareState","props","hardware","online","locked","state","_a","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","ReadOnlyTextInput","value","style","className","defaultClasses","DeviceState","Property","widgetIcon","widgetState","getUnit","unitName","unit","widgetContent","InputGroup","MonitorPanelItem","forwardRef","children","rest","ref","Col","BaseMonitor","Variants","BaseState","BaseName","BaseInfo","BaseProperty","BaseVariants","Mocks","defaultjson","State","MultiState","states","variants","descriptions","minWidth","mainState","renderTooltip","Tooltip","s","i","desc","Row","AirBearingState","RawAirBearing","disabled","isOn","isOff","ButtonGroup","AirBearing","getWidgetContent","ActionButton","DropdownAirBearing","requestOn","requestOff","hardwareDisabled","movingOn","movingOff","Dropdown","Container","AirBearingProtected","AirBearingVariants","delay","ms","resolve","Simulator","alias","type","setProperty","call","properties","useHardwareContext","ctx","actions","useMemo","_b","previousHardware","useRef","useEffect","isEqual","AirBearingSimulator","setState","useState","BeamviewerOverlay","current","setCurrent","errorMsg","setErrorMsg","read","promise","resp","onChangeRange","e","map","r","Beamviewer","toggle","prop","p","BeamviewerVariants","diodeRanges","BeamviewerSimulator","led","setLed","screen","setScreen","foil","setFoil","diodeRange","setDiodeRange","EnergyManagerState","energy","energyState","DropdownSources","source","sourceNames","selectedSource","selectSource","sourceName","createSelectableItem","EnergyManagerDefault","formatEnergy","EnergyManagerMonitor","text","bgVariant","EnergyManagerVariants","ENERGIES","EnergyManagerSimulator","setSource","shortName","key","formatEng","scalar","powerPrefix","q","subtrhnd","pow10","prefix","ucfirst","str","toHoursMins","seconds","min","mins","hours","toEnergy","wavelength","round","digits","FrontendOverlay","reset","itlks","ring","getPropertyState","Frontend","onClick","getValidityStyle","FrontendMonitor","status","checkClass","widget","overlayStr","FrontendVariants","GaugeOverlay","Gauge","GaugeVariants","defaultjson2","NumericStep","stepSizeRef","focusTimeoutRef","currentStep","setCurrentStep","retakeFocus","setRetakeFocus","onStep","up","ref2","val","multiplier","stepSize","onStepProp","step","overlay","incIcon","decIcon","swapIncDec","onKeyDown","onBlur","horizontalArrows","largeArrows","stepOnly","onKeyDown2","onBlur2","steps","hasIncDec","classNames","NumericStep$1","HardwareNumericStep","valueRef","edited","setEdited","setError","updateRef","newValue","onChange","Laser","requestPowerChange","requestStateChange","LaserHeatingVariants","LaserHeatingOverlay","LaserHeating","pending","setPending","requestExposureChange","requestMeasure","LaserVariants","Light","sliderRef","requestIntensityChange","debounceIntensityChange","useCallback","_debounce","LightVariants","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","binning","setBinning","supportedBinningMode","limaBinningModeSupported","readOnly","bh","bv","b","LimaBinning","LimaRoiImageControl","LimaMaxSizeControl","struct","LimaLimaVersionControl","LimaModelControl","LimaRoiShapeWidget","imageMaxDim","roi","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","useHardwareSchema","useOperator","useScanRunning","isLimaHardware","entity","useLimaHardware","limaGuessSubframes","exposureTime","accMaxExpoTime","nbSubFrames","accExpoTime","LimaSize","LimaImageRoi","LimaDescription","LimaShape","LimaVariants","semver","flipjson","rotjson","roicenter","squaredetector","LimaSimulator","cameraPixelSize","setProperties","changeBinning","pixelSize","size","changeBinningMode","changeRotation","changeFlipX","flip","changeFlipY","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","WidgetContent","Alert","enabled","setSelection","added","removed","counter","selection","promises","Typeahead","shouldSelect","MeasurementGroup","setActive","MeasurementGroupVariants","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","sassVariables","Origin","InfiniteKnob360","max","origin","direction","angle","onInteractiveChange","editedValue","setEditedValue","onKnobEnd","onKnobInteractiveChange","tickSize","tickMargin","pointerMargin","outerTickRadius","outerKnobRadius","pointerSize","pointerPosRadius","editable","shadowWidth","localTarget","interactiveHook","getUnreachableRange","range","unrachableRange","angleRange","angleOffset","Knob","Range","Scale","Label","Pointer","Value","MotorRotation","moveHardware","useDebouncedCallback","isClockWise","isMotorClockWise","limits","motorLimits","getStyle","MotorMonitor","position","display_digits","getText","userTags","autoReady","autoOn","newState","reduced","isMotorHardware","useMotorHardware","inverted","anticlockwiseTag","clockwiseTag","MotorVariants","motor","halfMotor","unknownMotor","notReadyMotor","disconnectedMotor","powerOffMotor","createMotorMock","MotorSimulator","minLimit","maxLimit","initialPosition","initialVelocity","setPosition","setTarget","internalTimeRef","updatePosition","now","deltaTime","newPosition","newTarget","deltaPosition","pos","timer","rawHardware","MultipositionState","Multiposition","selectionRef","onMove","stop","opts","DropdownButton2","bsPrefix","rootCloseEvent","menuRole","renderMenuOnMount","href","menuVariant","popperConfig","DropdownToggle","DropdownMenu","DropdownButton2$1","PositionItem","currentPositionId","onSelect","filter","positionId","f","getPosition","positions","Header","targetPositionId","getBadge","badge","description","hardwareIsMoving","moveTo","normalizePositionId","setFilter","CloseButton","positionDesc","MultipositionDefault","MultipositionDefault2","MultipositionVariants","MultipositionSimulator","OpticState","MultiPositionMagnification","hardwareMoving","magnification","magnifications","a","moveHardwareMagnification","index","itemMagnification","m","FixedMagnification","allowtuning","InputMagnification","rangeMin","rangeMax","formRef","rangeRef","setHardwareMagnification","event","valueAsFloat","updateEdit","onInputChange","onRangeChange","onRangeAccepted","RangeMagnification","OffMagnification","Optic","getOpticClass","Class","isOpticHardware","OpticVariants","fixedjson","offjson","rangejson","OpticSimulator","kind","getInitial","move","speed","setMagnification","ProcedureState","Actions","waitingUserInput","aborting","isRunning","doStart","doAbort","ProcedureManage","awaitingUserInput","FinishedState","runState","runException","definition","ProcedureExecution","doValidate","ProcedureValidate","ProcedureVariants","isProcedureHardware","useProcedureHardware","standby","tooltip","BSTooltip","RegulationLoop","showOutput","requestFunctionChange","fn_name","requestSetpointChange","RegulationLoopMonitor","MultiCurveTooltipMesh","curves","abscissas","xToIndexScale","useValueToIndexScale","abscissaConfig","useVisCanvasContext","TooltipMesh","xi","COLORS","DEFAULT_DOMAIN","POINT_SIZE","CurvePlot","data","xAxisTitle","yAxisTitle","series","getAxisValues","xDomain","useCombinedDomain","useDomains","yDomain","VisCanvas","DataCurve","GlyphType","Zoom","Pan","BUFFER_LENGTH","useRollingBuffer","capacity","buffer","setBuffer","currentIndex","write","item","prevBuffer","newBuffer","RegulationPlot","plotHeight","plotWidth","timeBuffer","inputBuffer","outputBuffer","setPointBuffer","outputData","deadBandPlus","deadBandMinus","PopupRegulationPlot","popupPlacement","RegulationVariants","RegulationSimulator","inputValue","setInputValue","outputValue","setOutputValue","setPoint","setSetPoint","updatePID","newInput","newOutput","noise","ShutterState","getState","getVariant","ShutterOverlay","ShutterDefault","getAction","action","DropdownShutter","requestOpen","requestClose","ShutterProtected","capitalize","valueName","ShutterMonitor","ShutterVariants","closed","ShutterSimulator","useResolvedSlit","vgapId","vgap","hgapId","hgap","voffsetId","_c","voffset","hoffsetId","_d","hoffset","SlitState","info","vgapActions","hgapActions","voffsetActions","hoffsetActions","merge","DropdownSlit","operator","resolved","Widget","normalizePosition","gap","gapUnit","gapMoving","offset","offsetUnit","offsetMoving","_e","_f","_g","_h","SlitDefault","Variants$f","slit","horizontal","vertical","PumpOverlay","attrs","Pump","PumpVariants","PusherState","leftIcon","rightIcon","iconLocation","onAction","onActionChange","inAction","setInAction","iconAtRight","iconAtLeft","PusherBlock","leftToRight","ButtonPush","distance","RawPusher","isRetracted","isInTouch","isLost","moving","setMoving","getLocation","location","Pusher","PusherVariants","PusherSimulator","ServiceState","ServiceDefault","requestStart","requestRestart","requestStop","getStartAction","restartEnabled","getStopAction","stopEnabled","startAction","stopAction","DropdownService","ServiceProtected","ServiceVariants","TomoFlatMotionState","AxisName","motion","axisId","axis","DropAxis","axisRef","requestDropAxis","AxisOnOff","isUsed","requestAppendAxis","InputAxisMotion","exp","MotionKind","requestAbsoluteMotion","requestRelativeMotion","TomoFlatMotionDefault","isTomoFlatMotionEditable","imotion","getKind","kindVariant","kindTitle","TomoFlatMotionSmall","isIn","isOut","face","TomoFlatMotionSampleLocation","TomoFlatMotionVariants","isTomoFlatMotionHardware","useTomoFlatMotionHardware","sy","sy2","TomoFlatMotionSimulator","updateAxes","inList","TomoReferencePositionDefault","processing","setProcessing","onClickToReference","isTomoReferencePositionHardware","TomoReferencePositionVariants","TomoDetectorState","SelectPixelSizeMode","requestMode","mode","InputUserPixelSize","userSamplePixelSize","requestUserSamplePixelSize","DropdownPixelSize","useFormattedQuantity","displayUnit","normUnit","u","normValue","v","Qty","TomoDetectorSamplePixelSize","formattedValue","convert","from","to","formatedUnit","getHardwareIdFromRef","TomoDetectorFieldOfView","samplePixelSize","detector","hardwareDet","propertiesDet","AcquisitionMode","InputAccMaxExpoTime","requestUpdate","lima","DropdownAcquisitionMode","limaId","limaActions","TomoDetectorAcquisitionMode","TomoDetectorVariants","isTomoDetectorHardware","useTomoDetectorHardware","TomoDetectorsState","DropdownDetectors","detectors","activeDetectorId","targetDetectorId","mountDetector","detectorId","detectorRef","TomoDetectors","hardwareMounting","TomoDetectorsVariants","isTomoDetectorsHardware","useTomoDetectorsHardware","TomoImagingState","UpdateMode","updateOnMove","setUpdateModeOff","setUpdateModeAuto","ExposureTime","TakeActions","takeProj","takeDark","takeFlat","TomoImagingDefault","QuantityInputNumberOrNull","decimals","allowNullAsEmpty","editing","convertFromDisplay","convertToDisplay","inputToDisplay","acceptEdition","abortEdition","displayedValue","QuantityInputNumber","onAccepted","otherProps","AccumulationIfOne","hardwareTomo","acqMode","TomoImagingExposureTime","SettleTime","settleTime","TomoImagingSettleTime","ProcessingButton","onStarted","onTerminated","useActiveLimaDetector","restoreSample","limaOffline","TomoImagingActions","TomoImagingUpdateMode","TomoImagingVariants","TomoImagingSimulator","Variants$5","isTomoSampleStageHardware","useTomoSampleStageHardware","LatencyTime","valueFromHardware","TomoConfigLatencyTime","TomoConfigVariants","isTomoConfigHardware","useTomoConfigHardware","TomoHoloState","Variants$2","isTomoHoloHardware","useTomoHoloHardware","ValveOverlay","Valve","ValveVariants","logger","debug","NoObject","LoadingObject","MissingObject","ErrorObject","MissingComponentObject","FullSizer","containerRef","view","lowWarning","hiWarning","lowDanger","hiDanger","toPercent","geometry","lowPercentDanger","hiPercentDanger","lowPercentWarning","hiPercentWarning","valueClassName","powerRadius","width0","width100","getWidth","Power","PanelHeader","PanelContents","Panel","Wrap","Yaml","YamlLabel","providers","yamlNode","unknownOptions","assertString","assertNoUnknownKeys","YamlRow","panel","renderYamlNode","YamlCol","xs","assertOptionalNumber","YamlContainer","YamlPanel","contentsStyle","hash","YamlTabs","tabs","each","t","Tab","Tabs","remainingContent","assertOnRemainingKeys","RowTitle","row","getId","idContent","titlealign","stateinheader","newContent","stateContent","YamlForm","content","React","YamlGrid","columnSpan","rowSpan","gridColumn","gridRow","yamlContainers","registerYamlContainer","component","yamlComponents","YamlTodo","YamlNone","registerYamlComponent","registerYamlComponents","YamlComponent","scroll","Comp","Suspense","_parentNode","_indexFromParent","remainingContent2","UnknownKeysError","LayoutError","__publicField","unknownKeys","MissingKeysError","missingKeys","KeyError","getYamlRoot","getYamlHierarchy","path","normalizeLayout","parentNode","indexFromParent","newNode","assertKeyExpected","assertBoolean","assertNumber","assertOptionalBoolean","assertOptionalString","assertStringList","assertOptionalStringOrStringList","assertOptionalStringList","assertOptionalNumberList","assertOptionalListOfType","isType","typeName","assertDataCollectionId","assertOptionalBackend","assertOptionalArgs","assertOptionalKwargs","assertStringMappingRecord","optional","schema","unexpectedKeys","k","valueMap","assertFunc","hardwareMap","initialVariants","l","registerHardwareVariant","getHardwareVariantComponent","baseVariants","HardwareState","emptyifnone","args","ModalDialog","buttons","cancelText","footer","showClose","show","otherButtons","bodyClassName","fullscreen","onShow","onHide","Modal","ConditionalWrap","ButtonTriggerModal","showModal","setShowModal","showButton","targetRef","close","onCloseModal","useImperativeHandle","ModalClass","ButtonTriggerModal$1","dynamicOp","op","a1","b1","operators","rsplit","separator","split","normalizeId","useValue","valuePath","obj","propName","useUnit","unitPath","isFixedUnit","MonitorHardwareProperty","monitor","flt","checkValidity","Synoptic","buttonRefs","svg","setSvg","synoptic","fetchSVG","getHardwareGroupComponent","hardwareObjects","groups","el","stateColor","hasComponents","obj_state","comparison","cls","SvgProxy","popups","buttonRef","createRef","SvgLoader","DefaultErrorMessage","LayoutErrorMessage","formatPreview","indent","lines","actualIndentation","layoutName","INITIAL_STATE","ErrorBoundary","Component","prevProps","prevState","UnhandledErrorComponent","hasError","Main","layout","monitorMap","MonitorHardware","registerMonitorComponent","YmlError","MonitorPanel","nid"],"mappings":"y4BAKO,SAASA,GAAiBC,EAAkC,OAC3D,KAAA,CAAE,SAAAC,CAAa,EAAAD,EACf,CAA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