Offer setup device if device was not provisioned (#94)

This commit is contained in:
Paulus Schoutsen 2021-11-10 10:16:25 -08:00 committed by GitHub
parent e63743bfba
commit 69eec42e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,13 +247,7 @@ 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,
// there is nothing left for the user, let them go to the device dashboard
// if available
this._installState?.state === FlashStateType.FINISHED &&
this._installErase &&
this._client!.nextUrl !== undefined
? html` ? html`
<a <a
slot="primaryAction" slot="primaryAction"
@ -282,8 +277,7 @@ class EwtInstallDialog extends LitElement {
this._state = "DASHBOARD"; this._state = "DASHBOARD";
}} }}
></ewt-button> ></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;