Project

Profile

Help

Story #5378

Index pages on content server

Added by jaymzh 9 months ago. Updated 5 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Platform Release:
Blocks Release:
Backwards Incompatible:
No
Groomed:
No
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:

Description

As a user, I would like to be able to use a browser to view the content served by a Distribution as if it was being served by static file server. The root of each directory should display a listing of that directory.

Solution

If a request is made to a directory in a distribution, the content app will return an html page with a list of all files in that directory and with each item being a hyperlink to the file's location. The list of files will be determined based on the published artifacts in the publication.

Alternatively, plugins can override (or customize) this behavior by creating index.html files. The content app will first check for these files before displaying an html directory listing.


Related issues

Related to Pulp - Story #5397: As a user, I can see an index page at :24816/<CONTENT_PREFIX>/ CLOSED - CURRENTRELEASE Actions
Related to Pulp - Story #5559: As a plugin writer, I cannot export my Publication to POSIX filesystems CLOSED - CURRENTRELEASE Actions

Associated revisions

Revision 3a2ad9b5 View on GitHub
Added by dkliban@redhat.com 7 months ago

Return HTML listing of directories served by content app

This patch enables users to browse each distribution. However, the /pulp/content/ endpoint continues to return a 404.

When a user requests the 'base_url' of a Distribution or any path that ends in '/' inside the Distribution's 'base_url' path, the pulpcore-content app looks for either a PublishedArtifact or ContentArtifact with a relative path equal to 'index.html'. If no such relative path is found for the RepositoryVersion or Publication, an HTML page is dynamically generated and returned.

closes #5378 https://pulp.plan.io/issues/5378

History

#1 Updated by dkliban@redhat.com 9 months ago

  • Tracker changed from Issue to Story
  • Description updated (diff)
  • % Done set to 0

This is 2 feature requests. I'm updating the description of this one and will open a separate story for the 'welcome page index'.

#2 Updated by dkliban@redhat.com 9 months ago

  • Related to Story #5397: As a user, I can see an index page at :24816/<CONTENT_PREFIX>/ added

#3 Updated by daviddavis 9 months ago

  • Sprint/Milestone set to 71

#4 Updated by bmbouter 9 months ago

  • Sprint/Milestone changed from 71 to 3.0.0

#5 Updated by bmbouter 8 months ago

  • Related to Story #5559: As a plugin writer, I cannot export my Publication to POSIX filesystems added

#6 Updated by daviddavis 7 months ago

  • Description updated (diff)

#7 Updated by bmbouter 7 months ago

This rewrite looks good. The only detail I expected differently was the ability to use

index
index.html
index.*

where the mimetype of Content-Type for the content being responded with would match the file extension of index. Alternatively we could accept this story as-is, only support index.html and ensure Content-Type: text/html; is set on the response.

@daviddavis should we accept the story as you've written and save ^ for followup work later?

#8 Updated by daviddavis 7 months ago

@bmbouter do you have some examples of some use cases where plugins/users would use something other than text/html?

#9 Updated by bmbouter 7 months ago

I was imagining a static JSON blob API. Maybe like the PyPI one? https://warehouse.pypa.io/api-reference/json/

Still though a pre-generated json artifacts as content is a little far fetched so we should wait until someone is actually requesting it. I'm ok with only implementing index.html for now.

#10 Updated by daviddavis 7 months ago

+1, sounds good to me.

#11 Updated by bmbouter 7 months ago

We should consider using one of these libraries to easily generate a page with clickable links that looks decent.

https://wiki.python.org/moin/Templating#HTML_Generation_Packages

#12 Updated by dkliban@redhat.com 7 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to dkliban@redhat.com

#13 Updated by dkliban@redhat.com 7 months ago

  • Status changed from ASSIGNED to MODIFIED
  • % Done changed from 0 to 100

#15 Updated by bmbouter 5 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF