Skip to content

Commit

Permalink
Squash migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
cquiroz committed Dec 28, 2024
1 parent 9582f88 commit 109f2da
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 41 deletions.
30 changes: 25 additions & 5 deletions common/src/main/scala/explore/model/ExploreGridLayouts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import eu.timepit.refined.types.numeric.NonNegInt
import explore.model.enums.GridLayoutSection
import explore.model.layout.*
import explore.model.layout.LayoutsMap
import lucuma.core.enums.CalibrationRole
import lucuma.react.gridlayout.BreakpointName
import lucuma.react.gridlayout.Layout
import lucuma.react.gridlayout.LayoutItem
Expand Down Expand Up @@ -263,10 +264,29 @@ object ExploreGridLayouts:
)
)

lazy val specPhotoMedium = layoutMedium
lazy val twilightRemovedIds =
List(ObsTabTileIds.FinderChartsId, ObsTabTileIds.ItcId, ObsTabTileIds.NotesId).map(_.id.value)
lazy val twilightMedium = layoutMedium.asList.filterNot(l => twilightRemovedIds.contains(l.i))
List(ObsTabTileIds.FinderChartsId,
ObsTabTileIds.ItcId,
ObsTabTileIds.NotesId,
ObsTabTileIds.TimingWindowsId
).map(_.id.value)

lazy val twilightMedium =
layoutMedium.asList
.filterNot(l => twilightRemovedIds.contains(l.i))
lazy val specPhotoRemovedIds =
List(ObsTabTileIds.FinderChartsId, ObsTabTileIds.NotesId, ObsTabTileIds.TimingWindowsId).map(
_.id.value
)
lazy val specPhotoMedium =
layoutMedium.asList
.filterNot(l => specPhotoRemovedIds.contains(l.i))

def removedTiles(role: Option[CalibrationRole]) =
role match
case Some(CalibrationRole.Twilight) => twilightRemovedIds
case Some(CalibrationRole.SpectroPhotometric) => specPhotoRemovedIds
case _ => Nil

lazy val defaultObsLayouts: LayoutsMap =
defineStdLayouts(
Expand All @@ -279,8 +299,8 @@ object ExploreGridLayouts:
lazy val specPhotoObsLayouts: LayoutsMap =
defineStdLayouts(
Map(
(BreakpointName.lg, specPhotoMedium),
(BreakpointName.md, specPhotoMedium)
(BreakpointName.lg, Layout(specPhotoMedium)),
(BreakpointName.md, Layout(specPhotoMedium))
)
).withMinWidth

Expand Down
49 changes: 17 additions & 32 deletions explore/src/main/scala/explore/tabs/ObsTabTiles.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import explore.undo.UndoSetter
import japgolly.scalajs.react.*
import japgolly.scalajs.react.extra.router.SetRouteVia
import japgolly.scalajs.react.vdom.html_<^.*
import lucuma.core.enums.CalibrationRole
import lucuma.core.math.Angle
import lucuma.core.math.Offset
import lucuma.core.math.skycalc.averageParallacticAngle
Expand Down Expand Up @@ -86,7 +87,6 @@ import queries.schemas.odb.ObsQueries
import java.time.Instant
import scala.collection.immutable.SortedMap
import scala.collection.immutable.SortedSet
import lucuma.core.enums.CalibrationRole

case class ObsTabTiles(
vault: Option[UserVault],
Expand Down Expand Up @@ -552,38 +552,23 @@ object ObsTabTiles:
props.globalPreferences.get.wavelengthUnits
)

val alltiles =
List(
notesTile.some,
targetTile.some,
if (!props.vault.isGuest) finderChartsTile.some else none,
skyPlotTile,
constraintsTile.some,
schedulingWindowsTile.some,
configurationTile.some,
sequenceTile.some,
itcTile.some
).flattenOption

val removedIds = ExploreGridLayouts.observations.removedTiles(props.calibrationRole)

val tiles =
props.observation.zoom(Observation.calibrationRole).get match {
case Some(CalibrationRole.SpectroPhotometric) =>
List(
targetTile.some,
skyPlotTile,
constraintsTile.some,
configurationTile.some,
sequenceTile.some,
itcTile.some
).flattenOption
case Some(CalibrationRole.Twilight) =>
List(
targetTile.some,
skyPlotTile,
constraintsTile.some,
configurationTile.some,
sequenceTile.some
).flattenOption
case _ =>
List(
notesTile.some,
targetTile.some,
if (!props.vault.isGuest) finderChartsTile.some else none,
skyPlotTile,
constraintsTile.some,
schedulingWindowsTile.some,
configurationTile.some,
sequenceTile.some,
itcTile.some
).flattenOption
}
alltiles.filterNot(t => removedIds.contains(t.id))

TileController(
props.vault.userId,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

DELETE FROM "public"."lucumaGridLayoutId" WHERE "id" = 'observations_twilight';

DELETE FROM "public"."lucumaGridLayoutId" WHERE "id" = 'observations_specphoto';

DELETE FROM "public"."lucumaTableIds" WHERE "id" = 'observation_validations';
DELETE FROM "public"."lucumaTableIds" WHERE "id" = 'requested_configs';
DELETE FROM "public"."lucumaTableIds" WHERE "id" = 'unrequested_configs';
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

INSERT INTO "public"."lucumaTableIds"("id") VALUES (E'observation_validations');
INSERT INTO "public"."lucumaTableIds"("id") VALUES (E'requested_configs');
INSERT INTO "public"."lucumaTableIds"("id") VALUES (E'unrequested_configs');

INSERT INTO "public"."lucumaGridLayoutId"("id") VALUES (E'observations_specphoto');

INSERT INTO "public"."lucumaGridLayoutId"("id") VALUES (E'observations_twilight');

This file was deleted.

This file was deleted.

0 comments on commit 109f2da

Please sign in to comment.