From b9b1d9551410940f65b4b9ca2accc97c7c9cbb19 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 7 Aug 2016 21:56:17 -0700 Subject: [PATCH] Tweak panel parameters (#2746) --- homeassistant/components/frontend/__init__.py | 37 +++++++++--------- homeassistant/components/frontend/version.py | 2 +- .../frontend/www_static/frontend.html | 2 +- .../frontend/www_static/frontend.html.gz | Bin 121281 -> 121280 bytes .../www_static/home-assistant-polymer | 2 +- .../frontend/www_static/service_worker.js | 2 +- .../frontend/www_static/service_worker.js.gz | Bin 2177 -> 2179 bytes homeassistant/components/panel_iframe.py | 4 +- tests/components/test_panel_iframe.py | 4 +- 9 files changed, 27 insertions(+), 26 deletions(-) diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 3925170694e..552ac3567d1 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -20,8 +20,8 @@ _REGISTERED_COMPONENTS = set() _LOGGER = logging.getLogger(__name__) -def register_built_in_panel(hass, component_name, title=None, icon=None, - url_name=None, config=None): +def register_built_in_panel(hass, component_name, sidebar_title=None, + sidebar_icon=None, url_path=None, config=None): """Register a built-in panel.""" # pylint: disable=too-many-arguments path = 'panels/ha-panel-{}.html'.format(component_name) @@ -33,30 +33,31 @@ def register_built_in_panel(hass, component_name, title=None, icon=None, url = None # use default url generate mechanism register_panel(hass, component_name, os.path.join(STATIC_PATH, path), - FINGERPRINTS[path], title, icon, url_name, url, config) + FINGERPRINTS[path], sidebar_title, sidebar_icon, url_path, + url, config) -def register_panel(hass, component_name, path, md5=None, title=None, icon=None, - url_name=None, url=None, config=None): +def register_panel(hass, component_name, path, md5=None, sidebar_title=None, + sidebar_icon=None, url_path=None, url=None, config=None): """Register a panel for the frontend. component_name: name of the web component path: path to the HTML of the web component md5: the md5 hash of the web component (for versioning, optional) - title: title to show in the sidebar (optional) - icon: icon to show next to title in sidebar (optional) - url_name: name to use in the url (defaults to component_name) + sidebar_title: title to show in the sidebar (optional) + sidebar_icon: icon to show next to title in sidebar (optional) + url_path: name to use in the url (defaults to component_name) url: for the web component (for dev environment, optional) config: config to be passed into the web component Warning: this API will probably change. Use at own risk. """ # pylint: disable=too-many-arguments - if url_name is None: - url_name = component_name + if url_path is None: + url_path = component_name - if url_name in PANELS: - _LOGGER.warning('Overwriting component %s', url_name) + if url_path in PANELS: + _LOGGER.warning('Overwriting component %s', url_path) if not os.path.isfile(path): _LOGGER.error('Panel %s component does not exist: %s', component_name, path) @@ -67,14 +68,14 @@ def register_panel(hass, component_name, path, md5=None, title=None, icon=None, md5 = hashlib.md5(fil.read().encode('utf-8')).hexdigest() data = { - 'url_name': url_name, + 'url_path': url_path, 'component_name': component_name, } - if title: - data['title'] = title - if icon: - data['icon'] = icon + if sidebar_title: + data['title'] = sidebar_title + if sidebar_icon: + data['icon'] = sidebar_icon if config is not None: data['config'] = config @@ -90,7 +91,7 @@ def register_panel(hass, component_name, path, md5=None, title=None, icon=None, fprinted_url = URL_PANEL_COMPONENT_FP.format(component_name, md5) data['url'] = fprinted_url - PANELS[url_name] = data + PANELS[url_path] = data def setup(hass, config): diff --git a/homeassistant/components/frontend/version.py b/homeassistant/components/frontend/version.py index 7b1f8bc0d01..486d5869f0a 100644 --- a/homeassistant/components/frontend/version.py +++ b/homeassistant/components/frontend/version.py @@ -2,7 +2,7 @@ FINGERPRINTS = { "core.js": "fb9a1af0cf7d39f3041d3fa67e16e81c", - "frontend.html": "fb24d923539bd6cf82a96b0a93b33aec", + "frontend.html": "cfebe592f524eff270282929d5f5fa0c", "mdi.html": "f6c6cc64c2ec38a80e91f801b41119b3", "panels/ha-panel-dev-event.html": "8f63a091246408228beebf276440c06e", "panels/ha-panel-dev-info.html": "34e2df1af32e60fffcafe7e008a92169", diff --git a/homeassistant/components/frontend/www_static/frontend.html b/homeassistant/components/frontend/www_static/frontend.html index d3107844ff3..3a59a9676d5 100644 --- a/homeassistant/components/frontend/www_static/frontend.html +++ b/homeassistant/components/frontend/www_static/frontend.html @@ -2,4 +2,4 @@ },_distributeDirtyRoots:function(){for(var e,t=this.shadyRoot._dirtyRoots,o=0,i=t.length;o0?~setTimeout(e,t):(this._twiddle.textContent=this._twiddleContent++,this._callbacks.push(e),this._currVal++)},cancel:function(e){if(e<0)clearTimeout(~e);else{var t=e-this._lastVal;if(t>=0){if(!this._callbacks[t])throw"invalid async handle: "+e;this._callbacks[t]=null}}},_atEndOfMicrotask:function(){for(var e=this._callbacks.length,t=0;t \ No newline at end of file +}var r=window.requestAnimationFrame;window.requestAnimationFrame=function(t){return r(function(e){window.document.timeline._updateAnimationsPromises(),t(e),window.document.timeline._updateAnimationsPromises()})},e.AnimationTimeline=function(){this._animations=[],this.currentTime=void 0},e.AnimationTimeline.prototype={getAnimations:function(){return this._discardAnimations(),this._animations.slice()},_updateAnimationsPromises:function(){e.animationsWithPromises=e.animationsWithPromises.filter(function(t){return t._updatePromises()})},_discardAnimations:function(){this._updateAnimationsPromises(),this._animations=this._animations.filter(function(t){return"finished"!=t.playState&&"idle"!=t.playState})},_play:function(t){var i=new e.Animation(t,this);return this._animations.push(i),e.restartWebAnimationsNextTick(),i._updatePromises(),i._animation.play(),i._updatePromises(),i},play:function(t){return t&&t.remove(),this._play(t)}};var o=!1;e.restartWebAnimationsNextTick=function(){o||(o=!0,requestAnimationFrame(n))};var a=new e.AnimationTimeline;e.timeline=a;try{Object.defineProperty(window.document,"timeline",{configurable:!0,get:function(){return a}})}catch(t){}try{window.document.timeline=a}catch(t){}}(c,e,f),function(t,e,i){e.animationsWithPromises=[],e.Animation=function(e,i){if(this.id="",e&&e._id&&(this.id=e._id),this.effect=e,e&&(e._animation=this),!i)throw new Error("Animation with null timeline is not supported");this._timeline=i,this._sequenceNumber=t.sequenceNumber++,this._holdTime=0,this._paused=!1,this._isGroup=!1,this._animation=null,this._childAnimations=[],this._callback=null,this._oldPlayState="idle",this._rebuildUnderlyingAnimation(),this._animation.cancel(),this._updatePromises()},e.Animation.prototype={_updatePromises:function(){var t=this._oldPlayState,e=this.playState;return this._readyPromise&&e!==t&&("idle"==e?(this._rejectReadyPromise(),this._readyPromise=void 0):"pending"==t?this._resolveReadyPromise():"pending"==e&&(this._readyPromise=void 0)),this._finishedPromise&&e!==t&&("idle"==e?(this._rejectFinishedPromise(),this._finishedPromise=void 0):"finished"==e?this._resolveFinishedPromise():"finished"==t&&(this._finishedPromise=void 0)),this._oldPlayState=this.playState,this._readyPromise||this._finishedPromise},_rebuildUnderlyingAnimation:function(){this._updatePromises();var t,i,n,r,o=!!this._animation;o&&(t=this.playbackRate,i=this._paused,n=this.startTime,r=this.currentTime,this._animation.cancel(),this._animation._wrapper=null,this._animation=null),(!this.effect||this.effect instanceof window.KeyframeEffect)&&(this._animation=e.newUnderlyingAnimationForKeyframeEffect(this.effect),e.bindAnimationForKeyframeEffect(this)),(this.effect instanceof window.SequenceEffect||this.effect instanceof window.GroupEffect)&&(this._animation=e.newUnderlyingAnimationForGroup(this.effect),e.bindAnimationForGroup(this)),this.effect&&this.effect._onsample&&e.bindAnimationForCustomEffect(this),o&&(1!=t&&(this.playbackRate=t),null!==n?this.startTime=n:null!==r?this.currentTime=r:null!==this._holdTime&&(this.currentTime=this._holdTime),i&&this.pause()),this._updatePromises()},_updateChildren:function(){if(this.effect&&"idle"!=this.playState){var t=this.effect._timing.delay;this._childAnimations.forEach(function(i){this._arrangeChildren(i,t),this.effect instanceof window.SequenceEffect&&(t+=e.groupChildDuration(i.effect))}.bind(this))}},_setExternalAnimation:function(t){if(this.effect&&this._isGroup)for(var e=0;e \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/frontend.html.gz b/homeassistant/components/frontend/www_static/frontend.html.gz index 158bfc6af2c627450cef977e89364fa6095b00c8..529a2529da1ea3a75099b546f7a4d22fd503ba7b 100644 GIT binary patch delta 1393 zcmV-%1&;c`vj@Pl2L~UE2nZ_;sDTHy2LWi*e-htZQmD&@#)=HVz@`-~7FlS*Dbq!u z<%asQ^GNY>SDLr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0@MPFRUl=?Jy6 z?cMe_u~Qfsw+R<+pLlhP+nfUnHR*~zx*6(I;44+mR#X%$RpU<1LZ3Y^6>+Al8W+Re z#6^NG3^?b)Tnvoh4tiyly%lqLbZ!NqkVi1@-cj@A_-nFa&Ue^vmKkXE^pYY!e{?;~ zd+|e^{bAg{T3yfLq)5Et!`T&mfv>zOJeE}}+@*h3OuyhVgfgE0FW76(ZAE$q0Pte3 AMgRZ+ diff --git a/homeassistant/components/frontend/www_static/home-assistant-polymer b/homeassistant/components/frontend/www_static/home-assistant-polymer index a343d3d098e..3512e5aa25c 160000 --- a/homeassistant/components/frontend/www_static/home-assistant-polymer +++ b/homeassistant/components/frontend/www_static/home-assistant-polymer @@ -1 +1 @@ -Subproject commit a343d3d098e78976fc66f8ed66ce0ae5d7bc3861 +Subproject commit 3512e5aa25c0d48328a384865bd47514072a6c7e diff --git a/homeassistant/components/frontend/www_static/service_worker.js b/homeassistant/components/frontend/www_static/service_worker.js index 3c2d506e455..0c6a07acd39 100644 --- a/homeassistant/components/frontend/www_static/service_worker.js +++ b/homeassistant/components/frontend/www_static/service_worker.js @@ -1 +1 @@ -"use strict";function deleteAllCaches(){return caches.keys().then(function(e){return Promise.all(e.map(function(e){return caches.delete(e)}))})}var PrecacheConfig=[["/","c18e36573c1ffbf60f9539dcf140b1fc"],["/frontend/panels/dev-event-8f63a091246408228beebf276440c06e.html","8ff5aa2fc6949514399ddbfad500b8f1"],["/frontend/panels/dev-info-34e2df1af32e60fffcafe7e008a92169.html","7e939dc762dc0c0ec769db4ea76a4b09"],["/frontend/panels/dev-service-e24baccaed866b590f2a368dbda7e64b.html","48e5b1b46dca078f9d7dd14fe826822d"],["/frontend/panels/dev-state-be5221066c45aac6bf63f7871ebd0c20.html","26b71224269795796dd94af91c36fe19"],["/frontend/panels/dev-template-38373e06171b269a48bb8e2b09bfb565.html","21e9cc2a7155cea74c7240b928960bc5"],["/frontend/panels/map-39d4793bb67cedbbdbd1d79bdadc9c3f.html","67fde0ba390387969c2a603e52007aea"],["/static/core-fb9a1af0cf7d39f3041d3fa67e16e81c.js","76f71646ea7ddbb977fa5b5219f15e85"],["/static/frontend-fb24d923539bd6cf82a96b0a93b33aec.html","31c8fe27c776278a9762209c3eeded1e"],["/static/mdi-f6c6cc64c2ec38a80e91f801b41119b3.html","e010f32322ed6f66916c7c09dbba4acd"],["static/fonts/roboto/Roboto-Bold.ttf","d329cc8b34667f114a95422aaad1b063"],["static/fonts/roboto/Roboto-Light.ttf","7b5fb88f12bec8143f00e21bc3222124"],["static/fonts/roboto/Roboto-Medium.ttf","fe13e4170719c2fc586501e777bde143"],["static/fonts/roboto/Roboto-Regular.ttf","ac3f799d5bbaf5196fab15ab8de8431c"],["static/icons/favicon-192x192.png","419903b8422586a7e28021bbe9011175"],["static/icons/favicon.ico","04235bda7843ec2fceb1cbe2bc696cf4"],["static/images/card_media_player_bg.png","a34281d1c1835d338a642e90930e61aa"],["static/webcomponents-lite.min.js","b0f32ad3c7749c40d486603f31c9d8b1"]],CacheNamePrefix="sw-precache-v1--"+(self.registration?self.registration.scope:"")+"-",IgnoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var a=new URL(e);return"/"===a.pathname.slice(-1)&&(a.pathname+=t),a.toString()},getCacheBustedUrl=function(e,t){t=t||Date.now();var a=new URL(e);return a.search+=(a.search?"&":"")+"sw-precache="+t,a.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var a=new URL(t).pathname;return e.some(function(e){return a.match(e)})},populateCurrentCacheNames=function(e,t,a){var n={},c={};return e.forEach(function(e){var r=new URL(e[0],a).toString(),o=t+r+"-"+e[1];c[o]=r,n[r]=o}),{absoluteUrlToCacheName:n,currentCacheNamesToAbsoluteUrl:c}},stripIgnoredUrlParameters=function(e,t){var a=new URL(e);return a.search=a.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(e){return t.every(function(t){return!t.test(e[0])})}).map(function(e){return e.join("=")}).join("&"),a.toString()},mappings=populateCurrentCacheNames(PrecacheConfig,CacheNamePrefix,self.location),AbsoluteUrlToCacheName=mappings.absoluteUrlToCacheName,CurrentCacheNamesToAbsoluteUrl=mappings.currentCacheNamesToAbsoluteUrl;self.addEventListener("install",function(e){e.waitUntil(Promise.all(Object.keys(CurrentCacheNamesToAbsoluteUrl).map(function(e){return caches.open(e).then(function(t){return t.keys().then(function(a){if(0===a.length){var n=e.split("-").pop(),c=getCacheBustedUrl(CurrentCacheNamesToAbsoluteUrl[e],n),r=new Request(c,{credentials:"same-origin"});return fetch(r).then(function(a){return a.ok?t.put(CurrentCacheNamesToAbsoluteUrl[e],a):(console.error("Request for %s returned a response status %d, so not attempting to cache it.",c,a.status),caches.delete(e))})}})})})).then(function(){return caches.keys().then(function(e){return Promise.all(e.filter(function(e){return 0===e.indexOf(CacheNamePrefix)&&!(e in CurrentCacheNamesToAbsoluteUrl)}).map(function(e){return caches.delete(e)}))})}).then(function(){"function"==typeof self.skipWaiting&&self.skipWaiting()}))}),self.clients&&"function"==typeof self.clients.claim&&self.addEventListener("activate",function(e){e.waitUntil(self.clients.claim())}),self.addEventListener("message",function(e){"delete_all"===e.data.command&&(console.log("About to delete all caches..."),deleteAllCaches().then(function(){console.log("Caches deleted."),e.ports[0].postMessage({error:null})}).catch(function(t){console.log("Caches not deleted:",t),e.ports[0].postMessage({error:t})}))}),self.addEventListener("fetch",function(e){if("GET"===e.request.method){var t=stripIgnoredUrlParameters(e.request.url,IgnoreUrlParametersMatching),a=AbsoluteUrlToCacheName[t],n="index.html";!a&&n&&(t=addDirectoryIndex(t,n),a=AbsoluteUrlToCacheName[t]);var c="/";if(!a&&c&&e.request.headers.has("accept")&&e.request.headers.get("accept").includes("text/html")&&isPathWhitelisted(["^((?!(static|api|local|service_worker.js)).)*$"],e.request.url)){var r=new URL(c,self.location);a=AbsoluteUrlToCacheName[r.toString()]}a&&e.respondWith(caches.open(a).then(function(e){return e.keys().then(function(t){return e.match(t[0]).then(function(e){if(e)return e;throw Error("The cache "+a+" is empty.")})})}).catch(function(t){return console.warn('Couldn\'t serve response for "%s" from cache: %O',e.request.url,t),fetch(e.request)}))}}); \ No newline at end of file +"use strict";function deleteAllCaches(){return caches.keys().then(function(e){return Promise.all(e.map(function(e){return caches.delete(e)}))})}var PrecacheConfig=[["/","229cd1dc54d4e0cfc443c8885a65ab03"],["/frontend/panels/dev-event-8f63a091246408228beebf276440c06e.html","8ff5aa2fc6949514399ddbfad500b8f1"],["/frontend/panels/dev-info-34e2df1af32e60fffcafe7e008a92169.html","7e939dc762dc0c0ec769db4ea76a4b09"],["/frontend/panels/dev-service-e24baccaed866b590f2a368dbda7e64b.html","48e5b1b46dca078f9d7dd14fe826822d"],["/frontend/panels/dev-state-be5221066c45aac6bf63f7871ebd0c20.html","26b71224269795796dd94af91c36fe19"],["/frontend/panels/dev-template-38373e06171b269a48bb8e2b09bfb565.html","21e9cc2a7155cea74c7240b928960bc5"],["/frontend/panels/map-39d4793bb67cedbbdbd1d79bdadc9c3f.html","67fde0ba390387969c2a603e52007aea"],["/static/core-fb9a1af0cf7d39f3041d3fa67e16e81c.js","76f71646ea7ddbb977fa5b5219f15e85"],["/static/frontend-cfebe592f524eff270282929d5f5fa0c.html","2c49d8dd1769ab29576ed14d9a0faa0e"],["/static/mdi-f6c6cc64c2ec38a80e91f801b41119b3.html","e010f32322ed6f66916c7c09dbba4acd"],["static/fonts/roboto/Roboto-Bold.ttf","d329cc8b34667f114a95422aaad1b063"],["static/fonts/roboto/Roboto-Light.ttf","7b5fb88f12bec8143f00e21bc3222124"],["static/fonts/roboto/Roboto-Medium.ttf","fe13e4170719c2fc586501e777bde143"],["static/fonts/roboto/Roboto-Regular.ttf","ac3f799d5bbaf5196fab15ab8de8431c"],["static/icons/favicon-192x192.png","419903b8422586a7e28021bbe9011175"],["static/icons/favicon.ico","04235bda7843ec2fceb1cbe2bc696cf4"],["static/images/card_media_player_bg.png","a34281d1c1835d338a642e90930e61aa"],["static/webcomponents-lite.min.js","b0f32ad3c7749c40d486603f31c9d8b1"]],CacheNamePrefix="sw-precache-v1--"+(self.registration?self.registration.scope:"")+"-",IgnoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var a=new URL(e);return"/"===a.pathname.slice(-1)&&(a.pathname+=t),a.toString()},getCacheBustedUrl=function(e,t){t=t||Date.now();var a=new URL(e);return a.search+=(a.search?"&":"")+"sw-precache="+t,a.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var a=new URL(t).pathname;return e.some(function(e){return a.match(e)})},populateCurrentCacheNames=function(e,t,a){var n={},c={};return e.forEach(function(e){var r=new URL(e[0],a).toString(),o=t+r+"-"+e[1];c[o]=r,n[r]=o}),{absoluteUrlToCacheName:n,currentCacheNamesToAbsoluteUrl:c}},stripIgnoredUrlParameters=function(e,t){var a=new URL(e);return a.search=a.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(e){return t.every(function(t){return!t.test(e[0])})}).map(function(e){return e.join("=")}).join("&"),a.toString()},mappings=populateCurrentCacheNames(PrecacheConfig,CacheNamePrefix,self.location),AbsoluteUrlToCacheName=mappings.absoluteUrlToCacheName,CurrentCacheNamesToAbsoluteUrl=mappings.currentCacheNamesToAbsoluteUrl;self.addEventListener("install",function(e){e.waitUntil(Promise.all(Object.keys(CurrentCacheNamesToAbsoluteUrl).map(function(e){return caches.open(e).then(function(t){return t.keys().then(function(a){if(0===a.length){var n=e.split("-").pop(),c=getCacheBustedUrl(CurrentCacheNamesToAbsoluteUrl[e],n),r=new Request(c,{credentials:"same-origin"});return fetch(r).then(function(a){return a.ok?t.put(CurrentCacheNamesToAbsoluteUrl[e],a):(console.error("Request for %s returned a response status %d, so not attempting to cache it.",c,a.status),caches.delete(e))})}})})})).then(function(){return caches.keys().then(function(e){return Promise.all(e.filter(function(e){return 0===e.indexOf(CacheNamePrefix)&&!(e in CurrentCacheNamesToAbsoluteUrl)}).map(function(e){return caches.delete(e)}))})}).then(function(){"function"==typeof self.skipWaiting&&self.skipWaiting()}))}),self.clients&&"function"==typeof self.clients.claim&&self.addEventListener("activate",function(e){e.waitUntil(self.clients.claim())}),self.addEventListener("message",function(e){"delete_all"===e.data.command&&(console.log("About to delete all caches..."),deleteAllCaches().then(function(){console.log("Caches deleted."),e.ports[0].postMessage({error:null})}).catch(function(t){console.log("Caches not deleted:",t),e.ports[0].postMessage({error:t})}))}),self.addEventListener("fetch",function(e){if("GET"===e.request.method){var t=stripIgnoredUrlParameters(e.request.url,IgnoreUrlParametersMatching),a=AbsoluteUrlToCacheName[t],n="index.html";!a&&n&&(t=addDirectoryIndex(t,n),a=AbsoluteUrlToCacheName[t]);var c="/";if(!a&&c&&e.request.headers.has("accept")&&e.request.headers.get("accept").includes("text/html")&&isPathWhitelisted(["^((?!(static|api|local|service_worker.js)).)*$"],e.request.url)){var r=new URL(c,self.location);a=AbsoluteUrlToCacheName[r.toString()]}a&&e.respondWith(caches.open(a).then(function(e){return e.keys().then(function(t){return e.match(t[0]).then(function(e){if(e)return e;throw Error("The cache "+a+" is empty.")})})}).catch(function(t){return console.warn('Couldn\'t serve response for "%s" from cache: %O',e.request.url,t),fetch(e.request)}))}}); \ No newline at end of file diff --git a/homeassistant/components/frontend/www_static/service_worker.js.gz b/homeassistant/components/frontend/www_static/service_worker.js.gz index 19a9363dda9277c3918ef00b7b676147ec9ec65c..234f84d8c2e113ebb65638a7ae763237ab723643 100644 GIT binary patch delta 2140 zcmV-i2&4Cb5rYv2ABzYGD-EcT2OtPd<&CV6dQf7KFC>5RU}SP;cxKL-QQTPzPHUS& zS@+7!DrJkhax|1+;Z0e-6>1EvH+XEo&YH?mi@$>(@PH2kJBG?z9r9qk>r+!tiWUM< zmL3EXF+H|vX{vXH&*uaDn%{{AkHg}_w{>NTQGR{xUbwy+hFoc?RTAqMh%zdUBb8-Y zB3L3MiQIo1A2*t&t}ImgVk#;q+Y1eML%4&=4l~0dK{yR#7LzOtGYKF~n6fw~iZBSq zc2c6B%$P)o&?v@Zp3perTx)5BP6&~ip{M;6m8pkO452num?#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{x$fz~RBm>%d~$5(8)fsgvRCrj@Mnk|!;GO;WPVhro{9PzZahp>ufWgnpLs_o z={-tR1fD8**Pt~4|!0^X>j{_)!Qv$^>TL2&od>H1?`f)7no zW1?2!SXef!m#u%*TLootT(;P_maj(K%vdJbCaSQiAylsI|3JP5YymeM3PYjDx}96Q?)Vi(QsQH$V&q=S+XCHsB{OrYmE|qU3n=4lB-i zRUR92wox1#M6g;Mm-g-1Js`K8{FfO}+;AVqpee5u&H!rymi5@N--vo{IuiAVEIhQv z)%US>9=(Mhp}S|U-?cKPIs<^JZA^=`8yBtl&`0b%F6n<+&C7C`Gr4TRyA|V<-H!V! z+m|->tY?3$o5gMtkKtR2dmlV3L-s%3ed&Q~dTsjHE+@6>OOnaY_ETqjV&0TbO?lXp z^3!eO+F+^5?WJh?7oV#ad@!gmZzeyQ2p!YawI^)#Lz>KSD7?a}b*AKCu#Iy9Twz@P zgtr|%CCrTNp4xyVce?>KEz7w=I@kt&n$a>&Ja&IHy*bzRpN{kTh0~AYzxb^9)iuuY z*XlnIZtv^n2Q)a4V^MPd{x_W6_ds+HXD4~keXq`5zS-&eHw)fhs;j8#TVW>7Zo}f| zYaN^}hGu6&KRudmIyp9jpo6>KdSxa}eQ&+%EB_ZP+I{J^FZhLR6|L13^#|W}`!an( z6ze|9x6;NvZz|{2+j?HA>ff)7)u9U8#?kc@`(xYJSJ<~EO) QvcV?!UtpUllA03$0PqVMbpQYW diff --git a/homeassistant/components/panel_iframe.py b/homeassistant/components/panel_iframe.py index 30773296aeb..d0f9d20f838 100644 --- a/homeassistant/components/panel_iframe.py +++ b/homeassistant/components/panel_iframe.py @@ -23,9 +23,9 @@ CONFIG_SCHEMA = vol.Schema({ def setup(hass, config): """Setup iframe frontend panels.""" - for url_name, info in config[DOMAIN].items(): + for url_path, info in config[DOMAIN].items(): register_built_in_panel( hass, 'iframe', info.get(CONF_TITLE), info.get(CONF_ICON), - url_name, {'url': info[CONF_URL]}) + url_path, {'url': info[CONF_URL]}) return True diff --git a/tests/components/test_panel_iframe.py b/tests/components/test_panel_iframe.py index 7b024c9ed56..ac479dea645 100644 --- a/tests/components/test_panel_iframe.py +++ b/tests/components/test_panel_iframe.py @@ -63,7 +63,7 @@ class TestPanelIframe(unittest.TestCase): 'icon': 'mdi:network-wireless', 'title': 'Router', 'url': '/frontend/panels/iframe-md5md5.html', - 'url_name': 'router' + 'url_path': 'router' } assert frontend.PANELS['weather'] == { @@ -72,5 +72,5 @@ class TestPanelIframe(unittest.TestCase): 'icon': 'mdi:weather', 'title': 'Weather', 'url': '/frontend/panels/iframe-md5md5.html', - 'url_name': 'weather', + 'url_path': 'weather', }