mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +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>[[localize('ui.panel.developer-tools.tabs.states.state')]]</th>
|
||||||
<th hidden$="[[narrow]]">
|
<th hidden$="[[narrow]]">
|
||||||
[[localize('ui.panel.developer-tools.tabs.states.attributes')]]
|
[[localize('ui.panel.developer-tools.tabs.states.attributes')]]
|
||||||
<paper-checkbox checked="{{_showAttributes}}"></paper-checkbox>
|
<paper-checkbox checked="{{_showAttributes}}" on-change="{{saveAttributeCheckboxState}}"></paper-checkbox>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -285,7 +285,7 @@ class HaPanelDevState extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
|||||||
|
|
||||||
_showAttributes: {
|
_showAttributes: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true,
|
value: JSON.parse(localStorage.getItem("devToolsShowAttributes") || true),
|
||||||
},
|
},
|
||||||
|
|
||||||
_entities: {
|
_entities: {
|
||||||
@ -478,6 +478,14 @@ class HaPanelDevState extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
|||||||
return Array.isArray(value) ? value.join(", ") : value;
|
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) {
|
_computeParsedStateAttributes(stateAttributes) {
|
||||||
try {
|
try {
|
||||||
return stateAttributes.trim() ? safeLoad(stateAttributes) : {};
|
return stateAttributes.trim() ? safeLoad(stateAttributes) : {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user