mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-10 02:46:38 +00:00
Don't load mdi icons with JS - it doesn't do anything. (#546)
This commit is contained in:
parent
fdf2fa3d3f
commit
c3a6495eb1
@ -39,7 +39,7 @@
|
|||||||
<login-form
|
<login-form
|
||||||
hass='[[hass]]'
|
hass='[[hass]]'
|
||||||
connection-promise='{{connectionPromise}}'
|
connection-promise='{{connectionPromise}}'
|
||||||
show-loading='[[computeShowLoading(connectionPromise, hass, iconsLoaded)]]'>
|
show-loading='[[computeShowLoading(connectionPromise, hass)]]'>
|
||||||
</login-form>
|
</login-form>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@ -72,16 +72,9 @@ class HomeAssistant extends Polymer.Element {
|
|||||||
type: Object,
|
type: Object,
|
||||||
value: null,
|
value: null,
|
||||||
},
|
},
|
||||||
icons: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
iconsLoaded: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
showMain: {
|
showMain: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
computed: 'computeShowMain(hass, iconsLoaded)',
|
computed: 'computeShowMain(hass)',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -90,33 +83,16 @@ class HomeAssistant extends Polymer.Element {
|
|||||||
super.ready();
|
super.ready();
|
||||||
this.addEventListener('settheme', e => this.setTheme(e));
|
this.addEventListener('settheme', e => this.setTheme(e));
|
||||||
this.addEventListener('hass-language-select', e => this.selectLanguage(e));
|
this.addEventListener('hass-language-select', e => this.selectLanguage(e));
|
||||||
this.loadIcons();
|
|
||||||
this.loadResources();
|
this.loadResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
computeShowMain(hass, iconsLoaded) {
|
computeShowMain(hass) {
|
||||||
return hass && hass.states && hass.config && iconsLoaded;
|
return hass && hass.states && hass.config;
|
||||||
}
|
}
|
||||||
|
|
||||||
computeShowLoading(connectionPromise, hass, iconsLoaded) {
|
computeShowLoading(connectionPromise, hass) {
|
||||||
// Show loading when connecting or when connected but not all pieces loaded yet
|
// Show loading when connecting or when connected but not all pieces loaded yet
|
||||||
return (connectionPromise != null ||
|
return (connectionPromise != null || (hass && (!hass.states || !hass.config)));
|
||||||
(hass && (!hass.states || !hass.config || !iconsLoaded)));
|
|
||||||
}
|
|
||||||
|
|
||||||
loadIcons() {
|
|
||||||
// If the import fails, we'll try to import again, must be a server glitch
|
|
||||||
// Since HTML imports only resolve once, in prod mode we import another url.
|
|
||||||
const success = () => {
|
|
||||||
this.iconsLoaded = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
Polymer.importHref(
|
|
||||||
'/static/mdi' + this.icons + '.html',
|
|
||||||
success,
|
|
||||||
() => Polymer.importHref('/static/mdi.html', success, success),
|
|
||||||
true /* true for async */
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadResources() {
|
loadResources() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user