mirror of
https://github.com/Lissy93/dashy.git
synced 2025-12-06 08:34:14 +01:00
feat(home): apply advanced field-specific tile filtering in filterTiles()
This commit is contained in:
parent
80c971cc7b
commit
6220e935e3
1 changed files with 9 additions and 4 deletions
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import Defaults, { localStorageKeys, iconCdns } from '@/utils/defaults';
|
||||
import Keys from '@/utils/StoreMutations';
|
||||
import { searchTiles } from '@/utils/Search';
|
||||
import { searchTiles, searchTilesWithFields } from '@/utils/Search';
|
||||
import { checkItemVisibility } from '@/utils/CheckItemVisibility';
|
||||
|
||||
const HomeMixin = {
|
||||
|
|
@ -99,10 +99,15 @@ const HomeMixin = {
|
|||
},
|
||||
/* Returns only the tiles that match the users search query */
|
||||
filterTiles(allTiles) {
|
||||
if (!allTiles) {
|
||||
return [];
|
||||
}
|
||||
if (!allTiles) return [];
|
||||
const visibleTiles = allTiles.filter((tile) => checkItemVisibility(tile));
|
||||
const { appConfig } = this;
|
||||
const adv = appConfig?.advancedSearch || {};
|
||||
const enabled = !!adv.enabled;
|
||||
const fields = adv.fields || {};
|
||||
if (enabled) {
|
||||
return searchTilesWithFields(visibleTiles, this.searchValue, fields);
|
||||
}
|
||||
return searchTiles(visibleTiles, this.searchValue);
|
||||
},
|
||||
/* Checks if any sections or items use icons from a given CDN */
|
||||
|
|
|
|||
Loading…
Reference in a new issue