Skip to content

Commit

Permalink
Fix beamstop and capillary not shown
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc committed Oct 14, 2024
1 parent 03064ad commit f96fe26
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion demo/beamstop.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<object class="ExporterNStateMockup">
<username>beamstop</username>
<values>{"OUT": "OFF", "IN": "BEAM"}</values>
<values>{"IN": "BEAM", "OUT": "OFF"}</values>
<use_hwstate>True</use_hwstate>
</object>
4 changes: 2 additions & 2 deletions demo/mxcube-web/ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ beamline_setup:
id: beamline_setup
components:
- label: Beamstop
attribute: beamstop
attribute: diffractometer.beamstop
- label: Capillary
attribute: capillary
attribute: diffractometer.capillary
- label: Fast Shutter
attribute: fast_shutter
- label: Safety shutter
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/MotorInput/BaseMotorInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function BaseMotorInput(props) {
state === HW_STATE.OFF;

return (
<form noValidate onSubmit={handleSubmit}>
<form className="d-flex" noValidate onSubmit={handleSubmit}>
<Form.Control
className={className}
style={style}
Expand All @@ -72,7 +72,7 @@ function BaseMotorInput(props) {
max={max}
min={min}
disabled={disabled || !isReady}
data-testId={testId}
data-testid={testId}
data-dirty={isEdited || undefined}
data-busy={isBusy || undefined}
data-warning={isWarning || undefined}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/MotorInput/OneAxisTranslationControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function OneAxisTranslationControl(props) {
className={`${styles.input} rw-input`}
style={{
width: `${Number.parseFloat(precision) + 2}em`,
height: '2.1em',
height: 'auto',
display: 'inline-block',
marginLeft: '5px',
marginRight: '5px',
Expand Down
20 changes: 8 additions & 12 deletions ui/src/containers/BeamlineSetupContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,21 @@ function BeamlineSetupContainer(props) {
sendCommand,
} = props;

function handleSetAttribute(name, value) {
setAttribute(name, value);
}

function renderBeamstopAlignmentOverlay() {
const { hardwareObjects } = beamline;
const motorInputList = [];
let popover = null;

const motor = hardwareObjects.beamstop_alignemnt_x;
const motor = hardwareObjects['diffractometer.beamstop_distance'];
const step = sampleview.motorSteps.beamstop_distance;

if (motor !== undefined && motor.state !== 0) {
if (motor) {
motorInputList.push(
<div key={`bsao-${motor.name}`} style={{ padding: '0.5em' }}>
<p className="motor-name"> Beamstop distance: </p>
<div key={`bsao-${motor.name} d-flex`} style={{ padding: '0.5em' }}>
<p className="motor-name mb-1"> Beamstop distance:</p>
<OneAxisTranslationControl
save={sampleViewActions.updateMotorPosition}
value={motor.position}
value={motor.value}
min={motor.limits[0]}
max={motor.limits[1]}
step={step}
Expand Down Expand Up @@ -92,7 +88,7 @@ function BeamlineSetupContainer(props) {
labelText={uiprop.label}
pkey={key}
value={beamline.hardwareObjects[key].value}
onSave={handleSetAttribute}
onSave={setAttribute}
optionsOverlay={renderBeamstopAlignmentOverlay()}
/>
</Nav.Item>,
Expand All @@ -108,7 +104,7 @@ function BeamlineSetupContainer(props) {
labelText={uiprop.label}
pkey={key}
value={beamline.hardwareObjects[key].value}
onSave={handleSetAttribute}
onSave={setAttribute}
/>
</Nav.Item>,
);
Expand Down Expand Up @@ -164,7 +160,7 @@ function BeamlineSetupContainer(props) {
format={uiprop.format}
precision={uiprop.precision}
suffix={uiprop.suffix}
onSave={(value) => handleSetAttribute(uiprop.attribute, value)}
onSave={(value) => setAttribute(uiprop.attribute, value)}
onCancel={() => stopBeamlineAction(uiprop.attribute)}
/>
</td>,
Expand Down

0 comments on commit f96fe26

Please sign in to comment.