From 84773fd8c0a2d0964566ac948f7fb9ab3d7e96f3 Mon Sep 17 00:00:00 2001 From: Lum Date: Tue, 14 Jul 2026 14:49:17 -0700 Subject: [PATCH 1/2] Ensure data region name uniqueness --- .../experiment/ExperimentRunWebPartFactory.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/experiment/src/org/labkey/experiment/ExperimentRunWebPartFactory.java b/experiment/src/org/labkey/experiment/ExperimentRunWebPartFactory.java index ad267dd752e..4495b71f35c 100644 --- a/experiment/src/org/labkey/experiment/ExperimentRunWebPartFactory.java +++ b/experiment/src/org/labkey/experiment/ExperimentRunWebPartFactory.java @@ -53,6 +53,14 @@ private String getConfiguredRunFilterName(Portal.WebPart webPart) return webPart.getPropertyMap().get(EXPERIMENT_RUN_FILTER); } + /** + * Create a unique data region name for the webpart. + */ + private String getDataRegionName(Portal.WebPart webPart, int index) + { + return String.format("expRunWebPart_%d_%d", webPart.getIndex(), index); + } + public static class Bean { private final Set _types; @@ -106,9 +114,12 @@ public WebPartView getWebPartView(@NotNull ViewContext portalCtx, @NotNull Po VBox result = new VBox(); result.setTitle("Experiment Runs"); result.setFrame(WebPartView.FrameType.PORTAL); + int gridIndex = 0; for (ExperimentRunType runType : runTypes) { ExperimentRunListView runView = ExperimentService.get().createExperimentRunWebPart(new ViewContext(portalCtx), runType); + // GitHub Issue 1295: give each grid a unique data region name + runView.getSettings().setDataRegionName(getDataRegionName(webPart, gridIndex++)); if (runType != ExperimentRunType.ALL_RUNS_TYPE) { runView.setTitle(runType.getDescription() + " Runs"); @@ -126,6 +137,7 @@ public WebPartView getWebPartView(@NotNull ViewContext portalCtx, @NotNull Po } ExperimentRunListView result = ExperimentService.get().createExperimentRunWebPart(new ViewContext(portalCtx), selectedType); + result.getSettings().setDataRegionName(getDataRegionName(webPart, 0)); if (selectedType != ExperimentRunType.ALL_RUNS_TYPE) { result.setTitle(result.getTitle() + " (" + selectedType.getDescription() + ")"); From 1ea742a5c7f0ece91e31971c5fc87b5649370591 Mon Sep 17 00:00:00 2001 From: Lum Date: Thu, 16 Jul 2026 16:16:02 -0700 Subject: [PATCH 2/2] Set the data region name at query view initialization time through QuerySettings --- .../org/labkey/api/exp/ExperimentRunListView.java | 15 +++++++++++++-- .../org/labkey/api/exp/api/ExperimentService.java | 2 ++ .../experiment/ExperimentRunWebPartFactory.java | 7 +++---- .../experiment/api/ExperimentServiceImpl.java | 8 +++++++- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/api/src/org/labkey/api/exp/ExperimentRunListView.java b/api/src/org/labkey/api/exp/ExperimentRunListView.java index 560407dd600..6dc72386c2e 100644 --- a/api/src/org/labkey/api/exp/ExperimentRunListView.java +++ b/api/src/org/labkey/api/exp/ExperimentRunListView.java @@ -85,7 +85,12 @@ public ExperimentRunListView(UserSchema schema, QuerySettings settings, @NotNull public static QuerySettings getRunListQuerySettings(UserSchema schema, ViewContext model, String tableName, boolean allowCustomizations) { - QuerySettings settings = schema.getSettings(model, tableName, tableName); + return getRunListQuerySettings(schema, model, tableName, null, allowCustomizations); + } + + public static QuerySettings getRunListQuerySettings(UserSchema schema, ViewContext model, String tableName, @Nullable String dataRegionName, boolean allowCustomizations) + { + QuerySettings settings = schema.getSettings(model, dataRegionName != null ? dataRegionName : tableName, tableName); settings.getQueryDef(schema); settings.setBaseSort(new Sort("-RowId")); settings.setAllowChooseView(allowCustomizations); @@ -107,6 +112,11 @@ protected void renderHeaderView(HttpServletRequest request, HttpServletResponse } public static ExperimentRunListView createView(ViewContext model, ExperimentRunType selectedType, boolean allowCustomizations) + { + return createView(model, selectedType, null, allowCustomizations); + } + + public static ExperimentRunListView createView(ViewContext model, ExperimentRunType selectedType, @Nullable String dataRegionName, boolean allowCustomizations) { UserSchema schema = QueryService.get().getUserSchema(model.getUser(), model.getContainer(), selectedType.getSchemaName()); if (schema == null) @@ -115,7 +125,8 @@ public static ExperimentRunListView createView(ViewContext model, ExperimentRunT selectedType = ExperimentRunType.ALL_RUNS_TYPE; schema = QueryService.get().getUserSchema(model.getUser(), model.getContainer(), selectedType.getSchemaName()); } - return new ExperimentRunListView(schema, getRunListQuerySettings(schema, model, selectedType.getTableName(), allowCustomizations), selectedType); + String tableName = selectedType.getTableName(); + return new ExperimentRunListView(schema, getRunListQuerySettings(schema, model, tableName, dataRegionName, allowCustomizations), selectedType); } public void setShowUploadAssayRunsButton(boolean showUploadAssayRunsButton) diff --git a/api/src/org/labkey/api/exp/api/ExperimentService.java b/api/src/org/labkey/api/exp/api/ExperimentService.java index fd98f473a44..df052bbe503 100644 --- a/api/src/org/labkey/api/exp/api/ExperimentService.java +++ b/api/src/org/labkey/api/exp/api/ExperimentService.java @@ -738,6 +738,8 @@ static void validateParentAlias(Map aliasMap, Set reserv ExperimentRunListView createExperimentRunWebPart(ViewContext context, ExperimentRunType type); + ExperimentRunListView createExperimentRunWebPart(ViewContext context, ExperimentRunType type, @Nullable String dataRegionName); + DbSchema getSchema(); ExpProtocolApplication getExpProtocolApplication(String lsid); diff --git a/experiment/src/org/labkey/experiment/ExperimentRunWebPartFactory.java b/experiment/src/org/labkey/experiment/ExperimentRunWebPartFactory.java index 4495b71f35c..c34d0263681 100644 --- a/experiment/src/org/labkey/experiment/ExperimentRunWebPartFactory.java +++ b/experiment/src/org/labkey/experiment/ExperimentRunWebPartFactory.java @@ -117,9 +117,8 @@ public WebPartView getWebPartView(@NotNull ViewContext portalCtx, @NotNull Po int gridIndex = 0; for (ExperimentRunType runType : runTypes) { - ExperimentRunListView runView = ExperimentService.get().createExperimentRunWebPart(new ViewContext(portalCtx), runType); // GitHub Issue 1295: give each grid a unique data region name - runView.getSettings().setDataRegionName(getDataRegionName(webPart, gridIndex++)); + ExperimentRunListView runView = ExperimentService.get().createExperimentRunWebPart(new ViewContext(portalCtx), runType, getDataRegionName(webPart, gridIndex++)); if (runType != ExperimentRunType.ALL_RUNS_TYPE) { runView.setTitle(runType.getDescription() + " Runs"); @@ -136,8 +135,8 @@ public WebPartView getWebPartView(@NotNull ViewContext portalCtx, @NotNull Po selectedType = ChooseExperimentTypeBean.getBestTypeSelection(types, selectedType, protocols); } - ExperimentRunListView result = ExperimentService.get().createExperimentRunWebPart(new ViewContext(portalCtx), selectedType); - result.getSettings().setDataRegionName(getDataRegionName(webPart, 0)); + // GitHub Issue 1295: give the grid a unique data region name + ExperimentRunListView result = ExperimentService.get().createExperimentRunWebPart(new ViewContext(portalCtx), selectedType, getDataRegionName(webPart, 0)); if (selectedType != ExperimentRunType.ALL_RUNS_TYPE) { result.setTitle(result.getTitle() + " (" + selectedType.getDescription() + ")"); diff --git a/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java b/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java index 46490f7c156..5e97c39ce6e 100644 --- a/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java +++ b/experiment/src/org/labkey/experiment/api/ExperimentServiceImpl.java @@ -2146,7 +2146,13 @@ public DbScope.Transaction ensureTransaction(Lock... locks) @Override public ExperimentRunListView createExperimentRunWebPart(ViewContext context, ExperimentRunType type) { - ExperimentRunListView view = ExperimentRunListView.createView(context, type, true); + return createExperimentRunWebPart(context, type, null); + } + + @Override + public ExperimentRunListView createExperimentRunWebPart(ViewContext context, ExperimentRunType type, @Nullable String dataRegionName) + { + ExperimentRunListView view = ExperimentRunListView.createView(context, type, dataRegionName, true); view.setShowDeleteButton(true); view.setShowAddToRunGroupButton(true); view.setShowMoveRunsButton(true);