mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
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": {
|
"globals": {
|
||||||
"__DEV__": false,
|
"__DEV__": false,
|
||||||
"__DEMO__": false,
|
"__DEMO__": false,
|
||||||
|
"__BUILD__": false,
|
||||||
"Polymer": true,
|
"Polymer": true,
|
||||||
"webkitSpeechRecognition": false,
|
"webkitSpeechRecognition": false,
|
||||||
},
|
},
|
||||||
|
@ -37,7 +37,7 @@ async function buildHassioPanel(es6) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return minifyStream(stream, es6)
|
return minifyStream(stream, es6)
|
||||||
.pipe(rename('hassio-main.html'))
|
.pipe(rename(`hassio-main-${es6 ? 'latest' : 'es5'}.html`))
|
||||||
.pipe(gulp.dest('build-temp'));
|
.pipe(gulp.dest('build-temp'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,10 +3,11 @@ import * as HAWS from 'home-assistant-js-websocket';
|
|||||||
window.HAWS = HAWS;
|
window.HAWS = HAWS;
|
||||||
window.HASS_DEMO = __DEMO__;
|
window.HASS_DEMO = __DEMO__;
|
||||||
window.HASS_DEV = __DEV__;
|
window.HASS_DEV = __DEV__;
|
||||||
|
window.HASS_BUILD = __BUILD__;
|
||||||
|
|
||||||
const init = window.createHassConnection = function (password) {
|
const init = window.createHassConnection = function (password) {
|
||||||
const proto = window.location.protocol === 'https:' ? 'wss' : 'ws';
|
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 = {
|
const options = {
|
||||||
setupRetry: 10,
|
setupRetry: 10,
|
||||||
};
|
};
|
||||||
|
@ -39,7 +39,7 @@ class HaPanelHassio extends Polymer.Element {
|
|||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
if (!window.HASS_DEV) {
|
if (!window.HASS_DEV) {
|
||||||
Polymer.importHref('/api/hassio/panel', null, () => {
|
Polymer.importHref(`/api/hassio/panel_${window.HASS_BUILD}`, null, () => {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
alert('Failed to load the Hass.io panel from supervisor.');
|
alert('Failed to load the Hass.io panel from supervisor.');
|
||||||
});
|
});
|
||||||
|
@ -31,6 +31,7 @@ const plugins = [
|
|||||||
values: {
|
values: {
|
||||||
__DEV__: JSON.stringify(DEV),
|
__DEV__: JSON.stringify(DEV),
|
||||||
__DEMO__: JSON.stringify(DEMO),
|
__DEMO__: JSON.stringify(DEMO),
|
||||||
|
__BUILD__: JSON.stringify('latest'),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
@ -41,6 +41,7 @@ const plugins = [
|
|||||||
values: {
|
values: {
|
||||||
__DEV__: JSON.stringify(DEV),
|
__DEV__: JSON.stringify(DEV),
|
||||||
__DEMO__: JSON.stringify(DEMO),
|
__DEMO__: JSON.stringify(DEMO),
|
||||||
|
__BUILD__: JSON.stringify('es5'),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user