Skip to content
Snippets Groups Projects
Commit 9caf7816 authored by juanf's avatar juanf
Browse files

SSDM-516: Storage Manager Ongoing Work.

SVN: 31824
parent af894db4
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,15 @@ function StorageController(configOverride) { ...@@ -24,6 +24,15 @@ function StorageController(configOverride) {
if(this._storageModel.config.boxSelector === "on") { if(this._storageModel.config.boxSelector === "on") {
this._gridController.getView().setLabelClickedEventHandler(function(posX, posY, label) { this._gridController.getView().setLabelClickedEventHandler(function(posX, posY, label) {
//
// Delete old state in model and view
//
_this._storageModel.resetBoxInfo();
//
// Set new sate in model and view
//
_this._storageModel.row = posX; _this._storageModel.row = posX;
_this._storageModel.column = posY; _this._storageModel.column = posY;
_this._storageModel.boxName = label; _this._storageModel.boxName = label;
...@@ -41,15 +50,32 @@ function StorageController(configOverride) { ...@@ -41,15 +50,32 @@ function StorageController(configOverride) {
if(this._storageModel.config.rackSelector === "on") { if(this._storageModel.config.rackSelector === "on") {
this._gridController.getView().setPosClickedEventHandler(function(posX, posY) { this._gridController.getView().setPosClickedEventHandler(function(posX, posY) {
//
// Delete old state in model and view
//
_this._storageModel.resetBoxInfo();
if(_this._storageModel.config.contentsSelector === "on") {
_this._storageView.showContents([]);
}
//
// Set new sate in model and view
//
_this._storageModel.row = posX; _this._storageModel.row = posX;
_this._storageModel.column = posY; _this._storageModel.column = posY;
_this._storageModel.boxName = "";
_this._storageView.getBoxField().val(""); _this._storageView.getBoxField().val("");
_this._storageView.getBoxField().removeAttr("disabled"); _this._storageView.getBoxField().removeAttr("disabled");
_this._storageView.getBoxField().show(); _this._storageView.getBoxField().show();
}); });
} }
if(this._storageModel.config.contentsSelector === "on") {
this._storageView.getBoxContentsDropDown().change(function() {
var selectedSamples = $(this).val();
_this._storageModel.boxContents = selectedSamples;
});
}
this._storageView.getBoxField().keyup(function() { this._storageView.getBoxField().keyup(function() {
_this._storageModel.boxName = $(this).val(); _this._storageModel.boxName = $(this).val();
...@@ -65,7 +91,14 @@ function StorageController(configOverride) { ...@@ -65,7 +91,14 @@ function StorageController(configOverride) {
this._storageView.getSelectStorageDropdown().change(function(event) { this._storageView.getSelectStorageDropdown().change(function(event) {
_this._storageView.getBoxField().hide(); _this._storageView.getBoxField().hide();
//
// Delete old state in model and view
//
_this._storageModel.resetBoxInfo(); _this._storageModel.resetBoxInfo();
if(_this._storageModel.config.contentsSelector === "on") {
_this._storageView.showContents([]);
}
// //
// Obtain Storage Configuration // Obtain Storage Configuration
// //
......
...@@ -34,13 +34,13 @@ function StorageModel(configOverride) { ...@@ -34,13 +34,13 @@ function StorageModel(configOverride) {
this.userId = null; //Selected user Being filtered (creator or latest modifier of the box) this.userId = null; //Selected user Being filtered (creator or latest modifier of the box)
this.row = null; //Selected Row this.row = null; //Selected Row
this.column = null; //Selected Column this.column = null; //Selected Column
this.boxName = //Selected Box this.boxName = null; //Selected Box
this.boxContents = null; //Selected Box contents (samples) this.boxContents = null; //Selected Box contents (samples)
this.resetBoxInfo = function() { this.resetBoxInfo = function() {
this.row = null; //Selected Row this.row = null; //Selected Row
this.column = null; //Selected Column this.column = null; //Selected Column
this.boxName = //Selected Box this.boxName = null; //Selected Box
this.boxContents = null; //Selected Box contents (samples) this.boxContents = null; //Selected Box contents (samples)
} }
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ function StorageView(storageModel, gridView) { ...@@ -23,7 +23,7 @@ function StorageView(storageModel, gridView) {
this._userIdFilter = FormUtil._getInputField("text", "", "User id to filter", null, false); this._userIdFilter = FormUtil._getInputField("text", "", "User id to filter", null, false);
this._gridContainer = $("<div>"); this._gridContainer = $("<div>");
this._boxField = FormUtil._getInputField("text", "", "Box Name", null, false); this._boxField = FormUtil._getInputField("text", "", "Box Name", null, false);
this._contentsContainer = $("<div>"); this._boxContentsDropDown = $('<select>', { 'id' : 'boxSamplesSelector' , class : 'multiselect' , 'multiple' : 'multiple'});
this.repaint = function($container) { this.repaint = function($container) {
var _this = this; var _this = this;
...@@ -55,21 +55,18 @@ function StorageView(storageModel, gridView) { ...@@ -55,21 +55,18 @@ function StorageView(storageModel, gridView) {
} }
if(this._storageModel.config.contentsSelector === "on") { if(this._storageModel.config.contentsSelector === "on") {
var $controlGroupBoxContents = FormUtil.getFieldForComponentWithLabel(this._contentsContainer, "Box Contents"); var $controlGroupBoxContents = FormUtil.getFieldForComponentWithLabel(this._boxContentsDropDown, "Box Contents");
$container.append($controlGroupBoxContents); $container.append($controlGroupBoxContents);
this._boxContentsDropDown.multiselect();
} }
} }
this.showContents = function(contents) { this.showContents = function(contents) {
this._contentsContainer.empty(); this._boxContentsDropDown.empty();
var $contentsDropDown = $('<select>', { 'id' : 'boxSamplesSelector' , class : 'multiselect' , 'multiple' : 'multiple'});
for (var i = 0; i < contents.length; i++) { for (var i = 0; i < contents.length; i++) {
$contentsDropDown.append($('<option>', { 'value' : contents[i].code , 'selected' : ''}).html(contents[i].code)); this._boxContentsDropDown.append($('<option>', { 'value' : contents[i].code , 'selected' : ''}).html(contents[i].code));
} }
this._boxContentsDropDown.multiselect('rebuild');
this._contentsContainer.append($contentsDropDown);
$('#boxSamplesSelector').multiselect();
} }
// //
...@@ -94,4 +91,8 @@ function StorageView(storageModel, gridView) { ...@@ -94,4 +91,8 @@ function StorageView(storageModel, gridView) {
this.getBoxField = function() { this.getBoxField = function() {
return this._boxField; return this._boxField;
} }
this.getBoxContentsDropDown = function() {
return this._boxContentsDropDown;
}
} }
\ No newline at end of file
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