Increase weight of name and domain in add integration search (#16562)

This commit is contained in:
Bram Kragten 2023-05-17 12:51:31 +02:00 committed by GitHub
parent 2ed48d67c6
commit cbcca6e190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,6 +44,7 @@ import {
showConfirmationDialog, showConfirmationDialog,
} from "../../../dialogs/generic/show-dialog-box"; } from "../../../dialogs/generic/show-dialog-box";
import { haStyleDialog, haStyleScrollbar } from "../../../resources/styles"; import { haStyleDialog, haStyleScrollbar } from "../../../resources/styles";
import { loadVirtualizer } from "../../../resources/virtualizer";
import type { HomeAssistant } from "../../../types"; import type { HomeAssistant } from "../../../types";
import "./ha-domain-integrations"; import "./ha-domain-integrations";
import "./ha-integration-list-item"; import "./ha-integration-list-item";
@ -127,6 +128,11 @@ class AddIntegrationDialog extends LitElement {
public willUpdate(changedProps: PropertyValues): void { public willUpdate(changedProps: PropertyValues): void {
super.willUpdate(changedProps); super.willUpdate(changedProps);
if (!this.hasUpdated) {
loadVirtualizer();
}
if (this._filter === undefined && this._initialFilter !== undefined) { if (this._filter === undefined && this._initialFilter !== undefined) {
this._filter = this._initialFilter; this._filter = this._initialFilter;
} }
@ -234,10 +240,10 @@ class AddIntegrationDialog extends LitElement {
if (filter) { if (filter) {
const options: Fuse.IFuseOptions<IntegrationListItem> = { const options: Fuse.IFuseOptions<IntegrationListItem> = {
keys: [ keys: [
"name", { name: "name", weight: 5 },
"domain", { name: "domain", weight: 5 },
{ name: "integrations", weight: 2 },
"supported_by", "supported_by",
"integrations",
"iot_standards", "iot_standards",
], ],
isCaseSensitive: false, isCaseSensitive: false,