Skip to content

Beautify ha-attribute <pre>#8101

Merged
bramkragten merged 2 commits intohome-assistant:devfrom
spacegaier:attr-pre
Jan 6, 2021
Merged

Beautify ha-attribute <pre>#8101
bramkragten merged 2 commits intohome-assistant:devfrom
spacegaier:attr-pre

Conversation

@spacegaier
Copy link
Copy Markdown
Member

Breaking change

Proposed change

In case an attribute is in YAML form, it will be rendered as a <pre>. That however was not nicely styled so far.

I know it looks a bit jarring that we suddenly have an attribute left-aligned, but it is a lot easier to read I think. Nonetheless, I added a screenshot for right aligned as well, with the rest of the issues fixed (no more overflowing characters at the ride side).

Before:
image

After (left):
image

After (right):
image

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@bramkragten
Copy link
Copy Markdown
Member

I think we should leave it right-aligned, having this much content in an attribute is a bad practice I guess, and shorter content would make sense to have right-aligned.

This content is not really meant to be easily readable I guess? As the individual keys are also attributes?

@spacegaier
Copy link
Copy Markdown
Member Author

Yes, the attributes are basically the split up keys from the YAML. Not sure why this integration does it that way.

Another case where I have seen YAML resulting in this <pre> is with HACS when updates are available. But also here, a user does not really have to check that value, as there is the HACS UI.

Before:
image

After:
image

@spacegaier spacegaier requested a review from bramkragten January 6, 2021 18:55
@bramkragten bramkragten merged commit b9259b8 into home-assistant:dev Jan 6, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2021
@spacegaier spacegaier deleted the attr-pre branch January 7, 2021 21:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants