Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve custom panel support #1236

Merged
merged 4 commits into from Jun 1, 2018
Merged

Improve custom panel support #1236

merged 4 commits into from Jun 1, 2018

Conversation

balloob
Copy link
Member

@balloob balloob commented May 30, 2018

Add support for:

  • JS based custom panels
  • Embedding custom panels in iframes (optional) (allows React based panels)
  • Confirming with user if they want to load an external panel
  • Allow trusting individual external panels to be loaded without confirmation

Backend PR home-assistant/core#14708
Starter kit example for React based panel: https://github.com/home-assistant/custom-panel-starter-kit-react

Config example:

# Configuration.yaml example
panel_custom:
  - name: react-panel
    url_path: react-panel-prod
    sidebar_title: React Prod
    sidebar_icon: mdi:react
    js_url: https://s3.amazonaws.com/home-assistant-demos/panel-examples/react-demo.js
    embed_iframe: true
    config:
      name: World

image

@balloob balloob mentioned this pull request May 30, 2018
3 tasks
@balloob balloob changed the title Add custom panel Improve custom panel support May 30, 2018
tempA.href = panel.config.html_url || panel.config.js_url;

if (!panel.config.trust_external && !['localhost', '127.0.0.1', location.hostname].includes(tempA.hostname)) {
if (!confirm(`Do you trust the external panel "${panel.config.name}" at "${tempA.href}"?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Afaik confirm does not work on mobile Safari or the iOS App

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c727
Copy link
Contributor

c727 commented May 31, 2018

panel.config.config is a bit odd, we will get a 2nd release with many forum posts about XXX is broken

@balloob
Copy link
Member Author

balloob commented Jun 1, 2018

Ok, fair point. I have an idea how to fix it. It means that we're going to keep panel config as panel.config and then have panel.config._custom_panel be our config.

@balloob
Copy link
Member Author

balloob commented Jun 1, 2018

👍 done!

@balloob balloob merged commit c3d6713 into master Jun 1, 2018
@balloob balloob deleted the custom-panel branch June 1, 2018 14:06
@balloob balloob mentioned this pull request Jun 1, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants