This commit is contained in:
Ian Richardson
2020-11-16 20:33:14 -06:00
parent 90e585529b
commit a102dd0d4f
4 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "boilerplate-card", "name": "boilerplate-card",
"version": "1.3.0", "version": "1.3.1",
"description": "Lovelace boilerplate-card", "description": "Lovelace boilerplate-card",
"keywords": [ "keywords": [
"home-assistant", "home-assistant",
+8 -4
View File
@@ -59,7 +59,7 @@ export class BoilerplateCard extends LitElement {
public setConfig(config: BoilerplateCardConfig): void { public setConfig(config: BoilerplateCardConfig): void {
// TODO Check for required fields and that they are of the proper format // TODO Check for required fields and that they are of the proper format
if (!config || config.show_error) { if (!config) {
throw new Error(localize('common.invalid_configuration')); throw new Error(localize('common.invalid_configuration'));
} }
@@ -84,7 +84,11 @@ export class BoilerplateCard extends LitElement {
protected render(): TemplateResult | void { protected render(): TemplateResult | void {
// TODO Check for stateObj or other necessary things and render a warning if missing // TODO Check for stateObj or other necessary things and render a warning if missing
if (this.config.show_warning) { if (this.config.show_warning) {
return this.showWarning(localize('common.show_warning')); return this._showWarning(localize('common.show_warning'));
}
if (this.config.show_error) {
return this._showError(localize('common.show_error'));
} }
return html` return html`
@@ -107,13 +111,13 @@ export class BoilerplateCard extends LitElement {
} }
} }
private showWarning(warning: string): TemplateResult { private _showWarning(warning: string): TemplateResult {
return html` return html`
<hui-warning>${warning}</hui-warning> <hui-warning>${warning}</hui-warning>
`; `;
} }
private showError(error: string): TemplateResult { private _showError(error: string): TemplateResult {
const errorCard = document.createElement('hui-error-card'); const errorCard = document.createElement('hui-error-card');
errorCard.setConfig({ errorCard.setConfig({
type: 'error', type: 'error',
+1 -1
View File
@@ -1 +1 @@
export const CARD_VERSION = '1.3.0'; export const CARD_VERSION = '1.3.1';
+2 -1
View File
@@ -2,6 +2,7 @@
"common": { "common": {
"version": "Version", "version": "Version",
"invalid_configuration": "Invalid configuration", "invalid_configuration": "Invalid configuration",
"show_warning": "Show Warning" "show_warning": "Show Warning",
"show_error": "Show Error"
} }
} }