Make Lovelace default (#2414)

* Set Lovelace as default

* Remove template

* Make link follow OPT_IN_PANEL
This commit is contained in:
Bram Kragten 2019-01-13 18:30:25 +01:00 committed by Paulus Schoutsen
parent 7173b16ef3
commit 937a939907
2 changed files with 23 additions and 3 deletions

View File

@ -8,7 +8,7 @@
export const DEFAULT_DOMAIN_ICON = "hass:bookmark";
/** Panel to show when no panel is picked. */
export const DEFAULT_PANEL = "states";
export const DEFAULT_PANEL = "lovelace";
/** Domains that have a state card. */
export const DOMAINS_WITH_CARD = [

View File

@ -20,7 +20,7 @@ import formatTime from "../../common/datetime/format_time";
import EventsMixin from "../../mixins/events-mixin";
import LocalizeMixin from "../../mixins/localize-mixin";
const OPT_IN_PANEL = "lovelace";
const OPT_IN_PANEL = "states";
let registeredDialog = false;
class HaPanelDevInfo extends EventsMixin(LocalizeMixin(PolymerElement)) {
@ -167,7 +167,7 @@ class HaPanelDevInfo extends EventsMixin(LocalizeMixin(PolymerElement)) {
</template>
</p>
<p>
<a href='/lovelace'>Try out the new Lovelace UI</a>
<a href="[[_nonDefaultLink()]]">[[_nonDefaultLinkText()]]</a>
<div id="love" style="cursor:pointer;" on-click="_toggleDefaultPage">[[_defaultPageText()]]</div
</p>
</div>
@ -366,6 +366,26 @@ class HaPanelDevInfo extends EventsMixin(LocalizeMixin(PolymerElement)) {
});
}
_nonDefaultLink() {
if (
localStorage.defaultPage === OPT_IN_PANEL &&
OPT_IN_PANEL === "states"
) {
return "/lovelace";
}
return "/states";
}
_nonDefaultLinkText() {
if (
localStorage.defaultPage === OPT_IN_PANEL &&
OPT_IN_PANEL === "states"
) {
return "Go to the Lovelace UI";
}
return "Go to the states UI";
}
_defaultPageText() {
return `>> ${
localStorage.defaultPage === OPT_IN_PANEL ? "Remove" : "Set"