equinor / webviz-config

Make Dash applications from a user-friendly config file :book: :snake:
https://github.com/orgs/equinor/projects/24
MIT License
54 stars 39 forks source link

Banner Image does not render #620

Open Vikaparra opened 2 years ago

Vikaparra commented 2 years ago

Description

I'm running webviz from Windows 10, and every time I try to use the Banner feature, the image doesn't render, instead, only the title appears on the screen. When I inspect the element using developer tools in the browser, this is what it shows:

When I'm using the non-portable version: nonportableerror

When I'm using the portable version: portableerror

I've tried running in edge and firefox, and it doesn't work in either. Looking at the '"background-image" of the banner tag, it seems like the '/' is being removed and the image path is not found.

How to reproduce My .yaml file looks like this:

options:
  menu:
    show_logo: true
    bar_position: left
    drawer_position: left
    initially_pinned: true
    initially_collapsed: true

# ------------------------------
layout:
  - section: Webviz Boilerplate
    content:
      # ------------------------------

      - page: Front page
        icon: home
        content:
          - This is a `webviz` instance created from a configuration file.
          - Open menu on the left to select page for demo plugins.
          - BannerImage:
              image: ./image.png
              title: My banner image

I've tried putting the .png file in "./examples", "./plugins", in the plugin folder, and when I use the portable version, the file is in the "./assets" folder as it should.

When I try to use other features, like the tablePlotter, it works normally

anders-kiaer commented 2 years ago

Thanks @Vikaparra for the detailed report 👍👏

I would expect this to somehow be related to this line https://github.com/equinor/webviz-config/blob/f65576bc026b205f23d0e87ab444008d66f0e929/webviz_config/webviz_assets.py#L72

Maybe, in order to be compatible with Windows, it needs to use as_posix, i.e. instead be:

return (pathlib.Path(self._base_folder()) / assigned_id).as_posix()

I don't easily have available Python environment + Windows 10, could you try changing the referenced line and see if that fixes the problem you see on Windows? 🙂

Vikaparra commented 1 year ago

It worked, thanks for the help!