Skip to content

Allow custom cards and more-info#365

Closed
bramkragten wants to merge 10 commits intohome-assistant:masterfrom
bramkragten:patch-2
Closed

Allow custom cards and more-info#365
bramkragten wants to merge 10 commits intohome-assistant:masterfrom
bramkragten:patch-2

Conversation

@bramkragten
Copy link
Copy Markdown
Member

Allow custom cards for the domains that have "big" cards.

Same config as a "state" card.

@mention-bot
Copy link
Copy Markdown

@bramkragten, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob and @Tommatheussen to be potential reviewers.

Kept config the same as the state-card for simplicity for the user.
Only the height is still [fixed for the domain](https://github.com/home-assistant/home-assistant-polymer/blob/6a864106e0a07452abe148617fa3a0f067b0c526/src/components/ha-cards.html#L84), might need to make that customizable too?
@andrey-git
Copy link
Copy Markdown
Contributor

Paulus,

I think we should drop the requirement in state-card-content that custom_ui elements start with "state-card".
Maybe also rename custom_ui_state_card attribute to custom_ui and use the value as full element name.

It is very convenient to have a single custom ui element entrypoint, as it can be vulcanized.

Stupid notepad++
@balloob
Copy link
Copy Markdown
Member

balloob commented Aug 2, 2017

I agree, we should drop the state-card requirement. However, how would you decide if something has to be rendered in an individual card or as part of a group?

@andrey-git
Copy link
Copy Markdown
Contributor

We could override window.hassUtil.DOMAINS_WITH_CARD on per-entity basis by an attribute.
Otherwise the card-vs-state-card will remain by domain.

If someone writes a single state card/state-card it's not a problem - they can still create card-weather.html or state-card-custom_light.html.

If someone creates a single entrypoint - custom_ui.html it will need to look into window.hassUtil.DOMAINS_WITH_CARD to determine if the "original" element is a card or a state-card.

@bramkragten
Copy link
Copy Markdown
Member Author

bramkragten commented Aug 5, 2017

The way I made it isn't going to work, because it now also takes the card in the more-info.
If we would only have a custom_ui attribute, how would you customize both a state-card for in the more-info and a card?
I now made it a separate attribute custom_ui_card, so you can define both...

@andrey-git
Copy link
Copy Markdown
Contributor

I don't understand your last comment.
Your custom code can check the inDialog property to know if it in more-info or not.

If you want separate entry points for similar things - it gets ugly.

Paulus, should we have a separate attributes for card/state-cards?

In any case let's move away from mandatory file prefixes.

@bramkragten
Copy link
Copy Markdown
Member Author

That would make this a breaking-change as of now.

Yes, we could use inDialog, but that would mean a user would have to duplicate the normal state-card in the custom-card if he doesn't want to customize the state-card in the more info.

Or am I missing something?

@andrey-git
Copy link
Copy Markdown
Contributor

I'm fine with the change as it is now, as it still allows to have a single entrypoint.

@bramkragten bramkragten changed the title Allow custom cards Allow custom cards and more-info Aug 5, 2017
Comment thread src/util/hass-util.html Outdated

if (unit && domain === 'sensor') {
if (unit === '°C' || unit === '°F') {
if (unit === '°C' || unit === '°F') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Extra characters here

Comment thread src/util/hass-util.html
window.hassUtil.DOMAINS_WITH_MORE_INFO = [
'alarm_control_panel', 'automation', 'camera', 'climate', 'configurator',
'cover', 'fan', 'group', 'light', 'lock', 'media_player', 'script',
'sun', 'updater', 'vacuum',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You removed 'vacuum' here.

Comment thread src/util/hass-util.html

if (window.hassUtil.DOMAINS_WITH_MORE_INFO.indexOf(domain) !== -1) {
return domain;
return 'MORE-INFO-' + domain;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since the return value of this function need to be uppercased anyway, I think it is more readable to use lower-case here.

@andrey-git
Copy link
Copy Markdown
Contributor

There are conflicts because fetching custom ui html is now done separately.

@balloob
Copy link
Copy Markdown
Member

balloob commented Sep 22, 2017

This PR seems to have gone stale. Closing it. You can reopen it when you're ready to finish it.

@balloob balloob closed this Sep 22, 2017
tkdrob pushed a commit to tkdrob/frontend that referenced this pull request Apr 20, 2021
Bumps [react](https://github.com/facebook/react/tree/HEAD/packages/react) from 16.13.1 to 16.14.0.
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v16.14.0/packages/react)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 8, 2022
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.

5 participants