Skip to content
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

Mapping in default view config #7858

Merged
merged 19 commits into from
Jun 13, 2024

Conversation

MichaelBuessemeyer
Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer commented Jun 4, 2024

URL of deployed dev instance (used for testing):

  • https://___.webknossos.xyz

Steps to test:

  • Set default mapping from view mode!

    • Open a dataset with at least one segmentation layer with a mapping. Enable that mapping and save the config as default.
    • Open the dataset settings. Navigate to the View Configuration Tab and check whether your settings were set as default appropriately in the layer settings.
  • Set default mappings from dataset config view

    • Open the dataset settings and open the View Configuration Tab.
    • In the layer settings configure a mapping by defining "mapping: {"name": <name>, "type": <"JSON"|"HDF5">} as a new property to a layer. In case the json is valid but the name & type combination cannot be found, this should be reported to the user and submitting the config should not work.
    • After successfully submitting, reload / reopen the View Configuration. The updated settings should be shown.
  • As a new user (e.g. [email protected]), view the just updated dataset. The configured mapping should be active by default.

  • Make the dataset public and open it in a private tab (somewhere where you are not logged in). The mapping should be active by default.

  • Confirm the UI bottom margin fix in the layer settings view by viewing a dataset with multiple segmentation layers as an admin. Then disable the last segmentation layer. The button to save the config as the dataset default should have a proper distance to the last segmentation layer settings in any scenario.

TODOs:

  • Ensure loading when having an annotation
  • consider moving the activeMappingByLayer to DatasetConfiguration.layer
  • only show mapping selection for segmentation layers with mappings No longer possible due to TODO directly above
  • open new issue for not initially rendering a mapping under when switching layer in an annotation -> Fix loading (json) mappings in annotation view when changing active segmentation layers. #7859
  • Allow saving "no mapping active" from view mode as default view configuration (currently the mapping is still kept)
  • in settings view cache fetched available mappings & agglomerates
  • rename from defaultMapping to mapping

Issues:


(Please delete unneeded items, merge only when none are left open)

- add config settings to dataset settings default view config tab
- auto load initial default mapping
- was broken in view mode with multiple segmentation layers; the "Save View Config..." Button had no spacing to towards
@MichaelBuessemeyer MichaelBuessemeyer marked this pull request as ready for review June 12, 2024 11:37
Copy link
Member

@hotzenklotz hotzenklotz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the feature works as expected.

Please see some of my code comments.

if (layerName in availableMappingsPerLayerCache) {
return availableMappingsPerLayerCache[layerName];
}
let jsonAndAgglomerateMappings = [[], []] as [string[], string[]];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why let? This variable is never changed and can be a const.

I think you could move the return arguments into the try and the catch block directly. The catch block would return the default value.

Screenshot 2024-06-12 at 14 56 45

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good 👍

max: "Only for color layers",
intensityRange: "Only for color layers",
const comments: Partial<Record<keyof DatasetLayerConfiguration, [string, string | null]>> = {
alpha: ["20 for segmentation layer", null],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are using arrays to hold the descriptions? Would it not be easier to read to use an object with names keys, e.g. tooltip, shortDescription?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, also fine. Might make thinks also easier to understand 🎉

Copy link
Contributor Author

@MichaelBuessemeyer MichaelBuessemeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you review 🙏

Please find my comment below / attached to yours.

Do you think this is mergable in the newest commit / with the newest changes?

if (layerName in availableMappingsPerLayerCache) {
return availableMappingsPerLayerCache[layerName];
}
let jsonAndAgglomerateMappings = [[], []] as [string[], string[]];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good 👍

max: "Only for color layers",
intensityRange: "Only for color layers",
const comments: Partial<Record<keyof DatasetLayerConfiguration, [string, string | null]>> = {
alpha: ["20 for segmentation layer", null],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, also fine. Might make thinks also easier to understand 🎉

@hotzenklotz
Copy link
Member

Let's go 🚀

@MichaelBuessemeyer MichaelBuessemeyer merged commit 7b95132 into master Jun 13, 2024
2 checks passed
@MichaelBuessemeyer MichaelBuessemeyer deleted the mapping-in-default-view-config branch June 13, 2024 11:16
MichaelBuessemeyer added a commit that referenced this pull request Jun 17, 2024
* allow viewing a mapping

* WIP: enable setting default active mappings in default view configuration

* add default active mapping to default view configuration
- add config settings to dataset settings default view config tab
- auto load initial default mapping

* fix bottom margin of layer settings
- was broken in view mode with multiple segmentation layers; the "Save View Config..." Button had no spacing to towards

* fix having the mapping settings enabled for layers with default mapping

* WIP: move default mapping store proeprty to dataset layer config
- undo moving mapping selection to a shared component

* moved default active mapping from separate select to view config layer config
- Also added validation check whether the mapping exists in the dataset view config settings

* allow saving no default active mapping from view mode & model init to new dataset config version

* rename defaultMapping to mapping

* cache available mappings fetched from backend when checking config in dataset settings

* remove logging statements

* clean up

* add changelog entry

* apply pr feedback
aaronkanzer pushed a commit to lincbrain/webknossos that referenced this pull request Jun 17, 2024
* allow viewing a mapping

* WIP: enable setting default active mappings in default view configuration

* add default active mapping to default view configuration
- add config settings to dataset settings default view config tab
- auto load initial default mapping

* fix bottom margin of layer settings
- was broken in view mode with multiple segmentation layers; the "Save View Config..." Button had no spacing to towards

* fix having the mapping settings enabled for layers with default mapping

* WIP: move default mapping store proeprty to dataset layer config
- undo moving mapping selection to a shared component

* moved default active mapping from separate select to view config layer config
- Also added validation check whether the mapping exists in the dataset view config settings

* allow saving no default active mapping from view mode & model init to new dataset config version

* rename defaultMapping to mapping

* cache available mappings fetched from backend when checking config in dataset settings

* remove logging statements

* clean up

* add changelog entry

* apply pr feedback
MichaelBuessemeyer added a commit that referenced this pull request Aug 28, 2024
* Add dataset metadata input to details view in dashboard

* update docs

* Improve mobile support of views (#7876)

* make login, registration and forgot password view more responsive to mobile devices
- includes adding a link back to login for password reset view

* make dashboard dataset view less awful

* add changelog entry

* Mapping in default view config (#7858)

* allow viewing a mapping

* WIP: enable setting default active mappings in default view configuration

* add default active mapping to default view configuration
- add config settings to dataset settings default view config tab
- auto load initial default mapping

* fix bottom margin of layer settings
- was broken in view mode with multiple segmentation layers; the "Save View Config..." Button had no spacing to towards

* fix having the mapping settings enabled for layers with default mapping

* WIP: move default mapping store proeprty to dataset layer config
- undo moving mapping selection to a shared component

* moved default active mapping from separate select to view config layer config
- Also added validation check whether the mapping exists in the dataset view config settings

* allow saving no default active mapping from view mode & model init to new dataset config version

* rename defaultMapping to mapping

* cache available mappings fetched from backend when checking config in dataset settings

* remove logging statements

* clean up

* add changelog entry

* apply pr feedback

* Fix animation modal color layer validation (#7882)

* fix animation modal color layer validation

* changelog

* rename variable

* apply pr feedback

* improve error message of uint24 layers in animation modal

---------

Co-authored-by: Michael Büßemeyer <[email protected]>

* Validate animation job bounding box (#7883)

* validate BB size to be larger then 0

* changelog

* appy PR feedback

* force serialization of dataset details prop in compact version of dataset

* WIP adding details to folder

* First version metadata support for folders

* fix folder listing query

* finish frontend support for folder metadata

* default to undefined columnKey and not null to potentially prevent frontend dataset filtering
- reason: ll.530 checks for sortedInfo.columnKey == null and columnKey is per default "" which makes this check fail and thus the chained map will never be executed

* add evolution

* update test db init data & folder snapshot test & bump schema version

* remove unused import

* also blur on property input

* only support / show current error

* improve css

* WIP: use new json schema to save dataset & folder details and re-style metadata table

* fix backend to work with new type of details dataset / folder field & WIP restyling of metadata / details table

* WIP: improve dataset details table styling and add support for different types

* details table for folders and datasets version 2

* WIP: adapt migration to new details format

* uncomment ci tests

* mini migration fix

* - rename details to metadata

* fix schema

* remove unused backend imports

* only update metadata set of metadata table when folder / dataset changes

* ensure flushing updates on unmount of metadata table & increase debounce time

* remove accidental change

* WIP apply styling feedback & refactor handling metadataentry type

* remove unused css

* keep old dataset while updating & refetching in the dataset details view

* remove unused code as search support for metadata entries is currently not planned

* do not include metadata in dataset compact version

* Fix Dataset refetching

- also update datasetById when updating a dataset in the dashboard
- Avoid spinner when updating metadata
- Avoid unnecessary updates by guarding the debounced flush against not having pending calls to the debounced function

* have fix width for metadata table cell contents to  ensure consistent table column width and consistent layout

- Ignore adding new metadata entry when there is already an empty one to avoid showing an error

* enable selecting current folder of folder tree view as active details element

* do not have initial empty metadata row

* WIP: Apply styling update

* Finish next version

* hopefully fix flickering bug in when two different metadata updates have a cyclic race against each other

* Only have default metadata on species, brainRegion & acquisition when creating a publication

* also fill full metadata table width in case of an empty table

* allow changing prop name although it is a duplicate; do not save metadata in case it has errors

* clean up code for review

* add changelog & migration entry; rename evolution

* also rename revision; add comments to revision; remove dev logging

* Apply PR Feedback

* move metadata table to own file

* only update when metadata changed & refactor code

* fix updating the wrong dataset or folder with the newest metadata version of the table

* allow multiple error rows & only update local metadata set if new folder/dataset or update failed

- Try forcing dropdown menu to stay open during update -> does not work atm :/

* update preview image

* fix color layer / segmentation layer switchero bug

* remove periodic autosave an replace with explicit save via button or autosave when changing focused dataset / folder

* re add auto saving mechanism and do not have nested components to avoid frequent remounting

* update snapshots

* refactor code & remove `useWillUnmount` which sent outdated metadata update to the backend breaking the whole metadata feature.

* remove unnecessary dependency from useEffect accidentally added in a different pr

* include metadata in full dataset update route

* fix full update dataset route for metadata support

* remove option to update tags (as they will no longer be rendered in the frontend)

* remove index from initial metdata added to datasets with publication

* apply pr feedback (testing pending)

* lint frontend

* do not send updates while a row of the metadata table is focused
- Also: Use up-to-date metadata value on unmount effect (previously the inital value was sent to the server)

* avoid lost isSaving updates due to changes to `focusedRow` state while updating. Due to changes to `focusedRow` while saving the previously used isMounted boolean was set to false when changed during the update post to the backend and thus the update to isSaving never got through the guarding. => Now it is explicitly tracked via a custom hook to avoid this scenario

* fix sending double updates on unmount

* apply pr feedback

* migrate existing tags into metadata

* remove unwanted additional wrapping array around migrated tags in metadata value entry

* add undo migrating tags to metadata to revision

* fix revision schema

* give delete metadata entry button some more space; align key input to top & center delete button

* update schema migration version

* apply feedback

* readd tag support in frontend (and backend)

* fix backend

* make metadata non nullable

* update snapshots tests

* fix metadatatype type definition

* fix reversion against default null values of re-added details column

---------

Co-authored-by: Tom Herold <[email protected]>
Co-authored-by: Florian M <[email protected]>
Co-authored-by: Philipp Otto <[email protected]>
Co-authored-by: Michael Büßemeyer <[email protected]>
Co-authored-by: Florian M <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend dataset view configuration to include ID mapping
2 participants