Skip to content

Commit

Permalink
Fix function naming and single boot select in error-log-card
Browse files Browse the repository at this point in the history
  • Loading branch information
wendevlin committed Oct 31, 2024
1 parent 50bed72 commit dd01298
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/panels/config/logs/dialog-download-logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ class DownloadLogsDialog extends LitElement {
const boot = this._dialogParams!.boot;

const timeString = new Date().toISOString().replace(/:/g, "-");
const downloadUrl = this._getDownloadUrl()(provider, this._lineCount, boot);
const downloadUrl = this._getDownloadUrlFunction()(
provider,
this._lineCount,
boot
);
const logFileName =
provider !== "core"
? `${provider}_${timeString}.log`
Expand All @@ -125,7 +129,7 @@ class DownloadLogsDialog extends LitElement {
this.closeDialog();
}

private _getDownloadUrl() {
private _getDownloadUrlFunction() {
if (this._dialogParams!.boot === 0) {
return getHassioLogDownloadLinesUrl;
}
Expand Down
7 changes: 4 additions & 3 deletions src/panels/config/logs/error-log-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class ErrorLogCard extends LitElement {
isComponentLoaded(this.hass, "hassio") &&
this.provider
) {
const response = await this._fetchLogs()(
const response = await this._fetchLogsFunction()(
this.hass,
this.provider,
this._logStreamAborter.signal,
Expand Down Expand Up @@ -469,7 +469,7 @@ class ErrorLogCard extends LitElement {
}
}

private _fetchLogs = () => {
private _fetchLogsFunction = () => {
if (this._boot === 0) {
return fetchHassioLogsFollow;
}
Expand Down Expand Up @@ -582,7 +582,8 @@ class ErrorLogCard extends LitElement {
.map(Number)
.sort((a, b) => b - a);

if (boots.length) {
// only show boots select when there are more than one boot
if (boots.length > 1) {
this._boots = boots;
}
} catch (err: any) {
Expand Down

0 comments on commit dd01298

Please sign in to comment.