cockpit-project / cockpit-files

A Featureful File Browser for Cockpit (Modernized and tested version of https://github.com/45Drives/cockpit-navigator)
GNU Lesser General Public License v2.1
41 stars 26 forks source link

"File Browser" should display pictures and pdf files in Cockpit #734

Open yu-shao-gm opened 1 week ago

yu-shao-gm commented 1 week ago

Page: File Browser

Currently, if I use File Browser to open a picture file, double click on the file will only show the metadata information on the right side of screen. I expect File Browser would be able to display the picture inside the the main area of the screen, same as for pdf files.

mac2net commented 1 week ago

Patience

mgoodwi commented 1 week ago

Patience

Is there a roadmap for features like this one?

mac2net commented 1 week ago

As far as I know, it's being actively worked on right now.

garrett commented 1 week ago

@yu-shao-gm: How would you use this feature? I'm asking why you'd like to view pictures and PDFs from a server in Cockpit files. Basically: What are you doing, and how would Cockpit Files solve that?


As far as a UI, it would probably need to be a modal (not in the sidebar, especially as that's going away), and could have the following abilities:

  1. Open image or PDF in new tab (for filetypes with native browser support, to let the browser handle full viewing)
  2. Download
  3. Change viewing scale (that is, if you see it all at once or 1:1 and pan around, for example)
  4. Show only when under a certain filesize; like limit it to 5 MB or 10 MB or something like that, but still have a way to download the file or perhaps override the limit (similar to what GitHub does for file viewing inline in PRs, but with a larger limit)
  5. We could possibly have a next/previous button when viewing an image (which would just cycle through the images)

Just because it's on this list won't mean we will implement it. Although, I think these are all probably pretty useful, and we will absolutely need file size limitations, as we wouldn't want to try to view a 1 GB picture or PDF in a browser.

(Implementation detail, probably for @jelly: I think instead of hotlinking the file, we might need to stream it with a data URI? Or would we be able to do a get request somehow, which could be cachable?)

garrett commented 1 week ago

@yu-shao-gm: Based on our conversation, I guess the scenario would be this?

  1. Someone screenshots errors of their computer misbehaving
  2. They put it in a special folder only an admin can see (it could be mounted locally via SSH, uploaded to another machine, etc.)
  3. Admin browses to the location of the error screenshots (either uploaded to a machine or a shared network directory)
  4. Admin views the screenshots in Cockpit Files

No guarantees we can or will do this, but I'll consider this when working on the design.

ryan-blakley commented 1 week ago

So the scenario is to provide an easier method of viewing files that require a GUI application on a server without a GUI installed so images, pdfs, doc files, etc. I can elaborate more, and provide internal links via email if that helps, I'd prefer not to mention the full scenario on here.

yu-shao-gm commented 1 week ago

@garrett

What I am looking for is the easiest way to view the images/pdfs etc without the need to right click and download.

Here is the screenshot of when using JupyterLab how a picture is rendered, I am looking for something similar: image

mac2net commented 1 week ago

Is this something for Cockpit? I would prefer code syntax in the file editor which is more appropriate for the central mission of Cockpit. If you want document management, why. not roll your own WordPress site in a cockpit generated VM and use a fancy plugin?

mac2net commented 1 week ago

You can also get a utility like CloudMounterwhich enables one to mount also sorts of cloud formats and SFTP in the Mac Finder and Windows too. Then, just press the space bar on an image or hit Command-4 to view as a gallery on the Mac. Here is the view of my WordPress-->wp-content-->uploads folder. It also works with PDFs!

image image
yu-shao-gm commented 1 week ago

@mac2net Thanks, I found there is no linux version of the software, it runs on Mac or Windows only, and I personally expect cockpit-files would become like that.

mac2net commented 1 week ago

You're wrong. First of all, an SFTP mounter is built into Linux file managers. From there all you have to do is assign the appropriate file viewer for the file type and then pressing the space bar works exactly the same. For PDF, I installed Evince on my Alma VM. Image viewers are already installed.

ryan-blakley commented 1 week ago

@mac2net So we want to use a Red Hat product for our use case, we already have a custom internal web application that's filling this role. But we're wanting to get rid of it, and simplify what we have to support by only installing cockpit and the specific plugins. Another reason for cockpit is it's authentication system, that fills the security requirements we have to meet. So if we could please keep the topic of this RFE on cockpit that would be great.

garrett commented 6 days ago

(@mac2net: Please watch your tone, and please also stay on topic if you're going to participate in issues here. Thanks!)

mac2net commented 6 days ago

I apologise if my tone offended anyone. Is the Cockpit use case as a media viewer? Did I miss something? Wouldn't it take a huge effort to reproduce functionality that already exists elsewhere? Cockpit Navigator explicitly dissuades from opening binary files. Isn't that the preferable solution?

image
mac2net commented 6 days ago

@mac2net So we want to use a Red Hat product for our use case, we already have a custom internal web application that's filling this role. But we're wanting to get rid of it, and simplify what we have to support by only installing cockpit and the specific plugins. Another reason for cockpit is it's authentication system, that fills the security requirements we have to meet. So if we could please keep the topic of this RFE on cockpit that would be great.

Not sure what you mean. I am not knowledgeable regarding what Red Hat product you are referencing.

ryan-blakley commented 6 days ago

@mac2net So we want to use a Red Hat product for our use case, we already have a custom internal web application that's filling this role. But we're wanting to get rid of it, and simplify what we have to support by only installing cockpit and the specific plugins. Another reason for cockpit is it's authentication system, that fills the security requirements we have to meet. So if we could please keep the topic of this RFE on cockpit that would be great.

Not sure what you mean. I am not knowledgeable regarding what Red Hat product you are referencing.

Cockpit is a Red Hat maintained product, or Red Hat sponsored project is maybe a better term.

mac2net commented 6 days ago

I love Cockpit. I had no idea that there was a desire to add a media viewer. I was aware of the discussion to add syntax highlighting to text format config files.

ryan-blakley commented 6 days ago

I don't understand your point, this is an RFE. We're requesting this as a feature to add in the future, so yes it's our desire to add a media viewer. The cockpit team can decide if they want to add this feature or not, that's the whole point of an RFE.