From a9196447bc7f014a2fa35dcda7f8ebfe17782061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Piaggio?= Date: Mon, 23 Dec 2024 14:45:14 -0300 Subject: [PATCH] show execution status tags in completed steps --- .../lucuma-css/lucuma-ui-sequence.scss | 12 +++++++++++- .../scala/lucuma/ui/sequence/SequenceRow.scala | 10 +++++++++- .../lucuma/ui/sequence/SequenceRowBuilder.scala | 3 +++ .../lucuma/ui/sequence/SequenceStyles.scala | 1 + .../main/scala/lucuma/ui/sequence/package.scala | 17 +++++++++++++++++ 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/modules/ui/src/main/resources/lucuma-css/lucuma-ui-sequence.scss b/modules/ui/src/main/resources/lucuma-css/lucuma-ui-sequence.scss index 8d8b032ba..1c8908f5d 100644 --- a/modules/ui/src/main/resources/lucuma-css/lucuma-ui-sequence.scss +++ b/modules/ui/src/main/resources/lucuma-css/lucuma-ui-sequence.scss @@ -116,10 +116,20 @@ table tr { width: 100%; display: flex; justify-content: space-between; + align-items: center; padding-left: 5%; .lucuma-sequence-visit-extraRow-datetime { - width: 20%; + width: 10%; + } + + .lucuma-sequence-visit-extraRow-status { + width: 10%; + + .p-tag { + padding-top: 0; + padding-bottom: 0; + } } .lucuma-sequence-visit-extraRow-datasets { diff --git a/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceRow.scala b/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceRow.scala index 8c2462108..17a6c79ee 100644 --- a/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceRow.scala +++ b/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceRow.scala @@ -180,7 +180,15 @@ object SequenceRow: val instrumentConfig = stepRecord.instrumentConfig.some val stepConfig = stepRecord.stepConfig.some val telescopeConfig = stepRecord.telescopeConfig.some - export stepRecord.{created, datasets, id => stepId, interval, qaState} + export stepRecord.{ + created, + datasets, + executionState, + generatedId, + id => stepId, + interval, + qaState + } object ExecutedStep: given [D]: Eq[ExecutedStep[D]] = Eq.by(_.id) diff --git a/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceRowBuilder.scala b/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceRowBuilder.scala index ca46e75a6..b666b4eb2 100644 --- a/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceRowBuilder.scala +++ b/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceRowBuilder.scala @@ -111,6 +111,9 @@ trait SequenceRowBuilder[D]: .map(_.start.toInstant) .fold("---")(start => UtcFormatter.format(start)) ), + <.span(SequenceStyles.VisitStepExtraStatus)( + step.executionState.renderVdom + ), <.span(SequenceStyles.VisitStepExtraDatasets)( step.datasets .map: dataset => diff --git a/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceStyles.scala b/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceStyles.scala index a772cacd3..6365fb794 100644 --- a/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceStyles.scala +++ b/modules/ui/src/main/scala/lucuma/ui/sequence/SequenceStyles.scala @@ -20,6 +20,7 @@ object SequenceStyles: val VisitHeader = Css("lucuma-sequence-visit-header") val VisitStepExtra = Css("lucuma-sequence-visit-extraRow") val VisitStepExtraDatetime = Css("lucuma-sequence-visit-extraRow-datetime") + val VisitStepExtraStatus = Css("lucuma-sequence-visit-extraRow-status") val VisitStepExtraDatasets = Css("lucuma-sequence-visit-extraRow-datasets") val VisitStepExtraDatasetItem = Css("lucuma-sequence-visit-extraRow-dataset-item") val VisitStepExtraDatasetQAStatus = Css("lucuma-sequence-visit-extraRow-dataset-qaStatus") diff --git a/modules/ui/src/main/scala/lucuma/ui/sequence/package.scala b/modules/ui/src/main/scala/lucuma/ui/sequence/package.scala index 7939e2d91..e5925eca1 100644 --- a/modules/ui/src/main/scala/lucuma/ui/sequence/package.scala +++ b/modules/ui/src/main/scala/lucuma/ui/sequence/package.scala @@ -14,9 +14,11 @@ import lucuma.core.model.sequence.gmos.DynamicConfig import lucuma.core.util.NewType import lucuma.react.SizePx import lucuma.react.common.* +import lucuma.react.primereact.Tag import lucuma.react.primereact.Tooltip import lucuma.react.primereact.tooltip.* import lucuma.react.syntax.* +import lucuma.schemas.model.enums.StepExecutionState import lucuma.ui.LucumaIcons import lucuma.ui.LucumaStyles import lucuma.ui.utils.* @@ -53,6 +55,21 @@ given Render[Option[DatasetQaState]] = Render.by: qaState => case Some(DatasetQaState.Fail) => LucumaStyles.IndicatorFail case None => LucumaStyles.IndicatorUnknown +given Render[StepExecutionState] = Render.by: + case StepExecutionState.NotStarted | StepExecutionState.Ongoing | StepExecutionState.Completed => + EmptyVdom + case other @ (StepExecutionState.Aborted | StepExecutionState.Stopped | + StepExecutionState.Abandoned) => + Tag( + other match + case StepExecutionState.Aborted => "Aborted" + case StepExecutionState.Stopped => "Stopped Early" + case StepExecutionState.Abandoned => "Abandoned", + severity = other match + case StepExecutionState.Stopped => Tag.Severity.Info + case _ => Tag.Severity.Danger + ) + extension [D, R <: SequenceRow[D]](list: List[R]) /* Zip list with `StepIndex` and return the indexed list and the next index */ def zipWithStepIndex(