Skip to content
Snippets Groups Projects
Commit 17a2eac9 authored by juanf's avatar juanf
Browse files

SSDM-1724 : Plate View (ongoing work)

SVN: 33910
parent 3e7be74a
No related branches found
No related tags found
No related merge requests found
......@@ -461,7 +461,7 @@ table.downloads {
}
/*
* Plate Widget
* Plate & Storage Widget
*/
.gridTable {
border : none !important;
......@@ -481,6 +481,17 @@ table.downloads {
border-color: #CCCCCC;
}
/*
* Plate Widget
*/
.gridTable td .well {
background-color: #E7E7E7;
}
.gridTable td .well:hover {
background-color: #C7C7C7;
cursor : pointer;
}
/*
* Storage Widget
*/
......
......@@ -535,6 +535,36 @@ function ServerFacade(openbisServer) {
this.openbisServer.searchForDataSets(dataSetCriteria, callbackFunction)
}
this.searchContained = function(permId, callbackFunction) {
var matchClauses = [];
var subCriteria = {
"@type" : "SearchSubCriteria",
"targetEntityKind" : "SAMPLE_CONTAINER",
"criteria" : {
matchClauses : [{
"@type":"AttributeMatchClause",
fieldType : "ATTRIBUTE",
attribute : "PERM_ID",
desiredValue : permId
}],
operator : "MATCH_ALL_CLAUSES"
}
}
var sampleCriteria =
{
matchClauses : matchClauses,
subCriterias : [ subCriteria ],
operator : "MATCH_ALL_CLAUSES"
};
var localReference = this;
this.openbisServer.searchForSamplesWithFetchOptions(sampleCriteria, ["PROPERTIES"], function(data) {
callbackFunction(localReference.getInitializedSamples(data.result));
});
}
this.searchWithIdentifier = function(sampleIdentifier, callbackFunction)
{
this.searchWithIdentifiers([sampleIdentifier], callbackFunction);
......
......@@ -19,6 +19,11 @@ function PlateController(sample) {
this._plateView = new PlateView(this, this._plateModel);
this.init = function($container) {
this._plateView.repaint($container);
var _this = this;
$container.append("Loading Wells ...");
mainController.serverFacade.searchContained(this._plateModel.sample.permId, function(contained) {
_this._plateModel.wells = contained;
_this._plateView.repaint($container);
});
}
}
\ No newline at end of file
......@@ -16,6 +16,7 @@
function PlateModel(sample) {
this.sample = sample;
this.wells = null;
var getRowsAndColsFromPlateSample = function(sample) {
try {
......@@ -34,6 +35,16 @@ function PlateModel(sample) {
this.numRows = getRowsAndColsFromPlateSample(sample)[0];
this.numColumns = getRowsAndColsFromPlateSample(sample)[1];
this.getWell = function(rowNum, colNum) {
var wellIdentifier = this.sample.identifier + ":" + this.getAlphabetLabel(rowNum) + colNum;
for(var wellIdx = 0; wellIdx < this.wells.length; wellIdx++) {
if(this.wells[wellIdx].identifier === wellIdentifier) {
var toReturn = this.wells[wellIdx];
return toReturn;
}
}
return null;
}
this.getAlphabetLabel = function(number) {
var alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
......
......@@ -19,6 +19,7 @@ function PlateView(plateController, plateModel) {
this.repaint = function($container) {
var _this = this;
$container.empty();
var gridTable = $("<table>", { "class" : "table table-bordered gridTable" });
for(var i = 0; i <= this._plateModel.numRows; i++) {
......@@ -32,7 +33,11 @@ function PlateView(plateController, plateModel) {
} else if (j === 0){ //header with row letter
$cell = $("<th>").append(this._plateModel.getAlphabetLabel(i-1));
} else {
$cell = $("<td>");
var well = this._plateModel.getWell(i-1,j);
$cell = $("<td>").append("&nbsp;");
if(well) {
$cell.addClass('well');
}
}
$row.append($cell);
}
......
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