From ada3486a63385b10f7b7e61010e3061014b56c47 Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Wed, 7 Jan 2015 13:20:50 +0000 Subject: [PATCH] SSDM-1338: PAPER - PETER MIGRATION - Storage Improvements (Position Field) SVN: 33188 --- .../newbrowser/1/as/initialize-master-data.py | 7 +++-- .../newbrowser/html/js/config/Profile.js | 2 ++ .../html/js/config/StandardProfile.js | 13 ++++---- .../views/SampleForm/SampleFormController.js | 3 +- .../StorageManagerController.js | 9 ++++-- .../widgets/StorageController.js | 3 ++ .../StorageManager/widgets/StorageModel.js | 3 +- .../StorageManager/widgets/StorageView.js | 30 +++++++++++++++++++ 8 files changed, 56 insertions(+), 14 deletions(-) diff --git a/plasmid/source/core-plugins/newbrowser/1/as/initialize-master-data.py b/plasmid/source/core-plugins/newbrowser/1/as/initialize-master-data.py index 418e552ed6d..430d54465d7 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/initialize-master-data.py +++ b/plasmid/source/core-plugins/newbrowser/1/as/initialize-master-data.py @@ -17,8 +17,8 @@ ## ## Configuration ## -#PATH_TO_MANAGE_PROPERTIES_SCRIPTS = "/Users/juanf/Documents/workspace/openbis/source/core-plugins/newbrowser/1/compatibility/"; -PATH_TO_MANAGE_PROPERTIES_SCRIPTS = None; +PATH_TO_MANAGE_PROPERTIES_SCRIPTS = "/Users/juanf/Documents/workspace/openbis/source/core-plugins/newbrowser/1/compatibility/"; +#PATH_TO_MANAGE_PROPERTIES_SCRIPTS = "/Users/juanf/Documents/installations/S195/servers/core-plugins/newbrowser/1/compatibility/"; # MasterDataRegistrationTransaction Class import os @@ -699,7 +699,8 @@ addPropertiesToSamples([ ["STORAGE_ROW", "Physical Storage", "Storage Row", DataType.INTEGER, None, "Storage Row", None], ["STORAGE_COLUMN", "Physical Storage", "Storage Column", DataType.INTEGER, None, "Storage Column", None], ["STORAGE_BOX_NAME", "Physical Storage", "Storage Box Name", DataType.VARCHAR, None, "Storage Box Name", None], - ["STORAGE_USER", "Physical Storage", "Storage User Id", DataType.VARCHAR, None, "Storage User Id", None] + ["STORAGE_USER", "Physical Storage", "Storage User Id", DataType.VARCHAR, None, "Storage User Id", None], + ["STORAGE_POSITION", "Physical Storage", "Storage Position", DataType.VARCHAR, None, "Storage Position", None] ]); ## diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/config/Profile.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/config/Profile.js index c78f15065e4..67b5e6fae6a 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/config/Profile.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/config/Profile.js @@ -105,6 +105,7 @@ $.extend(DefaultProfile.prototype, { propertyGroup.columnProperty = storagePropertyGroups[i]["COLUMN_PROPERTY"]; propertyGroup.boxProperty = storagePropertyGroups[i]["BOX_PROPERTY"]; propertyGroup.userProperty = storagePropertyGroups[i]["USER_PROPERTY"]; + propertyGroup.positionProperty = storagePropertyGroups[i]["POSITION_PROPERTY"]; return propertyGroup; } } @@ -131,6 +132,7 @@ $.extend(DefaultProfile.prototype, { propertyGroups[i].columnProperty = storagePropertyGroups[i]["COLUMN_PROPERTY"]; propertyGroups[i].boxProperty = storagePropertyGroups[i]["BOX_PROPERTY"]; propertyGroups[i].userProperty = storagePropertyGroups[i]["USER_PROPERTY"]; + propertyGroups[i].positionProperty = storagePropertyGroups[i]["POSITION_PROPERTY"]; } return propertyGroups; } diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/config/StandardProfile.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/config/StandardProfile.js index 896d9ea4e63..42735ad0115 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/config/StandardProfile.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/config/StandardProfile.js @@ -7,8 +7,6 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { init: function(serverFacade){ DefaultProfile.prototype.init.call(this, serverFacade); - this.inventorySpaces = ["MATERIALS", "METHODS"]; - this.storagesConfiguration = { "isEnabled" : true, /* @@ -17,11 +15,12 @@ $.extend(StandardProfile.prototype, DefaultProfile.prototype, { "STORAGE_PROPERTIES": [{ "STORAGE_PROPERTY_GROUP" : "Physical Storage", //Where the storage will be painted. "STORAGE_GROUP_DISPLAY_NAME" : "Physical Storage", //Storage Group Name - "NAME_PROPERTY" : "STORAGE_NAMES", //Should be a Vocabulary. - "ROW_PROPERTY" : "STORAGE_ROW", //Should be an integer. - "COLUMN_PROPERTY" : "STORAGE_COLUMN", //Should be an integer. - "BOX_PROPERTY" : "STORAGE_BOX_NAME", //Should be text. - "USER_PROPERTY" : "STORAGE_USER" //Should be text. + "NAME_PROPERTY" : "STORAGE_NAMES", //Should be a Vocabulary. + "ROW_PROPERTY" : "STORAGE_ROW", //Should be an integer. + "COLUMN_PROPERTY" : "STORAGE_COLUMN", //Should be an integer. + "BOX_PROPERTY" : "STORAGE_BOX_NAME", //Should be text. + "USER_PROPERTY" : "STORAGE_USER", //Should be text. + "POSITION_PROPERTY" : "STORAGE_POSITION" //Should be text. }], /* * Storages map, can hold configurations for several storages. diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/SampleFormController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/SampleFormController.js index 9b463ce8727..c6c4da9e67d 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/SampleFormController.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/SampleFormController.js @@ -50,7 +50,8 @@ function SampleFormController(mainController, mode, sample) { userSelector : "off", boxSelector: "on", rackSelector: "on", - contentsSelector: "off" + contentsSelector: "off", + positionSelector: "on" }); storageController.getModel().storagePropertyGroup = profile.getStoragePropertyGroup(storagePropertyGroupName); this._storageControllers.push(storageController); diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/StorageManagerController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/StorageManagerController.js index b580203c07a..09da6dc78b0 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/StorageManagerController.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/StorageManagerController.js @@ -25,7 +25,8 @@ function StorageManagerController(mainController) { userSelector : "on", boxSelector: "on", rackSelector: "off", - contentsSelector: "on" + contentsSelector: "on", + positionSelector: "off" }); this._storageToController = new StorageController({ @@ -35,7 +36,8 @@ function StorageManagerController(mainController) { userSelector : "on", boxSelector: "on", rackSelector: "on", - contentsSelector: "off" + contentsSelector: "off", + positionSelector: "off" }); @@ -69,12 +71,15 @@ function StorageManagerController(mainController) { sample.properties[fromModel.storagePropertyGroup.columnProperty] = ""; sample.properties[fromModel.storagePropertyGroup.boxProperty] = ""; sample.properties[fromModel.storagePropertyGroup.userProperty] = ""; +// IGNORING POSITIONS ON UPDATES, ARE NOT SUPPORTED YET +// sample.properties[fromModel.storagePropertyGroup.positionProperty] = ""; sample.properties[toModel.storagePropertyGroup.nameProperty] = toModel.storageCode; sample.properties[toModel.storagePropertyGroup.rowProperty] = toModel.row; sample.properties[toModel.storagePropertyGroup.columnProperty] = toModel.column; sample.properties[toModel.storagePropertyGroup.boxProperty] = toModel.boxName; sample.properties[toModel.storagePropertyGroup.userProperty] = mainController.serverFacade.openbisServer.getSession().split("-")[0]; +// sample.properties[toModel.storagePropertyGroup.positionProperty] = ""; var sampleSpace = sample.spaceCode; var sampleProject = null; diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageController.js index d3798db33df..83179893ca6 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageController.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageController.js @@ -55,6 +55,7 @@ function StorageController(configOverride) { // Delete old state in model and view and set new sate in model and view _this._storageModel.resetBoxInfo(posX, posY, null, null); _this._storageView.showBoxField(); + _this._storageView.showPosField(); if(_this._storageModel.config.contentsSelector === "on") { _this._storageView.refreshBoxContents(); } @@ -101,6 +102,7 @@ function StorageController(configOverride) { this._storageModel.resetBoxInfo(null, null, null, null); this._storageView.refreshGrid(); this._storageView.hideBoxField(); + this._storageView.hidePosField(); this._storageView.refreshBoxContents(); } @@ -117,6 +119,7 @@ function StorageController(configOverride) { // Delete old state in model and view and set new sate in model and view this._storageModel.resetBoxInfo(null, null, null, null); this._storageView.hideBoxField(); + this._storageView.hidePosField(); if(this._storageModel.config.contentsSelector === "on") { this._storageView.refreshBoxContents(); } diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageModel.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageModel.js index 47a8efe4085..59011cd8ed8 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageModel.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageModel.js @@ -25,7 +25,8 @@ function StorageModel(configOverride) { userSelector : "on", boxSelector: "on", rackSelector: "on", - contentsSelector: "off" + contentsSelector: "off", + positionSelector: "off" }; } diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageView.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageView.js index e4dfc0303cc..ee427d39af1 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageView.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageView.js @@ -25,6 +25,7 @@ function StorageView(storageController, storageModel, gridView) { this._gridContainer = $("<div>"); this._boxField = FormUtil._getInputField("text", "", "Box Name", null, false); this._boxContentsDropDown = $('<select>', { 'id' : 'boxSamplesSelector' , class : 'multiselect' , 'multiple' : 'multiple'}); + this._positionField = FormUtil._getInputField("text", "", "Position", null, false); this.repaint = function($container) { // @@ -122,12 +123,30 @@ function StorageView(storageController, storageModel, gridView) { }); } + if(this._storageModel.config.positionSelector === "on") { + //Paint + var $controlGroupPosition = FormUtil.getFieldForComponentWithLabel(this._positionField, "Position"); + $container.append($controlGroupPosition); + //Attach Event + this._positionField.change(function() { + if(_this._storageModel.sample) { //Sample to bind + _this._storageModel.sample.properties[_this._storageModel.storagePropertyGroup.positionProperty] = $(this).val(); + } + }); + //Sample to bind + if(this._storageModel.sample) { + this._positionField.val(this._storageModel.sample.properties[this._storageModel.storagePropertyGroup.positionProperty]); + this._positionField.show(); + } + } + if(this._storageModel.isDisabled) { this._storageGroupsDropDown.attr("disabled", ""); this._defaultStoragesDropDown.attr("disabled", ""); this._userIdDropdown.attr("disabled", ""); this._boxField.attr("disabled", ""); this._boxContentsDropDown.attr("disabled", ""); + this._positionField.attr("disabled", ""); } } @@ -164,6 +183,17 @@ function StorageView(storageController, storageModel, gridView) { this._gridView.repaint(this._gridContainer); } + this.hidePosField = function() { + this._positionField.val(""); + this._positionField.hide(); + } + + this.showPosField = function() { + this._positionField.val(""); + this._positionField.removeAttr("disabled"); + this._positionField.show(); + } + this.hideBoxField = function() { this._boxField.val(""); this._boxField.hide(); -- GitLab