Skip to content

Commit b0bd71e

Browse files
authored
Update fast-search-card.js
1 parent deaa663 commit b0bd71e

File tree

1 file changed

+1
-59
lines changed

1 file changed

+1
-59
lines changed

dist/fast-search-card.js

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5254,7 +5254,6 @@ class FastSearchCard extends HTMLElement {
52545254
}
52555255

52565256
switchToCategory(newCategory) {
5257-
console.log(`🔄 Switching to category: ${newCategory}`);
52585257

52595258
// 1. Interne Variable setzen
52605259
this.activeCategory = newCategory;
@@ -5279,8 +5278,7 @@ class FastSearchCard extends HTMLElement {
52795278

52805279
// 5. Items laden und anzeigen
52815280
this.showCurrentCategoryItems();
5282-
5283-
console.log(`✅ Category switched to: ${newCategory}`);
5281+
52845282
}
52855283

52865284
updateCategoryButtonStates() {
@@ -5299,18 +5297,14 @@ class FastSearchCard extends HTMLElement {
52995297
if (this._config.auto_discover) {
53005298
const discoveredEntities = await this.discoverEntities(); // ← AWAIT hinzugefügt!
53015299
allEntityConfigs = [...discoveredEntities];
5302-
console.log(`Auto-discovered: ${discoveredEntities.length} entities`);
53035300
}
53045301

53055302
// 1.5. Custom Data Sources (NEU: IMMER prüfen, nicht nur bei activeCategory)
53065303
if (this._config.custom_mode.enabled) {
5307-
console.log(`🔄 Loading custom items...`);
53085304
const customItems = await this.parseCustomDataSources();
53095305
if (customItems && Array.isArray(customItems)) { // ← Sicherheitscheck hinzufügen
53105306
allEntityConfigs = [...allEntityConfigs, ...customItems];
5311-
console.log(`🍳 Custom items: ${customItems.length} items`);
53125307
} else {
5313-
console.log(`🍳 No custom items found`);
53145308
}
53155309
}
53165310

@@ -5323,11 +5317,8 @@ class FastSearchCard extends HTMLElement {
53235317

53245318
// Füge manuelle Entities hinzu
53255319
allEntityConfigs = [...allEntityConfigs, ...this._config.entities];
5326-
console.log(`Added ${this._config.entities.length} manual entities`);
53275320
}
53285321

5329-
console.log(`Total entities to process: ${allEntityConfigs.length}`);
5330-
53315322
// 3. Entity-Objekte erstellen
53325323
this.allItems = allEntityConfigs.map(entityConfig => {
53335324
// Custom Items bereits fertig verarbeitet
@@ -5372,12 +5363,10 @@ class FastSearchCard extends HTMLElement {
53725363
// ✅ FIX: Force initial display - HIER EINFÜGEN!
53735364
setTimeout(() => {
53745365
if (this.filteredItems.length === 0) {
5375-
console.log('🔧 Force initial load');
53765366
this.showCurrentCategoryItems();
53775367
}
53785368
}, 100);
53795369

5380-
console.log(`Final items: ${this.allItems.length} (${this.allItems.filter(i => i.auto_discovered).length} auto-discovered, ${this.allItems.filter(i => i.domain === 'custom').length} custom)`);
53815370
}
53825371

53835372

@@ -5388,7 +5377,6 @@ class FastSearchCard extends HTMLElement {
53885377

53895378
// NEU: Multiple data_sources unterstützen
53905379
if (customMode.data_sources && customMode.data_sources.length > 0) {
5391-
console.log(`🔗 Processing ${customMode.data_sources.length} data sources...`);
53925380

53935381
for (let i = 0; i < customMode.data_sources.length; i++) {
53945382
const dataSource = customMode.data_sources[i];
@@ -6789,13 +6777,7 @@ class FastSearchCard extends HTMLElement {
67896777
performSearch(query) {
67906778
const startTime = performance.now();
67916779

6792-
// ✅ FIX: Debug-Logging hinzufügen
6793-
console.log('🔍 performSearch called with:', query);
6794-
console.log('📊 Current filteredItems before search:', this.filteredItems.length);
6795-
console.log('🏷️ activeCategory:', this.activeCategory);
6796-
67976780
if (!query.trim()) {
6798-
console.log('🔍 Empty query, showing current category items');
67996781
this.showCurrentCategoryItems();
68006782
return;
68016783
}
@@ -6804,7 +6786,6 @@ class FastSearchCard extends HTMLElement {
68046786
const preprocessedQuery = this.preprocessQuery(query);
68056787

68066788
const categoryItems = this.allItems.filter(item => this.isItemInCategory(item, this.activeCategory));
6807-
console.log('📊 categoryItems found:', categoryItems.length);
68086789

68096790
// KORREKTUR: Parse Filter-Syntax mit preprocessedQuery (nicht original query)
68106791
const parsedQuery = this.parseFilterSyntax(preprocessedQuery);
@@ -6847,7 +6828,6 @@ class FastSearchCard extends HTMLElement {
68476828
filteredResults = this.applyFilterSyntax(filteredResults, parsedQuery.filters);
68486829

68496830
this.filteredItems = filteredResults;
6850-
console.log(`Enhanced Custom search: ${this.filteredItems.length} results (${parsedQuery.filters.length} filters applied)`); // ← GEÄNDERT
68516831

68526832
} catch (error) {
68536833
console.error('Custom search error, falling back:', error);
@@ -6865,36 +6845,19 @@ class FastSearchCard extends HTMLElement {
68656845
return originalItem ? { ...originalItem, searchScore: result.score } : null;
68666846
})
68676847
.filter(Boolean);
6868-
6869-
console.log(`Enhanced Standard search: ${this.filteredItems.length} results`); // ← GEÄNDERT
68706848

68716849
} catch (error) {
68726850
console.error('Standard search error, falling back:', error);
68736851
this.fallbackSearch(query, categoryItems);
68746852
}
68756853
} else {
68766854
// FALLBACK SEARCH
6877-
console.log('🔍 Using fallback search');
68786855
this.fallbackSearch(query, categoryItems);
68796856
}
68806857

6881-
// ✅ FIX: Debug-Logging nach der Suche
6882-
console.log('📊 Search results found:', this.filteredItems.length, 'items');
6883-
console.log('🎯 About to call renderResults...');
6884-
68856858
this.logSearchPerformance(query, startTime, 'EnhancedFuzzySearch', this.filteredItems.length); // ← GEÄNDERT
68866859
this.renderResults();
68876860

6888-
// ✅ FIX: Debug nach renderResults
6889-
setTimeout(() => {
6890-
const grid = this.shadowRoot.querySelector('.results-grid');
6891-
const list = this.shadowRoot.querySelector('.results-list');
6892-
console.log('🔍 After renderResults:');
6893-
console.log(' - Grid innerHTML length:', grid?.innerHTML?.length || 0);
6894-
console.log(' - List innerHTML length:', list?.innerHTML?.length || 0);
6895-
console.log(' - hasAnimated:', this.hasAnimated);
6896-
console.log(' - Current view mode:', this.currentViewMode);
6897-
}, 50);
68986861
}
68996862

69006863
applyFilterSyntax(items, filters) {
@@ -6954,8 +6917,6 @@ class FastSearchCard extends HTMLElement {
69546917
item.id.toLowerCase().includes(searchTerm) ||
69556918
item.area.toLowerCase().includes(searchTerm);
69566919
});
6957-
6958-
console.log(`Fallback search found ${this.filteredItems.length} results for "${query}"`);
69596920
}
69606921

69616922
logSearchPerformance(query, startTime, method, resultCount) {
@@ -7263,34 +7224,23 @@ class FastSearchCard extends HTMLElement {
72637224
showCurrentCategoryItems() {
72647225
// ✅ SAFETY CHECK: Prüfe ob Funktion existiert
72657226
if (typeof this.isItemInCategory !== 'function') {
7266-
console.error('❌ isItemInCategory function missing! Defining it now...');
72677227
this.defineIsItemInCategoryFunction();
72687228
}
72697229

7270-
console.log('🔍 showCurrentCategoryItems called');
7271-
console.log('📊 allItems:', this.allItems.length);
7272-
console.log('🏷️ activeCategory:', this.activeCategory);
7273-
console.log('🏷️ activeSubcategory:', this.activeSubcategory);
7274-
72757230
this.filteredItems = this.allItems.filter(item => this.isItemInCategory(item, this.activeCategory));
72767231

7277-
console.log('📊 filteredItems after category filter:', this.filteredItems.length);
7278-
72797232
if (this.activeSubcategory !== 'all') {
72807233
this.filterBySubcategory();
72817234
} else {
72827235
this.renderResults();
72837236
}
72847237

7285-
console.log('📊 Final filteredItems:', this.filteredItems.length);
72867238
}
72877239

72887240
ensureCriticalMethods() {
72897241
if (typeof this.isItemInCategory !== 'function') {
7290-
console.warn('🔧 Adding missing isItemInCategory function');
72917242
this.defineIsItemInCategoryFunction();
72927243
}
7293-
console.log('✅ Critical methods check completed');
72947244
}
72957245

72967246
defineIsItemInCategoryFunction() {
@@ -14194,7 +14144,6 @@ class FastSearchCard extends HTMLElement {
1419414144

1419514145
// 🎯 NAVIGATE TO ACTION DETAIL - Finale, funktionierende Version
1419614146
navigateToActionDetail(actionId, actionDomain) {
14197-
console.log(`🎯 Simulating click on ${actionDomain}: ${actionId}`);
1419814147

1419914148
// 1. Bestimme Ziel-Kategorie
1420014149
const targetCategory = this.getTargetCategoryForDomain(actionDomain);
@@ -14212,7 +14161,6 @@ class FastSearchCard extends HTMLElement {
1421214161

1421314162
// Wenn Element gefunden, klicken und aufhören
1421414163
if (element) {
14215-
console.log(`✅ Element ${targetId} gefunden! Klick wird ausgeführt.`);
1421614164
element.click();
1421714165
return;
1421814166
}
@@ -14250,23 +14198,17 @@ class FastSearchCard extends HTMLElement {
1425014198
triggerAction(actionId) {
1425114199
const domain = actionId.split('.')[0];
1425214200

14253-
console.log(`🚀 Triggering ${domain}: ${actionId}`);
14254-
1425514201
switch(domain) {
1425614202
case 'scene':
1425714203
this._hass.callService('scene', 'turn_on', { entity_id: actionId });
14258-
console.log(`✅ Scene activated: ${actionId}`);
1425914204
break;
1426014205
case 'script':
1426114206
this._hass.callService('script', 'turn_on', { entity_id: actionId });
14262-
console.log(`✅ Script executed: ${actionId}`);
1426314207
break;
1426414208
case 'automation':
1426514209
this._hass.callService('automation', 'trigger', { entity_id: actionId });
14266-
console.log(`✅ Automation triggered: ${actionId}`);
1426714210
break;
1426814211
default:
14269-
console.warn(`❌ Unknown action domain: ${domain}`);
1427014212
}
1427114213
}
1427214214

0 commit comments

Comments
 (0)