Expose build type on window (#630)
* Expose build type on window * Build two panels for Hass.io
This commit is contained in:
parent
de87c5b19b
commit
6fac4e9027
|
@ -14,6 +14,7 @@
|
|||
"globals": {
|
||||
"__DEV__": false,
|
||||
"__DEMO__": false,
|
||||
"__BUILD__": false,
|
||||
"Polymer": true,
|
||||
"webkitSpeechRecognition": false,
|
||||
},
|
||||
|
|
|
@ -37,7 +37,7 @@ async function buildHassioPanel(es6) {
|
|||
});
|
||||
|
||||
return minifyStream(stream, es6)
|
||||
.pipe(rename('hassio-main.html'))
|
||||
.pipe(rename(`hassio-main-${es6 ? 'latest' : 'es5'}.html`))
|
||||
.pipe(gulp.dest('build-temp'));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,11 @@ import * as HAWS from 'home-assistant-js-websocket';
|
|||
window.HAWS = HAWS;
|
||||
window.HASS_DEMO = __DEMO__;
|
||||
window.HASS_DEV = __DEV__;
|
||||
window.HASS_BUILD = __BUILD__;
|
||||
|
||||
const init = window.createHassConnection = function (password) {
|
||||
const proto = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
const url = `${proto}://${window.location.host}/api/websocket${window.location.search}`;
|
||||
const url = `${proto}://${window.location.host}/api/websocket?${window.HASS_BUILD}`;
|
||||
const options = {
|
||||
setupRetry: 10,
|
||||
};
|
||||
|
|
|
@ -39,7 +39,7 @@ class HaPanelHassio extends Polymer.Element {
|
|||
connectedCallback() {
|
||||
super.connectedCallback();
|
||||
if (!window.HASS_DEV) {
|
||||
Polymer.importHref('/api/hassio/panel', null, () => {
|
||||
Polymer.importHref(`/api/hassio/panel_${window.HASS_BUILD}`, null, () => {
|
||||
// eslint-disable-next-line
|
||||
alert('Failed to load the Hass.io panel from supervisor.');
|
||||
});
|
||||
|
|
|
@ -31,6 +31,7 @@ const plugins = [
|
|||
values: {
|
||||
__DEV__: JSON.stringify(DEV),
|
||||
__DEMO__: JSON.stringify(DEMO),
|
||||
__BUILD__: JSON.stringify('latest'),
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
|
|
@ -41,6 +41,7 @@ const plugins = [
|
|||
values: {
|
||||
__DEV__: JSON.stringify(DEV),
|
||||
__DEMO__: JSON.stringify(DEMO),
|
||||
__BUILD__: JSON.stringify('es5'),
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue