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
2 changes: 1 addition & 1 deletion api/src/org/labkey/api/data/ConvertHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ public static String getStandardConversionErrorMessage(Object value, String fiel

// Issue 50768: Need a better error message if date value is not in the expected format.
if (fieldType.equalsIgnoreCase("date") || fieldType.equalsIgnoreCase("datetime") || fieldType.equalsIgnoreCase("timestamp"))
return "'" + value + "' is not a valid " + fieldType + " for " + fieldName + " using " + LookAndFeelProperties.getInstance(ContainerManager.getRoot()).getDateParsingMode().getDisplayString();
return "'" + value + "' is not a valid " + fieldType + " for '" + fieldName + "' using " + LookAndFeelProperties.getInstance(ContainerManager.getRoot()).getDateParsingMode().getDisplayString();

return "Could not convert value '" + value + "' (" + value.getClass().getSimpleName() + ") for " + fieldType + " field '" + fieldName + "'" ;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ else if (attachmentValue instanceof File file)

private ValidationException propertyValidationException(DomainProperty property, Object value)
{
return rowValidationException(String.format("Can't upload '%s' to field %s with type %s.", value, property.getName(), property.getType().getLabel()));
return rowValidationException(String.format("Cannot upload '%s' to %s type field '%s'.", value, property.getType().getLabel(), property.getName()));
}

private ValidationException rowValidationException(String message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public Map<Integer, Map<String, Object>> getExistingRows(User user, Container co
if (StringUtils.isEmpty(dataContainer))
dataContainer = (String) row.get("folder");
if (!container.getId().equals(dataContainer))
throw new InvalidKeyException("Data doesn't belong to folder '" + container.getName() + "': " + key.getValue().values());
throw new InvalidKeyException("Data does not belong to folder '" + container.getName() + "': " + key.getValue().values());
}
}
else if (verifyExisting)
Expand Down
8 changes: 4 additions & 4 deletions assay/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clean": "rimraf resources/web/assay/gen && rimraf resources/views/gen && rimraf resources/web/gen"
},
"dependencies": {
"@labkey/components": "7.13.0"
"@labkey/components": "7.13.1-fb-crossSampleTypeWarnings.0"
},
"devDependencies": {
"@labkey/build": "8.7.0",
Expand Down
8 changes: 4 additions & 4 deletions core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}
},
"dependencies": {
"@labkey/components": "7.13.0",
"@labkey/components": "7.13.1-fb-crossSampleTypeWarnings.0",
"@labkey/themes": "1.5.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions experiment/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion experiment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test-integration": "cross-env NODE_ENV=test jest --ci --runInBand -c test/js/jest.config.integration.js"
},
"dependencies": {
"@labkey/components": "7.13.0"
"@labkey/components": "7.13.1-fb-crossSampleTypeWarnings.0"
},
"devDependencies": {
"@labkey/build": "8.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ protected Map<String, Object> _update(User user, Container c, Map<String, Object
else if (value != null && !StringUtils.isEmpty(String.valueOf(value)))
{
// Issue 53498: string value for attachment field is not allowed
throw new ValidationException("Can't upload '" + value + "' to field " + name + " with type Attachment.");
throw new ValidationException("Cannot upload '" + value + "' to Attachment type field '" + name + "'.");
}
else
rowStripped.put(name, value); // if null or empty, remove attachment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -1215,17 +1216,21 @@ else if (fileMap.size() == 1)
throw new IllegalArgumentException("Unable to find a posted file or the file for the posted id/path.");
}

return getInferDomainResponse(loader, form.getNumLinesToInclude(), form.isCheckCommentLineCount(), form.getDomainKindName());
return getInferDomainResponse(loader, form);
}
finally
{
IOUtils.closeQuietly(loader);
}
}

private ApiSimpleResponse getInferDomainResponse(DataLoader loader, Integer numLinesToInclude, boolean checkCommentLineCount, String domainKindName) throws IOException
private ApiSimpleResponse getInferDomainResponse(DataLoader loader, InferDomainForm form) throws IOException
{
ApiSimpleResponse response = new ApiSimpleResponse();
Integer numLinesToInclude = form.getNumLinesToInclude();
boolean checkCommentLineCount = form.isCheckCommentLineCount();
String domainKindName = form.getDomainKindName();
Collection<String> distinctValueColumns = form.getDistinctValueColumns();

List<GWTPropertyDescriptor> fields = new ArrayList<>();
List<GWTPropertyDescriptor> reservedFields = new ArrayList<>();
Expand Down Expand Up @@ -1258,12 +1263,43 @@ private ApiSimpleResponse getInferDomainResponse(DataLoader loader, Integer numL
{
response.put("commentLineCount", loader.getCommentLineCount());
}
if (distinctValueColumns != null && !distinctValueColumns.isEmpty())
{
response.put("distinctValues", getDistinctValues(loader, distinctValueColumns));
}
}

response.put("fields", fields);
response.put("reservedFields", reservedFields);
return response;
}

/**
* Iterate through the data and get the distinct values for the specified columns.
* Response is a map of column name to set of distinct string values, for those columns
* that have at least one non-null value.
*/
private Map<String, Set<String>> getDistinctValues(DataLoader loader, Collection<String> colKeys) throws IOException
{
Map<String, Set<String>> distinctValuesMap = new HashMap<>();
try (var iter = loader.iterator())
{
while (iter.hasNext())
{
Map<String, Object> values = iter.next();
if (values == null)
continue;

for (String key : colKeys)
{
Object val = values.get(key);
if (val != null)
distinctValuesMap.computeIfAbsent(key, k -> new CaseInsensitiveHashSet()).add(val.toString());
}
}
}
return distinctValuesMap;
}
}

public static class InferDomainForm
Expand All @@ -1274,6 +1310,7 @@ public static class InferDomainForm
private String _domainKindName;
private boolean _guessFormatAsTSV;
private boolean _checkCommentLineCount;
private Collection<String> _distinctValueColumns;

public Integer getNumLinesToInclude()
{
Expand Down Expand Up @@ -1324,6 +1361,16 @@ public void setCheckCommentLineCount(boolean checkCommentLineCount)
{
_checkCommentLineCount = checkCommentLineCount;
}

public Collection<String> getDistinctValueColumns()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nullable annotation?

{
return _distinctValueColumns;
}

public void setDistinctValueColumns(Collection<String> distinctValueColumns)
{
_distinctValueColumns = distinctValueColumns;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion list/src/org/labkey/list/model/ListQueryUpdateService.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ protected Map<String, Object> updateRow(User user, Container container, Map<Stri
}
else if (r.getValue() != null && !StringUtils.isEmpty(String.valueOf(r.getValue())))
{
throw new ValidationException("Can't upload '" + r.getValue() + "' to field " + r.getKey() + " with type Attachment.");
throw new ValidationException("Cannot upload '" + r.getValue() + "' to Attachment type field '" + r.getKey() + "'.");
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions pipeline/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build-prod": "npm run clean && cross-env NODE_ENV=production PROD_SOURCE_MAP=source-map webpack --config node_modules/@labkey/build/webpack/prod.config.js --color --progress --profile"
},
"dependencies": {
"@labkey/components": "7.13.0"
"@labkey/components": "7.13.1-fb-crossSampleTypeWarnings.0"
},
"devDependencies": {
"@labkey/build": "8.7.0",
Expand Down
2 changes: 1 addition & 1 deletion study/test/src/org/labkey/test/tests/study/AssayTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ private void uploadRuns(String folder, String asUser)
assertTextPresent(
"Could not convert value 'Bad Test' (String) for Double field '" + TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 1) + "'.",
"Could not convert value 'Bad Test' (String) for Integer field '" + TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 2) + "'.",
"'Bad Test' is not a valid Date for " + TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 3) + " using U.S. date parsing (MDY).");
"'Bad Test' is not a valid Date for '" + TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 3) + "' using U.S. date parsing (MDY).");
setFormElement(Locator.name(TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 1)), TEST_ASSAY_SET_PROPERTIES[1]);
setFormElement(Locator.name(TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 2)), TEST_ASSAY_SET_PROPERTIES[2]);
setFormElement(Locator.name(TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 3)), TEST_ASSAY_SET_PROPERTIES[3]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private void uploadRuns(String folder, String asUser)
assertTextPresent(
"Could not convert value 'Bad Test' (String) for Double field '" + TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 1) + "'.",
"Could not convert value 'Bad Test' (String) for Integer field '" + TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 2) + "'.",
"'Bad Test' is not a valid Date for " + TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 3) + " using U.S. date parsing (MDY).");
"'Bad Test' is not a valid Date for '" + TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 3) + "' using U.S. date parsing (MDY).");
setFormElement(Locator.name(TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 1)), TEST_ASSAY_SET_PROPERTIES[1]);
setFormElement(Locator.name(TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 2)), TEST_ASSAY_SET_PROPERTIES[2]);
setFormElement(Locator.name(TEST_ASSAY_SET_PROP_NAME + (TEST_ASSAY_SET_PREDEFINED_PROP_COUNT + 3)), TEST_ASSAY_SET_PROPERTIES[3]);
Expand Down