mirror of
https://github.com/esphome/esp-web-tools.git
synced 2025-07-27 21:56:35 +00:00
Offer setup device if device was not provisioned (#94)
This commit is contained in:
parent
e63743bfba
commit
69eec42e7a
@ -55,6 +55,7 @@ class EwtInstallDialog extends LitElement {
|
|||||||
@state() private _installState?: FlashState;
|
@state() private _installState?: FlashState;
|
||||||
|
|
||||||
@state() private _provisionForce = false;
|
@state() private _provisionForce = false;
|
||||||
|
private _wasProvisioned = false;
|
||||||
|
|
||||||
@state() private _error?: string;
|
@state() private _error?: string;
|
||||||
|
|
||||||
@ -246,44 +247,37 @@ class EwtInstallDialog extends LitElement {
|
|||||||
heading = undefined;
|
heading = undefined;
|
||||||
content = html`
|
content = html`
|
||||||
${messageTemplate(OK_ICON, "Device connected to the network!")}
|
${messageTemplate(OK_ICON, "Device connected to the network!")}
|
||||||
${
|
${!this._wasProvisioned && this._client!.nextUrl !== undefined
|
||||||
// If we went to provision after installing the firmware with a full erase,
|
? html`
|
||||||
// there is nothing left for the user, let them go to the device dashboard
|
<a
|
||||||
// if available
|
slot="primaryAction"
|
||||||
this._installState?.state === FlashStateType.FINISHED &&
|
href=${this._client!.nextUrl}
|
||||||
this._installErase &&
|
class="has-button"
|
||||||
this._client!.nextUrl !== undefined
|
target="_blank"
|
||||||
? html`
|
@click=${() => {
|
||||||
<a
|
this._state = "DASHBOARD";
|
||||||
slot="primaryAction"
|
}}
|
||||||
href=${this._client!.nextUrl}
|
>
|
||||||
class="has-button"
|
<ewt-button label="Set up Device"></ewt-button>
|
||||||
target="_blank"
|
</a>
|
||||||
@click=${() => {
|
<ewt-button
|
||||||
this._state = "DASHBOARD";
|
slot="secondaryAction"
|
||||||
}}
|
label="Skip"
|
||||||
>
|
@click=${() => {
|
||||||
<ewt-button label="Set up Device"></ewt-button>
|
this._state = "DASHBOARD";
|
||||||
</a>
|
this._installState = undefined;
|
||||||
<ewt-button
|
}}
|
||||||
slot="secondaryAction"
|
></ewt-button>
|
||||||
label="Skip"
|
`
|
||||||
@click=${() => {
|
: html`
|
||||||
this._state = "DASHBOARD";
|
<ewt-button
|
||||||
this._installState = undefined;
|
slot="primaryAction"
|
||||||
}}
|
label="Continue"
|
||||||
></ewt-button>
|
@click=${() => {
|
||||||
`
|
this._state = "DASHBOARD";
|
||||||
: html`
|
}}
|
||||||
<ewt-button
|
></ewt-button>
|
||||||
slot="primaryAction"
|
`}
|
||||||
label="Continue"
|
|
||||||
@click=${() => {
|
|
||||||
this._state = "DASHBOARD";
|
|
||||||
}}
|
|
||||||
></ewt-button>
|
|
||||||
`
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
} else {
|
} else {
|
||||||
let error: string | undefined;
|
let error: string | undefined;
|
||||||
@ -597,6 +591,8 @@ class EwtInstallDialog extends LitElement {
|
|||||||
|
|
||||||
private async _doProvision() {
|
private async _doProvision() {
|
||||||
this._busy = true;
|
this._busy = true;
|
||||||
|
this._wasProvisioned =
|
||||||
|
this._client!.state === ImprovSerialCurrentState.PROVISIONED;
|
||||||
const ssid = (
|
const ssid = (
|
||||||
this.shadowRoot!.querySelector("ewt-textfield[name=ssid]") as EwtTextfield
|
this.shadowRoot!.querySelector("ewt-textfield[name=ssid]") as EwtTextfield
|
||||||
).value;
|
).value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user