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

Mapviewer crashes when using Portal #31

Closed
rsrg-zwiama opened this issue Feb 18, 2025 · 2 comments
Closed

Mapviewer crashes when using Portal #31

rsrg-zwiama opened this issue Feb 18, 2025 · 2 comments

Comments

@rsrg-zwiama
Copy link

rsrg-zwiama commented Feb 18, 2025

The mapviewer will fail on start up with a blank page, when using the Portal in the config.json. This is due to the missing dictionary key 'key' for the Portal, menuItems 'Homepage'

        "name": "Portal",
        "cfg": {
          "logo": "logo.svg",
          "topBarText": "QWC2 Portal",
          "showMenuOnStartup": true,
          "keepMenuOpen": true,
          "bottomBarLinks": [
              {"href": "https://qwc-services.github.io/", "label": "Homepage", "target": "iframe"},
              {"href": "https://qgis.org", "label": "QGIS.org"}
          ],
          "menuItems": [
              {"title": "Homepage","key": "placeholder", "icon": "info", "url": "https://qwc-services.github.io/", "target": "iframe"},
              {"title": "QGIS.org","key": "placeholder", "icon": "link", "url": "https://qgis.org"},
              {"key": "Tools", "icon": "tools", "title": "Links", "subitems": [
                {"icon": "link", "title": "qwc2-demo-app", "url": "https://github.com/qgis/qwc2-demo-app/"},
                {"icon": "link", "title": "qwc-docker", "url": "https://github.com/qwc-services/qwc-docker"}
              ]}
          ]
        }

To avoid this, the def __replace_login__helper_items(self, items, signed_in, hide): should check if the dictionary has a key called 'key' in this section

if item["key"] == "Login" and signed_in:

            if ('key' in item) and item["key"] == "Login" and signed_in:
                if hide:
                    removeIndex = idx
                    break
                else:
                    item["key"] = "Logout"
                    item["icon"] = "logout"
            elif "subitems" in item:
                self.__replace_login__helper_items(
                    item["subitems"], signed_in, hide)

Other solution would be to exclude the portal plugin here

if "menuItems" in plugin["cfg"]:

if "menuItems" in plugin["cfg"] and plugin["name"] != "Portal":

I tested with version 2025lts

@manisandro
Copy link
Member

Thanks, fixed in v2025.5-lts and v2025.02.18.

@rsrg-zwiama
Copy link
Author

Great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants