Spaces:
Running
Running
update
Browse files- index.html +109 -2
index.html
CHANGED
|
@@ -33,6 +33,35 @@
|
|
| 33 |
align-items: center;
|
| 34 |
gap: 10px;
|
| 35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
#contentWrapper {
|
| 37 |
position: relative;
|
| 38 |
margin-top: 20px;
|
|
@@ -152,6 +181,13 @@
|
|
| 152 |
<button id="resetBtn" class="button reset-button">Reset</button>
|
| 153 |
</div>
|
| 154 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
<div id="contentWrapper">
|
| 156 |
<div id="tabContainer" class="tab-list"></div>
|
| 157 |
<div id="contentContainer"></div>
|
|
@@ -297,24 +333,95 @@
|
|
| 297 |
activeTab = '';
|
| 298 |
originalFileName = '';
|
| 299 |
document.getElementById('fileInput').value = '';
|
|
|
|
| 300 |
renderInterface();
|
| 301 |
}
|
| 302 |
|
| 303 |
function getVariantIds() {
|
| 304 |
return Object.keys(data).filter(key =>
|
| 305 |
!key.includes('_feedback') &&
|
| 306 |
-
!key.includes('_correct') &&
|
|
|
|
| 307 |
key !== 'node' &&
|
| 308 |
key !== 'textValue' &&
|
| 309 |
-
key !== 'variantNodeId'
|
|
|
|
|
|
|
| 310 |
);
|
| 311 |
}
|
| 312 |
|
| 313 |
function renderInterface() {
|
|
|
|
| 314 |
renderTabs();
|
| 315 |
renderContent();
|
| 316 |
}
|
| 317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
function renderTabs() {
|
| 319 |
const tabContainer = document.getElementById('tabContainer');
|
| 320 |
tabContainer.innerHTML = '';
|
|
|
|
| 33 |
align-items: center;
|
| 34 |
gap: 10px;
|
| 35 |
}
|
| 36 |
+
.metadata-container {
|
| 37 |
+
background: white;
|
| 38 |
+
padding: 15px;
|
| 39 |
+
margin: 20px 0;
|
| 40 |
+
border-radius: 8px;
|
| 41 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 42 |
+
}
|
| 43 |
+
.metadata-item {
|
| 44 |
+
margin-bottom: 10px;
|
| 45 |
+
}
|
| 46 |
+
.metadata-key {
|
| 47 |
+
font-weight: bold;
|
| 48 |
+
margin-right: 8px;
|
| 49 |
+
}
|
| 50 |
+
.metadata-value {
|
| 51 |
+
word-break: break-word;
|
| 52 |
+
}
|
| 53 |
+
.metadata-list {
|
| 54 |
+
margin: 5px 0 0 20px;
|
| 55 |
+
padding-left: 0;
|
| 56 |
+
}
|
| 57 |
+
.metadata-header {
|
| 58 |
+
display: flex;
|
| 59 |
+
justify-content: space-between;
|
| 60 |
+
align-items: center;
|
| 61 |
+
margin-bottom: 10px;
|
| 62 |
+
border-bottom: 1px solid #e0e0e0;
|
| 63 |
+
padding-bottom: 8px;
|
| 64 |
+
}
|
| 65 |
#contentWrapper {
|
| 66 |
position: relative;
|
| 67 |
margin-top: 20px;
|
|
|
|
| 181 |
<button id="resetBtn" class="button reset-button">Reset</button>
|
| 182 |
</div>
|
| 183 |
</div>
|
| 184 |
+
<div id="metadataContainer" class="metadata-container">
|
| 185 |
+
<div class="metadata-header">
|
| 186 |
+
<h3 style="margin-top: 0; display: inline-block;">Metadata</h3>
|
| 187 |
+
<button id="toggleMetadata" class="button" style="float: right; padding: 4px 8px; margin: 0;">Toggle</button>
|
| 188 |
+
</div>
|
| 189 |
+
<div id="metadataContent"></div>
|
| 190 |
+
</div>
|
| 191 |
<div id="contentWrapper">
|
| 192 |
<div id="tabContainer" class="tab-list"></div>
|
| 193 |
<div id="contentContainer"></div>
|
|
|
|
| 333 |
activeTab = '';
|
| 334 |
originalFileName = '';
|
| 335 |
document.getElementById('fileInput').value = '';
|
| 336 |
+
document.getElementById('metadataContainer').innerHTML = '';
|
| 337 |
renderInterface();
|
| 338 |
}
|
| 339 |
|
| 340 |
function getVariantIds() {
|
| 341 |
return Object.keys(data).filter(key =>
|
| 342 |
!key.includes('_feedback') &&
|
| 343 |
+
!key.includes('_correct') &&
|
| 344 |
+
!key.includes('_new') &&
|
| 345 |
key !== 'node' &&
|
| 346 |
key !== 'textValue' &&
|
| 347 |
+
key !== 'variantNodeId' &&
|
| 348 |
+
key !== 'metadata' &&
|
| 349 |
+
key !== 'mapper'
|
| 350 |
);
|
| 351 |
}
|
| 352 |
|
| 353 |
function renderInterface() {
|
| 354 |
+
renderMetadata();
|
| 355 |
renderTabs();
|
| 356 |
renderContent();
|
| 357 |
}
|
| 358 |
|
| 359 |
+
function renderMetadata() {
|
| 360 |
+
const metadataContainer = document.getElementById('metadataContainer');
|
| 361 |
+
const metadataContent = document.getElementById('metadataContent');
|
| 362 |
+
metadataContent.innerHTML = '';
|
| 363 |
+
|
| 364 |
+
if (!data.metadata) {
|
| 365 |
+
metadataContainer.style.display = 'none';
|
| 366 |
+
return;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
metadataContainer.style.display = 'block';
|
| 370 |
+
|
| 371 |
+
Object.entries(data.metadata).forEach(([key, value]) => {
|
| 372 |
+
const item = document.createElement('div');
|
| 373 |
+
item.className = 'metadata-item';
|
| 374 |
+
|
| 375 |
+
const keySpan = document.createElement('span');
|
| 376 |
+
keySpan.className = 'metadata-key';
|
| 377 |
+
keySpan.textContent = key + ':';
|
| 378 |
+
item.appendChild(keySpan);
|
| 379 |
+
|
| 380 |
+
// Handle different types of values
|
| 381 |
+
if (Array.isArray(value)) {
|
| 382 |
+
const valueSpan = document.createElement('span');
|
| 383 |
+
valueSpan.className = 'metadata-value';
|
| 384 |
+
item.appendChild(valueSpan);
|
| 385 |
+
|
| 386 |
+
const list = document.createElement('ul');
|
| 387 |
+
list.className = 'metadata-list';
|
| 388 |
+
|
| 389 |
+
value.forEach(item => {
|
| 390 |
+
const listItem = document.createElement('li');
|
| 391 |
+
listItem.textContent = item;
|
| 392 |
+
list.appendChild(listItem);
|
| 393 |
+
});
|
| 394 |
+
|
| 395 |
+
item.appendChild(list);
|
| 396 |
+
} else if (typeof value === 'object' && value !== null) {
|
| 397 |
+
const valueSpan = document.createElement('span');
|
| 398 |
+
valueSpan.className = 'metadata-value';
|
| 399 |
+
valueSpan.textContent = JSON.stringify(value, null, 2);
|
| 400 |
+
item.appendChild(valueSpan);
|
| 401 |
+
} else {
|
| 402 |
+
const valueSpan = document.createElement('span');
|
| 403 |
+
valueSpan.className = 'metadata-value';
|
| 404 |
+
valueSpan.textContent = value;
|
| 405 |
+
item.appendChild(valueSpan);
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
metadataContent.appendChild(item);
|
| 409 |
+
});
|
| 410 |
+
|
| 411 |
+
// Initialize toggle functionality
|
| 412 |
+
const toggleBtn = document.getElementById('toggleMetadata');
|
| 413 |
+
toggleBtn.onclick = toggleMetadataVisibility;
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
function toggleMetadataVisibility() {
|
| 417 |
+
const content = document.getElementById('metadataContent');
|
| 418 |
+
if (content.style.display === 'none') {
|
| 419 |
+
content.style.display = 'block';
|
| 420 |
+
} else {
|
| 421 |
+
content.style.display = 'none';
|
| 422 |
+
}
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
function renderTabs() {
|
| 426 |
const tabContainer = document.getElementById('tabContainer');
|
| 427 |
tabContainer.innerHTML = '';
|