From 24afd272b96bf15bcf313879dc6b7aecbcb03b8b Mon Sep 17 00:00:00 2001 From: Dan Birman Date: Mon, 2 Dec 2024 10:57:42 -0800 Subject: [PATCH] feat: updating height bug --- src/aind_qc_portal/panel/custom_metrics.py | 7 +++++-- src/aind_qc_portal/panel/evaluation.py | 4 ++-- src/aind_qc_portal/panel/media.py | 10 +++++++--- src/aind_qc_portal/panel/metric.py | 5 +++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/aind_qc_portal/panel/custom_metrics.py b/src/aind_qc_portal/panel/custom_metrics.py index 6b59a4f..97fdf60 100644 --- a/src/aind_qc_portal/panel/custom_metrics.py +++ b/src/aind_qc_portal/panel/custom_metrics.py @@ -107,8 +107,11 @@ def _checkbox_helper(self, data: dict): name="Value", options=data["options"], ) - if data["value"]: - self._panel.value = data["value"] + if data["value"] and isinstance(data["value"], list) and all(value in data["options"] for value in data["value"]): + self._panel.value = [data["value"]] + else: + print("Checkbox value not in options") + self._panel.value = [] # watch the selector and pass event updates back through the callback self._panel.param.watch(self._callback_helper, "value") diff --git a/src/aind_qc_portal/panel/evaluation.py b/src/aind_qc_portal/panel/evaluation.py index 7082de6..04a9019 100644 --- a/src/aind_qc_portal/panel/evaluation.py +++ b/src/aind_qc_portal/panel/evaluation.py @@ -67,9 +67,9 @@ def panel(self): else: notes.param.watch(self.set_notes, "value") - header_row = pn.Row(header, notes) + header_row = pn.Row(header, notes, max_height=1200) - accordion = pn.Accordion(*objects) + accordion = pn.Accordion(*objects, sizing_mode="stretch_width", max_height=1200) accordion.active = [0] col = pn.Column(header_row, accordion, name=self._data.name) diff --git a/src/aind_qc_portal/panel/media.py b/src/aind_qc_portal/panel/media.py index e1b6688..cb836b2 100644 --- a/src/aind_qc_portal/panel/media.py +++ b/src/aind_qc_portal/panel/media.py @@ -141,6 +141,10 @@ def parse_reference(self, reference: str): self.parse_reference(reference.split(";")[1]), ) + # Strip slashes at the start of the reference + if reference.startswith("/"): + reference = reference[1:] + # Step 1: get the data # possible sources are: http, s3, local data asset, figurl if "http" in reference: @@ -165,13 +169,11 @@ def parse_reference(self, reference: str): if not reference_data: return pn.pane.Alert(f"Failed to load asset: {reference}", alert_type="danger") - print(f"Parsing type: {reference}") - # Step 2: parse the type and return the appropriate object return _parse_type(reference, reference_data) def panel(self): - return Fullscreen(self.object, sizing_mode="stretch_both") + return Fullscreen(self.object, sizing_mode="stretch_width", max_height=1200) def _iframe_html(reference): @@ -207,6 +209,8 @@ def _parse_type(reference, data): data : _type_ _description_ """ + print(f"Parsing type: {reference}") + if "https://s3" in data: data = _get_s3_file(data, os.path.splitext(reference)[1]) diff --git a/src/aind_qc_portal/panel/metric.py b/src/aind_qc_portal/panel/metric.py index 08dbd75..519dc63 100644 --- a/src/aind_qc_portal/panel/metric.py +++ b/src/aind_qc_portal/panel/metric.py @@ -88,7 +88,8 @@ def panel(self): self.metric_panel(), self.reference_img, name=self._data.name, - sizing_mode="stretch_both", + sizing_mode="stretch_width", + max_height=1200, ) return row @@ -179,7 +180,7 @@ def metric_panel(self): header, pn.WidgetBox(value_widget, self.state_selector), self.hidden_html, - width=350, + width=350, max_height=1200, ) return col