Skip to content

Commit

Permalink
Revert "20240626.1" (#21180)
Browse files Browse the repository at this point in the history
Revert "20240626.1 (#21179)"

This reverts commit a16cae0.
  • Loading branch information
piitaya authored Jun 26, 2024
1 parent a16cae0 commit 530745d
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 38 deletions.
3 changes: 1 addition & 2 deletions hassio/src/components/hassio-filter-addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import type { IFuseOptions } from "fuse.js";
import Fuse from "fuse.js";
import { stripDiacritics } from "../../../src/common/string/strip-diacritics";
import { StoreAddon } from "../../../src/data/supervisor/store";
import { getStripDiacriticsFn } from "../../../src/util/fuse";

export function filterAndSort(addons: StoreAddon[], filter: string) {
const options: IFuseOptions<StoreAddon> = {
keys: ["name", "description", "slug"],
isCaseSensitive: false,
minMatchCharLength: Math.min(filter.length, 2),
threshold: 0.2,
getFn: getStripDiacriticsFn,
getFn: (obj, path) => stripDiacritics(Fuse.config.getFn(obj, path)),
};
const fuse = new Fuse(addons, options);
return fuse.search(stripDiacritics(filter)).map((result) => result.item);
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "home-assistant-frontend"
version = "20240626.1"
version = "20240626.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/common/string/strip-diacritics.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const stripDiacritics = (str: string) =>
export const stripDiacritics = (str) =>
str.normalize("NFD").replace(/[\u0300-\u036F]/g, "");
5 changes: 2 additions & 3 deletions src/panels/config/automation/add-automation-element-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import memoizeOne from "memoize-one";
import { fireEvent } from "../../../common/dom/fire_event";
import { computeDomain } from "../../../common/entity/compute_domain";
import { stringCompare } from "../../../common/string/compare";
import { stripDiacritics } from "../../../common/string/strip-diacritics";
import { LocalizeFunc } from "../../../common/translations/localize";
import { deepEqual } from "../../../common/util/deep-equal";
import "../../../components/ha-dialog";
Expand Down Expand Up @@ -51,11 +50,11 @@ import { TRIGGER_GROUPS, TRIGGER_ICONS } from "../../../data/trigger";
import { HassDialog } from "../../../dialogs/make-dialog-manager";
import { haStyle, haStyleDialog } from "../../../resources/styles";
import { HomeAssistant } from "../../../types";
import { getStripDiacriticsFn } from "../../../util/fuse";
import {
AddAutomationElementDialogParams,
PASTE_VALUE,
} from "./show-add-automation-element-dialog";
import { stripDiacritics } from "../../../common/string/strip-diacritics";

const TYPES = {
trigger: { groups: TRIGGER_GROUPS, icons: TRIGGER_ICONS },
Expand Down Expand Up @@ -210,7 +209,7 @@ class DialogAddAutomationElement extends LitElement implements HassDialog {
isCaseSensitive: false,
minMatchCharLength: Math.min(filter.length, 2),
threshold: 0.2,
getFn: getStripDiacriticsFn,
getFn: (obj, path) => stripDiacritics(Fuse.config.getFn(obj, path)),
};
const fuse = new Fuse(items, options);
return fuse.search(stripDiacritics(filter)).map((result) => result.item);
Expand Down
3 changes: 1 addition & 2 deletions src/panels/config/integrations/dialog-add-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import {
} from "./show-add-integration-dialog";
import { getConfigEntries } from "../../../data/config_entries";
import { stripDiacritics } from "../../../common/string/strip-diacritics";
import { getStripDiacriticsFn } from "../../../util/fuse";

export interface IntegrationListItem {
name: string;
Expand Down Expand Up @@ -257,7 +256,7 @@ class AddIntegrationDialog extends LitElement {
isCaseSensitive: false,
minMatchCharLength: Math.min(filter.length, 2),
threshold: 0.2,
getFn: getStripDiacriticsFn,
getFn: (obj, path) => stripDiacritics(Fuse.config.getFn(obj, path)),
};
const helpers = Object.entries(h).map(([domain, integration]) => ({
domain,
Expand Down
25 changes: 12 additions & 13 deletions src/panels/config/integrations/ha-config-integrations-dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
import { ActionDetail } from "@material/mwc-list";
import { mdiFilterVariant, mdiPlus } from "@mdi/js";
import type { IFuseOptions } from "fuse.js";
import Fuse from "fuse.js";
import type { IFuseOptions } from "fuse.js";
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
import {
CSSResultGroup,
LitElement,
PropertyValues,
css,
CSSResultGroup,
html,
LitElement,
nothing,
PropertyValues,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";
import memoizeOne from "memoize-one";
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
import {
PROTOCOL_INTEGRATIONS,
protocolIntegrationPicked,
PROTOCOL_INTEGRATIONS,
} from "../../../common/integrations/protocolIntegrationPicked";
import { navigate } from "../../../common/navigate";
import { caseInsensitiveStringCompare } from "../../../common/string/compare";
import { stripDiacritics } from "../../../common/string/strip-diacritics";
import { extractSearchParam } from "../../../common/url/search-params";
import { nextRender } from "../../../common/util/render-status";
import "../../../components/ha-button-menu";
Expand All @@ -31,7 +29,6 @@ import "../../../components/ha-fab";
import "../../../components/ha-icon-button";
import "../../../components/ha-svg-icon";
import "../../../components/search-input";
import "../../../components/search-input-outlined";
import { ConfigEntry, getConfigEntries } from "../../../data/config_entries";
import { getConfigFlowInProgressCollection } from "../../../data/config_flow";
import { fetchDiagnosticHandlers } from "../../../data/diagnostics";
Expand All @@ -40,11 +37,11 @@ import {
subscribeEntityRegistry,
} from "../../../data/entity_registry";
import {
IntegrationLogInfo,
IntegrationManifest,
domainToName,
fetchIntegrationManifest,
fetchIntegrationManifests,
IntegrationLogInfo,
IntegrationManifest,
subscribeLogInfo,
} from "../../../data/integration";
import {
Expand All @@ -62,17 +59,19 @@ import "../../../layouts/hass-tabs-subpage";
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
import { haStyle } from "../../../resources/styles";
import type { HomeAssistant, Route } from "../../../types";
import { getStripDiacriticsFn } from "../../../util/fuse";
import { configSections } from "../ha-panel-config";
import { isHelperDomain } from "../helpers/const";
import "./ha-config-flow-card";
import { DataEntryFlowProgressExtended } from "./ha-config-integrations";
import "./ha-disabled-config-entry-card";
import "./ha-ignored-config-entry-card";
import "./ha-integration-card";
import type { HaIntegrationCard } from "./ha-integration-card";
import "./ha-integration-overflow-menu";
import { showAddIntegrationDialog } from "./show-add-integration-dialog";
import "./ha-disabled-config-entry-card";
import { caseInsensitiveStringCompare } from "../../../common/string/compare";
import "../../../components/search-input-outlined";
import { stripDiacritics } from "../../../common/string/strip-diacritics";

export interface ConfigEntryExtended extends ConfigEntry {
localized_domain_name?: string;
Expand Down Expand Up @@ -210,7 +209,7 @@ class HaConfigIntegrationsDashboard extends SubscribeMixin(LitElement) {
isCaseSensitive: false,
minMatchCharLength: Math.min(filter.length, 2),
threshold: 0.2,
getFn: getStripDiacriticsFn,
getFn: (obj, path) => stripDiacritics(Fuse.config.getFn(obj, path)),
};
const fuse = new Fuse(configEntriesInProgress, options);
filteredEntries = fuse
Expand Down
2 changes: 0 additions & 2 deletions src/panels/lovelace/cards/hui-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ export class HuiCard extends ReactiveElement {
"ll-upgrade",
(ev: Event) => {
ev.stopPropagation();
element.hass = this.hass;
element.preview = this.preview;
fireEvent(this, "card-updated");
},
{ once: true }
Expand Down
3 changes: 1 addition & 2 deletions src/panels/lovelace/editor/card-editor/hui-card-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
getCustomCardEntry,
} from "../../../../data/lovelace_custom_cards";
import type { HomeAssistant } from "../../../../types";
import { getStripDiacriticsFn } from "../../../../util/fuse";
import {
calcUnusedEntities,
computeUsedEntities,
Expand Down Expand Up @@ -88,7 +87,7 @@ export class HuiCardPicker extends LitElement {
isCaseSensitive: false,
minMatchCharLength: Math.min(filter.length, 2),
threshold: 0.2,
getFn: getStripDiacriticsFn,
getFn: (obj, path) => stripDiacritics(Fuse.config.getFn(obj, path)),
};
const fuse = new Fuse(cards, options);
cards = fuse.search(stripDiacritics(filter)).map((result) => result.item);
Expand Down
12 changes: 0 additions & 12 deletions src/util/fuse.ts

This file was deleted.

0 comments on commit 530745d

Please sign in to comment.