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

Empty file formats should not be visible at all #95

Open
christophfriedrich opened this issue Oct 21, 2024 · 1 comment
Open

Empty file formats should not be visible at all #95

christophfriedrich opened this issue Oct 21, 2024 · 1 comment

Comments

@christophfriedrich
Copy link
Collaborator

When there is no information on file formats because crawling /file_formats failed, the heading "File Formats (0)" is rendered anyway:

grafik

Interestingly, this behaviour is different for collections, processes and service types, which currently can't be crawled either on the backend in question, but are not rendered.

@christophfriedrich
Copy link
Collaborator Author

The Backend component does check whether fileFormats actually has content:

<FileFormats v-if="backend.fileFormats" :collapsed="true" :searchTerm="''" :formats="preparedBackend.fileFormats" :showInput="true" :showOutput="true"></FileFormats>

But the problem is that the backend never serves null, but instead this:

	"fileFormats": {
		"input": {},
		"output": null
	}

grafik

That is due to this MongoDB query:

fileFormats: {
input: { $ifNull: ['$fileFormats.input', {}] }, // input formats didn't exist in API v0.4 -> empty object as default
output: { $ifNull: ['$fileFormats.output', '$fileFormats'] } // first item: API v1.0, second item: API v0.4
},

It would be cleaner if the output would be fileFormats: null, but from the top of my head I couldn't come up with a quick Mongo query that does that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant