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

Remove wkw datasource suggestions #7697

Merged
merged 22 commits into from
Jun 18, 2024
Merged

Remove wkw datasource suggestions #7697

merged 22 commits into from
Jun 18, 2024

Conversation

frcroth
Copy link
Member

@frcroth frcroth commented Mar 18, 2024

Removes the automatic datasource-properties.json suggestions for the Dataset Settings view. They only worked for WKW and confusing errors popped up for other data formats. Also, since most dataset creation code already generates valid jsons, it was mostly unused.

At some point in the future we may want to use the explore code to bring them back, if that turns out to be a comon use case. (We’d probably have to add an Explorer for WKW).

Steps to test:

TODOs:

  • Backend
    • Remove exploring route
    • remove unused code
    • Adapt readInboxDatasource route to support reporting the most current version from disk
  • Frontend
    • Use readInboxDataSource in dataset settings view (note that it may contain existingDataSourceProperties in case of Unusable json)
    • Decide what to show exactly in case of invalid json (both invalid fields and json parse error) -> an error :)
    • In dashboard, always call the link “Settings”, no longer “Import”
    • What should the frontend to in case the datasource-properties.json is not valid? / cannot be parsed?

Issues:


@fm3 fm3 self-assigned this Mar 21, 2024
@MichaelBuessemeyer
Copy link
Contributor

This is how the settings view looks like, in case the datasource-properties.json is not a valid json file:

image

And like this, in case the "name" property is missing in the "id" field
image

I'd say it is okaisch, or do we want to improve the suggestion?

@philippotto
Copy link
Member

I'd say it is okaisch

Yes, since manually edited jsons are rare, it's okay in my opinion.

Comment on lines 98 to +99
<Button
onClick={() => history.push(`/datasets/${organization}/${datasetName}/import`)}
onClick={() => history.push(`/datasets/${organization}/${datasetName}/edit`)}
Copy link
Contributor

Choose a reason for hiding this comment

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

As according to the pr description, the "import" should always be named edit, I got rid of the import route (see router.tsx). I hope I didn't misunderstand this 🤞

@@ -137,54 +131,6 @@ function DatasetActionView(props: Props) {
setIsReloading(false);
};

const onDeleteDataset = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function was only used in the importLink. And as I removed this, I also removed this function here

@@ -330,7 +236,7 @@ export function getDatasetActionContextMenu({
},
}
: null,
dataset.isEditable && dataset.isActive
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I correct, that we no longer have a "not imported" state for a dataset? In that case, is it possible for a dataset to not be active? The only option would be to delete a dataset 🤔

My thought is that we may not need this field isActive anymore / do not need to consider it any longer in the frontend 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Am I correct, that we no longer have a "not imported" state for a dataset? In that case, is it possible for a dataset to not be active?

I don't know what happens now if a datasource properties json does not exist (or is incomplete). I assume the dataset won't be active then. However, the front-end should still show the edit button. Otherwise, the dataset would not be usable/fixable as you say.

Comment on lines 156 to -266
// Ensure that zarr layers (which aren't inferred by the back-end) are still
// included in the inferred data source
if (
savedDataSourceOnServer &&
"dataLayers" in savedDataSourceOnServer &&
inferredDataSource != null
) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This cannot be done as there is no longer a inferredDataSource. So does this maybe result in errors with zarr layers?

@MichaelBuessemeyer
Copy link
Contributor

I'd say the frontend changes are ready for the first review / comments

Comment on lines 200 to 235
const importLink = (
<div className="dataset-table-actions">
<Link
to={`/datasets/${dataset.owningOrganization}/${dataset.name}/import`}
className="import-dataset"
>
<PlusCircleOutlined className="icon-margin-right" />
Import
</Link>
{reloadLink}
<a
onClick={() =>
Modal.error({
title: "Cannot load this dataset",
content: (
<div>
<p>{dataset.status}</p>
{dataset.status === "Deleted by user." ? (
<p>
Even though this dataset was deleted by a user, it is still shown here, because
it was referenced by at least one annotation.
</p>
) : null}
</div>
),
})
}
>
<WarningOutlined className="icon-margin-right" />
Show Error
</a>
{dataset.status !== "Deleted by user." ? (
<a onClick={() => onDeleteDataset()}>
<DeleteOutlined className="icon-margin-right" />
Delete Dataset
</a>
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure whether it's a good idea to delete this. The use case is:

  • a dataset exists on disk, but wk isn't able to read it properly (e.g., because of an invalid json)
  • in that case, as a user I want to be able to see the issue, be able to fix it or to delete the dataset directly from the table.

I don't think that removing the wkw datasource suggestions means that the above use cases goes away.

cc @fm3

Copy link
Member

Choose a reason for hiding this comment

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

I agree, it should still be possible to fix the json, and parsing errors should be reported. Just not the automated suggestions.

messages: dataSourceMessages,
dataSourceSettingsStatus,
});
// TODOM: handle case in which dataSource is null / could not be parsed by the server
Copy link
Member

Choose a reason for hiding this comment

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

todo

Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer May 29, 2024

Choose a reason for hiding this comment

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

please see my post below :)
I'd say both cases are handle relatively adequately. Thus, I removed this todo

@MichaelBuessemeyer
Copy link
Contributor

This is how it looks if there is no datasource-properties.json available in the backend in the dataset list view on the newest version of the branch:
image
And this in the settings view:
image

In case the datasource-properties.json contains errors the dataset table looks the same as above.
And the settings look like this:
image

I'm not sure whether it's a good idea to delete this. The use case is:
a dataset exists on disk, but wk isn't able to read it properly (e.g., because of an invalid json)

This should be handled now: The dataset table always gives the option to a user to edit the settings (as long as the user has the capabilities (isEditable)).

in that case, as a user I want to be able to see the issue, be able to fix it or to delete the dataset directly from the table.

The settings view gives a warning about not being able to parse the datasource-properties.json (although the warning is not easy to understand). And the settings are accessible from the dataset table.
I do not understand why one would want to delete a dataset directly from the dataset table view. This is currently not possible but I think I also misunderstand your part

to delete the dataset directly from the table.

here a little.

@philippotto
Copy link
Member

I do not understand why one would want to delete a dataset directly from the dataset table view. This is currently not possible but I think I also misunderstand your part [...] here a little.

This feature was added not long ago. See here for context. I think, it would be good to keep it :)

@MichaelBuessemeyer MichaelBuessemeyer marked this pull request as ready for review May 29, 2024 09:38
@MichaelBuessemeyer
Copy link
Contributor

I'd say I applied all requested cases. How to we want to proceed with this @fm3?

Maybe we can check together my changes requested by philipp and then merge this once its clear to go?

@fm3
Copy link
Member

fm3 commented Jun 5, 2024

Do you think that letting this PR lie will create many merge conflicts? If not, I’d say it’s fair to wait until Philipp returns.

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.

sweet, red lines :) front-end lgtm 👍

@fm3 fm3 enabled auto-merge (squash) June 18, 2024 07:51
@fm3 fm3 merged commit 5bf95c8 into master Jun 18, 2024
2 checks passed
@fm3 fm3 deleted the remove-wkw-suggestions branch June 18, 2024 07:53
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.

Unify exploring zarr and importing wkw
4 participants