mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 09:56:36 +00:00
Re-add success/failure indicator on call service button in dev tools (#9600)
* Re-add success/failure indicator on call service button in dev tools * move success outside of try block * Export HaProgressButton
This commit is contained in:
parent
982c940381
commit
32c6fb14dd
@ -5,7 +5,7 @@ import { customElement, property, query } from "lit/decorators";
|
|||||||
import "../ha-circular-progress";
|
import "../ha-circular-progress";
|
||||||
|
|
||||||
@customElement("ha-progress-button")
|
@customElement("ha-progress-button")
|
||||||
class HaProgressButton extends LitElement {
|
export class HaProgressButton extends LitElement {
|
||||||
@property({ type: Boolean }) public disabled = false;
|
@property({ type: Boolean }) public disabled = false;
|
||||||
|
|
||||||
@property({ type: Boolean }) public progress = false;
|
@property({ type: Boolean }) public progress = false;
|
||||||
|
@ -9,7 +9,8 @@ import { computeDomain } from "../../../common/entity/compute_domain";
|
|||||||
import { computeObjectId } from "../../../common/entity/compute_object_id";
|
import { computeObjectId } from "../../../common/entity/compute_object_id";
|
||||||
import { hasTemplate } from "../../../common/string/has-template";
|
import { hasTemplate } from "../../../common/string/has-template";
|
||||||
import { extractSearchParam } from "../../../common/url/search-params";
|
import { extractSearchParam } from "../../../common/url/search-params";
|
||||||
import "../../../components/buttons/ha-progress-button";
|
import { HaProgressButton } from "../../../components/buttons/ha-progress-button";
|
||||||
|
|
||||||
import "../../../components/entity/ha-entity-picker";
|
import "../../../components/entity/ha-entity-picker";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-expansion-panel";
|
import "../../../components/ha-expansion-panel";
|
||||||
@ -135,11 +136,15 @@ class HaPanelDevService extends LitElement {
|
|||||||
>`
|
>`
|
||||||
: ""}
|
: ""}
|
||||||
</div>
|
</div>
|
||||||
<mwc-button .disabled=${!isValid} raised @click=${this._callService}>
|
<ha-progress-button
|
||||||
|
.disabled=${!isValid}
|
||||||
|
raised
|
||||||
|
@click=${this._callService}
|
||||||
|
>
|
||||||
${this.hass.localize(
|
${this.hass.localize(
|
||||||
"ui.panel.developer-tools.tabs.services.call_service"
|
"ui.panel.developer-tools.tabs.services.call_service"
|
||||||
)}
|
)}
|
||||||
</mwc-button>
|
</ha-progress-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -295,7 +300,8 @@ class HaPanelDevService extends LitElement {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
private async _callService() {
|
private async _callService(ev) {
|
||||||
|
const button = ev.currentTarget as HaProgressButton;
|
||||||
if (!this._serviceData?.service) {
|
if (!this._serviceData?.service) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -310,6 +316,7 @@ class HaPanelDevService extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
forwardHaptic("failure");
|
forwardHaptic("failure");
|
||||||
|
button.actionError();
|
||||||
showToast(this, {
|
showToast(this, {
|
||||||
message:
|
message:
|
||||||
this.hass.localize(
|
this.hass.localize(
|
||||||
@ -318,7 +325,9 @@ class HaPanelDevService extends LitElement {
|
|||||||
this._serviceData.service
|
this._serviceData.service
|
||||||
) + ` ${err.message}`,
|
) + ` ${err.message}`,
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
button.actionSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _toggleYaml() {
|
private _toggleYaml() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user