Skip to content

Commit

Permalink
rename clean function
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Nov 15, 2023
1 parent ad474da commit d9b5ab9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { HuiDashboardStrategyElementEditor } from "../../editor/dashboard-s
import { ConfigChangedEvent } from "../../editor/hui-element-editor";
import { GUIModeChangedEvent } from "../../editor/types";
import type { DashboardStrategyEditorDialogParams } from "./show-dialog-dashboard-strategy-editor";
import { cleanStrategyConfig } from "../legacy-strategy";
import { cleanLegacyStrategyConfig } from "../legacy-strategy";

@customElement("dialog-dashboard-strategy-editor")
class DialogDashboardStrategyEditor extends LitElement {
Expand Down Expand Up @@ -76,7 +76,7 @@ class DialogDashboardStrategyEditor extends LitElement {
return nothing;
}

const config = cleanStrategyConfig(this._strategyConfig);
const config = cleanLegacyStrategyConfig(this._strategyConfig);

return html`
<ha-dialog
Expand Down
4 changes: 2 additions & 2 deletions src/panels/lovelace/strategies/get-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
isStrategyView,
} from "../../../data/lovelace/config/view";
import { AsyncReturnType, HomeAssistant } from "../../../types";
import { cleanStrategyConfig, isLegacyStrategy } from "./legacy-strategy";
import { cleanLegacyStrategyConfig, isLegacyStrategy } from "./legacy-strategy";
import {
LovelaceDashboardStrategy,
LovelaceStrategy,
Expand Down Expand Up @@ -109,7 +109,7 @@ const generateStrategy = async <T extends LovelaceStrategyConfigType>(
}
}

const config = cleanStrategyConfig(strategyConfig);
const config = cleanLegacyStrategyConfig(strategyConfig);

return await strategy.generate(config, hass);
} catch (err: any) {
Expand Down
2 changes: 1 addition & 1 deletion src/panels/lovelace/strategies/legacy-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface LovelaceViewStrategy {
}): Promise<LovelaceViewConfig>;
}

export const cleanStrategyConfig = (config: LovelaceStrategyConfig) => {
export const cleanLegacyStrategyConfig = (config: LovelaceStrategyConfig) => {
if (!(Object.keys(config).length === 2 && "options" in config)) {
return config;
}
Expand Down

0 comments on commit d9b5ab9

Please sign in to comment.