Skip to content
Open
Show file tree
Hide file tree
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
15 changes: 13 additions & 2 deletions api/src/org/labkey/api/exp/ExperimentRunListView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions api/src/org/labkey/api/exp/api/ExperimentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ static void validateParentAlias(Map<String, String> aliasMap, Set<String> reserv

ExperimentRunListView createExperimentRunWebPart(ViewContext context, ExperimentRunType type);

ExperimentRunListView createExperimentRunWebPart(ViewContext context, ExperimentRunType type, @Nullable String dataRegionName);

DbSchema getSchema();

ExpProtocolApplication getExpProtocolApplication(String lsid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ExperimentRunType> _types;
Expand Down Expand Up @@ -106,9 +114,11 @@ 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
ExperimentRunListView runView = ExperimentService.get().createExperimentRunWebPart(new ViewContext(portalCtx), runType, getDataRegionName(webPart, gridIndex++));
if (runType != ExperimentRunType.ALL_RUNS_TYPE)
{
runView.setTitle(runType.getDescription() + " Runs");
Expand All @@ -125,7 +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);
// 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() + ")");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down