Skip to content

Commit

Permalink
Merge pull request #4262 from gemini-hlsw/sc-3334-observation-summary…
Browse files Browse the repository at this point in the history
…-table-improvements-part-2

Elevation plots in observation summary
  • Loading branch information
rpiaggio authored Oct 28, 2024
2 parents 3eaf25f + 3745cee commit 95019a7
Show file tree
Hide file tree
Showing 30 changed files with 272 additions and 161 deletions.
8 changes: 8 additions & 0 deletions USERPREFS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ We have four environments with a respective db and heroku app:
- staging
- production

## Console

You can spin up a server that servers a console app for an environment by using the CLI from the `hasura/user-prefs` directory. For example:

```
hasura console --endpoint https://user-prefs-master.herokuapp.com
```

## Copy the database

To copy the database between instances you can create a backup on the postgress page under the
Expand Down
91 changes: 63 additions & 28 deletions common/src/main/scala/explore/model/ExploreGridLayouts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ import scala.collection.immutable.SortedMap
object ExploreGridLayouts:

def sectionLayout: GridLayoutSection => LayoutsMap = _ match {
case GridLayoutSection.ProgramsLayout => programs.defaultProgramsLayouts
case GridLayoutSection.ConstraintsLayout => constraints.defaultConstraintsLayouts
case GridLayoutSection.SchedulingLayout => scheduling.defaultSchedulingLayouts
case GridLayoutSection.TargetLayout => targets.defaultTargetLayouts
case GridLayoutSection.ObservationsLayout => observations.defaultObsLayouts
case GridLayoutSection.OverviewLayout => overview.defaultOverviewLayouts
case GridLayoutSection.ProposalLayout => proposal.defaultProposalLayouts
case GridLayoutSection.GroupEditLayout => groupEdit.defaultGroupEditLayouts
case GridLayoutSection.ProgramsLayout => programs.defaultProgramsLayouts
case GridLayoutSection.ConstraintsLayout => constraints.defaultConstraintsLayouts
case GridLayoutSection.SchedulingLayout => scheduling.defaultSchedulingLayouts
case GridLayoutSection.TargetLayout => targets.defaultTargetLayouts
case GridLayoutSection.ObservationsLayout => observations.defaultObsLayouts
case GridLayoutSection.ObservationListLayout => observationList.defaultObsListLayouts
case GridLayoutSection.OverviewLayout => overview.defaultOverviewLayouts
case GridLayoutSection.ProposalLayout => proposal.defaultProposalLayouts
case GridLayoutSection.GroupEditLayout => groupEdit.defaultGroupEditLayouts
}

extension (l: LayoutsMap)
Expand Down Expand Up @@ -63,14 +64,14 @@ object ExploreGridLayouts:
private lazy val layoutMedium: Layout = Layout(
List(
LayoutItem(
i = ObsTabTilesIds.ConstraintsId.id.value,
i = ObsTabTileIds.ConstraintsId.id.value,
x = 0,
y = 0,
w = DefaultWidth.value,
h = ConstraintsHeight.value
),
LayoutItem(
i = ObsTabTilesIds.TimingWindowsId.id.value,
i = ObsTabTileIds.TimingWindowsId.id.value,
x = 0,
y = ConstraintsHeight.value,
w = DefaultWidth.value,
Expand All @@ -95,7 +96,7 @@ object ExploreGridLayouts:
private lazy val layoutMedium: Layout = Layout(
List(
LayoutItem(
i = ObsTabTilesIds.TimingWindowsId.id.value,
i = ObsTabTileIds.TimingWindowsId.id.value,
x = 0,
y = 0,
w = DefaultWidth.value,
Expand All @@ -122,21 +123,21 @@ object ExploreGridLayouts:
private lazy val layoutMedium: Layout = Layout(
List(
LayoutItem(
i = ObsTabTilesIds.TargetSummaryId.id.value,
i = ObsTabTileIds.TargetSummaryId.id.value,
x = 0,
y = 0,
w = DefaultWidth.value,
h = SummaryHeight.value
),
LayoutItem(
i = ObsTabTilesIds.TargetId.id.value,
i = ObsTabTileIds.TargetId.id.value,
x = 0,
y = SummaryHeight.value,
w = DefaultWidth.value,
h = TargetHeight.value
),
LayoutItem(
i = ObsTabTilesIds.PlotId.id.value,
i = ObsTabTileIds.PlotId.id.value,
x = 0,
y = SummaryHeight.value + TargetHeight.value,
w = DefaultWidth.value,
Expand All @@ -157,7 +158,7 @@ object ExploreGridLayouts:
private lazy val singleLayoutMedium: Layout = Layout(
List(
LayoutItem(
i = ObsTabTilesIds.TargetSummaryId.id.value,
i = ObsTabTileIds.TargetSummaryId.id.value,
x = 0,
y = 0,
w = DefaultWidth.value,
Expand Down Expand Up @@ -195,67 +196,67 @@ object ExploreGridLayouts:
y = 0,
w = DefaultWidth.value,
h = NotesMaxHeight.value,
i = ObsTabTilesIds.NotesId.id.value
i = ObsTabTileIds.NotesId.id.value
),
LayoutItem(
x = 0,
y = NotesMaxHeight.value,
w = DefaultWidth.value,
h = TargetHeight.value,
i = ObsTabTilesIds.TargetId.id.value
i = ObsTabTileIds.TargetId.id.value
),
LayoutItem(
x = 0,
y = (NotesMaxHeight |+| TargetHeight).value,
w = DefaultWidth.value,
h = FinderChartHeight.value,
i = ObsTabTilesIds.FinderChartsId.id.value
i = ObsTabTileIds.FinderChartsId.id.value
),
LayoutItem(
x = 0,
y = (NotesMaxHeight |+| TargetHeight |+| FinderChartHeight).value,
w = DefaultWidth.value,
h = SkyPlotHeight.value,
i = ObsTabTilesIds.PlotId.id.value
i = ObsTabTileIds.PlotId.id.value
),
LayoutItem(
x = 0,
y = (NotesMaxHeight |+| TargetHeight |+| FinderChartHeight |+| SkyPlotHeight).value,
w = DefaultWidth.value,
h = ConstraintsMaxHeight.value,
i = ObsTabTilesIds.ConstraintsId.id.value
i = ObsTabTileIds.ConstraintsId.id.value
),
LayoutItem(
x = 0,
y =
(NotesMaxHeight |+| TargetHeight |+| FinderChartHeight |+| SkyPlotHeight |+| ConstraintsMaxHeight).value,
w = DefaultWidth.value,
h = TimingWindowsMaxHeight.value,
i = ObsTabTilesIds.TimingWindowsId.id.value
i = ObsTabTileIds.TimingWindowsId.id.value
),
LayoutItem(
x = 0,
y =
(NotesMaxHeight |+| TargetHeight |+| FinderChartHeight |+| SkyPlotHeight |+| ConstraintsMaxHeight |+| TimingWindowsMaxHeight).value,
w = DefaultWidth.value,
h = ConfigurationMaxHeight.value,
i = ObsTabTilesIds.ConfigurationId.id.value
i = ObsTabTileIds.ConfigurationId.id.value
),
LayoutItem(
x = 0,
y =
(NotesMaxHeight |+| TargetHeight |+| FinderChartHeight |+| SkyPlotHeight |+| ConstraintsMaxHeight |+| TimingWindowsMaxHeight |+| ConfigurationMaxHeight).value,
w = DefaultWidth.value,
h = ItcMaxHeight.value,
i = ObsTabTilesIds.ItcId.id.value
i = ObsTabTileIds.ItcId.id.value
),
LayoutItem(
x = 0,
y =
(NotesMaxHeight |+| TargetHeight |+| FinderChartHeight |+| SkyPlotHeight |+| ConstraintsMaxHeight |+| TimingWindowsMaxHeight |+| ConfigurationMaxHeight |+| ItcMaxHeight).value,
w = DefaultWidth.value,
h = SequenceMaxHeight.value,
i = ObsTabTilesIds.SequenceId.id.value
i = ObsTabTileIds.SequenceId.id.value
)
)
)
Expand All @@ -269,6 +270,40 @@ object ExploreGridLayouts:
).withMinWidth
end observations

object observationList:
private lazy val SummaryHeight: NonNegInt = 9.refined
private lazy val SkyPlotHeight: NonNegInt = 9.refined

private lazy val layoutMedium: Layout = Layout(
List(
LayoutItem(
i = ObsSummaryTabTileIds.SummaryId.id.value,
x = 0,
y = 0,
w = DefaultWidth.value,
h = SummaryHeight.value
),
LayoutItem(
i = ObsSummaryTabTileIds.PlotId.id.value,
x = 0,
y = SummaryHeight.value,
w = DefaultWidth.value,
h = SkyPlotHeight.value
)
)
)

lazy val defaultObsListLayouts: LayoutsMap =
defineStdLayouts(
Map(
(BreakpointName.lg,
layoutItems.andThen(layoutItemWidth).replace(DefaultLargeWidth)(layoutMedium)
),
(BreakpointName.md, layoutMedium)
)
).withMinWidth
end observationList

object programs:
private lazy val DetailsHeight: NonNegInt = 6.refined
private lazy val NotesHeight: NonNegInt = 6.refined
Expand Down Expand Up @@ -318,14 +353,14 @@ object ExploreGridLayouts:
private lazy val layoutMedium: Layout = Layout(
List(
LayoutItem(
i = ObsTabTilesIds.WarningsAndErrorsId.id.value,
i = ObsTabTileIds.WarningsAndErrorsId.id.value,
x = 0,
y = 0,
w = DefaultWidth.value,
h = WarningsAndErrorsHeight.value
),
LayoutItem(
i = ObsTabTilesIds.ObsAttachmentsId.id.value,
i = ObsTabTileIds.ObsAttachmentsId.id.value,
x = 0,
y = WarningsAndErrorsHeight.value,
w = DefaultWidth.value,
Expand Down Expand Up @@ -403,14 +438,14 @@ object ExploreGridLayouts:
private lazy val layoutMedium: Layout = Layout(
List(
LayoutItem(
i = GroupEditIds.GroupEditId.id.value,
i = GroupEditTileIds.GroupEditId.id.value,
x = 0,
y = 0,
w = DefaultWidth.value,
h = GroupEditHeight.value
),
LayoutItem(
i = GroupEditIds.GroupNotesId.id.value,
i = GroupEditTileIds.GroupNotesId.id.value,
x = 0,
y = GroupEditHeight.value,
w = DefaultWidth.value,
Expand Down
3 changes: 3 additions & 0 deletions common/src/main/scala/explore/model/UserPreferences.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ case class UserPreferences(
val observationsTabLayout =
tabLayout(GridLayoutSection.ObservationsLayout)

val observationListTabLayout =
tabLayout(GridLayoutSection.ObservationListLayout)

val programsTabLayout =
tabLayout(GridLayoutSection.ProgramsLayout)

Expand Down
3 changes: 2 additions & 1 deletion common/src/main/webapp/css/react-grid-layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
}

.rgl-tile-overlay {
display: none; /* Enable for grid debugging */
display: none;
/* Enable for grid debugging */
pointer-events: none;
position: absolute;
top: 5px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import crystal.react.View
import explore.components.Tile
import explore.model.AsterismIds
import explore.model.Execution
import explore.model.ObsTabTilesIds
import explore.model.ObsTabTileIds
import explore.model.Observation
import lucuma.core.model.Program

Expand All @@ -22,7 +22,7 @@ object SequenceEditorTile:
sequenceChanged: View[Pot[Unit]]
) =
Tile(
ObsTabTilesIds.SequenceId.id,
ObsTabTileIds.SequenceId.id,
s"Sequence"
)(
_ =>
Expand Down
4 changes: 2 additions & 2 deletions explore/src/main/scala/explore/notes/NotesTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import explore.Icons
import explore.components.HelpIcon
import explore.components.Tile
import explore.components.ui.ExploreStyles
import explore.model.ObsTabTilesIds
import explore.model.ObsTabTileIds
import explore.model.Observation
import explore.model.enums.TileSizeState
import japgolly.scalajs.react.*
Expand All @@ -33,7 +33,7 @@ object NotesTile:

def notesTile(obsId: Observation.Id, notes: View[Option[NonEmptyString]]) =
Tile(
ObsTabTilesIds.NotesId.id,
ObsTabTileIds.NotesId.id,
s"Note for Observer",
NotesTileState(notes.get.foldMap(_.value), Editing.NotEditing),
bodyClass = ExploreStyles.NotesTile
Expand Down
4 changes: 2 additions & 2 deletions explore/src/main/scala/explore/tabs/AsterismEditorTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import explore.model.GlobalPreferences
import explore.model.GuideStarSelection
import explore.model.ObsConfiguration
import explore.model.ObsIdSet
import explore.model.ObsTabTilesIds
import explore.model.ObsTabTileIds
import explore.model.ObservationsAndTargets
import explore.model.OnAsterismUpdateParams
import explore.model.OnCloneParameters
Expand Down Expand Up @@ -74,7 +74,7 @@ object AsterismEditorTile:
)

Tile(
ObsTabTilesIds.TargetId.id,
ObsTabTileIds.TargetId.id,
title,
AsterismTileState(),
back = backButton,
Expand Down
4 changes: 2 additions & 2 deletions explore/src/main/scala/explore/tabs/ConfigurationTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import explore.config.ConfigurationPanel
import explore.model.AsterismIds
import explore.model.BasicConfigAndItc
import explore.model.ObsConfiguration
import explore.model.ObsTabTilesIds
import explore.model.ObsTabTileIds
import explore.model.Observation
import explore.model.ScienceRequirements
import explore.model.TargetList
Expand Down Expand Up @@ -48,7 +48,7 @@ object ConfigurationTile:
units: WavelengthUnits
)(using Logger[IO]) =
Tile(
ObsTabTilesIds.ConfigurationId.id,
ObsTabTileIds.ConfigurationId.id,
"Configuration",
bodyClass = ExploreStyles.ConfigurationTileBody
)(_ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ object ConstraintsTabContents extends TwoPanels:

val constraintsTile: Tile[Option[VdomNode]] =
Tile(
ObsTabTilesIds.ConstraintsId.id,
ObsTabTileIds.ConstraintsId.id,
constraintsTitle,
backButton.some
)(_ =>
Expand Down
5 changes: 3 additions & 2 deletions explore/src/main/scala/explore/tabs/ElevationPlotTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
package explore.tabs

import cats.syntax.all.*
import eu.timepit.refined.types.string.NonEmptyString
import explore.components.Tile
import explore.components.ui.ExploreStyles
import explore.model.GlobalPreferences
import explore.model.ObsTabTilesIds
import explore.targeteditor.plots.ObjectPlotSection
import explore.targeteditor.plots.PlotData
import japgolly.scalajs.react.*
Expand All @@ -24,6 +24,7 @@ object ElevationPlotTile:

def elevationPlotTile(
userId: Option[User.Id],
tileId: NonEmptyString,
plotData: PlotData,
site: Option[Site],
vizTime: Option[Instant],
Expand All @@ -32,7 +33,7 @@ object ElevationPlotTile:
globalPreferences: GlobalPreferences
): Tile[Unit] =
Tile(
ObsTabTilesIds.PlotId.id,
tileId,
"Elevation Plot",
bodyClass = ExploreStyles.ElevationPlotTileBody
) { _ =>
Expand Down
4 changes: 2 additions & 2 deletions explore/src/main/scala/explore/tabs/FinderChartsTile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import explore.findercharts.FinderChartsBody
import explore.findercharts.FinderChartsTileState
import explore.findercharts.FinderChartsTitle
import explore.model.ObsAttachmentList
import explore.model.ObsTabTilesIds
import explore.model.ObsTabTileIds
import explore.model.Observation
import japgolly.scalajs.react.vdom.html_<^.*
import lucuma.core.math.Angle
Expand All @@ -35,7 +35,7 @@ object FinderChartsTile:
readOnly: Boolean
) =
Tile(
ObsTabTilesIds.FinderChartsId.id,
ObsTabTileIds.FinderChartsId.id,
s"Finder Charts",
FinderChartsTileState(ChartSelector.Closed, None),
bodyClass = ExploreStyles.FinderChartsTile
Expand Down
Loading

0 comments on commit 95019a7

Please sign in to comment.