holoviz/lumen

Cannot add Lumen dashboards dynamically to Panel layouts

Closed this issue · 4 comments

Not sure if this should reside in Panel or Lumen.

I've tried as a ChatMessage:

import panel as pn
import lumen as lm
import yaml
pn.extension()

def callback(contents, user, instance):
    with open("test.yaml", "r") as f:
        spec = yaml.safe_load(f)
    dashboard = lm.Dashboard(spec)
    return


tabs = pn.Tabs(("Chat", pn.chat.ChatInterface(callback=callback)))
tabs.servable()

Tabs:

import panel as pn
import lumen as lm
import yaml
pn.extension()

def callback(contents, user, instance):
    with open("test.yaml", "r") as f:
        spec = yaml.safe_load(f)
    dashboard = lm.Dashboard(spec)
    tabs.append(("Dashboard", dashboard))


tabs = pn.Tabs(("Chat", pn.chat.ChatInterface(callback=callback)))
tabs.servable()

It just displays an empty dashboard

image

I suspect it might be lazily loading and not trigger because I tried to extract the layout, but it crashes with list index out of range.

import panel as pn
import lumen as lm
import yaml
pn.extension()

def callback(contents, user, instance):
    with open("test.yaml", "r") as f:
        spec = yaml.safe_load(f)
    dashboard = lm.Dashboard(spec).layouts[0]
    return dashboard


tabs = pn.Tabs(("Chat", pn.chat.ChatInterface(callback=callback)))
tabs.servable()

test.yaml

sources:
  penguin_source:
    type: file
    tables:
      penguin_table: https://datasets.holoviz.org/penguins/v1/penguins.csv

layouts:
  - title: Penguins
    source: penguin_source
    views:
      - type: table
        table: penguin_table

Actually this doesn't work:

import panel as pn
import lumen as lm
import yaml
pn.extension()


dashboard = lm.Dashboard("test.yaml")
dashboard.servable()

The fix was adding these extensions:
pn.extension("tabulator", notifications=True)

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.