diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/MoveSampleController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/MoveSampleController.js index bce188a53904f2f303017b11dc6d3134d2d3213d..1f3f0e4fb830c64bfe6613510986465c629e235c 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/MoveSampleController.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/widgets/MoveSampleController.js @@ -48,7 +48,17 @@ function MoveSampleController(samplePermId, successAction) { this._moveSampleModel.experimentIdentifier, this._moveSampleModel.experimentType, function(isOK) { if(isOK) { - Util.showSuccess("Sample " + _this._moveSampleModel.sample.identifier + " moved to " + _this._moveSampleModel.experimentIdentifier, function() { Util.unblockUI(); if(_this._moveSampleModel.successAction) { _this._moveSampleModel.successAction(); } }); + Util.showSuccess("Sample " + _this._moveSampleModel.sample.identifier + " moved to " + _this._moveSampleModel.experimentIdentifier, function() { + Util.unblockUI(); + if(_this._moveSampleModel.successAction) { + //Delete Sample from current experiment menu + mainController.sideMenu.deleteUniqueIdAndMoveToParent(_this._moveSampleModel.sample.identifier, true); + //Refresh Experiment where sample was moved + mainController.sideMenu.refreshSubExperiment(_this._moveSampleModel.experimentIdentifier); + + _this._moveSampleModel.successAction(); + } + }); } else { Util.showError("Sample " + _this._moveSampleModel.sample.identifier + " failed " + _this._moveSampleModel.experimentIdentifier, function() {}); } diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetController.js index b6c4fc6378ff5aaa4530a3dcda060a3078642ff6..d76ecca94974aff6d91eefcae2c889ee1650c442 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetController.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetController.js @@ -30,7 +30,7 @@ function SideMenuWidgetController(mainController) { // External API for real time updates // - this.deleteUniqueIdAndMoveToParent = function(uniqueId) { + this.deleteUniqueIdAndMoveToParent = function(uniqueId, notMoveToParent) { var itemsToCheck = [this._sideMenuWidgetModel.menuStructure]; var currentItem = null; while(currentItem = itemsToCheck.shift()) { @@ -39,8 +39,11 @@ function SideMenuWidgetController(mainController) { var currentItemChild = currentItem.newMenuIfSelected.children[i]; if(currentItemChild.uniqueId === uniqueId) { currentItem.newMenuIfSelected.children.splice(i,1); - mainController.changeView(currentItem.newViewIfSelected, currentItem.newViewIfSelectedData); - this._sideMenuWidgetModel.pointerToMenuNode = currentItem; + if(!notMoveToParent) { + mainController.changeView(currentItem.newViewIfSelected, currentItem.newViewIfSelectedData); + this._sideMenuWidgetModel.pointerToMenuNode = currentItem; + } + this._sideMenuWidgetView.repaint(); return; }