Skip to content

Attempt to create a more generalized version of the PopInput

Created by: marcus-oscarsson

Hi

So Ive made an attempt to generalize the PopInput so that you hopefully can use it for the motor controls. I'm open to suggestions and we can change the way it works if there something you don't like or find cumbersome. Don't hesitate to let me know :).

The way it works right now: The PopInput can have two children that are used as input and busy controls. The PopInput itself is responsible for showing and hiding these depending on the state of the action performed. There is an example for the Energy input in BeamlineSetupContainer.jsx

<PopInput
  ref="energy" name="Energy" pkey="energy" suffix="keV"
  data={this.props.data.energy} onSave={this.onSaveHandler}
  onCancel={this.onCancelHandler}
>
  <DefaultInput
    key="input" dataType={this.props.dataType} inputSize={this.props.inputSize}
  />
  <DefaultBusy key="busy" />
</PopInput>

The data object given to the pop input should look like:

data: { value:'' , state:'' , msg: ''}

where state, for the moment, is one of: IDLE, BUSY and ABORTED.

I know that some people advise against passing objects in properties, I did it like that for the moment to avoid creating a lot of properties. The risk is of course that we by mistake mutate this object, but I don't believe its a problem.

Please let me know what you think, thanks !

Marcus

Merge request reports