- Add .gitignore to exclude node_modules, dist, logs, and system files - Add comprehensive project documentation including README, deployment guide, and development setup - Add .kiro project specifications for amazon-product-bar-extension, appwrite-cloud-storage, appwrite-userid-repair, blacklist-feature, and enhanced-item-management - Add .kiro steering documents for product, structure, styling, and tech guidelines - Add VSCode settings configuration for consistent development environment - Add manifest.json and babel/vite configuration for extension build setup - Add complete source code implementation including AppWrite integration, storage managers, UI components, and services - Add comprehensive test suite with Jest configuration and 30+ test files covering all major modules - Add test HTML files for integration testing and validation - Add coverage reports and build validation scripts - Add AppWrite setup and repair documentation for database schema management - Add migration guides and responsive accessibility implementation documentation - Establish foundation for Amazon product bar extension with full feature set including blacklist management, enhanced item workflows, and real-time synchronization
294 lines
12 KiB
HTML
294 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>userId Attribute Fix Verification - Amazon Extension</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 20px;
|
|
background: #f5f5f5;
|
|
}
|
|
.container {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
}
|
|
.status {
|
|
padding: 15px;
|
|
margin: 15px 0;
|
|
border-radius: 8px;
|
|
font-weight: bold;
|
|
}
|
|
.success { background: #d4edda; color: #155724; border: 2px solid #c3e6cb; }
|
|
.error { background: #f8d7da; color: #721c24; border: 2px solid #f5c6cb; }
|
|
.warning { background: #fff3cd; color: #856404; border: 2px solid #ffeaa7; }
|
|
.info { background: #d1ecf1; color: #0c5460; border: 2px solid #bee5eb; }
|
|
|
|
.collection-status {
|
|
margin: 10px 0;
|
|
padding: 10px;
|
|
border-radius: 4px;
|
|
font-family: monospace;
|
|
}
|
|
|
|
button {
|
|
background: #007bff;
|
|
color: white;
|
|
border: none;
|
|
padding: 12px 24px;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
margin: 10px 5px;
|
|
font-size: 16px;
|
|
}
|
|
|
|
button:hover {
|
|
background: #0056b3;
|
|
}
|
|
|
|
.log {
|
|
background: #f8f9fa;
|
|
border: 1px solid #e9ecef;
|
|
padding: 15px;
|
|
margin: 15px 0;
|
|
border-radius: 6px;
|
|
font-family: monospace;
|
|
font-size: 14px;
|
|
max-height: 400px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.fix-instructions {
|
|
background: #fff3cd;
|
|
border: 2px solid #ffeaa7;
|
|
padding: 20px;
|
|
margin: 20px 0;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.fix-step {
|
|
margin: 10px 0;
|
|
padding: 8px;
|
|
background: rgba(255,255,255,0.7);
|
|
border-radius: 4px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>🔧 userId Attribute Fix Verification</h1>
|
|
|
|
<div class="status info">
|
|
<strong>Zweck:</strong> Überprüft, ob alle AppWrite Collections das erforderliche <code>userId</code>-Attribut haben.
|
|
</div>
|
|
|
|
<button onclick="testUserIdAttributes()">🧪 userId Attribute testen</button>
|
|
<button onclick="clearLog()">Log löschen</button>
|
|
|
|
<div id="results-container" style="display: none;">
|
|
<h2>Test Ergebnisse</h2>
|
|
<div id="overall-status"></div>
|
|
<div id="collection-results"></div>
|
|
</div>
|
|
|
|
<div id="fix-instructions" class="fix-instructions" style="display: none;">
|
|
<h3>🔧 Reparatur erforderlich</h3>
|
|
<p><strong>Einige Collections fehlt das userId-Attribut. Folgen Sie diesen Schritten:</strong></p>
|
|
|
|
<div class="fix-step">
|
|
<strong>1.</strong> AppWrite Console öffnen: <a href="https://appwrite.webklar.com" target="_blank">https://appwrite.webklar.com</a>
|
|
</div>
|
|
|
|
<div class="fix-step">
|
|
<strong>2.</strong> Gehe zu: Databases → amazon-extension-db
|
|
</div>
|
|
|
|
<div class="fix-step">
|
|
<strong>3.</strong> Für jede fehlgeschlagene Collection:
|
|
<ul>
|
|
<li>Auf Collection-Name klicken</li>
|
|
<li>"Attributes" Tab öffnen</li>
|
|
<li>"Create Attribute" klicken</li>
|
|
<li>Type: <strong>String</strong></li>
|
|
<li>Key: <strong>userId</strong></li>
|
|
<li>Size: <strong>255</strong></li>
|
|
<li>Required: <strong>✅ Ja</strong></li>
|
|
<li>Array: <strong>❌ Nein</strong></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="fix-step">
|
|
<strong>4.</strong> Nach dem Hinzufügen: Extension neu laden und erneut testen
|
|
</div>
|
|
|
|
<p><strong>📖 Detaillierte Anleitung:</strong> Siehe <code>APPWRITE_USERID_ATTRIBUTE_FIX.md</code></p>
|
|
</div>
|
|
|
|
<h2>Test Log</h2>
|
|
<div id="test-log" class="log">Warten auf Test...</div>
|
|
</div>
|
|
|
|
<!-- Load the extension content script -->
|
|
<script src="dist/content.js"></script>
|
|
|
|
<script>
|
|
let logContainer = document.getElementById('test-log');
|
|
|
|
function log(message, type = 'info') {
|
|
const timestamp = new Date().toLocaleTimeString();
|
|
const logEntry = document.createElement('div');
|
|
const color = type === 'error' ? 'red' : type === 'success' ? 'green' : type === 'warning' ? 'orange' : 'blue';
|
|
logEntry.innerHTML = `<span style="color: #666;">[${timestamp}]</span> <span style="color: ${color};">${message}</span>`;
|
|
logContainer.appendChild(logEntry);
|
|
logContainer.scrollTop = logContainer.scrollHeight;
|
|
}
|
|
|
|
function clearLog() {
|
|
logContainer.innerHTML = 'Log gelöscht...';
|
|
document.getElementById('results-container').style.display = 'none';
|
|
document.getElementById('fix-instructions').style.display = 'none';
|
|
}
|
|
|
|
async function testUserIdAttributes() {
|
|
log('🚀 Starte userId Attribut Test...', 'info');
|
|
|
|
if (!window.appWriteManager) {
|
|
log('❌ AppWriteManager nicht verfügbar - Extension nicht geladen?', 'error');
|
|
return;
|
|
}
|
|
|
|
const collections = [
|
|
'amazon-ext-enhanced-items',
|
|
'amazon-ext-saved-products',
|
|
'amazon_ext_blacklist',
|
|
'amazon-ext-enhanced-settings',
|
|
'amazon-ext-migration-status'
|
|
];
|
|
|
|
let results = {};
|
|
let successCount = 0;
|
|
let failCount = 0;
|
|
|
|
for (const collectionId of collections) {
|
|
log(`🧪 Teste Collection: ${collectionId}`, 'info');
|
|
|
|
try {
|
|
// Test query with userId filter - this will fail if userId attribute doesn't exist
|
|
const testQuery = {
|
|
method: 'equal',
|
|
attribute: 'userId',
|
|
values: ['test-user-id-12345']
|
|
};
|
|
|
|
const result = await window.appWriteManager.listDocuments(collectionId, [testQuery]);
|
|
|
|
log(` ✅ ${collectionId}: userId Attribut vorhanden`, 'success');
|
|
results[collectionId] = { success: true, message: 'userId Attribut vorhanden' };
|
|
successCount++;
|
|
|
|
} catch (error) {
|
|
if (error.message.includes('Attribute not found in schema: userId')) {
|
|
log(` ❌ ${collectionId}: userId Attribut FEHLT!`, 'error');
|
|
results[collectionId] = { success: false, message: 'userId Attribut fehlt' };
|
|
failCount++;
|
|
} else if (error.message.includes('Collection not found')) {
|
|
log(` ❌ ${collectionId}: Collection existiert nicht!`, 'error');
|
|
results[collectionId] = { success: false, message: 'Collection nicht gefunden' };
|
|
failCount++;
|
|
} else if (error.message.includes('not authorized') || error.message.includes('401')) {
|
|
log(` ⚠️ ${collectionId}: Berechtigungsfehler (aber userId Attribut scheint zu existieren)`, 'warning');
|
|
results[collectionId] = { success: true, message: 'userId vorhanden, aber Berechtigungsfehler' };
|
|
successCount++;
|
|
} else {
|
|
log(` ⚠️ ${collectionId}: Unbekannter Fehler: ${error.message}`, 'warning');
|
|
results[collectionId] = { success: false, message: `Unbekannter Fehler: ${error.message}` };
|
|
failCount++;
|
|
}
|
|
}
|
|
|
|
// Small delay between tests
|
|
await new Promise(resolve => setTimeout(resolve, 300));
|
|
}
|
|
|
|
// Show results
|
|
showResults(results, successCount, failCount, collections.length);
|
|
}
|
|
|
|
function showResults(results, successCount, failCount, totalCount) {
|
|
const resultsContainer = document.getElementById('results-container');
|
|
const overallStatus = document.getElementById('overall-status');
|
|
const collectionResults = document.getElementById('collection-results');
|
|
const fixInstructions = document.getElementById('fix-instructions');
|
|
|
|
resultsContainer.style.display = 'block';
|
|
|
|
// Overall status
|
|
if (failCount === 0) {
|
|
overallStatus.innerHTML = `
|
|
<div class="status success">
|
|
🎉 <strong>Alle Collections sind korrekt konfiguriert!</strong><br>
|
|
✅ ${successCount}/${totalCount} Collections haben das userId Attribut
|
|
</div>
|
|
`;
|
|
fixInstructions.style.display = 'none';
|
|
log(`\n🎉 ERFOLG: Alle ${totalCount} Collections haben das userId Attribut!`, 'success');
|
|
} else {
|
|
overallStatus.innerHTML = `
|
|
<div class="status error">
|
|
❌ <strong>Reparatur erforderlich!</strong><br>
|
|
${failCount}/${totalCount} Collections fehlt das userId Attribut
|
|
</div>
|
|
`;
|
|
fixInstructions.style.display = 'block';
|
|
log(`\n🔧 AKTION ERFORDERLICH: ${failCount} Collections müssen repariert werden`, 'error');
|
|
}
|
|
|
|
// Individual collection results
|
|
let collectionHtml = '<h3>Collection Details:</h3>';
|
|
Object.entries(results).forEach(([collection, result]) => {
|
|
const statusClass = result.success ? 'success' : 'error';
|
|
const icon = result.success ? '✅' : '❌';
|
|
collectionHtml += `
|
|
<div class="collection-status ${statusClass}">
|
|
${icon} <strong>${collection}</strong>: ${result.message}
|
|
</div>
|
|
`;
|
|
});
|
|
collectionResults.innerHTML = collectionHtml;
|
|
|
|
// Log summary
|
|
log(`\n📊 Zusammenfassung:`, 'info');
|
|
log(` ✅ Erfolgreich: ${successCount}/${totalCount}`, 'success');
|
|
log(` ❌ Fehlgeschlagen: ${failCount}/${totalCount}`, failCount > 0 ? 'error' : 'success');
|
|
|
|
if (failCount > 0) {
|
|
log(`\n🔧 Nächste Schritte:`, 'warning');
|
|
log(` 1. AppWrite Console öffnen`, 'info');
|
|
log(` 2. userId Attribut zu fehlgeschlagenen Collections hinzufügen`, 'info');
|
|
log(` 3. Extension neu laden und erneut testen`, 'info');
|
|
}
|
|
}
|
|
|
|
// Auto-run test when page loads
|
|
window.addEventListener('load', () => {
|
|
log('🔧 userId Attribut Test geladen', 'info');
|
|
|
|
setTimeout(() => {
|
|
if (window.appWriteManager) {
|
|
log('✅ AppWriteManager erkannt', 'success');
|
|
// Auto-run the test after a short delay
|
|
setTimeout(testUserIdAttributes, 1000);
|
|
} else {
|
|
log('❌ AppWriteManager nicht gefunden - Extension möglicherweise nicht geladen', 'error');
|
|
log('💡 Tipp: Stellen Sie sicher, dass die Extension aktiviert ist', 'info');
|
|
}
|
|
}, 2000);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |