Replace Debug View table with rich metadata display matching Download tab

Now Debug View shows assets with same rich metadata as A1→A2 Download tab:

Asset Display Features:
- Asset cards with name, ID, type, file size
- "View Metadata" button for each asset
- Expandable metadata sections:
  - 📋 Basic Info (brown border) - Brand, Country, Language, etc.
  - 🖼️ Content Info (green border) - Width, Height, Duration, etc.
  - 📁 Custom Fields by category (yellow border, collapsible)
  - Full Raw JSON (collapsible for complete asset data)

Uses MetadataExtractor::extractAllMetadata() for rich data extraction.

Workflow:
1. Select campaign
2. Click Master or Final button
3. See all assets in that folder
4. Click "View Metadata" on any asset
5. See complete metadata organized by category
6. Expand/collapse sections as needed
7. View raw JSON for debugging

Perfect match to Download tab's proven UX pattern.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DJP 2025-11-09 14:59:49 -05:00
parent 6aad744fc4
commit 1db2d32309

View file

@ -3795,28 +3795,100 @@ $envInfo = $configV3->getEnvironmentInfo();
</div>
<?php if (count($results['debug_campaign_assets']) > 0): ?>
<table class="results-table">
<thead>
<tr>
<th style="width: 60px;">Type</th>
<th>Asset Name</th>
<th style="width: 150px;">File Size</th>
<th style="width: 120px;">Asset ID</th>
</tr>
</thead>
<tbody>
<?php foreach ($results['debug_campaign_assets'] as $asset): ?>
<tr>
<td>📄</td>
<td style="font-weight: 400;"><?= htmlspecialchars($asset['name'] ?? 'Unknown') ?></td>
<td><?= isset($asset['file_size']) ? number_format($asset['file_size']) . ' bytes' : 'N/A' ?></td>
<td style="font-family: monospace; font-size: 11px; color: #666;">
<?= htmlspecialchars(substr($asset['asset_id'] ?? '', 0, 12)) ?>...
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="asset-list">
<?php foreach ($results['debug_campaign_assets'] as $index => $asset): ?>
<?php
$assetName = extractFolderName($asset);
$assetId = $asset['asset_id'];
$metadataId = 'debug-metadata-' . $index;
?>
<div class="asset-item">
<div class="asset-info">
<strong><?= htmlspecialchars($assetName) ?></strong><br>
<small>ID: <?= htmlspecialchars($assetId) ?></small><br>
<small>Type: <?= htmlspecialchars($asset['mime_type'] ?? 'Unknown') ?></small>
<?php if (isset($asset['file_size'])): ?>
<small> | Size: <?= number_format($asset['file_size']) ?> bytes</small>
<?php endif; ?>
</div>
<div class="asset-actions">
<button class="btn btn-secondary"
onclick="toggleMetadata('<?= $metadataId ?>')">
📋 View Metadata
</button>
</div>
</div>
<div id="<?= $metadataId ?>" class="metadata-display" style="display: none;">
<?php
$metadata = MetadataExtractor::extractAllMetadata($asset);
if (!empty($metadata)):
?>
<div style="font-size: 13px;">
<?php if (isset($metadata['basic'])): ?>
<div style="background: white; padding: 12px; margin: 8px 0; border-radius: 4px; border-left: 4px solid #431b06;">
<strong>📋 Basic Info:</strong><br>
<div style="margin-top: 8px; display: grid; grid-template-columns: 150px 1fr; gap: 5px;">
<?php foreach ($metadata['basic'] as $key => $value): ?>
<?php if ($value !== null): ?>
<div style="color: #666;"><?= ucwords(str_replace('_', ' ', $key)) ?>:</div>
<div><strong><?= htmlspecialchars($value) ?></strong></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?php if (isset($metadata['content'])): ?>
<div style="background: white; padding: 12px; margin: 8px 0; border-radius: 4px; border-left: 4px solid #28a745;">
<strong>🖼️ Content Info:</strong><br>
<div style="margin-top: 8px; display: grid; grid-template-columns: 150px 1fr; gap: 5px;">
<?php foreach ($metadata['content'] as $key => $value): ?>
<?php if ($value !== null && $value !== -1): ?>
<div style="color: #666;"><?= ucwords(str_replace('_', ' ', $key)) ?>:</div>
<div><strong><?= is_string($value) ? htmlspecialchars($value) : $value ?></strong></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?php if (isset($metadata['custom_fields'])): ?>
<?php foreach ($metadata['custom_fields'] as $category => $fields): ?>
<?php if (!empty($fields)): ?>
<details style="background: white; padding: 12px; margin: 8px 0; border-radius: 4px; border-left: 4px solid #ffc107;">
<summary style="cursor: pointer; font-weight: 600; color: #333;">
📁 <?= htmlspecialchars($category) ?> (<?= count($fields) ?> fields)
</summary>
<div style="margin-top: 8px; display: grid; grid-template-columns: 200px 1fr; gap: 5px;">
<?php foreach ($fields as $fieldName => $fieldData): ?>
<div style="color: #666; padding-top: 4px;"><?= htmlspecialchars($fieldName) ?>:</div>
<div style="padding-top: 4px;">
<strong>
<?php
if (is_array($fieldData['value'])) {
echo htmlspecialchars(implode(', ', $fieldData['value']));
} else {
echo htmlspecialchars($fieldData['value']);
}
?>
</strong>
</div>
<?php endforeach; ?>
</div>
</details>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<details style="margin-top: 10px;">
<summary style="cursor: pointer; font-size: 13px;">View Full Raw JSON</summary>
<pre style="background: #f0f0f0; padding: 10px; border-radius: 4px; overflow: auto; max-height: 400px; font-size: 11px; margin-top: 10px;"><?= htmlspecialchars(json_encode($asset, JSON_PRETTY_PRINT)) ?></pre>
</details>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php else: ?>
<p style="color: #999; font-style: italic;">No assets found in this folder</p>
<?php endif; ?>