Skip to content

Commit cb7f7f4

Browse files
a-bit-of-codingdistancerunner
authored andcommitted
Improve statistics developer tools UI flow
Streamline the process of fixing multiple values by improving the open/close behavior of date pickers and input dialogs.
1 parent b42d52b commit cb7f7f4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/panels/config/developer-tools/statistics/dialog-statistics-adjust-sum.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ export class DialogStatisticsFixUnsupportedUnitMetadata extends LitElement {
8787
this._open = false;
8888
}
8989

90+
private _adjustDataAndCloseInputDialog(): void {
91+
fireEvent(this, "dialog-closed", { dialog: this.localName });
92+
this._clearChosenStatistic();
93+
this._fetchStats();
94+
}
95+
9096
private _dialogClosed(): void {
9197
this._open = false;
9298
this._params = undefined;
@@ -97,7 +103,6 @@ export class DialogStatisticsFixUnsupportedUnitMetadata extends LitElement {
97103
this._amount = undefined;
98104
this._chosenStat = undefined;
99105
this._busy = false;
100-
fireEvent(this, "dialog-closed", { dialog: this.localName });
101106
}
102107

103108
protected render() {
@@ -120,7 +125,7 @@ export class DialogStatisticsFixUnsupportedUnitMetadata extends LitElement {
120125
"ui.panel.config.developer-tools.tabs.statistics.fix_issue.adjust_sum.outliers"
121126
)}
122127
</ha-button>
123-
<ha-button slot="primaryAction" data-dialog="close">
128+
<ha-button slot="primaryAction" @click=${this.closeDialog}>
124129
${this.hass.localize("ui.common.close")}
125130
</ha-button>
126131
`;
@@ -482,6 +487,7 @@ export class DialogStatisticsFixUnsupportedUnitMetadata extends LitElement {
482487
this._amount! - this._origAmount!,
483488
unit || null
484489
);
490+
this._busy = false;
485491
} catch (err: any) {
486492
this._busy = false;
487493
showAlertDialog(this, {
@@ -497,7 +503,7 @@ export class DialogStatisticsFixUnsupportedUnitMetadata extends LitElement {
497503
"ui.panel.config.developer-tools.tabs.statistics.fix_issue.adjust_sum.sum_adjusted"
498504
),
499505
});
500-
this.closeDialog();
506+
this._adjustDataAndCloseInputDialog();
501507
}
502508

503509
static get styles(): CSSResultGroup {

0 commit comments

Comments
 (0)