-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Convert hui-weblink-row to TypeScript/LitElement #1898
Conversation
} | ||
|
||
public setConfig(config): void { | ||
if (!config || !config.icon || !config.name || !config.url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why we make icon mandatory, can't we default to one?
Same with name, if no name, use url?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we should add a type for this config.
* Made name and icon fields optional. Will create a corresponding PR to the docs to update them as Optional * Updated entities-card to not check weblink config as that is the job of the element (entities-card should be updated to not check service-call config either as that is the job of the row element as well)
This will coincide with home-assistant/frontend#1898
throw new Error("Invalid Configuration: 'url' required"); | ||
} | ||
|
||
config.icon = config.icon || "hass:link"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should never change the passed in value. Instead do this:
this._config = {
icon: 'hass:link',
name: config.url,
...config
}
That's cool!
* weblink parameters `name` and `icon` optional This will coincide with home-assistant/frontend#1898 * 🚑 Fixes build error
* weblink parameters `name` and `icon` optional This will coincide with home-assistant/frontend#1898 * 🚑 Fixes build error
No description provided.