LinkDesk/frontend/test-shot-column-visibility...

258 lines
8.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shot Column Visibility Debug</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
line-height: 1.6;
}
.status {
padding: 12px;
border-radius: 6px;
margin: 16px 0;
font-weight: 500;
}
.status.info { background: #e3f2fd; color: #1565c0; border-left: 4px solid #2196f3; }
.status.pass { background: #e8f5e8; color: #2e7d32; border-left: 4px solid #4caf50; }
.status.fail { background: #ffebee; color: #c62828; border-left: 4px solid #f44336; }
.code-block {
background: #f5f5f5;
border: 1px solid #ddd;
border-radius: 4px;
padding: 16px;
margin: 16px 0;
overflow-x: auto;
}
.code {
font-family: 'Monaco', 'Consolas', monospace;
background: #f0f0f0;
padding: 2px 6px;
border-radius: 3px;
font-size: 0.9em;
}
.test-section {
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 20px;
margin: 20px 0;
}
.feature-list {
list-style: none;
padding: 0;
}
.feature-list li {
padding: 8px 0;
border-bottom: 1px solid #eee;
}
.feature-list li:before {
content: "✓ ";
color: #4caf50;
font-weight: bold;
}
table {
width: 100%;
border-collapse: collapse;
margin: 16px 0;
}
th, td {
border: 1px solid #ddd;
padding: 12px;
text-align: left;
}
th {
background: #f5f5f5;
font-weight: 600;
}
.highlight {
background: #fff3cd;
padding: 2px 4px;
border-radius: 3px;
}
</style>
</head>
<body>
<h1>🔍 Shot Column Visibility Debug</h1>
<div class="status info">
<strong>Issue:</strong> Column Visibility Control in ShotTableToolbar is using direct popover but not showing all task type columns including custom task types.
</div>
<div class="test-section">
<h2>📋 Current Implementation Analysis</h2>
<h3>ShotTableToolbar.vue Column Visibility</h3>
<div class="code-block">
// Current allColumns computed property
const allColumns = [
{ id: 'thumbnail', label: 'Thumbnail' },
{ id: 'name', label: 'Shot Name' },
{ id: 'episode', label: 'Episode' },
{ id: 'frameRange', label: 'Frame Range' },
{ id: 'frames', label: 'Frames' },
{ id: 'status', label: 'Status' },
{ id: 'description', label: 'Description' },
...props.allTaskTypes.map(taskType => ({
id: taskType,
label: taskType.charAt(0).toUpperCase() + taskType.slice(1)
}))
]
</div>
<h3>Data Flow</h3>
<ol>
<li><strong>ShotBrowser.vue:</strong> Loads task types via <code>customTaskTypeService.getAllTaskTypes()</code></li>
<li><strong>Sets allTaskTypes:</strong> <code>allTaskTypes.value = data.shot_task_types || []</code></li>
<li><strong>Passes to ShotTableToolbar:</strong> <code>:all-task-types="allTaskTypes"</code></li>
<li><strong>ShotTableToolbar:</strong> Creates columns from <code>props.allTaskTypes</code></li>
</ol>
</div>
<div class="test-section">
<h2>🔧 Potential Issues</h2>
<table>
<thead>
<tr>
<th>Issue</th>
<th>Description</th>
<th>Impact</th>
</tr>
</thead>
<tbody>
<tr>
<td>Timing Issue</td>
<td>Custom task types not loaded when component renders</td>
<td>Missing columns in visibility control</td>
</tr>
<tr>
<td>Reactivity Issue</td>
<td>allColumns not updating when allTaskTypes changes</td>
<td>Static column list</td>
</tr>
<tr>
<td>API Response Issue</td>
<td>shot_task_types not including custom types</td>
<td>Only standard types shown</td>
</tr>
<tr>
<td>Prop Passing Issue</td>
<td>allTaskTypes not properly passed to toolbar</td>
<td>Empty or incomplete task types</td>
</tr>
</tbody>
</table>
</div>
<div class="test-section">
<h2>🔍 Debug Steps</h2>
<h3>1. Check API Response</h3>
<div class="code-block">
// In ShotBrowser.vue loadTaskTypes method, add logging:
const loadTaskTypes = async () => {
if (!props.projectId) return
try {
const data = await customTaskTypeService.getAllTaskTypes(props.projectId)
console.log('🔍 API Response:', data)
console.log('🔍 Shot Task Types:', data.shot_task_types)
allTaskTypes.value = data.shot_task_types || []
console.log('🔍 Final allTaskTypes:', allTaskTypes.value)
} catch (err) {
console.error('Failed to load task types:', err)
}
}
</div>
<h3>2. Check Prop Passing</h3>
<div class="code-block">
// In ShotTableToolbar.vue, add logging in setup:
console.log('🔍 ShotTableToolbar allTaskTypes prop:', props.allTaskTypes)
// Watch for changes
watch(() => props.allTaskTypes, (newTypes) => {
console.log('🔍 allTaskTypes changed:', newTypes)
}, { immediate: true })
</div>
<h3>3. Check Column Generation</h3>
<div class="code-block">
// In ShotTableToolbar.vue, make allColumns reactive:
const allColumns = computed(() => {
const columns = [
{ id: 'thumbnail', label: 'Thumbnail' },
{ id: 'name', label: 'Shot Name' },
{ id: 'episode', label: 'Episode' },
{ id: 'frameRange', label: 'Frame Range' },
{ id: 'frames', label: 'Frames' },
{ id: 'status', label: 'Status' },
{ id: 'description', label: 'Description' },
...props.allTaskTypes.map(taskType => ({
id: taskType,
label: taskType.charAt(0).toUpperCase() + taskType.slice(1)
}))
]
console.log('🔍 Generated columns:', columns)
return columns
})
</div>
</div>
<div class="test-section">
<h2>🛠️ Proposed Fix</h2>
<div class="status info">
The issue is likely that <code>allColumns</code> is not reactive to changes in <code>props.allTaskTypes</code>.
It should be a computed property instead of a static array.
</div>
<h3>Updated ShotTableToolbar.vue</h3>
<div class="code-block">
// Change from static array to computed property
const allColumns = computed(() => [
{ id: 'thumbnail', label: 'Thumbnail' },
{ id: 'name', label: 'Shot Name' },
{ id: 'episode', label: 'Episode' },
{ id: 'frameRange', label: 'Frame Range' },
{ id: 'frames', label: 'Frames' },
{ id: 'status', label: 'Status' },
{ id: 'description', label: 'Description' },
...props.allTaskTypes.map(taskType => ({
id: taskType,
label: taskType.charAt(0).toUpperCase() + taskType.slice(1)
}))
])
</div>
<h3>Benefits</h3>
<ul class="feature-list">
<li>Reactive to changes in allTaskTypes prop</li>
<li>Automatically includes custom task types when loaded</li>
<li>Maintains proper column visibility state</li>
<li>Consistent with Vue 3 reactivity patterns</li>
</ul>
</div>
<div class="test-section">
<h2>📝 Implementation Plan</h2>
<ol>
<li><strong>Update ShotTableToolbar.vue:</strong> Make allColumns a computed property</li>
<li><strong>Add Debug Logging:</strong> Verify task types are loaded correctly</li>
<li><strong>Test Column Visibility:</strong> Ensure all task types appear in popover</li>
<li><strong>Verify Reactivity:</strong> Check that adding custom task types updates columns</li>
</ol>
</div>
<script>
console.log('Shot Column Visibility Debug');
console.log('Ready to investigate column visibility issues');
</script>
</body>
</html>