-
Notifications
You must be signed in to change notification settings - Fork 248
feat: Add collapsible blob list in DA Explorer #3033
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,6 +27,12 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .method-post { background-color: #49cc90; color: white; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .example-link { color: #007cba; text-decoration: none; font-size: 13px; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .example-link:hover { text-decoration: underline; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .blob-ids { margin-top: 5px; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .blob-ids-preview { display: inline; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .blob-ids-full { display: none; max-height: 200px; overflow-y: auto; margin-top: 5px; padding: 5px; background: #fafafa; border-radius: 3px; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .blob-ids-full.expanded { display: block; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .blob-toggle { background: none; border: 1px solid #007cba; color: #007cba; padding: 2px 8px; border-radius: 3px; cursor: pointer; font-size: 11px; margin-left: 5px; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .blob-toggle:hover { background: #007cba; color: white; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </style> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </head> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <body> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -177,12 +183,27 @@ <h2>Recent Submissions</h2> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <td> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{.NumBlobs}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{if .BlobIDs}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{$namespace := .Namespace}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{$numBlobs := len .BlobIDs}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{if le $numBlobs 5}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div class="blob-ids"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{$namespace := .Namespace}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{range .BlobIDs}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <a href="/da/blob?id={{.}}&namespace={{$namespace}}" class="blob-link blob-id" title="Click to view blob details">{{slice . 0 8}}...</a> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{end}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{else}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div class="blob-ids"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span class="blob-ids-preview"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{range $i, $id := .BlobIDs}}{{if lt $i 3}}<a href="/da/blob?id={{$id}}&namespace={{$namespace}}" class="blob-link blob-id" title="Click to view blob details">{{slice $id 0 8}}...</a>{{end}}{{end}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <button class="blob-toggle" onclick="toggleBlobs(this)">+{{subtract $numBlobs 3}} more</button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <div class="blob-ids-full"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{range .BlobIDs}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <a href="/da/blob?id={{.}}&namespace={{$namespace}}" class="blob-link blob-id" title="Click to view blob details">{{slice . 0 8}}...</a> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{end}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{end}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{end}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </td> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <td>{{.BlobSize}}</td> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -215,6 +236,25 @@ <h2>Node Information</h2> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| location.reload(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, 1000); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Toggle blob list expansion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function toggleBlobs(btn) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const container = btn.parentElement; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const fullList = container.querySelector('.blob-ids-full'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const preview = container.querySelector('.blob-ids-preview'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const isExpanded = fullList.classList.contains('expanded'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (isExpanded) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fullList.classList.remove('expanded'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| preview.style.display = 'inline'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| btn.textContent = btn.dataset.expandText; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fullList.classList.add('expanded'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| preview.style.display = 'none'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| btn.dataset.expandText = btn.textContent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| btn.textContent = 'Show less'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+241
to
+257
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </body> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </html> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The HTML for rendering a blob link is duplicated in three places within this block (for <=5 blobs, for the preview of >5 blobs, and for the full list of >5 blobs). This could lead to inconsistencies if the link format needs to be changed in the future.
To improve maintainability, you could define a reusable template for the link using
{{define}}. For example, you could add this somewhere in your template file (e.g., at the top):{{define "blobLink"}}<a href="/da/blob?id={{.id}}&namespace={{.namespace}}" class="blob-link blob-id" title="Click to view blob details">{{slice .id 0 8}}...</a>{{end}}Then, you can replace each instance of the
<a>tag with a call to this template, for example:{{range .BlobIDs}}{{template "blobLink" (dict "id" . "namespace" $namespace)}}{{end}}This change would centralize the blob link's HTML, making it easier to update.