mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-25 05:47:20 +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";
|
||||
|
||||
@customElement("ha-progress-button")
|
||||
class HaProgressButton extends LitElement {
|
||||
export class HaProgressButton extends LitElement {
|
||||
@property({ type: Boolean }) public disabled = 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 { hasTemplate } from "../../../common/string/has-template";
|
||||
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/ha-card";
|
||||
import "../../../components/ha-expansion-panel";
|
||||
@ -135,11 +136,15 @@ class HaPanelDevService extends LitElement {
|
||||
>`
|
||||
: ""}
|
||||
</div>
|
||||
<mwc-button .disabled=${!isValid} raised @click=${this._callService}>
|
||||
<ha-progress-button
|
||||
.disabled=${!isValid}
|
||||
raised
|
||||
@click=${this._callService}
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.developer-tools.tabs.services.call_service"
|
||||
)}
|
||||
</mwc-button>
|
||||
</ha-progress-button>
|
||||
</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) {
|
||||
return;
|
||||
}
|
||||
@ -310,6 +316,7 @@ class HaPanelDevService extends LitElement {
|
||||
return;
|
||||
}
|
||||
forwardHaptic("failure");
|
||||
button.actionError();
|
||||
showToast(this, {
|
||||
message:
|
||||
this.hass.localize(
|
||||
@ -318,7 +325,9 @@ class HaPanelDevService extends LitElement {
|
||||
this._serviceData.service
|
||||
) + ` ${err.message}`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
button.actionSuccess();
|
||||
}
|
||||
|
||||
private _toggleYaml() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user