-
Notifications
You must be signed in to change notification settings - Fork 24
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
Multiple custom layouts for tracing views #3299
Conversation
…tive layout as state to action bar; reworked layout persistence to match new layout schema
… active layout is resetable
…itple-tracing-custom-layouts
@philippotto shall we / I add a short "feature explanation" to the documentation? Right now I can't find anything about the custom viewports / layout feature. |
…minds/webknossos into mulitple-tracing-custom-layouts
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.
Wow! 👍 Awesome work! I just tested it and it seems to work pretty well. I left some review comments for the code and I also have some remarks for the UI:
- the icons to delete a layout should be aligned to the far right in my opinion
- can we add a way to edit the name of an existing layout?
- we should make it more clear that we store different layouts for the different UI setups. One way would be to add an information icon which has some explanation text. Another idea would be to list all layouts in a categorized way, but disable the ones which can not be used.
E.g.:
---- Orthogonal Mode ----
Default Layout
Layout 1
Layout 2
---- Arbitrary Mode ------
Default Layout
Layout 1
(cursive is disabled).
What do you think? Maybe you can brainstorm a bit, too, so that we can discuss afterwards with which solution we want to go?
@@ -103,17 +106,16 @@ export class GoldenLayoutAdapter extends React.PureComponent<Props<*>, *> { | |||
} | |||
|
|||
onStateChange() { | |||
console.log("changing gl 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.
This log can probably be removed.
|
||
export function setActiveLayout(layoutKey: LayoutKeys, activeLayout: string) { | ||
const newLayouts = getDeepCopyOfStoredLayouts(); | ||
if (newLayouts[layoutKey] && newLayouts[layoutKey][activeLayout]) { |
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.
Shouldn't we throw an error if this if-check fails?
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.
Like an error toast that says e.g. "The selected layout was not found. Please add a layout for the selected name."?
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 was thinking of a simple js throw via throw new Error("Active layout could not be set ...")
. This case should never occur, right? If there is no plausible way for the user, to hit this case, we do not need to add code here for a user-facing error message (so, no toast). But if the if-check shouldn't pass for some reason (e.g., future changes break something), then it would be very helpful to see an error in the console, when debugging this. That's why, you should usually just throw an error in these cases, since the error would be silently swallowed otherwise.
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "webknossos", | |||
"version": "0.17.146", | |||
"version": "1.10.1", |
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 think this change was added when you executed yarn version
. Can you undo this?
if (version !== 5) { | ||
return defaultLayoutSchema; | ||
} | ||
// migrate to newst schema |
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.
newEst
}, | ||
OrthoLayout: { | ||
"Custom Layout": layouts.OrthoLayout || defaultLayouts.OrthoLayout, | ||
lastActive: "Custom Layout", |
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.
This lastActive
attribute has some disadvantages in my opinion. Two example symptoms are that a layout must not be named "lastActive" and that "lastActive" has to be ignored when listing layout names. In general, the problem is that OrthoLayout (and co) contain a map from layout name to layout config AND the information what is active. These are two different things which can be stored independently.
For example, you could have:
...
OrthoLayout: {...},
LastActiveLayouts: {
OrthoLayout: "Custom Layout",
ArbitraryLayout: "Layout X",
}
as a format. Do you agree?
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.
Sure it was obvious to me that my solution is not so good. I like your idea way more than mine and it makes the code even better 😃
<React.Fragment> | ||
<h5 style={{ color: "#fff" }}>Where is my layout?</h5> | ||
<p> | ||
{`The tracing views are seperated into four classes. Each of them has their own layouts. If you |
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.
separated
OrthoLayoutView: "Othogonal Tracings - View Only", | ||
VolumeTracingView: "Volume Tracings", | ||
ArbitraryLayout: "Arbitray View Mode", | ||
OrthoLayout: "Othogonal Tracings", |
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.
oRthogonal (same in line 110)
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.
Can you rename "Tracings" to "Mode" in these labels?
Nice, nice, nice :) I made another comment ("Tracing" vs "Mode") and I also have another request: Can we remove the bullet points in front of the custom layout names? I think it would look better without the bullets. |
@philippotto could you please have a look at this PR again? I applied the feedback, but the frontend test didn't run correctly the first time on CircleCI. But without changing a thing the second try worked out. I don't know why 🤔 |
So, both runs worked out? :) The PR looks really good. I also just tested the conversion between the persisted layouts and it seems to work pretty well. What's a bit weird is that I can sometimes delete the last layout (so that the list is empty) and sometimes I can't delete it. But I think that's not a blocker. Feel free to merge! |
Please wait with merging until tomorrow, as the lab is conducting live tests at the moment. |
meant: "but the frontend test didn't run correctly the first time on CircleCI." 🙂 |
This PR addes the possibility to add muliple layouts.
URL of deployed dev instance (used for testing):
Steps to test:
Issues: