diff --git a/bundles/org.openhab.ui/web/src/pages/settings/rules/rules-list.vue b/bundles/org.openhab.ui/web/src/pages/settings/rules/rules-list.vue index b1b373a852..3441717225 100644 --- a/bundles/org.openhab.ui/web/src/pages/settings/rules/rules-list.vue +++ b/bundles/org.openhab.ui/web/src/pages/settings/rules/rules-list.vue @@ -78,19 +78,6 @@ {{ rules.length }} {{ type.toLowerCase() }} -
- - - Alphabetical - - - By Semantic - - - By Tags - - -
+ media-list> { - const initial = rule.name.substring(0, 1).toUpperCase() - if (!prev[initial]) { - prev[initial] = [] - } - prev[initial].push(rule) - - return prev - }, {}) - return initialGroup - } else if (this.groupBy === 'semantic') { - const semanticGroup = filteredRules.reduce((prev, rule, i, rules) => { - let initial = rule.tags.filter((t) => t !== 'Script' && t !== 'Scene' && - this.isSemanticTag(t)) - if (initial.length === 0) initial = '- No Semantic Tags -' - - if (!prev[initial]) { - prev[initial] = [] - } - prev[initial].push(rule) - - return prev - }, {}) - return Object.keys(semanticGroup).sort((a, b) => a.localeCompare(b)).reduce((objEntries, key) => { - objEntries[key] = semanticGroup[key] - return objEntries - }, {}) - } else if (this.groupBy === 'tags') { - const tagsMap = new Map() - filteredRules.forEach((rule, i, rules) => { - if (rule.tags.length > 0) { - rule.tags.filter((t) => t !== 'Scratchpad') - .forEach(t => { - let tag = t.substring(0, 1).toUpperCase() + t.slice(1) - if (tag.includes('Marketplace:')) tag = '- Marketplace -' - let tags = [] - if (tagsMap.has(tag)) tags = tagsMap.get(tag) - if (!tags.includes(rule)) tags.push(rule) - tagsMap.set(tag, tags) - }) - } else { - let tags = [] - if (tagsMap.has('- No Tags -')) tags = tagsMap.get('- No Tags -') - tags.push(rule) - tagsMap.set('- No Tags -', tags) - } - }) + const initialGroup = filteredRules.reduce((prev, rule, i, rules) => { + const initial = rule.name.substring(0, 1).toUpperCase() + if (!prev[initial]) { + prev[initial] = [] + } + prev[initial].push(rule) - let tagsRules = Object.fromEntries(tagsMap) - return Object.keys(tagsRules).sort((a, b) => a.localeCompare(b)).reduce((objEntries, key) => { - objEntries[key] = tagsRules[key] - return objEntries - }, {}) - } else { - return this.rules - } + return prev + }, {}) + return initialGroup }, searchPlaceholder () { return window.innerWidth >= 1280 ? 'Search (for advanced search, use the developer sidebar (Shift+Alt+D))' : 'Search' @@ -410,18 +349,6 @@ export default { this.$f7.dialog.alert('An error occurred while enabling/disabling: ' + err) }) }, - switchGroupOrder (groupBy) { - this.groupBy = groupBy - const searchbar = this.$refs.searchbar.$el.f7Searchbar - const filterQuery = searchbar.query - this.$nextTick(() => { - if (filterQuery) { - searchbar.clear() - searchbar.search(filterQuery) - } - this.$refs.listIndex.update() - }) - }, toggleSearchTag (e, item) { const target = e.target