diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/UserTests.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/UserTests.js index 313e22c816934ac1602cf01146ba8af202a6cddd..6fc26c24b8b271ddc9ab090f6b8575302053541c 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/UserTests.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/UserTests.js @@ -74,10 +74,10 @@ var UserTests = new function() { .then(() => e.waitForId("create-btn")) .then(() => e.click("create-btn")) .then(() => e.waitForId("sampleFormTitle")) - .then(() => e.equalTo("sampleFormTitle", "Create Object Bacteria", false)) + .then(() => e.equalTo("sampleFormTitle", "Create Object Bacteria", true, false)) .then(() => e.waitForId("codeId")) .then(() => e.waitForFill("codeId")) - .then(() => e.equalTo("codeId", code, false)) + .then(() => e.equalTo("codeId", code, true, false)) .then(() => e.waitForId("NAME")) .then(() => e.change("NAME", name, false)) //Paste from Word @@ -87,8 +87,8 @@ var UserTests = new function() { //Check saving results .then(() => e.waitForId("edit-btn")) .then(() => e.waitForId("NAME")) - .then(() => e.equalTo("NAME", name, false)) - .then(() => e.equalTo("BACTERIAGENOTYPE", richText, false)) + .then(() => e.equalTo("NAME", name, true, false)) + .then(() => e.equalTo("BACTERIAGENOTYPE", richText, true, false)) .then(() => resolve()); }); } @@ -107,6 +107,7 @@ var UserTests = new function() { return new Promise(function executor(resolve, reject) { var e = EventUtil; Promise.resolve().then(() => UserTests.importBacteriasFromFile(baseURL + pathToResource)) + // check that bacterias was created .then(() => e.waitForId("bac5-column-id")) .then(() => e.waitForId("bac6-column-id")) .then(() => e.waitForId("bac7-column-id")) @@ -121,6 +122,7 @@ var UserTests = new function() { return new Promise(function executor(resolve, reject) { var e = EventUtil; Promise.resolve().then(() => UserTests.importBacteriasFromFile(baseURL + pathToResource)) + // check that bacterias was created .then(() => e.waitForId("bac10-column-id")) .then(() => e.waitForId("bac11-column-id")) .then(() => e.waitForId("next-page-id")) @@ -167,14 +169,14 @@ var UserTests = new function() { .then(() => e.click("add-storage-btn")) .then(() => e.waitForId("storage-drop-down-id")) .then(() => e.change("storage-drop-down-id", "DEFAULT_STORAGE", false)) - .then(() => e.waitForId("grid-cell-1-2")) - .then(() => e.click("grid-cell-1-2")) + .then(() => e.waitForId("storage-drop-down-id-1-2")) + .then(() => e.click("storage-drop-down-id-1-2")) .then(() => e.waitForId("box-name-id")) .then(() => e.write("box-name-id", "Test Box", false)) .then(() => e.waitForId("box-size-drop-down-id")) .then(() => e.change("box-size-drop-down-id", "4X4", false)) - .then(() => e.waitForId("grid-cell-C-2")) - .then(() => e.click("grid-cell-C-2")) + .then(() => e.waitForId("storage-drop-down-id-C-2")) + .then(() => e.click("storage-drop-down-id-C-2")) .then(() => e.click("storage-accept")) .then(() => e.waitForId("save-btn")) .then(() => e.click("save-btn")) @@ -188,8 +190,19 @@ var UserTests = new function() { return new Promise(function executor(resolve, reject) { var e = EventUtil; - Promise.resolve().then(() => e.waitForId("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) - .then(() => e.click("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) + Promise.resolve().then(() => e.waitForId("STORAGE_MANAGER")) + .then(() => e.click("STORAGE_MANAGER")) + .then(() => e.waitForId("storage-drop-down-id-a")) + .then(() => e.change("storage-drop-down-id-a", "DEFAULT_STORAGE", false)) + .then(() => e.waitForId("toggle-storage-b-id")) + .then(() => e.click("toggle-storage-b-id")) + .then(() => e.waitForId("storage-drop-down-id-b")) + .then(() => e.change("storage-drop-down-id-b", "BENCH", false)) + .then(() => e.waitForId("storage-drop-down-id-a-1-2-storage-box")) + .then(() => e.waitForId("storage-drop-down-id-b-1-1")) + .then(() => e.dragAndDrop("storage-drop-down-id-a-1-2-storage-box", "storage-drop-down-id-b-1-1", false)) + .then(() => e.equalTo("change-log-container-id", "None", false, false)) + .then(() => e.click("save-changes-btn")) .then(() => resolve()); }); } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/EventUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/EventUtil.js index 47ac0026fb0e617a5d29931e41e7bd23d0ce2434..abe3051fd51783e5fba9f2a70b0d48fa7ea9c0d2 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/EventUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/EventUtil.js @@ -42,14 +42,15 @@ var EventUtil = new function() { }); }; - this.equalTo = function(elementId, value, ignoreError) { + this.equalTo = function(elementId, value, isEqual, ignoreError) { return new Promise(function executor(resolve, reject) { try { var element = EventUtil.getElement(elementId, ignoreError, resolve); - if (element.html() === value || element.val() === value) { + if (isEqual && (element.html() === value || element.val() === value) || + !isEqual && (element.html() != value && element.val() != value)) { resolve(); } else { - throw "Element #" + elementId + " should have value = " + element.val() + " but have " + value; + throw "Element #" + elementId + " should" + (isEqual ? "" : " not") + " be equal " + value; } } catch(error) { reject(); @@ -130,6 +131,32 @@ var EventUtil = new function() { return timeout; } + this.dragAndDrop = function(dragId, dropId, ignoreError) { + return new Promise(function executor(resolve, reject) { + try { + var dragElement = EventUtil.getElement(dragId, ignoreError, resolve).draggable(); + var dropElement = EventUtil.getElement(dropId, ignoreError, resolve).droppable(); + + var dt = new DataTransfer(); + + var dragStartEvent = jQuery.Event("dragstart"); + dragStartEvent.originalEvent = jQuery.Event("mousedown"); + dragStartEvent.originalEvent.dataTransfer = dt; + + dropEvent = jQuery.Event("drop"); + dropEvent.originalEvent = jQuery.Event("DragEvent"); + dropEvent.originalEvent.dataTransfer = dt; + + dragElement.trigger(dragStartEvent); + dropElement.trigger(dropEvent); + resolve(); + } catch(error) { + reject(); + } + }); + }; + + this.getElement = function(elementId, ignoreError, resolve) { var element = $( "#" + elementId ); if(!element) { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/StorageListView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/StorageListView.js index c760d1ead893bf5cfd0330ebca85d39df8bafc28..168fdea7b06007a1f83af9960e5e44667b02f9c6 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/StorageListView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/StorageListView.js @@ -217,7 +217,8 @@ function StorageListView(storageListController, storageListModel) { positionSelector: "on", positionDropEventHandler: null, boxPositionMultiple: "on", - positionDragAndDropEnabled: "off" + positionDragAndDropEnabled: "off", + storageId : "storage-drop-down-id" }); var storagePropGroup = profile.getStoragePropertyGroup(); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerController.js index 4791f2a45e3648b093fe4a11a22e2eb046233d04..67ffcaf6054dbe8e7f6dffd1c2bda334604796d5 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerController.js @@ -154,7 +154,8 @@ function StorageManagerController(mainController) { positionSelector: "on", positionDropEventHandler: getPositionDropEventHandler(), boxPositionMultiple: "off", - positionDragAndDropEnabled: "on" + positionDragAndDropEnabled: "on", + storageId : "storage-drop-down-id-a" }); this._storageToController = new StorageController({ @@ -171,7 +172,8 @@ function StorageManagerController(mainController) { positionSelector: "on", positionDropEventHandler: getPositionDropEventHandler(), boxPositionMultiple: "off", - positionDragAndDropEnabled: "on" + positionDragAndDropEnabled: "on", + storageId : "storage-drop-down-id-b" }); this._storageManagerView = new StorageManagerView(this, this._storageManagerModel, this._storageFromController.getView(), this._storageToController.getView()); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerView.js index 1cc28e0bd669ce97c5322dc1882427cb2cf49c6f..87951dc8d04237b6a7bf0a996048ccd4a4fe94e5 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/StorageManagerView.js @@ -20,10 +20,10 @@ function StorageManagerView(storageManagerController, storageManagerModel, stora this._storageFromView = storageFromView; this._storageToView = storageToView; - this._changeLogContainer = $("<div>").append("None"); + this._changeLogContainer = $("<div id = 'change-log-container-id'>").append("None"); - this._moveBtn = FormUtil.getButtonWithIcon("glyphicon-floppy-disk", null, "Save Changes"); - this._showHideStorageToBtn = FormUtil.getButtonWithIcon("glyphicon-eye-open", null, "Toggle Storage B"); + this._moveBtn = FormUtil.getButtonWithIcon("glyphicon-floppy-disk", null, "Save Changes", null, "save-changes-btn"); + this._showHideStorageToBtn = FormUtil.getButtonWithIcon("glyphicon-eye-open", null, "Toggle Storage B", null, 'toggle-storage-b-id'); this._showHideMenuBtn = FormUtil.getButtonWithIcon("glyphicon-resize-full", function() { var iconSpan = $(this.children[0]); if(iconSpan.hasClass("glyphicon-resize-full")) { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridController.js index efe4444eac0a2f13cd2794b0c94861f30d298632..45b7afa6d496c78cd9bde90fd457329f6591d64d 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridController.js @@ -14,8 +14,8 @@ * limitations under the License. */ -function GridController(isSelectMultiple, isDragable) { - this._gridModel = new GridModel(isSelectMultiple, isDragable); +function GridController(isSelectMultiple, isDragable, gridId) { + this._gridModel = new GridModel(isSelectMultiple, isDragable, gridId); this._gridView = new GridView(this._gridModel); this.init = function($container) { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridModel.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridModel.js index cf87f8641fedd2759a3f573e949c110491d5a926..9892dfd51ed04b804be17a3a9af639492489c869 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridModel.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridModel.js @@ -14,7 +14,7 @@ * limitations under the License. */ -function GridModel(isSelectMultiple, isDragable) { +function GridModel(isSelectMultiple, isDragable, gridId) { this.isDisabled = false; this.isSelectMultiple = false; if(isSelectMultiple) { @@ -31,6 +31,10 @@ function GridModel(isSelectMultiple, isDragable) { this.labelsFilter = null; this.dataFilter = null; this.useLettersOnRows = false; + this.gridId = null; + if(gridId) { + this.gridId = gridId; + } this.reset = function(numRows, numColumns, labels) { this.numRows = numRows; diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js index 61dfa2fc05558425dea9712ca501f0e21b9e113c..e56dc88d71ff2618f9bf8157ed09b56d7a63cb08 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js @@ -70,7 +70,7 @@ function GridView(gridModel) { $newRow.append($numberCell); for(var j = 0; j < this._gridModel.numColumns; j++) { - var id = "grid-cell-" + rowLabel + "-" + (j+1); + var id = this._gridModel.gridId + "-" + rowLabel + "-" + (j+1); var $newColumn = $("<td id = '" + id + "'>"); if(this._gridModel.isDragable) { var dropEventFuncCopyPos = function(newX,newY) { @@ -165,7 +165,8 @@ function GridView(gridModel) { }).bind(this, sample)); } - var labelContainer = $("<div>", { class: "storageBox", id : Util.guid() }).text(labels[i].displayName); + var storageBoxId = this._gridModel.gridId + "-" + posX + "-" + posY + "-storage-box"; + var labelContainer = $("<div>", { class: "storageBox", id : storageBoxId }).text(labels[i].displayName); if (sample) { var tooltip = PrintUtil.getTable(sample, false, optSampleTitle, 'inspectorWhiteFont', 'colorEncodedWellAnnotations-holder-' + sample.permId, null, null); labelContainer.tooltipster({ diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageController.js index 94376a71ae74270028b5a2127a849bddc970db0b..096b3a0da3a8508d128e4697fe542ca2da3cdec5 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageController.js @@ -23,8 +23,8 @@ function StorageController(configOverride) { //Dependent widgets - this._gridController = new GridController(this._storageModel.config.rackPositionMultiple === "on", this._storageModel.config.rackBoxDragAndDropEnabled === "on"); - this._gridControllerPosition = new GridController(this._storageModel.config.boxPositionMultiple === "on", this._storageModel.config.positionDragAndDropEnabled === "on"); + this._gridController = new GridController(this._storageModel.config.rackPositionMultiple === "on", this._storageModel.config.rackBoxDragAndDropEnabled === "on", this._storageModel.config.storageId); + this._gridControllerPosition = new GridController(this._storageModel.config.boxPositionMultiple === "on", this._storageModel.config.positionDragAndDropEnabled === "on", this._storageModel.config.storageId); this._storageView = new StorageView(this, this._storageModel, this._gridController.getView(), this._gridControllerPosition.getView()); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageModel.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageModel.js index e0fa2eb0ce8eb552cb77a061c89668a4d6329a7a..ef24b32ed19a941ec51f138d4a2538ba7c85e387 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageModel.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageModel.js @@ -32,7 +32,8 @@ function StorageModel(configOverride) { positionSelector: "off", positionDropEventHandler: null, boxPositionMultiple: "off", - positionDragAndDropEnabled: "off" + positionDragAndDropEnabled: "off", + storageId : "storage-drop-down-id" }; } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js index ad62b8918338d985d680f56b52b34402c862a35d..3c266f0e014811c0a9c87d7a9d1f25e3e4b3e2ff 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/StorageView.js @@ -30,7 +30,7 @@ function StorageView(storageController, storageModel, gridViewRack, gridViewPosi this.repaint = function($container, callbackFunction) { var _this = this; - FormUtil.getDefaultStoragesDropDown("storage-drop-down-id", false, function($storagesDropdownComponent) { + FormUtil.getDefaultStoragesDropDown(_this._storageModel.config.storageId, false, function($storagesDropdownComponent) { _this._defaultStoragesDropDown = $storagesDropdownComponent; //