-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds configuration requests and new observation workflow #4253
Conversation
BundleMonFiles updated (2)
Unchanged files (6)
Total files change +5.22KB +0.21% Final result: ✅ View report in BundleMon website ➡️ |
instrument | ||
mode | ||
gmosNorthLongSlit { | ||
grating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we care only about grating?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷 Apparently that is the only piece of a gmos long slit observation that matters when they are handing out approvals.
ProgramSummaryQueriesGQL | ||
.AllProgramConfigurationRequests[IO] | ||
.query(props.programId, offset.orUnassign), | ||
_.program.fold(List.empty)(_.configurationRequests.matches), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
foldMap
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. Good catch.
@@ -132,12 +134,28 @@ object ProgramCacheController | |||
offset => | |||
ProgramSummaryQueriesGQL | |||
.AllProgramObservations[IO] | |||
.query(props.programId.toWhereObservation, offset.orUnassign), | |||
.query(props.programId.toWhereObservation, offset.orUnassign)(using | |||
ErrorPolicy.IgnoreOnData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is IgnoreOnData necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to remember. I'll get back to you shortly...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that one at least sounds more like a validation message than a query error.
But I agree that we want the IgnoreOnData in the presence of this. Maybe add a comment?
): ProgramSummaries = | ||
println(s"stati: ${obsList.map(_.workflow.state)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of queries! LGTM
@@ -301,13 +300,9 @@ object ObsList: | |||
props.obsExecutionTimes.getPot(obsId).map(_.programTimeEstimate), | |||
ObsBadge.Layout.ObservationsTab, | |||
selected = selected, | |||
setStatusCB = obsEditStatus(obsId) | |||
setStateCB = obsEditStatus(obsId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to rename to obsEditState
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that after I rebase on your PR. 👅
@@ -85,7 +85,7 @@ object ObsSummaryTable: | |||
private val GroupsColumnId = ColumnId("groups") | |||
private val ObservationIdColumnId = ColumnId("observation_id") | |||
private val ValidationCheckColumnId = ColumnId("validation_check") | |||
private val StatusColumnId = ColumnId("status") | |||
private val StateColumnId = ColumnId("status") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to rename to "state" too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I guess I missed this table for that somehow.
@@ -99,6 +99,10 @@ case class KeyedIndexedList[K, A] private (private val list: TreeSeqMap[K, (A, N | |||
def updatedValueWith(key: K, f: A => A): KeyedIndexedList[K, A] = | |||
updatedWith(key, (v, i) => (f(v), i)) | |||
|
|||
// WARNING - Do not use to update the part of the value used as a key | |||
def unsafeMapValues(f: A => A): KeyedIndexedList[K, A] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make this safe by passing a lens for the key so that it gets reinstated in case it's modified. In fact, this would be automatic if you use KIListMod(keyLens).mod
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While digging through the KeyedIndexexList stuff to figure out how to make this work, I realized where I'm using this isn't participating in undo
. 😢 I'll take care of that, and then figure this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I'm not sure this should participate in undo
. We can't get rid of a ConfigurationRequest via the API. I guess once we get a mutation we could Withdraw
the request on undo
and set it back to Requested
on redo
? It's not quite the same as fully undoing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like we want to make those actions explicit. Like submit/retract a proposal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I think you're right. Undo doesn't seem appropriate here. Thanks for the input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll deal with the unsafeMapValues in a new PR. I want to get this merged so Rob can continue cleaning up the odb/core.
@@ -179,33 +183,76 @@ case class Observation( | |||
lazy val constraintsSummary: String = | |||
s"${constraints.imageQuality.label} ${constraints.cloudExtinction.label} ${constraints.skyBackground.label} ${constraints.waterVapor.label}" | |||
|
|||
private val executedStates = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExecutedStates
? Would it make sense to put it in Constants
, or will it only be used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, it's only needed here. I guess that could change in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, anyway we use CamelCase for constants, it's in the new code guidelines ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have guidelines? 😮 Anyway, their just guidelines - kind of like the Pirates Code. 😆
): ProgramSummaries = | ||
println(s"stati: ${obsList.map(_.workflow.state)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
println
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too late. Carlos already reported that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome, thank you.
LGTM, with some comments.
dbf709a
to
39bd3e9
Compare
Adds configuration requests to Explore. For now, the only place you can request approval is on the summary tab in the validations table. This will change will a future PR. When an approval is requested, we optimistically update the affected observations, but they don't get updated via the API. This will change when the
ConfigurationRequest
in the API has the affected observations added to it and we can request them as part of theconfigurationRequestEdit
event.It also incorporates the new observation workflow, which removes
obsStatus
andobsActiveStatus
. A newObservationWorkflow
is present on theObservation
in the API, which contains a new calculatedObservationWorkflowState
. It also contains a list of the valid states to which the observation can be transitioned, and the observation validations have been moved within the workflow. TheObsBadge
has been updated to remove the Active State and change the status dropdown to update the new state where invalid transitions have been disabled. Currently there is no mutation for updating the state via the API, so any changes made locally will be overwritten on reload of the observation.