Skip to content
Snippets Groups Projects
Commit 4d5a36d1 authored by juanf's avatar juanf
Browse files

SSDM-2293 : Storage manager that allows to add/delete different positions for...

SSDM-2293 : Storage manager that allows to add/delete different positions for a single sample on the same box.

SVN: 34493
parent b235de79
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ function StorageController(configOverride) {
var _this = this;
//Dependent widgets
this._gridController = new GridController();
this._gridControllerPosition = new GridController();
this._gridControllerPosition = new GridController(true);
//This controller M/V
this._storageModel = new StorageModel(configOverride);
......
......@@ -210,6 +210,8 @@ function StorageView(storageController, storageModel, gridView) {
this._storageController._gridController.selectPosition(
this._storageModel.sample.properties[this._storageModel.storagePropertyGroup.rowProperty],
this._storageModel.sample.properties[this._storageModel.storagePropertyGroup.columnProperty]);
this._storageModel.row = this._storageModel.sample.properties[this._storageModel.storagePropertyGroup.rowProperty];
this._storageModel.column = this._storageModel.sample.properties[this._storageModel.storagePropertyGroup.columnProperty];
}
}
......@@ -241,26 +243,32 @@ function StorageView(storageController, storageModel, gridView) {
var labels = [];
samples.forEach(function(element, index, array) {
var code = element.code;
var position = element.properties[_this._storageModel.storagePropertyGroup.positionProperty];
if(position) {
var xyPos = Util.getXYfromLetterNumberCombination(position);
var x = xyPos[0];
var y = xyPos[1];
var row = labels[x];
if(!row) {
row = [];
labels[x] = row;
}
var col = row[y];
if(!col) {
col = [];
row[y] = col;
var positionProp = element.properties[_this._storageModel.storagePropertyGroup.positionProperty];
if(positionProp) {
var positions = positionProp.split(" ");
for(var pIdx = 0; pIdx < positions.length; pIdx++) {
var position = positions[pIdx];
if (position) {
var xyPos = Util.getXYfromLetterNumberCombination(position);
var x = xyPos[0];
var y = xyPos[1];
var row = labels[x];
if(!row) {
row = [];
labels[x] = row;
}
var col = row[y];
if(!col) {
col = [];
row[y] = col;
}
label = { displayName : code, data : {} };
col.push(label);
}
}
label = { displayName : code, data : {} };
col.push(label);
} else {
//Not position found
}
......@@ -273,13 +281,26 @@ function StorageView(storageController, storageModel, gridView) {
var numRows = parseInt(rowsAndCols[0]);
var numCols = parseInt(rowsAndCols[1]);
_this._storageController._gridControllerPosition.getModel().reset(numRows, numCols, labels);
_this._storageController._gridControllerPosition.getView().setPosSelectedEventHandler(function(posX, posY) {
_this._storageController._gridControllerPosition.getView().setPosSelectedEventHandler(function(posX, posY, isSelectedOrDeleted) {
var newPosition = Util.getLetterForNumber(posX) + posY;
var isMultiple = _this._storageController._gridControllerPosition.getModel().isSelectMultiple;
var boxPosition = _this._storageModel.boxPosition;
if(!boxPosition || !isMultiple) {
boxPosition = "";
}
if(isMultiple && !isSelectedOrDeleted) {
boxPosition = boxPosition.replace(newPosition + " ", "");
} else {
boxPosition += newPosition + " ";
}
//Binded sample
if(_this._storageModel.sample) {
_this._storageModel.sample.properties[_this._storageModel.storagePropertyGroup.positionProperty] = newPosition;
_this._storageModel.sample.properties[_this._storageModel.storagePropertyGroup.positionProperty] = boxPosition;
}
_this._storageModel.boxPosition = newPosition;
_this._storageModel.boxPosition = boxPosition;
});
//
......@@ -304,8 +325,14 @@ function StorageView(storageController, storageModel, gridView) {
} else {
if(_this._storageModel.sample.properties[_this._storageModel.storagePropertyGroup.positionProperty]) {
_this._storageModel.boxPosition = _this._storageModel.sample.properties[_this._storageModel.storagePropertyGroup.positionProperty];
var xyPos = Util.getXYfromLetterNumberCombination(_this._storageModel.boxPosition);
_this._storageController._gridControllerPosition.selectPosition(xyPos[0], xyPos[1]);
var positions = _this._storageModel.boxPosition.split(" ");
for(var pIdx = 0; pIdx < positions.length; pIdx++) {
var position = positions[pIdx];
if(position) {
var xyPos = Util.getXYfromLetterNumberCombination(position);
_this._storageController._gridControllerPosition.selectPosition(xyPos[0], xyPos[1]);
}
}
}
}
});
......
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