Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into fb_javascriptfragm…
Browse files Browse the repository at this point in the history
…ent_asjson
  • Loading branch information
labkey-matthewb committed Jan 16, 2024
2 parents 1ef6526 + 7736e67 commit 3dfebca
Show file tree
Hide file tree
Showing 67 changed files with 581 additions and 345 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ public static HtmlString getUserDetailsLink(Container container, User currentUse
if (includeGroups)
{
HtmlString groupList = SecurityManager.getGroupList(container, UserManager.getUser(formattedUserId));
if (groupList.length() > 0)
if (!groupList.isEmpty())
{
builder.append(" (").append(groupList).append(")");
}
Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ dependencies {
BuildUtils.addExternalDependency(
project,
new ExternalDependency(
"org.hamcrest:hamcrest-core:${hamcrestVersion}",
"org.hamcrest:hamcrest:${hamcrestVersion}",
"Hamcrest",
"Java Hamcrest",
"http://hamcrest.org/JavaHamcrest/",
Expand Down
2 changes: 2 additions & 0 deletions api/schemas/queryCustomView.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@
<xsd:enumeration value="where"/>
<xsd:enumeration value="inexpancestorsof"/>
<xsd:enumeration value="inexpdescendantsof"/>
<xsd:enumeration value="notinexpancestorsof"/>
<xsd:enumeration value="notinexpdescendantsof"/>
</xsd:restriction>
</xsd:simpleType>

Expand Down
12 changes: 6 additions & 6 deletions api/src/org/labkey/api/admin/AdminBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,20 @@ public static Map<String, String> getPropertyMap()
public static HtmlString getPropertyGridHtml(Map<String, String> propertyMap)
{
HtmlStringBuilder builder = HtmlStringBuilder.of()
.append(HtmlString.unsafe("<table class=\"labkey-data-region-legacy labkey-show-borders\">"))
.append(HtmlString.unsafe("<tr class=\"labkey-frame\"><th>Property</th><th>Current Value</th></tr>"))
.unsafeAppend("<table class=\"labkey-data-region-legacy labkey-show-borders\">")
.unsafeAppend("<tr class=\"labkey-frame\"><th>Property</th><th>Current Value</th></tr>")
.append
(
propertyMap.entrySet().stream()
.map(e -> HtmlStringBuilder.of(HtmlString.unsafe("<tr valign=top class=\"labkey-row\"><td>"))
.append(e.getKey())
.append(HtmlString.unsafe("</td><td>"))
.unsafeAppend("</td><td>")
.append(formatValue(e.getKey(), e.getValue()))
.append(HtmlString.unsafe("</td></tr>\n"))
.unsafeAppend("</td></tr>\n")
.getHtmlString())
.collect(LabKeyCollectors.joining(HtmlString.unsafe("\n")))
)
.append(HtmlString.unsafe("</table>\n"));
.unsafeAppend("</table>\n");

return builder.getHtmlString();
}
Expand All @@ -192,6 +192,6 @@ private static HtmlString formatValue(String key, String value)
{
// Format GUID properties with monospace font
return StringUtils.endsWithIgnoreCase(key, "GUID") ? HtmlStringBuilder.of(HtmlString.unsafe("<span style=\"font-family:monospace\">"))
.append(value).append(HtmlString.unsafe("</span>")).getHtmlString() : HtmlString.of(value);
.append(value).unsafeAppend("</span>").getHtmlString() : HtmlString.of(value);
}
}
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/assay/AssayProtocolSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ public HtmlString getFormattedHtml(RenderContext ctx)
}
for (Map.Entry<String, String> decodedVal : decodedVals.entrySet())
{
sb.append(HtmlString.unsafe("<br/>"));
sb.unsafeAppend("<br/>");
sb.append(StringUtils.substringAfter(decodedVal.getKey(), ThawListResolverType.NAMESPACE_PREFIX));
sb.append(" : ");
sb.append(decodedVal.getValue());
Expand Down
4 changes: 2 additions & 2 deletions api/src/org/labkey/api/data/DataColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -569,14 +569,14 @@ public HtmlString getFormattedHtml(RenderContext ctx)
if (getRequiresHtmlFiltering())
formatted = PageFlowUtil.filter(formatted);

if (formatted.length() == 0)
if (formatted.isEmpty())
formatted = "&nbsp;";
else if (isPreserveNewlines())
formatted = formatted.replaceAll("\\n", "<br>\n");
else if (value instanceof Date)
formatted = "<nobr>" + formatted + "</nobr>";

hsb.append(HtmlString.unsafe(formatted));
hsb.unsafeAppend(formatted);
}

return hsb.getHtmlString();
Expand Down
8 changes: 4 additions & 4 deletions api/src/org/labkey/api/data/DbSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -858,19 +858,19 @@ OrphanedContainer VARCHAR(60) NULL
{
new SqlSelector(coreSchema, " SELECT * FROM " + tempTableName
+ " WHERE OrphanedContainer IS NOT NULL ORDER BY 1,3").forEach(rs -> {
sbOut.append(HtmlString.unsafe("<br/>&nbsp;&nbsp;&nbsp;"))
sbOut.unsafeAppend("<br/>&nbsp;&nbsp;&nbsp;")
.append("ERROR: ")
.append(rs.getString(1))
.append(HtmlString.unsafe(" &nbsp;&nbsp;&nbsp;&nbsp; "))
.unsafeAppend(" &nbsp;&nbsp;&nbsp;&nbsp; ")
.append(rs.getString(2))
.append("." )
.append(rs.getString(3))
.append(" = ")
.append(rs.getString(4))
.append(HtmlString.unsafe("&nbsp;&nbsp;&nbsp;"))
.unsafeAppend("&nbsp;&nbsp;&nbsp;")
.append("Module: ")
.append(rs.getString(5))
.append(HtmlString.unsafe("&nbsp;&nbsp;&nbsp;"))
.unsafeAppend("&nbsp;&nbsp;&nbsp;")
.append("Container: ")
.append(rs.getString(6))
.append("\n");
Expand Down
6 changes: 3 additions & 3 deletions api/src/org/labkey/api/data/MVDisplayColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep

// If we have a raw value, include it in the popup
HtmlString value = super.getFormattedHtml(ctx);
if (value.length() != 0)
popupText.append(HtmlString.unsafe("<p>The value as originally entered was: '"))
if (!value.isEmpty())
popupText.unsafeAppend("<p>The value as originally entered was: '")
.append(value)
.append(HtmlString.unsafe("'.</p>"));
.unsafeAppend("'.</p>");

out.write("<font class=\"labkey-mv\">");
PageFlowUtil.popupHelp(popupText.getHtmlString(), "Missing Value Indicator: " + mvIndicator).link(HtmlString.of(mvIndicator)).appendTo(out);
Expand Down
4 changes: 2 additions & 2 deletions api/src/org/labkey/api/data/RenderContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,8 @@ public HtmlString getErrors(String paramName)
}
uniqueErrorStrs.add(errStr);
}
if (builder.toString().length() > 0)
builder.append(HtmlString.unsafe("</font>"));
if (!builder.isEmpty())
builder.unsafeAppend("</font>");
return builder.getHtmlString();
}

Expand Down
1 change: 1 addition & 0 deletions api/src/org/labkey/api/data/views/DataViewInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public interface DataViewInfo
@Nullable String getSchemaName();
@Nullable String getQueryName();
@Nullable String getViewName();
@Nullable String getDataRegionName();

boolean isVisible(); // specifies whether this view is hidden
boolean showInDashboard(); // an optional visibility level
Expand Down
2 changes: 2 additions & 0 deletions api/src/org/labkey/api/data/views/DataViewService.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ public JSONObject toJSON(User user, DataViewInfo info)
o.put("queryName", info.getQueryName());
if (info.getViewName() != null)
o.put("viewName", info.getViewName());
if (info.getDataRegionName() != null)
o.put("dataRegionName", info.getDataRegionName());

if (info.getDefaultIconCls() != null)
o.put("defaultIconCls", info.getDefaultIconCls());
Expand Down
13 changes: 13 additions & 0 deletions api/src/org/labkey/api/data/views/DefaultViewInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class DefaultViewInfo implements DataViewInfo
private String _schemaName;
private String _queryName;
private String _viewName;
private String _dataRegionName;

private int _displayOrder;

Expand Down Expand Up @@ -436,6 +437,18 @@ public void setQueryName(String queryName)

public void setViewName(String viewName) { _viewName = viewName; }

@Nullable
@Override
public String getDataRegionName()
{
return _dataRegionName;
}

public void setDataRegionName(String dataRegionName)
{
_dataRegionName = dataRegionName;
}

@Override
public int getDisplayOrder() {return _displayOrder; }

Expand Down
4 changes: 2 additions & 2 deletions api/src/org/labkey/api/exp/OntologyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -3748,15 +3748,15 @@ private static void doProjectColumnCheck(final String descriptorTable, final Str
{
fixProjectColumn(descriptorTable, uriColumn, idColumn, container, projectId, newProjectId);
msgBuilder
.append(HtmlString.unsafe("<br/>&nbsp;&nbsp;&nbsp;"))
.unsafeAppend("<br/>&nbsp;&nbsp;&nbsp;")
.append("Fixed inconsistent project ids found for ")
.append(descriptorTable).append(" in folder ")
.append(ContainerManager.getForId(containerId).getPath());

}
else
msgBuilder
.append(HtmlString.unsafe("<br/>&nbsp;&nbsp;&nbsp;"))
.unsafeAppend("<br/>&nbsp;&nbsp;&nbsp;")
.append("ERROR: Inconsistent project ids found for ")
.append(descriptorTable).append(" in folder ").append(container.getPath());
}
Expand Down
Loading

0 comments on commit 3dfebca

Please sign in to comment.