Skip to content

Commit

Permalink
#16 - Update error to distinguish between 'no filtered data' and 'no …
Browse files Browse the repository at this point in the history
…data from entity'
  • Loading branch information
fratsloos committed Oct 17, 2022
1 parent e517ac9 commit 40e8dbb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/fr24_card.js

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions src/javascript/fr24_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ window.fr24db = [];
class Fr24Card extends HTMLElement {
set hass(hass) {
this._hass = hass;
this._isStateUndefined = false;

// Update the card
if (!this._config) {
Expand Down Expand Up @@ -217,6 +218,7 @@ class Fr24Card extends HTMLElement {
this._hass.states[this._config.entity].attributes[this._config.attribute];

if (typeof states === "undefined") {
this._isStateUndefined = true;
return;
}

Expand Down Expand Up @@ -475,9 +477,13 @@ class Fr24Card extends HTMLElement {
"color:" + this._config.colors.table_even_row_text + " !important;";
}

html += `<div class="no-data"${style !== "" ? ` style="${style}"` : ""}>${
this._lang.content.table.data.none
}</div>`;
let error = this._isStateUndefined
? this._lang.content.table.data.undefined
: this._lang.content.table.data.none;

html += `<div class="no-data"${
style !== "" ? ` style="${style}"` : ""
}>${error}</div>`;
}

// Set content
Expand Down
3 changes: 2 additions & 1 deletion src/javascript/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"data": {
"not_available": "N/V",
"none": "Keine Flugzeuge erkannt!"
"none": "Keine Flugzeuge erkannt!",
"undefined": "Die konfigurierte Entität enthält keine Daten!"
}
},
"popup": {
Expand Down
3 changes: 2 additions & 1 deletion src/javascript/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"data": {
"not_available": "N/A",
"none": "No aircrafts detected!"
"none": "No aircrafts detected!",
"undefined": "The configurated entity doesn't contain data!"
}
},
"popup": {
Expand Down
3 changes: 2 additions & 1 deletion src/javascript/lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"data": {
"not_available": "Nb",
"none": "Geen vliegtuigen gedetecteerd!"
"none": "Geen vliegtuigen gedetecteerd!",
"undefined": "De ingestelde entiteit bevat geen data!"
}
},
"popup": {
Expand Down
3 changes: 2 additions & 1 deletion src/javascript/lang/sl.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"data": {
"not_available": "N/A",
"none": "Ni zaznanih letal!"
"none": "Ni zaznanih letal!",
"undefined": "Konfigurirana entiteta ne vsebuje podatkov!"
}
},
"popup": {
Expand Down

0 comments on commit 40e8dbb

Please sign in to comment.