diff --git a/lumen/ui/base.py b/lumen/ui/base.py index ad3f480d..a5fcc51e 100644 --- a/lumen/ui/base.py +++ b/lumen/ui/base.py @@ -2,6 +2,7 @@ import param # type: ignore from panel.reactive import ReactiveHTML +from panel.viewable import Viewable from .fast import FastDivider @@ -89,6 +90,10 @@ def _next(self, event=None): self.next_disable = True self.loading = False + def select(self, selector=None): + items = super().select(selector) + items += [o for v in self.items if isinstance(v, Viewable) for o in v.select(selector)] + return items class WizardItem(ReactiveHTML): @@ -113,3 +118,13 @@ def __init__(self, **params): def _update_spec(self, *events): pass + + def select(self, selector=None): + items = super().select(selector) + for values in self.param.objects().values(): + if isinstance(values, (list, dict)): + values = values.values() if isinstance(values, dict) else values + items += [o for v in values if isinstance(v, Viewable) for o in v.select(selector)] + elif isinstance(values, Viewable): + items += values.select(selector) + return items diff --git a/lumen/ui/dashboard.py b/lumen/ui/dashboard.py index 7eecb61f..c69ae301 100644 --- a/lumen/ui/dashboard.py +++ b/lumen/ui/dashboard.py @@ -51,11 +51,11 @@ class DashboardGallery(WizardItem, Gallery):
{% for item in items.values() %} - + ${item} {% endfor %} - +
Create new dashboard diff --git a/lumen/ui/fast.py b/lumen/ui/fast.py index 162b3771..4f524d10 100644 --- a/lumen/ui/fast.py +++ b/lumen/ui/fast.py @@ -120,7 +120,7 @@ class FastCheckbox(FastComponent): _child_config = {'name': 'template'} - _template = '${name}' + _template = '${name}' class FastRadioGroup(FastComponent, SelectBase): diff --git a/lumen/ui/launcher.py b/lumen/ui/launcher.py index 444d1473..137b055c 100644 --- a/lumen/ui/launcher.py +++ b/lumen/ui/launcher.py @@ -72,7 +72,7 @@ class LauncherGallery(WizardItem, Gallery):
{% for item in items.values() %} - + ${item} {% endfor %} diff --git a/lumen/ui/layouts.py b/lumen/ui/layouts.py index a923a4a3..e150b45c 100644 --- a/lumen/ui/layouts.py +++ b/lumen/ui/layouts.py @@ -50,7 +50,7 @@ class LayoutEditor(ReactiveHTML): {{ param.layout_type.doc }}
-
${layout}
+
${layout}
""" @@ -176,11 +176,11 @@ class LayoutGallery(WizardItem, Gallery): {{ __doc__ }}

{% for item in items.values() %} - + ${item} {% endfor %} - +
Create new layout group diff --git a/lumen/ui/pipeline.py b/lumen/ui/pipeline.py index 39e683cc..2c0d683b 100644 --- a/lumen/ui/pipeline.py +++ b/lumen/ui/pipeline.py @@ -314,7 +314,7 @@ class PipelinesEditor(WizardItem):
{% for pipeline in pipelines.values() %} -
${pipeline}
+
${pipeline}
{% endfor %}
@@ -406,11 +406,11 @@ class PipelineGallery(WizardItem, Gallery): {{ __doc__ }}

{% for item in items.values() %} - + ${item} {% endfor %} - +
Add new pipeline diff --git a/lumen/ui/sources.py b/lumen/ui/sources.py index ddde85e2..e8428389 100644 --- a/lumen/ui/sources.py +++ b/lumen/ui/sources.py @@ -31,7 +31,7 @@ class SourceEditor(FastComponent, Editor): form = param.Parameter() - preview = param.Parameter() + preview = param.Parameter(allow_refs=False) source_type = param.String(default="") @@ -75,19 +75,20 @@ def __new__(cls, **params): return super().__new__(cls) def __init__(self, **params): + params.pop('type', None) spec = params.pop('spec', {}) params.update(**{ k: v for k, v in spec.items() if k in self.param and k not in params }) self._source = None self._thumbnail = params.pop('thumbnail', None) - super().__init__(spec=spec, **params) - self.form = pn.Column(sizing_mode='stretch_width') theme = 'midnight' if getattr(pn.config, 'theme', 'default') == 'dark' else 'simple' - self.preview = pn.widgets.Tabulator( + params['preview'] = pn.widgets.Tabulator( sizing_mode='stretch_width', pagination='remote', page_size=12, theme=theme, height=400 ) + super().__init__(spec=spec, **params) + self.form = pn.Column(sizing_mode='stretch_width') self._select_table = pn.widgets.Select( name='Select table', margin=0, sizing_mode='stretch_width' ) @@ -171,11 +172,11 @@ class SourceGallery(WizardItem, Gallery): {{ __doc__ }}

{% for item in items.values() %} - + ${item} {% endfor %} - +
Add new source @@ -272,7 +273,7 @@ class IntakeSourceEditor(SourceEditor):
- +
@@ -356,8 +357,8 @@ class IntakeDremioSourceEditor(SourceEditor):
- Load schema - Enable TLS + Load schema + Enable TLS
@@ -373,7 +374,7 @@ class IntakeDremioSourceEditor(SourceEditor):
- +
@@ -463,7 +464,7 @@ class FileSourceEditor(SourceEditor):
- +
@@ -506,7 +507,8 @@ def _add_table(self, event=None, **kwargs): remove = table.param.watch(self._remove_table, 'remove') update = table.param.watch(self._update_spec, 'uri') self._table_watchers[table.name] = (remove, update) - self.table_editors += [table] + self.table_editors.append(table) + self.param.trigger('table_editors') self.resize += 1 @catch_and_notify @@ -565,7 +567,7 @@ class SourcesEditor(WizardItem):
{% for source in sources.values() %} -
${source}
+
${source}
{% endfor %}
diff --git a/lumen/ui/views.py b/lumen/ui/views.py index f04bee24..a32f40d1 100644 --- a/lumen/ui/views.py +++ b/lumen/ui/views.py @@ -22,7 +22,7 @@ class ViewsEditor(WizardItem): Declare the views for your dashboard. """ - spec = param.List(default=[], precedence=-1) + spec = param.List(default=[], precedence=-1, allow_None=True) pipeline = param.String() @@ -213,11 +213,11 @@ class ViewGallery(WizardItem, Gallery): {{ __doc__ }}

{% for item in items %} - + ${item} {% endfor %} - +
Add new view diff --git a/setup.py b/setup.py index ab8e67ab..320a4e09 100644 --- a/setup.py +++ b/setup.py @@ -42,6 +42,7 @@ def get_setup_version(reponame): 'toolz', 'pre-commit', 'matplotlib >=3.4', # Ubuntu + Python 3.9 installs old version matplotlib (3.3.2) + 'pandas <2.2', ], 'tests_ci' : [ 'pytest-github-actions-annotate-failures',