Skip to content

Commit

Permalink
better handle long firmware names (#252)
Browse files Browse the repository at this point in the history
balloob authored Jun 14, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d273fbf commit 38d6102
Showing 2 changed files with 29 additions and 22 deletions.
3 changes: 3 additions & 0 deletions src/components/ewt-button.ts
Original file line number Diff line number Diff line change
@@ -15,6 +15,9 @@ export class EwtButton extends ButtonBase {
.mdc-button {
min-width: initial;
}
:host([text-left]) .mdc-button__label {
text-align: left;
}
`,
];
}
48 changes: 26 additions & 22 deletions src/install-dialog.ts
Original file line number Diff line number Diff line change
@@ -164,24 +164,23 @@ export class EwtInstallDialog extends LitElement {
let allowClosing = true;

content = html`
<table>
<tr>
<td>${firmwareIcon}</td>
<td>${this._info!.firmware}&nbsp;${this._info!.version}</td>
</tr>
<tr>
<td>${chipIcon}</td>
<td>${this._info!.chipFamily}</td>
</tr>
</table>
<div class="table-row">
${firmwareIcon}
<div>${this._info!.firmware}&nbsp;${this._info!.version}</div>
</div>
<div class="table-row last">
${chipIcon}
<div>${this._info!.chipFamily}</div>
</div>
<div class="dashboard-buttons">
${!this._isSameVersion
? html`
<div>
<ewt-button
text-left
.label=${!this._isSameFirmware
? `Install ${this._manifest!.name}`
: `Update ${this._manifest!.name}`}
? `Install ${this._manifest.name}`
: `Update ${this._manifest.name}`}
@click=${() => {
if (this._isSameFirmware) {
this._startInstall(false);
@@ -291,6 +290,7 @@ export class EwtInstallDialog extends LitElement {
<div class="dashboard-buttons">
<div>
<ewt-button
text-left
.label=${`Install ${this._manifest.name}`}
@click=${() => {
if (this._manifest.new_install_prompt_erase) {
@@ -523,9 +523,7 @@ export class EwtInstallDialog extends LitElement {
}

_renderInstall(): [string | undefined, TemplateResult, boolean, boolean] {
let heading: string | undefined = `${
this._installConfirmed ? "Installing" : "Install"
} ${this._manifest!.name}`;
let heading: string | undefined;
let content: TemplateResult;
let hideActions = false;
const allowClosing = false;
@@ -545,16 +543,17 @@ export class EwtInstallDialog extends LitElement {
></ewt-button>
`;
} else if (!this._installConfirmed) {
heading = "Confirm Installation";
const action = isUpdate ? "update to" : "install";
content = html`
${isUpdate
? html`Your device is running
${this._info!.firmware}&nbsp;${this._info!.version}.<br /><br />`
: ""}
Do you want to ${action}
${this._manifest!.name}&nbsp;${this._manifest!.version}?
${this._manifest.name}&nbsp;${this._manifest.version}?
${this._installErase
? "All existing data will be erased from your device."
? html`<br /><br />All data on the device will be erased.`
: ""}
<ewt-button
slot="primaryAction"
@@ -575,9 +574,11 @@ export class EwtInstallDialog extends LitElement {
this._installState.state === FlashStateType.MANIFEST ||
this._installState.state === FlashStateType.PREPARING
) {
heading = "Installing";
content = this._renderProgress("Preparing installation");
hideActions = true;
} else if (this._installState.state === FlashStateType.ERASING) {
heading = "Installing";
content = this._renderProgress("Erasing");
hideActions = true;
} else if (
@@ -587,6 +588,7 @@ export class EwtInstallDialog extends LitElement {
(this._installState.state === FlashStateType.FINISHED &&
this._client === undefined)
) {
heading = "Installing";
let percentage: number | undefined;
let undeterminateLabel: string | undefined;
if (this._installState.state === FlashStateType.FINISHED) {
@@ -630,6 +632,7 @@ export class EwtInstallDialog extends LitElement {
></ewt-button>
`;
} else if (this._installState.state === FlashStateType.ERROR) {
heading = "Installation failed";
content = html`
<ewt-page-message
.icon=${ERROR_ICON}
@@ -896,7 +899,7 @@ export class EwtInstallDialog extends LitElement {
*/
private get _isSameVersion() {
return (
this._isSameFirmware && this._info!.version === this._manifest!.version
this._isSameFirmware && this._info!.version === this._manifest.version
);
}

@@ -916,12 +919,13 @@ export class EwtInstallDialog extends LitElement {
right: 4px;
top: 10px;
}
table {
border-spacing: 0;
color: var(--improv-text-color);
.table-row {
display: flex;
}
.table-row.last {
margin-bottom: 16px;
}
table svg {
.table-row svg {
width: 20px;
margin-right: 8px;
}

0 comments on commit 38d6102

Please sign in to comment.