Skip to content

Commit e191160

Browse files
Fix for PR #1297 – Prevents a crash when clicking the table inside a task item in the queue (DataCollection view)
1 parent 59fb1b2 commit e191160

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

ui/src/components/Tasks/Characterisation.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ class Characterisation extends React.Component {
173173
<InputField propName="kappa_phi" type="number" label="Phi" />
174174
</FieldsRow>
175175
<FieldsRow>
176-
{this.props.initialValues.detector_mode_list.length > 0 && (
176+
{this.props.detector_mode_list.length > 0 && (
177177
<SelectField
178178
propName="detector_roi_mode"
179179
label="Detector mode"
180-
list={this.props.initialValues.detector_mode_list}
180+
list={this.props.detector_mode_list}
181181
/>
182182
)}
183183
<InputField propName="overlap" label="Overlap" />
@@ -496,7 +496,8 @@ export default connect((state) => {
496496
}
497497

498498
const { type } = state.taskForm.taskData;
499-
const { limits } = state.taskForm.defaultParameters[type.toLowerCase()];
499+
const { limits, acq_parameters } =
500+
state.taskForm.defaultParameters[type.toLowerCase()];
500501
const { parameters } = state.taskForm.taskData;
501502

502503
// Set number of images to 1 for 2D points
@@ -523,6 +524,7 @@ export default connect((state) => {
523524
opt_sad: selector(state, 'opt_sad'),
524525
use_min_dose: selector(state, 'use_min_dose'),
525526
use_min_time: selector(state, 'use_min_time'),
527+
detector_mode_list: acq_parameters.detector_mode_list,
526528
components: state.uiproperties.sample_view_motors.components,
527529
initialValues: {
528530
...parameters,

ui/src/components/Tasks/DataCollection.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,12 @@ class DataCollection extends React.Component {
283283
<InputField propName="kappa" type="number" label="Kappa" />
284284
<InputField propName="kappa_phi" type="number" label="Phi" />
285285
</FieldsRow>
286-
{this.props.initialValues.detector_mode_list.length > 0 && (
286+
{this.props.detector_mode_list.length > 0 && (
287287
<FieldsRow>
288288
<SelectField
289289
propName="detector_roi_mode"
290290
label="Detector mode"
291-
list={this.props.initialValues.detector_mode_list}
291+
list={this.props.detector_mode_list}
292292
/>
293293
</FieldsRow>
294294
)}
@@ -375,7 +375,8 @@ export default connect((state) => {
375375
}
376376

377377
const { type } = state.taskForm.taskData;
378-
const { limits } = state.taskForm.defaultParameters[type.toLowerCase()];
378+
const { limits, acq_parameters } =
379+
state.taskForm.defaultParameters[type.toLowerCase()];
379380
const { parameters } = state.taskForm.taskData;
380381

381382
if (Number.parseFloat(parameters.osc_range) === 0) {
@@ -390,6 +391,7 @@ export default connect((state) => {
390391
filename: fname,
391392
acqParametersLimits: limits,
392393
beamline: state.beamline,
394+
detector_mode_list: acq_parameters.detector_mode_list,
393395
components: state.uiproperties.sample_view_motors.components,
394396
initialValues: {
395397
...parameters,

ui/src/components/Tasks/Helical.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ class Helical extends React.Component {
174174
label="Beam size"
175175
list={this.props.apertureList}
176176
/>
177-
{this.props.initialValues.detector_mode_list.length > 0 && (
177+
{this.props.detector_mode_list.length > 0 && (
178178
<SelectField
179179
propName="detector_roi_mode"
180180
label="Detector mode"
181-
list={this.props.initialValues.detector_mode_list}
181+
list={this.props.detector_mode_list}
182182
/>
183183
)}
184184
</FieldsRow>
@@ -295,13 +295,15 @@ export default connect((state) => {
295295
}
296296

297297
const { type } = state.taskForm.taskData;
298-
const { limits } = state.taskForm.defaultParameters[type.toLowerCase()];
298+
const { limits, acq_parameters } =
299+
state.taskForm.defaultParameters[type.toLowerCase()];
299300

300301
return {
301302
path: `${state.login.rootPath}/${subdir}`,
302303
filename: fname,
303304
acqParametersLimits: limits,
304305
beamline: state.beamline,
306+
detector_mode_list: acq_parameters.detector_mode_list,
305307
components: state.uiproperties.sample_view_motors.components,
306308
initialValues: {
307309
...state.taskForm.taskData.parameters,

ui/src/components/Tasks/Mesh.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ class Mesh extends React.Component {
184184
label="Beam size"
185185
list={this.props.apertureList}
186186
/>
187-
{this.props.initialValues.detector_mode_list.length > 0 && (
187+
{this.props.detector_mode_list.length > 0 && (
188188
<SelectField
189189
propName="detector_roi_mode"
190190
label="Detector mode"
191-
list={this.props.initialValues.detector_mode_list}
191+
list={this.props.detector_mode_list}
192192
/>
193193
)}
194194
</FieldsRow>
@@ -308,13 +308,15 @@ export default connect((state) => {
308308
}
309309

310310
const { type } = state.taskForm.taskData;
311-
const { limits } = state.taskForm.defaultParameters[type.toLowerCase()];
311+
const { limits, acq_parameters } =
312+
state.taskForm.defaultParameters[type.toLowerCase()];
312313

313314
return {
314315
path: `${state.login.rootPath}/${subdir}`,
315316
filename: fname,
316317
acqParametersLimits: limits,
317318
beamline: state.beamline,
319+
detector_mode_list: acq_parameters.detector_mode_list,
318320
components: state.uiproperties.sample_view_motors.components,
319321
initialValues: {
320322
...state.taskForm.taskData.parameters,

0 commit comments

Comments
 (0)