diff --git a/.vscode/i18n-ally-reviews.yml b/.vscode/i18n-ally-reviews.yml new file mode 100644 index 00000000..8e914e43 --- /dev/null +++ b/.vscode/i18n-ally-reviews.yml @@ -0,0 +1,10 @@ +# Review comments generated by i18n-ally. Please commit this file. + +reviews: + error.reconnecting: + locales: + pt-BR: + translation_candidate: + source: en + text: Reconectando + time: '2022-06-23T03:45:39.286Z' diff --git a/.vscode/settings.json b/.vscode/settings.json index 3ec3801e..a4a10938 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,9 +1,8 @@ { - "i18n-ally.localesPaths": [ - "src/localize/languages" - ], - "i18n-ally.keystyle": "nested", - "i18n-ally.sortKeys": true, - "i18n-ally.keepFulfilled": true, - "i18n-ally.editor.preferEditor": true -} \ No newline at end of file + "i18n-ally.localesPaths": ["src/localize/languages"], + "i18n-ally.keystyle": "nested", + "i18n-ally.sortKeys": true, + "i18n-ally.keepFulfilled": true, + "i18n-ally.editor.preferEditor": true, + "i18n-ally.translate.saveAsCandidates": true +} diff --git a/src/card.ts b/src/card.ts index b52ac763..32322436 100644 --- a/src/card.ts +++ b/src/card.ts @@ -1106,8 +1106,26 @@ export class FrigateCard extends LitElement { if (oldHass) { const selectedCamera = this._getSelectedCameraConfig(); - if (this._getConfig().view.scan.enabled && this._updateTriggeredCameras(oldHass)) { - shouldUpdate ||= true; + if (oldHass.connected !== !!this._hass?.connected) { + if (!this._hass?.connected) { + this._setMessageAndUpdate( + { + message: localize('error.reconnecting'), + icon: 'mdi:lan-disconnect', + type: 'info', + dotdotdot: true, + }, + true, + ); + } else { + this._changeView(); + } + shouldUpdate = true; + } else if ( + this._getConfig().view.scan.enabled && + this._updateTriggeredCameras(oldHass) + ) { + shouldUpdate = true; } else if ( // Home Assistant pumps a lot of updates through. Re-rendering the card is // necessary at times (e.g. to update the 'clip' view as new clips @@ -1125,7 +1143,7 @@ export class FrigateCard extends LitElement { // default. Note that as per the Lit lifecycle, the setting of the view // itself will not trigger an *additional* re-render here. this._changeView(); - shouldUpdate ||= true; + shouldUpdate = true; } else { shouldUpdate ||= isHassDifferent( this._hass, diff --git a/src/components/message.ts b/src/components/message.ts index e7a1574d..e4f21fa5 100644 --- a/src/components/message.ts +++ b/src/components/message.ts @@ -1,10 +1,4 @@ -import { - CSSResultGroup, - html, - LitElement, - TemplateResult, - unsafeCSS, -} from 'lit'; +import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { TROUBLESHOOTING_URL } from '../const.js'; import { localize } from '../localize/localize.js'; @@ -23,6 +17,9 @@ export class FrigateCardMessage extends LitElement { @property({ attribute: false }) public icon?: string; + @property({ attribute: true, type: Boolean }) + public dotdotdot?: boolean; + // Render the menu. protected render(): TemplateResult { const icon = this.icon ? this.icon : 'mdi:information-outline'; @@ -33,6 +30,7 @@ export class FrigateCardMessage extends LitElement {
${JSON.stringify(this.context, null, 2)}`
: ''}
@@ -60,6 +58,7 @@ export class FrigateCardErrorMessage extends LitElement {
${localize('error.troubleshooting')}.`}
.icon=${'mdi:alert-circle'}
.context=${this.message.context}
+ .dotdotdot=${this.message.dotdotdot}
>
`;
}
@@ -89,15 +88,16 @@ export class FrigateCardProgressIndicator extends LitElement {
}
export function renderMessage(message: Message): TemplateResult {
- if (message.type == 'error') {
+ if (message.type === 'error') {
return html`