Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20240702.0 #21255

Merged
merged 14 commits into from
Jul 2, 2024
Merged

20240702.0 #21255

merged 14 commits into from
Jul 2, 2024

Conversation

bramkragten
Copy link
Member

@bramkragten bramkragten commented Jul 2, 2024

Summary by CodeRabbit

  • Bug Fixes

    • Removed Google Analytics tracking scripts from various HTML templates, enhancing privacy.
  • New Features

    • Dynamic title and section adjustments for Home Assistant demo based on conditions.
    • Added logic to ensure grid cell values remain within specified bounds in grid-related components.
    • Introduced getLayoutOptions method to various Lovelace cards for enhanced grid layout configurations.
    • Updated Home Assistant script and automation editors to handle blueprint configurations more effectively.
  • Dependencies

    • Updated @material/web to version 1.5.1.
    • Updated eslint-plugin-lit-a11y to version 4.1.3.
  • Refactor

    • Simplified and optimized stream handling for translation files.
    • Improved webpack configuration for better worker and chunk handling.
    • Various code and styling adjustments to improve readability and maintainability across multiple components.

renovate bot and others added 14 commits June 29, 2024 13:30
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* small improvements

* Update ha-config-application-credentials.ts

* Update ha-config-application-credentials.ts

---------

Co-authored-by: Bram Kragten <[email protected]>
* Fix Webpack bundling of recorder worklet
* Hide demo card when showing demo from frontpage

* Store in constant on load

* reverse

* Remove filter

* move constnat

* Make Home Assistant title
* Tweak first section in section demo

* Allow automation entities be toggled
* Ignore aspect ratio in grid section

* Feedback
* Change take control of blueprint UX

* Add margin to ha-alert

---------

Co-authored-by: Paul Bottein <[email protected]>
* Add min/max row/columns to resize card editor

* Add humidifier and thermostat card

* Removed unused condition

* Don't set max rows

* Add media card

* Add button card

* Use same rule if there is footer

* Don't show disabled cell

* Add min rows to sensor card

* Update sizes

* Update sizes

* Update sizes

* Add min rows to weather forecast card
Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

Warning

Rate limit exceeded

@bramkragten has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 17 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between fd6a192 and ab3b859.

Walkthrough

The recent changes include multiple updates across various project components. Key modifications involve improved stream handling in translation processing, enhanced Webpack configurations for worker parsing, removal of Google Analytics scripts from several HTML templates, updates in Home Assistant demo configurations, additions to UI-related scripts, and significant refactoring in several entity and card classes in the project. These changes improve functionality, maintainability, and address specific user interface enhancements.

Changes

File(s) Change Summary
build-scripts/gulp/translations.js Updated stream handling logic and merging process for translation files.
build-scripts/webpack.cjs Modified Webpack configuration for worker parsing and chunk handling.
cast/src/html/faq.html.template, cast/src/html/media.html.template, cast/src/html/receiver.html.template, demo/src/html/index.html.template Removed Google Analytics tracking script.
demo/src/configs/sections/lovelace.ts, demo/src/entrypoint.ts Dynamic setting of title based on condition and related section adjustments.
demo/src/util/is_frontpage.ts Introduced functionality for front page detection using query parameter.
package.json Incremented versions of @material/web and eslint-plugin-lit-a11y dependencies.
pyproject.toml Version update for the project "home-assistant-frontend."
src/components/ha-grid-size-picker.ts Added new import and utilized it to ensure min/max bounds for row and column values.
src/fake_data/entity.ts Added entry for automation type in the TYPES constant.
src/panels/config/application_credentials/... Adjusted column properties and added new CSS rule .warning.
src/panels/config/automation/blueprint-automation-editor.ts, src/panels/config/automation/manual-automation-editor.ts, src/panels/config/blueprint/blueprint-generic-editor.ts, src/panels/config/script/manual-script-editor.ts, src/panels/config/script/blueprint-script-editor.ts Removed and refactored sections related to warning messages and blueprint handling logic.
src/panels/config/script/ha-script-editor.ts, src/panels/config/automation/ha-automation-editor.ts Introduced handling for _blueprintConfig and _readOnly, affecting control flow for editing actions.
src/panels/logbook/ha-logbook.ts Refactored asynchronous functions for promise efficiency and simplified unsubscribe process.
src/panels/lovelace/cards/... Added/modified properties related to layout and grid configurations for various Lovelace cards.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Cast Related to Home Assistant Cast UI Build Related to building the code Demo Related to frontend demo content Design Related to Home Assistant design gallery labels Jul 2, 2024
@bramkragten bramkragten merged commit 28ced4b into master Jul 2, 2024
28 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

"text": "This automation is using a blueprint. By taking control, your automation will be converted into a regular automation using triggers, conditions and actions. You will be able to edit it directly and you won't be able to convert it back to a blueprint.",
"action": "Take control"
},
"confirm_take_control": "Your are viewing a preview of the automation config, do you want to take control?",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typographical error in the translation key confirm_take_control.

The word "Your" should be corrected to "You" in the translation string.

- "confirm_take_control": "Your are viewing a preview of the automation config, do you want to take control?",
+ "confirm_take_control": "You are viewing a preview of the automation config, do you want to take control?",
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"confirm_take_control": "Your are viewing a preview of the automation config, do you want to take control?",
"confirm_take_control": "You are viewing a preview of the automation config, do you want to take control?",

"text": "This script is using a blueprint. By taking control, your script will be converted into a regular automation using actions. You will be able to edit it directly and you won't be able to convert it back to a blueprint.",
"action": "[%key:ui::panel::config::automation::editor::take_control_confirmation::action%]"
},
"confirm_take_control": "Your are viewing a preview of the script config, do you want to take control?",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typographical error in the translation key confirm_take_control.

The word "Your" should be corrected to "You" in the translation string.

- "confirm_take_control": "Your are viewing a preview of the script config, do you want to take control?",
+ "confirm_take_control": "You are viewing a preview of the script config, do you want to take control?",
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"confirm_take_control": "Your are viewing a preview of the script config, do you want to take control?",
"confirm_take_control": "You are viewing a preview of the script config, do you want to take control?",

if (this._mode === "yaml") {
this.renderRoot.querySelector("ha-yaml-editor")?.setValue(this._config);
}
this._readOnly = true;
this._errors = undefined;
} catch (err: any) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using any type.

Using any disables type checking rules. Its use should be avoided. Replace any with a more specific type.

- } catch (err: any) {
+ } catch (err: Error) {
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (err: any) {
} catch (err: Error) {
Tools
Biome

[error] 693-693: Unexpected any. Specify a different type.

any disables many type checking rules. Its use should be avoided.

(lint/suspicious/noExplicitAny)

@@ -241,6 +245,15 @@ export class HuiEntityCard extends LitElement implements LovelaceCard {
fireEvent(this, "hass-more-info", { entityId: this._config!.entity });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using non-null assertion.

Replace the non-null assertion operator ! with the optional chaining operator ?. for safer runtime checks.

- fireEvent(this, "hass-more-info", { entityId: this._config!.entity });
+ fireEvent(this, "hass-more-info", { entityId: this._config?.entity });
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fireEvent(this, "hass-more-info", { entityId: this._config!.entity });
fireEvent(this, "hass-more-info", { entityId: this._config?.entity });
Tools
Biome

[error] 245-245: Forbidden non-null assertion.

Unsafe fix: Replace with optional chain operator ?. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator

(lint/style/noNonNullAssertion)

Comment on lines +125 to +139
const grid_columns = 2;
let grid_rows = 1;
if (this._config?.features?.length) {
options.grid_rows += Math.ceil((this._config.features.length * 2) / 3);
const featureHeight = Math.ceil((this._config.features.length * 2) / 3);
grid_rows += featureHeight;
}
if (this._config?.vertical) {
options.grid_rows++;
grid_rows!++;
}
return options;
return {
grid_columns,
grid_rows,
grid_min_rows: grid_rows,
grid_min_columns: grid_columns,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix: Remove non-null assertion.

Replace the non-null assertion with an optional chain operator to avoid potential runtime errors.

-    if (this._config?.vertical) {
-      grid_rows!++;
+    if (this._config?.vertical) {
+      grid_rows++;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const grid_columns = 2;
let grid_rows = 1;
if (this._config?.features?.length) {
options.grid_rows += Math.ceil((this._config.features.length * 2) / 3);
const featureHeight = Math.ceil((this._config.features.length * 2) / 3);
grid_rows += featureHeight;
}
if (this._config?.vertical) {
options.grid_rows++;
grid_rows!++;
}
return options;
return {
grid_columns,
grid_rows,
grid_min_rows: grid_rows,
grid_min_columns: grid_columns,
};
const grid_columns = 2;
let grid_rows = 1;
if (this._config?.features?.length) {
const featureHeight = Math.ceil((this._config.features.length * 2) / 3);
grid_rows += featureHeight;
}
if (this._config?.vertical) {
grid_rows++;
}
return {
grid_columns,
grid_rows,
grid_min_rows: grid_rows,
grid_min_columns: grid_columns,
};
Tools
Biome

[error] 132-132: Forbidden non-null assertion.

(lint/style/noNonNullAssertion)

@@ -98,6 +100,7 @@ export class HuiCard extends ReactiveElement {
if (this.hass) {
this._element.hass = this.hass;
}
this._element.layout = this.layout;
this._element.preview = this.preview;
// For backwards compatibility
(this._element as any).editMode = this.preview;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using any type.

The use of any disables many type checking rules. Consider specifying a different type.

-  (this._element as any).editMode = this.preview;
+  (this._element as LovelaceCard & { editMode: boolean }).editMode = this.preview;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
(this._element as any).editMode = this.preview;
(this._element as LovelaceCard & { editMode: boolean }).editMode = this.preview;
Tools
Biome

[error] 106-106: Unexpected any. Specify a different type.

any disables many type checking rules. Its use should be avoided.

(lint/suspicious/noExplicitAny)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Related to building the code Cast Related to Home Assistant Cast UI cla-signed Demo Related to frontend demo content Design Related to Home Assistant design gallery
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants