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

Show error icon / message when thumbnail can't be generated in-app #16843

Closed
wants to merge 11 commits into from

Conversation

jay-p-b-7span
Copy link
Contributor

@jay-p-b-7span jay-p-b-7span commented Dec 17, 2022

… be generated (e.g. image file too big)

Description

Fixes #16440, fixes ENG-139

Type of Change

  • Bugfix
  • Improvement
  • New Feature
  • Refactor / codestyle updates
  • Other, please describe:

Requirements Checklist

  • New / updated tests are included
  • All tests are passing locally
  • Performed a self-review of the submitted code

If adding a new feature:

  • Documentation was added/updated. PR:

@rijkvanzanten rijkvanzanten changed the title This PR solves issue 16440 No visual feedback if thumbnail cannot… Show error icon / message when thumbnail can't be generated in-app Dec 18, 2022
Copy link
Member

@paescuj paescuj left a comment

Choose a reason for hiding this comment

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

Thanks @jay-p-b-7span for your pull request! ❤️
Would you be able to provide a quick screenshot to get an idea of how it's going to look?

app/src/components/v-image.vue Outdated Show resolved Hide resolved
app/src/components/v-image.vue Outdated Show resolved Hide resolved
@jay-p-b-7span
Copy link
Contributor Author

I have attached screenshots.

image
image
image

@freekrai
Copy link
Contributor

So I get the

[ILLEGAL_ASSET_TRANSFORMATION] Image is too large to be transformed, or image size couldn't be determined.

error but it still creates the record in the database just doesn't actually upload the file, is this the behaviour you'd expect to see?

@paescuj
Copy link
Member

paescuj commented Jan 16, 2023

@freekrai It should get uploaded in any case, but not displayed as the generation of a thumbnail might take up too many resources for larger images. The idea of this pull request is that the user is informed accordingly in such a case, as otherwise it is unclear why no image is displayed.

As for this pull request, I'm currently wondering the following:

  • Would there possibly even be a more suitable icon, so that you can see directly what the display issue is?
  • I'm not yet completely satisfied with the design in the detailed view. Could we maybe show a thumbnail with the error icon there as well? This way it would be clear that the image is usually displayed at that place. And maybe we could embed the error message somehow?

@freekrai
Copy link
Contributor

@paescuj yeah I do see the file in uploads so that works as expected and yes, it can be confusing as when you first upload you don't see why there is no thumbnail showing unless you click on the image itself and go into the db record.

@paescuj
Copy link
Member

paescuj commented Jan 16, 2023

@paescuj yeah I do see the file in uploads so that works as expected and yes, it can be confusing as when you first upload you don't see why there is no thumbnail showing unless you click on the image itself and go into the db record.

I completely agree with you!

@freekrai
Copy link
Contributor

That said, this does do what's expected so it can be approved and further tweaks made in a future PR.

Copy link
Contributor

@freekrai freekrai left a comment

Choose a reason for hiding this comment

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

👍🏻

app/src/components/v-image.vue Outdated Show resolved Hide resolved
Comment on lines +45 to +53
async function onErrorHandle() {
if (!props.src) return;
try {
await api.get(props.src);
} catch (err: any) {
imgError.value = true;
imageError.value = err;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This error handling is fetching the image fresh to extract the error, even though the v-image that throws the error already emits the error. Lets reuse the error emitted by v-image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I completely agree with you @rijkvanzanten to reuse code. But error emitted by v-image has responseType ArrayBuffer which v-error component would not be able to handle it. Therefore result might look like attached in screenshot.

image
image

Reason of making new request

In order to address this responseType ArrayBuffer, I had made new request.

Solution

  • 1st option
    We can handle converting Responsetype to String in v-image Component.
    image

  • 2nd option
    We can handle this conversion of responseType in v-error Component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know for any updates.

app/src/views/private/components/file-preview.vue Outdated Show resolved Hide resolved
@rijkvanzanten
Copy link
Member

That said, this does do what's expected so it can be approved and further tweaks made in a future PR.

It might act like expected, but the code isn't quite there yet 🙂

@paescuj
Copy link
Member

paescuj commented Jan 18, 2023

That said, this does do what's expected so it can be approved and further tweaks made in a future PR.

It might act like expected, but the code isn't quite there yet 🙂

I agree! Besides, I'd like to have at least this point discussed / solved before having it merged (#16843 (comment)):

  • I'm not yet completely satisfied with the design in the detailed view. Could we maybe show a thumbnail with the error icon there as well? This way it would be clear that the image is usually displayed at that place. [...]

freekrai and others added 2 commits January 18, 2023 15:40
@jay-p-b-7span jay-p-b-7span requested review from rijkvanzanten and freekrai and removed request for rijkvanzanten and freekrai January 23, 2023 08:57
@rijkvanzanten rijkvanzanten removed their request for review February 15, 2023 22:16
@github-actions
Copy link

Hi @freekrai, @jay-p-b-7span!

Thank you for contributing to Directus! Before we consider your Pull Request, we ask that you sign our Contributor License Agreement (CLA). This is only required for your first Pull Request.

Please review the CLA, and sign it by adding your GitHub username to the contributors.yml file. Thanks!

@rijkvanzanten
Copy link
Member

I'll close this for now while we're researching a solution for #16843 (comment)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No visual feedback if thumbnail cannot be generated (e.g. image file too big)
5 participants