From 7863f54f543828c4a610bfe2b4f1d8356361f6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Piaggio?= Date: Wed, 30 Oct 2024 09:05:11 -0300 Subject: [PATCH] address PR comment --- .../explore/config/AdvancedConfigurationPanel.scala | 8 ++++---- .../main/scala/explore/config/ConfigurationPanel.scala | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/explore/src/main/scala/explore/config/AdvancedConfigurationPanel.scala b/explore/src/main/scala/explore/config/AdvancedConfigurationPanel.scala index a553177d3..51377ff0d 100644 --- a/explore/src/main/scala/explore/config/AdvancedConfigurationPanel.scala +++ b/explore/src/main/scala/explore/config/AdvancedConfigurationPanel.scala @@ -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 @@ -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( @@ -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, @@ -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, diff --git a/explore/src/main/scala/explore/config/ConfigurationPanel.scala b/explore/src/main/scala/explore/config/ConfigurationPanel.scala index abbf23dbc..648267937 100644 --- a/explore/src/main/scala/explore/config/ConfigurationPanel.scala +++ b/explore/src/main/scala/explore/config/ConfigurationPanel.scala @@ -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 @@ -244,7 +243,7 @@ object ConfigurationPanel: props.obsConf.calibrationRole, northAligner, specView, - deleteConfiguration, + revertConfiguration, props.modes, props.sequenceChanged, props.readonly, @@ -260,7 +259,7 @@ object ConfigurationPanel: props.obsConf.calibrationRole, southAligner, specView, - deleteConfiguration, + revertConfiguration, props.modes, props.sequenceChanged, props.readonly,