Skip to content

Commit 30c5263

Browse files
feat: Add loader (#1180)
1 parent 3b1c827 commit 30c5263

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/main.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,22 @@ class MiniGraphCard extends LitElement {
323323
}
324324

325325
renderGraph() {
326+
const ready = this.entity[0] && this.Graph[0]._history !== undefined;
327+
326328
return this.config.show.graph ? html`
327329
<div class="graph">
328-
<div class="graph__container">
329-
${this.renderLabels()}
330-
${this.renderLabelsSecondary()}
331-
<div class="graph__container__svg">
332-
${this.renderSvg()}
333-
</div>
334-
</div>
335-
${this.renderLegend()}
330+
${ready ? html`
331+
<div class="graph__container">
332+
${this.renderLabels()}
333+
${this.renderLabelsSecondary()}
334+
<div class="graph__container__svg">
335+
${this.renderSvg()}
336+
</div>
337+
</div>
338+
${this.renderLegend()}
339+
` : html`
340+
<ha-circular-progress indeterminate></ha-circular-progress>
341+
`}
336342
</div>` : '';
337343
}
338344

src/style.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ const style = css`
6767
ha-card[hover] {
6868
cursor: pointer;
6969
}
70+
ha-circular-progress {
71+
margin: auto;
72+
}
7073
.flex {
7174
display: flex;
7275
display: -webkit-flex;

0 commit comments

Comments
 (0)