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

Folder And Dataset Metadata #7886

Open
wants to merge 79 commits into
base: master
Choose a base branch
from

Conversation

MichaelBuessemeyer
Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer commented Jun 17, 2024

URL of deployed dev instance (used for testing):

Steps to test:

  • Open the dashboard & create another folder.
  • Try adding metadata to the folder. Try out all three kinds of entries. Test whether autosave works
  • Try editing metadata for a dataset
  • Switch between datasets, the metadata should stay consistent
  • Switch between folders, the metadata should stay consistent
  • And also switch between folders and datasets and also look for any errors / inconsistencies / lost metadata entries.

TODOs:

  • Clean up git history
  • Allow to search for metadata props -> Other issue
  • Add props & UI and everything for folders
  • Update UI to the newest design proposal
  • Clean up code

Open Question

  • What about supporting dataset tags? Should they be removed? Should one still be able to update the dataset tags via the API? Should they be removed from the schema? Should they be transferred into metadata entries?
  • How should tags be transferred into metadata?
    • As a single string array entry with key "tags"
    • For each on entry with numbered keys like "tagX" and x is the index of the tag in the tag array
    • other ideas

Issues:


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

MichaelBuessemeyer and others added 6 commits June 17, 2024 18:33
* 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
* 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

* changelog

* rename variable

* apply pr feedback

* improve error message of uint24 layers in animation modal

---------

Co-authored-by: Michael Büßemeyer <[email protected]>
* validate BB size to be larger then 0

* changelog

* appy PR feedback
@fm3 fm3 changed the title Folder dataset properties Folder And Dataset Properties Jun 18, 2024
@MichaelBuessemeyer MichaelBuessemeyer changed the title Folder And Dataset Properties Folder And Dataset Metadata Jul 23, 2024
@MichaelBuessemeyer
Copy link
Contributor Author

MichaelBuessemeyer commented Jul 29, 2024

@philippotto I prepared the code ready for your feedback and testing :D.

Moreover, I just removed an unnecessary dependency of a useEffect hook introduced by me in another pr which was just merged today. See: #7935 (comment)

@MichaelBuessemeyer
Copy link
Contributor Author

@markbader Metadata should now be updateable via the normal dataset update route

Copy link
Member

@philippotto philippotto left a comment

Choose a reason for hiding this comment

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

haven't looked at the code yet, but testing results are in :)

image

  • the table head ("Property") and the validation warning are not aligned with the rest of the table entries. strictly speaking, the input box is also a bit too wide, but since the text within that box is aligned, it feels good.
  • the trash icon is incorrectly positioned when a validation warning is there
  • auto-save also happens when a field is focussed. after auto-saving that focus is not there anymore. it's probably easiest to not auto-save as long as a field is focussed.

@@ -320,23 +316,6 @@ class DatasetRenderer {
</>
);
}
renderTags() {
Copy link
Member

Choose a reason for hiding this comment

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

so, the old dataset tags don't exist anymore? are these migrated to the new metadata? ah, I just saw the open questions..

Copy link
Member

@philippotto philippotto left a comment

Choose a reason for hiding this comment

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

I reviewed the code now. Cool stuff :) I left a couple of nitpicks. on a higher level I have two things (I commented both with more detail).

  1. I don't really get the index property of the metadata items. wouldn't it work without it?
  2. I'd enforce a remount when the user clicks on another folder/dataset, unless there is a strong reason against it.

it's probably best to discuss this in person before writing long walls of text :) 🤙

test/db/folders.csv Outdated Show resolved Hide resolved
frontend/stylesheets/_dashboard.less Outdated Show resolved Hide resolved
Comment on lines 250 to 259
position: relative; // Ensure the pseudo-element is positioned relative to the tr.
&:not(:last-child)::after {
// Using pseudo-element to create a border line that does not extend the whole width of the tr.
content: "";
position: absolute;
left: 8px; // Margin on the left side
right: 8px; // Margin on the right side
top: 0;
height: var(--ant-line-width); // Height of the border line
background-color: var(--ant-color-border); // Color of the border line
Copy link
Member

Choose a reason for hiding this comment

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

please remove the copilot comments. instead add a comment to the tr block and explain what is happening here on a higher level (instead of how). I think, a divider line is drawn?

callback: () => void | (() => void),
dependencies: React.DependencyList,
) {
const isInitialRunRef = useRef(true);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const isInitialRunRef = useRef(true);
// Same as useEffect but doesn't trigger the callback on the initial mounting. Also, there's no update when the
// callback changes.
const isInitialRunRef = useRef(true);

@@ -387,7 +366,7 @@ class FolderRenderer {
class DatasetTable extends React.PureComponent<Props, State> {
state: State = {
sortedInfo: {
columnKey: useLruRank ? "" : "created",
columnKey: useLruRank ? undefined : "created",
Copy link
Member

Choose a reason for hiding this comment

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

hmm, good catch. it's definitely a bit fishy.

the logic should be as follows:

  • if the table is sorted by a certain column (columnKey is properly defined), let antd sort the table accordingly (I think, this happens automatically)
  • if not:
    • if no search is active: sort by lastUsedByUser
    • if a search is active: sort by dice coefficient

can you doublecheck that it works now correctly?

although this should be done by the backend nowadays, or am I wrong?

no, I think, the frontend should do the sorting.

frontend/javascripts/dashboard/folders/metadata_table.tsx Outdated Show resolved Hide resolved
Comment on lines 193 to 202
const detailsWithoutEditedEntry = prev.filter((prop) => prop.index !== index);
setHasUnsavedChanges(true);
return [
...detailsWithoutEditedEntry,
{
...entry,
key: newPropName,
error,
},
];
Copy link
Member

Choose a reason for hiding this comment

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

is there a reason for moving the item to the back? intuitively, I would have mapped the items and only update the one with the requested index (even though I'm still not sure I get the relevance of the index; isn't it redundant?).

const updatedEntry = { ...entry, value: newValue };
const detailsWithoutEditedEntry = prev.filter((prop) => prop.index !== index);
setHasUnsavedChanges(true);
return [...detailsWithoutEditedEntry, updatedEntry];
Copy link
Member

Choose a reason for hiding this comment

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

same here

size: "small" as InputNumberProps<number>["size"],
disabled: isSaving,
};
switch (record.type) {
Copy link
Member

Choose a reason for hiding this comment

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

the switch block could be a good candidate for an own functional component.

Comment on lines 391 to 409
<div className="flex-center-child empty-metadata-placeholder">
<img
src="/assets/images/metadata-teaser.svg"
alt="Metadata preview"
style={{ width: "60%", marginBottom: 16 }}
/>
<span style={{ marginTop: 10 }}>
<Dropdown
menu={getTypeSelectDropdownMenu()}
placement="bottom"
trigger={["click"]}
autoFocus
>
<Button icon={<PlusOutlined style={{ marginLeft: -2 }} />}>
Add First Metadata Entry
</Button>
</Dropdown>
</span>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

own component? :)

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.

User-editable dataset and folder metadata
5 participants