Fix geospatial readout persistence mode
Browse files- .hyperview/extensions/geospatial-readout/panel.js +3 -6
- demo.py +5 -23
.hyperview/extensions/geospatial-readout/panel.js
CHANGED
|
@@ -4,7 +4,6 @@ if (!sdk) throw new Error("HyperViewPanelSDK is not available on window.");
|
|
| 4 |
const { React, components, hooks } = sdk;
|
| 5 |
const { Panel, PanelToolbar, PanelToolbarButton } = components;
|
| 6 |
const {
|
| 7 |
-
usePanelClient,
|
| 8 |
usePanelSelection,
|
| 9 |
usePanelSamples,
|
| 10 |
usePanelCommands,
|
|
@@ -475,7 +474,6 @@ function ExampleCard({
|
|
| 475 |
}
|
| 476 |
|
| 477 |
export default function GeospatialComparisonPanel() {
|
| 478 |
-
const client = usePanelClient();
|
| 479 |
const selection = usePanelSelection();
|
| 480 |
const samplesState = usePanelSamples();
|
| 481 |
const commands = usePanelCommands();
|
|
@@ -493,8 +491,7 @@ export default function GeospatialComparisonPanel() {
|
|
| 493 |
const clearSelection = async () => {
|
| 494 |
if (commands.setLabelFilter) commands.setLabelFilter(null);
|
| 495 |
setPanelError(null);
|
| 496 |
-
await
|
| 497 |
-
await commands.clearSelection();
|
| 498 |
};
|
| 499 |
|
| 500 |
const selectModelQuery = async (item, model) => {
|
|
@@ -508,14 +505,14 @@ export default function GeospatialComparisonPanel() {
|
|
| 508 |
|
| 509 |
setLoadingKey(key);
|
| 510 |
try {
|
| 511 |
-
await commands.setActiveLayout(model.layoutKey, { persist:
|
| 512 |
await commands.showSimilar({
|
| 513 |
sampleId: item.queryId,
|
| 514 |
layoutKey: model.layoutKey,
|
| 515 |
k: 10,
|
| 516 |
source: `geospatial-demo:${model.key}`,
|
| 517 |
focus: "samples",
|
| 518 |
-
persist:
|
| 519 |
});
|
| 520 |
} catch (error) {
|
| 521 |
const message = error instanceof Error ? error.message : String(error);
|
|
|
|
| 4 |
const { React, components, hooks } = sdk;
|
| 5 |
const { Panel, PanelToolbar, PanelToolbarButton } = components;
|
| 6 |
const {
|
|
|
|
| 7 |
usePanelSelection,
|
| 8 |
usePanelSamples,
|
| 9 |
usePanelCommands,
|
|
|
|
| 474 |
}
|
| 475 |
|
| 476 |
export default function GeospatialComparisonPanel() {
|
|
|
|
| 477 |
const selection = usePanelSelection();
|
| 478 |
const samplesState = usePanelSamples();
|
| 479 |
const commands = usePanelCommands();
|
|
|
|
| 491 |
const clearSelection = async () => {
|
| 492 |
if (commands.setLabelFilter) commands.setLabelFilter(null);
|
| 493 |
setPanelError(null);
|
| 494 |
+
await commands.clearQueryContext({ persist: true });
|
|
|
|
| 495 |
};
|
| 496 |
|
| 497 |
const selectModelQuery = async (item, model) => {
|
|
|
|
| 505 |
|
| 506 |
setLoadingKey(key);
|
| 507 |
try {
|
| 508 |
+
await commands.setActiveLayout(model.layoutKey, { persist: false });
|
| 509 |
await commands.showSimilar({
|
| 510 |
sampleId: item.queryId,
|
| 511 |
layoutKey: model.layoutKey,
|
| 512 |
k: 10,
|
| 513 |
source: `geospatial-demo:${model.key}`,
|
| 514 |
focus: "samples",
|
| 515 |
+
persist: false,
|
| 516 |
});
|
| 517 |
} catch (error) {
|
| 518 |
const message = error instanceof Error ? error.message : String(error);
|
demo.py
CHANGED
|
@@ -658,12 +658,7 @@ def build_demo_view(dataset: hv.Dataset, layouts: dict[str, str]) -> hv.ui.View:
|
|
| 658 |
id=samples_panel_id,
|
| 659 |
title="Samples",
|
| 660 |
position="center",
|
| 661 |
-
|
| 662 |
-
"dockview": {
|
| 663 |
-
"minimumHeight": 220,
|
| 664 |
-
"minimumWidth": 360,
|
| 665 |
-
},
|
| 666 |
-
},
|
| 667 |
),
|
| 668 |
hv.ui.Scatter(
|
| 669 |
id=clip_panel_id,
|
|
@@ -674,13 +669,7 @@ def build_demo_view(dataset: hv.Dataset, layouts: dict[str, str]) -> hv.ui.View:
|
|
| 674 |
direction="below",
|
| 675 |
geometry=clip_spec["geometry"],
|
| 676 |
layout_dimension=clip_spec["layout_dimension"],
|
| 677 |
-
|
| 678 |
-
"dockview": {
|
| 679 |
-
"initialHeight": 260,
|
| 680 |
-
"minimumHeight": 190,
|
| 681 |
-
"minimumWidth": 280,
|
| 682 |
-
},
|
| 683 |
-
},
|
| 684 |
),
|
| 685 |
hv.ui.Scatter(
|
| 686 |
id=candidate_panel_id,
|
|
@@ -691,18 +680,14 @@ def build_demo_view(dataset: hv.Dataset, layouts: dict[str, str]) -> hv.ui.View:
|
|
| 691 |
direction="right",
|
| 692 |
geometry=candidate_spec["geometry"],
|
| 693 |
layout_dimension=candidate_spec["layout_dimension"],
|
| 694 |
-
|
| 695 |
-
"dockview": {
|
| 696 |
-
"minimumHeight": 190,
|
| 697 |
-
"minimumWidth": 280,
|
| 698 |
-
},
|
| 699 |
-
},
|
| 700 |
),
|
| 701 |
hv.ui.ExtensionPanel(
|
| 702 |
id="geospatial-retrieval-readout",
|
| 703 |
extension="geospatial-readout",
|
| 704 |
panel="geospatial-comparison",
|
| 705 |
position="right",
|
|
|
|
| 706 |
props={
|
| 707 |
"datasetLabel": DATASET_LABEL,
|
| 708 |
"sampleCount": len(dataset.samples),
|
|
@@ -713,12 +698,9 @@ def build_demo_view(dataset: hv.Dataset, layouts: dict[str, str]) -> hv.ui.View:
|
|
| 713 |
"models": model_panel_props(layouts),
|
| 714 |
"examples": build_examples(dataset, summaries),
|
| 715 |
"warnings": RUNTIME_WARNINGS,
|
| 716 |
-
"dockview": {
|
| 717 |
-
"initialWidth": 330,
|
| 718 |
-
"minimumWidth": 290,
|
| 719 |
-
},
|
| 720 |
},
|
| 721 |
),
|
|
|
|
| 722 |
)
|
| 723 |
|
| 724 |
|
|
|
|
| 658 |
id=samples_panel_id,
|
| 659 |
title="Samples",
|
| 660 |
position="center",
|
| 661 |
+
layout=hv.ui.PanelLayout(min_height=220, min_width=360),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 662 |
),
|
| 663 |
hv.ui.Scatter(
|
| 664 |
id=clip_panel_id,
|
|
|
|
| 669 |
direction="below",
|
| 670 |
geometry=clip_spec["geometry"],
|
| 671 |
layout_dimension=clip_spec["layout_dimension"],
|
| 672 |
+
layout=hv.ui.PanelLayout(height=260, min_height=190, min_width=280),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 673 |
),
|
| 674 |
hv.ui.Scatter(
|
| 675 |
id=candidate_panel_id,
|
|
|
|
| 680 |
direction="right",
|
| 681 |
geometry=candidate_spec["geometry"],
|
| 682 |
layout_dimension=candidate_spec["layout_dimension"],
|
| 683 |
+
layout=hv.ui.PanelLayout(min_height=190, min_width=280),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
),
|
| 685 |
hv.ui.ExtensionPanel(
|
| 686 |
id="geospatial-retrieval-readout",
|
| 687 |
extension="geospatial-readout",
|
| 688 |
panel="geospatial-comparison",
|
| 689 |
position="right",
|
| 690 |
+
layout=hv.ui.PanelLayout(width=330, min_width=290),
|
| 691 |
props={
|
| 692 |
"datasetLabel": DATASET_LABEL,
|
| 693 |
"sampleCount": len(dataset.samples),
|
|
|
|
| 698 |
"models": model_panel_props(layouts),
|
| 699 |
"examples": build_examples(dataset, summaries),
|
| 700 |
"warnings": RUNTIME_WARNINGS,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 701 |
},
|
| 702 |
),
|
| 703 |
+
active_panel="geospatial-retrieval-readout",
|
| 704 |
)
|
| 705 |
|
| 706 |
|