mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Save attribute checkbox state (#8010)
This commit is contained in:
parent
f42c0a0717
commit
782b941531
@ -169,7 +169,7 @@ class HaPanelDevState extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
||||
<th>[[localize('ui.panel.developer-tools.tabs.states.state')]]</th>
|
||||
<th hidden$="[[narrow]]">
|
||||
[[localize('ui.panel.developer-tools.tabs.states.attributes')]]
|
||||
<paper-checkbox checked="{{_showAttributes}}"></paper-checkbox>
|
||||
<paper-checkbox checked="{{_showAttributes}}" on-change="{{saveAttributeCheckboxState}}"></paper-checkbox>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -285,7 +285,7 @@ class HaPanelDevState extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
||||
|
||||
_showAttributes: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
value: JSON.parse(localStorage.getItem("devToolsShowAttributes") || true),
|
||||
},
|
||||
|
||||
_entities: {
|
||||
@ -478,6 +478,14 @@ class HaPanelDevState extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
||||
return Array.isArray(value) ? value.join(", ") : value;
|
||||
}
|
||||
|
||||
saveAttributeCheckboxState(ev) {
|
||||
try {
|
||||
localStorage.setItem("devToolsShowAttributes", ev.target.checked);
|
||||
} catch (e) {
|
||||
// Catch for Safari private mode
|
||||
}
|
||||
}
|
||||
|
||||
_computeParsedStateAttributes(stateAttributes) {
|
||||
try {
|
||||
return stateAttributes.trim() ? safeLoad(stateAttributes) : {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user