Skip to content

Commit

Permalink
address PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiaggio committed Oct 30, 2024
1 parent 05985ad commit 7863f54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ sealed trait AdvancedConfigurationPanel[T <: ObservingMode, Input]:
def calibrationRole: Option[CalibrationRole]
def observingMode: Aligner[T, Input]
def spectroscopyRequirements: View[ScienceRequirements.Spectroscopy]
def deleteConfig: Callback
def revertConfig: Callback
def confMatrix: SpectroscopyModesMatrix
def sequenceChanged: Callback
def readonly: Boolean
Expand Down Expand Up @@ -723,7 +723,7 @@ sealed abstract class AdvancedConfigurationPanelBuilder[
label = "Revert Configuration",
icon = Icons.ListIcon,
severity = Button.Severity.Secondary,
onClick = props.deleteConfig
onClick = props.revertConfig
).compact.small
.unless(isCustomized(props.observingMode)),
Button(
Expand Down Expand Up @@ -786,7 +786,7 @@ object AdvancedConfigurationPanel {
calibrationRole: Option[CalibrationRole],
observingMode: Aligner[ObservingMode.GmosNorthLongSlit, GmosNorthLongSlitInput],
spectroscopyRequirements: View[ScienceRequirements.Spectroscopy],
deleteConfig: Callback,
revertConfig: Callback,
confMatrix: SpectroscopyModesMatrix,
sequenceChanged: Callback,
readonly: Boolean,
Expand Down Expand Up @@ -988,7 +988,7 @@ object AdvancedConfigurationPanel {
calibrationRole: Option[CalibrationRole],
observingMode: Aligner[ObservingMode.GmosSouthLongSlit, GmosSouthLongSlitInput],
spectroscopyRequirements: View[ScienceRequirements.Spectroscopy],
deleteConfig: Callback,
revertConfig: Callback,
confMatrix: SpectroscopyModesMatrix,
sequenceChanged: Callback,
readonly: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,15 @@ object ConfigurationPanel:
val optModeView: View[Option[ObservingMode]] =
modeAligner.view(_.map(_.toInput).orUnassign)

val deleteConfiguration: Callback =
val revertConfiguration: Callback =
optModeView.set(none) >>
props.revertedInstrumentConfig
.map: row => // Select the reverted config
props.selectedConfig.mod(c =>
props.selectedConfig.mod: c =>
InstrumentConfigAndItcResult(
row,
c.flatMap(_.itcResult.flatMap(_.toOption.map(_.asRight)))
).some
)
.orEmpty

val optModeAligner = modeAligner.toOption
Expand Down Expand Up @@ -244,7 +243,7 @@ object ConfigurationPanel:
props.obsConf.calibrationRole,
northAligner,
specView,
deleteConfiguration,
revertConfiguration,
props.modes,
props.sequenceChanged,
props.readonly,
Expand All @@ -260,7 +259,7 @@ object ConfigurationPanel:
props.obsConf.calibrationRole,
southAligner,
specView,
deleteConfiguration,
revertConfiguration,
props.modes,
props.sequenceChanged,
props.readonly,
Expand Down

0 comments on commit 7863f54

Please sign in to comment.