-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug option to enable logging server calls #17956
Merged
bramkragten
merged 5 commits into
home-assistant:dev
from
karwosts:frontend-debug-connection
Sep 27, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
605680a
Debug option to enable logging server calls
karwosts d2076fb
sentence case
karwosts 1378dd6
Merge branch 'dev' into frontend-debug-connection
karwosts 6def6fd
move to overflow menu
karwosts d155114
Merge branch 'frontend-debug-connection' of https://github.com/karwos…
karwosts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { CSSResultGroup, LitElement, css, html } from "lit"; | ||
import { customElement, property } from "lit/decorators"; | ||
import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; | ||
import { haStyle } from "../../../resources/styles"; | ||
import { HomeAssistant } from "../../../types"; | ||
import "./ha-debug-connection-row"; | ||
|
||
@customElement("developer-tools-debug") | ||
class HaPanelDevDebug extends SubscribeMixin(LitElement) { | ||
@property({ attribute: false }) public hass!: HomeAssistant; | ||
|
||
@property({ type: Boolean }) public narrow!: boolean; | ||
|
||
protected render() { | ||
return html` | ||
<div class="content"> | ||
<ha-card | ||
.header=${this.hass.localize( | ||
"ui.panel.developer-tools.tabs.debug.title" | ||
)} | ||
class="form" | ||
> | ||
<div class="card-content"> | ||
<ha-debug-connection-row | ||
.hass=${this.hass} | ||
.narrow=${this.narrow} | ||
></ha-debug-connection-row> | ||
</ha-card> | ||
</div> | ||
`; | ||
} | ||
|
||
static get styles(): CSSResultGroup { | ||
return [ | ||
haStyle, | ||
css` | ||
.content { | ||
padding: 28px 20px 16px; | ||
display: block; | ||
max-width: 600px; | ||
margin: 0 auto; | ||
} | ||
`, | ||
]; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"developer-tools-debug": HaPanelDevDebug; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/panels/developer-tools/debug/ha-debug-connection-row.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { html, LitElement, TemplateResult } from "lit"; | ||
import { customElement, property } from "lit/decorators"; | ||
import "../../../components/ha-settings-row"; | ||
import "../../../components/ha-switch"; | ||
import type { HaSwitch } from "../../../components/ha-switch"; | ||
import type { HomeAssistant } from "../../../types"; | ||
import { storeState } from "../../../util/ha-pref-storage"; | ||
|
||
@customElement("ha-debug-connection-row") | ||
class HaDebugConnectionRow extends LitElement { | ||
@property({ attribute: false }) public hass!: HomeAssistant; | ||
|
||
@property() public narrow!: boolean; | ||
|
||
protected render(): TemplateResult { | ||
return html` | ||
<ha-settings-row .narrow=${this.narrow}> | ||
<span slot="heading"> | ||
${this.hass.localize( | ||
"ui.panel.developer-tools.tabs.debug.debug_connection.title" | ||
)} | ||
</span> | ||
<span slot="description"> | ||
${this.hass.localize( | ||
"ui.panel.developer-tools.tabs.debug.debug_connection.description" | ||
)} | ||
</span> | ||
<ha-switch | ||
.checked=${this.hass.debugConnection} | ||
@change=${this._checkedChanged} | ||
></ha-switch> | ||
</ha-settings-row> | ||
`; | ||
} | ||
|
||
private async _checkedChanged(ev: Event) { | ||
const debugConnection = (ev.target as HaSwitch).checked; | ||
if (debugConnection === this.hass.debugConnection) { | ||
return; | ||
} | ||
this.hass.debugConnection = debugConnection; | ||
storeState(this.hass); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"ha-debug-connection-row": HaDebugConnectionRow; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should store this in
localStorage
, now you will never be able to catch things when the page is refreshed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does including this in ha-pref-storage take care of that? I thought it was working when I tested it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like I'm getting everything I expect to see when hitting refresh with this toggle enabled (and I did remove the DEV part of the equation just to test and be sure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, missed that 🙈 yeah pref storage stores that part in local storage!