Skip to content

Commit 915842e

Browse files
authored
Merge branch 'main' into julien/simplify-store
2 parents 1e26328 + 455b6c1 commit 915842e

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

pkg/rpc/server/da_visualization.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@ func (s *DAVisualizationServer) handleDAVisualizationHTML(w http.ResponseWriter,
503503
switch v := items.(type) {
504504
case []DASubmissionInfo:
505505
return len(v)
506+
case []string:
507+
return len(v)
506508
case struct {
507509
Submissions []DASubmissionInfo
508510
LastUpdate string
@@ -513,6 +515,15 @@ func (s *DAVisualizationServer) handleDAVisualizationHTML(w http.ResponseWriter,
513515
return 0
514516
}
515517
},
518+
"subtract": func(a, b int) int {
519+
return a - b
520+
},
521+
"lt": func(a, b int) bool {
522+
return a < b
523+
},
524+
"le": func(a, b int) bool {
525+
return a <= b
526+
},
516527
}).Parse(daVisualizationHTML)
517528

518529
if err != nil {

pkg/rpc/server/templates/da_visualization.html

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
.method-post { background-color: #49cc90; color: white; }
2828
.example-link { color: #007cba; text-decoration: none; font-size: 13px; }
2929
.example-link:hover { text-decoration: underline; }
30+
.blob-ids { margin-top: 5px; }
31+
.blob-ids-preview { display: inline; }
32+
.blob-ids-full { display: none; max-height: 200px; overflow-y: auto; margin-top: 5px; padding: 5px; background: #fafafa; border-radius: 3px; }
33+
.blob-ids-full.expanded { display: block; }
34+
.blob-toggle { background: none; border: 1px solid #007cba; color: #007cba; padding: 2px 8px; border-radius: 3px; cursor: pointer; font-size: 11px; margin-left: 5px; }
35+
.blob-toggle:hover { background: #007cba; color: white; }
3036
</style>
3137
</head>
3238
<body>
@@ -177,12 +183,27 @@ <h2>Recent Submissions</h2>
177183
<td>
178184
{{.NumBlobs}}
179185
{{if .BlobIDs}}
186+
{{$namespace := .Namespace}}
187+
{{$numBlobs := len .BlobIDs}}
188+
{{if le $numBlobs 5}}
180189
<div class="blob-ids">
181-
{{$namespace := .Namespace}}
182190
{{range .BlobIDs}}
183191
<a href="/da/blob?id={{.}}&namespace={{$namespace}}" class="blob-link blob-id" title="Click to view blob details">{{slice . 0 8}}...</a>
184192
{{end}}
185193
</div>
194+
{{else}}
195+
<div class="blob-ids">
196+
<span class="blob-ids-preview">
197+
{{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}}
198+
</span>
199+
<button class="blob-toggle" onclick="toggleBlobs(this)">+{{subtract $numBlobs 3}} more</button>
200+
<div class="blob-ids-full">
201+
{{range .BlobIDs}}
202+
<a href="/da/blob?id={{.}}&namespace={{$namespace}}" class="blob-link blob-id" title="Click to view blob details">{{slice . 0 8}}...</a>
203+
{{end}}
204+
</div>
205+
</div>
206+
{{end}}
186207
{{end}}
187208
</td>
188209
<td>{{.BlobSize}}</td>
@@ -215,6 +236,25 @@ <h2>Node Information</h2>
215236
location.reload();
216237
}
217238
}, 1000);
239+
240+
// Toggle blob list expansion
241+
function toggleBlobs(btn) {
242+
const container = btn.parentElement;
243+
const fullList = container.querySelector('.blob-ids-full');
244+
const preview = container.querySelector('.blob-ids-preview');
245+
const isExpanded = fullList.classList.contains('expanded');
246+
247+
if (isExpanded) {
248+
fullList.classList.remove('expanded');
249+
preview.style.display = 'inline';
250+
btn.textContent = btn.dataset.expandText;
251+
} else {
252+
fullList.classList.add('expanded');
253+
preview.style.display = 'none';
254+
btn.dataset.expandText = btn.textContent;
255+
btn.textContent = 'Show less';
256+
}
257+
}
218258
</script>
219259
</body>
220260
</html>

0 commit comments

Comments
 (0)