Conversation
|
is it possible to show icon for file type when it't not an image (so there is always a thumbnail/icon in front of file name)? |
For sure it's possible, but I'm not sure how complicated that would be. Maybe as first solution we can have a generic icon for all attachments that are not images. |
|
We can use below icons based on file extension and fallback to Except when we can show image thumbnail (so we need to exclude those file extensions) Icons
Sample code |
|
@benakansara I've implemented your suggestion and checked with @maciejforcone, here the result:
|
| import { isImage } from './utils'; | ||
|
|
||
| // eslint-disable-next-line complexity | ||
| const getIcon = (extension: string) => { |
There was a problem hiding this comment.
@cesco-f I think it's hard to list all related extensions. We should instead use parseMimeType function which is also used to display "Type" column in Files table
There was a problem hiding this comment.
The possible mime types are imageMimeTypes, textMimeTypes, compressionMimeTypes and pdfMimeTypes.
So I'm showing the document icon if the mime type is either textMimeTypes or pdfMimeTypes, the folderClosed icon if it's a compressionMimeTypes, the clickable image if it's imageMimeTypes and the paperClip icon in all the other cases.
Is this what you had in mind? Or how would you use the parseMimeType function you mentioned?
There was a problem hiding this comment.
yes exactly, thank you!
x-pack/platform/plugins/shared/cases/public/components/files/file_avatar.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/cases/public/components/files/file_avatar.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/cases/public/components/files/file_avatar.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/cases/public/components/files/file_avatar.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/cases/public/components/files/file_thumbnail.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/cases/public/components/files/file_thumbnail.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/cases/public/components/files/file_thumbnail.tsx
Outdated
Show resolved
Hide resolved
replaced EuiAvatar with a mix of EuiImage and EuiIcon
x-pack/platform/plugins/shared/cases/public/components/files/file_icon.tsx
Outdated
Show resolved
Hide resolved
janmonschke
left a comment
There was a problem hiding this comment.
kibana-cases changes lgtm
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
History
|
This PR closes elastic#222066. Before: https://github.com/user-attachments/assets/d4f82be7-59b8-44f4-bbc0-745e60bb9d62 After: https://github.com/user-attachments/assets/527550e3-5b57-4ac7-8711-6eff0d5c515e **Acceptance criteria**: - On the files attachment tab, show the thumbnails for attached images ✅ - In the activity feed, show the thumbnails for attached images ✅ --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>


This PR closes #222066.
Before:
Screen.Recording.2025-07-01.at.15.01.47.mov
After:
Screen.Recording.2025-07-01.at.15.01.08.mov
Acceptance criteria: