Skip to content
Snippets Groups Projects
Commit 62c9fe3e authored by juanf's avatar juanf
Browse files

SSDM-2732 : Ordering System, more validation.

SVN: 36848
parent a4b7e19c
No related branches found
No related tags found
No related merge requests found
...@@ -302,6 +302,7 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { ...@@ -302,6 +302,7 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, {
"LABEL" : "Suppliers", "LABEL" : "Suppliers",
"TYPE": "SUPPLIER", "TYPE": "SUPPLIER",
"MIN_COUNT" : 1, "MIN_COUNT" : 1,
"MAX_COUNT" : 1,
"ANNOTATION_PROPERTIES" : [] "ANNOTATION_PROPERTIES" : []
}] }]
}, },
......
...@@ -46,10 +46,15 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show ...@@ -46,10 +46,15 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show
var sampleTypeHint = sampleTypeHints[typeIdx]; var sampleTypeHint = sampleTypeHints[typeIdx];
var sampleTypeCode = sampleTypeHint["TYPE"]; var sampleTypeCode = sampleTypeHint["TYPE"];
var sampleTypeMinCount = sampleTypeHint["MIN_COUNT"]; var sampleTypeMinCount = sampleTypeHint["MIN_COUNT"];
var sampleTypeMaxCount = sampleTypeHint["MAX_COUNT"];
var sampleTypeAnnotations = sampleTypeHint["ANNOTATION_PROPERTIES"]; var sampleTypeAnnotations = sampleTypeHint["ANNOTATION_PROPERTIES"];
var sampleTypeCount = (linksModel.samplesByType[sampleTypeCode])?linksModel.samplesByType[sampleTypeCode].length:0; var sampleTypeCount = (linksModel.samplesByType[sampleTypeCode])?linksModel.samplesByType[sampleTypeCode].length:0;
if(sampleTypeCount < sampleTypeMinCount) { if(sampleTypeCount < sampleTypeMinCount) {
Util.showError("Currently you only have " + sampleTypeCount + " of the " + sampleTypeMinCount + " required " + sampleTypeCode + "."); Util.showError("Currently only have " + sampleTypeCount + " of the " + sampleTypeMinCount + " required " + sampleTypeCode + ".");
return false;
}
if(sampleTypeMaxCount && sampleTypeCount > sampleTypeMaxCount) {
Util.showError("Currently have " + sampleTypeCount + " of the maximum " + sampleTypeMaxCount + " for " + sampleTypeCode + ".");
return false; return false;
} }
...@@ -68,7 +73,7 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show ...@@ -68,7 +73,7 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show
var sampleTypeAnnotationType = sampleTypeAnnotation["TYPE"]; var sampleTypeAnnotationType = sampleTypeAnnotation["TYPE"];
var sampleTypeAnnotationIsMandatory = sampleTypeAnnotation["MANDATORY"]; var sampleTypeAnnotationIsMandatory = sampleTypeAnnotation["MANDATORY"];
if(sampleTypeAnnotationIsMandatory && !sampleFromIdxAnnotations[sampleTypeAnnotationType]) { if(sampleTypeAnnotationIsMandatory && !sampleFromIdxAnnotations[sampleTypeAnnotationType]) {
Util.showError("You are missing an annotation " + sampleTypeAnnotationType + " on " + sampleFromIdx.code +"."); Util.showError("Missing an annotation " + sampleTypeAnnotationType + " on " + sampleFromIdx.code +".");
return false; return false;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment