Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/databricks/labs/lsql/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
CounterSpec,
Dashboard,
Dataset,
DatePickerSpec,
DateRangePickerSpec,
DisplayType,
DropdownSpec,
Expand Down Expand Up @@ -231,6 +232,7 @@ class WidgetType(str, Enum):
DATE_RANGE_PICKER = "DATE_RANGE_PICKER"
MULTI_SELECT = "MULTI_SELECT"
DROPDOWN = "DROPDOWN"
DATE_PICKER = "DATE_PICKER"

def as_widget_spec(self) -> type[WidgetSpec]:
widget_spec_mapping: dict[str, type[WidgetSpec]] = {
Expand All @@ -239,6 +241,7 @@ def as_widget_spec(self) -> type[WidgetSpec]:
"DATE_RANGE_PICKER": DateRangePickerSpec,
"MULTI_SELECT": MultiSelectSpec,
"DROPDOWN": DropdownSpec,
"DATE_PICKER": DatePickerSpec,
}
if self.name not in widget_spec_mapping:
raise ValueError(f"Can not convert to widget spec: {self}")
Expand Down Expand Up @@ -788,6 +791,7 @@ def validate(self) -> None:
WidgetType.MULTI_SELECT,
WidgetType.DATE_RANGE_PICKER,
WidgetType.DROPDOWN,
WidgetType.DATE_PICKER,
}:
raise ValueError(f"Filter tile has an invalid widget type: {self}")

Expand Down