Skip to content

Commit e09ce38

Browse files
committed
feat: add json viewer
1 parent 544d311 commit e09ce38

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/views/database.slim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ html
7878
| .modal-title { color: #ffc66d; font-size: 16px; font-weight: bold; margin-bottom: 12px; }
7979
| .modal-message { color: #a9b7c6; font-size: 13px; margin-bottom: 20px; }
8080
| .modal-buttons { display: flex; gap: 8px; justify-content: flex-end; }
81+
| .json-box { background: #2b2b2b; border: 1px solid #464749; border-radius: 4px; padding: 12px; overflow-x: auto; max-height: 400px; overflow-y: auto; }
82+
| .json-box pre { margin: 0; font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12px; color: #a9b7c6; white-space: pre; line-height: 1.5; }
83+
| .json-missing { color: #808080; font-size: 12px; font-style: italic; }
84+
| .json-path { color: #808080; font-size: 11px; margin-bottom: 8px; font-family: 'Courier New', monospace; }
8185

8286
body
8387
.modal-overlay id="modal-overlay"
@@ -183,6 +187,18 @@ html
183187
- if page < total_pages
184188
a.pagination-btn href=url_for("/db?source=#{@source}&table=#{current_table}&page=#{page+1}") Next →
185189

190+
- json_path = @route[:mbtiles_file]&.sub(/\.mbtiles$/, '.progress.json')
191+
- json_content = json_path && File.exist?(json_path) ? File.read(json_path) : nil
192+
.section
193+
.section-title Progress JSON
194+
- if json_content
195+
.json-path = json_path
196+
.json-box
197+
pre = JSON.pretty_generate(JSON.parse(json_content)) rescue json_content
198+
- else
199+
.json-path = json_path || '(mbtiles_file not configured)'
200+
.json-missing File not found — progress has not been saved to JSON yet.
201+
186202
javascript:
187203
const BASE_PATH = '#{base_path}';
188204
const SOURCE = '#{@source}';

0 commit comments

Comments
 (0)