Skip to content
Snippets Groups Projects
Commit 7ef7ceb4 authored by Juan Fuentes's avatar Juan Fuentes
Browse files

SSDM-11855 : Only move to storages from the same group (same space)

parent 7c5f9844
No related branches found
No related tags found
No related merge requests found
......@@ -232,15 +232,29 @@ function StorageListView(storageListController, storageListModel) {
var storageContainer = $("#storage-pop-up-container");
storageController.getView().repaint(storageContainer, function() {
storageContainer.append(containerButtons);
if(!sampleChild.newSampleJustCreated) { //Restrict storages to the ones the created group
var storageToDropdown = storageController.getView().getStoragesDropdown();
var selectedSpace = IdentifierUtil.getSpaceCodeFromIdentifier(sampleChild.identifier);
// Show/hide storages from Storage To based on the one from the sample
for(var sIdx = 0; sIdx < storageToDropdown[0].childNodes.length; sIdx++) {
var spaceCode = storageToDropdown[0].childNodes[sIdx].attributes.spaceCode;
var show = spaceCode && spaceCode.value === selectedSpace;
storageToDropdown[0].childNodes[sIdx].disabled = !show;
}
}
$("#storage-accept").on("click", function(event) {
storageController.isValid(function(isValid) {
if(isValid) {
// 1. Find the Space of the selected storage
var spaceCode = storageController.getModel().storageConfig.spaceCode;
// 2. Update the Space the sample belongs to and with that the storage
sampleChild.identifier = IdentifierUtil.getSampleIdentifier(spaceCode, null, sampleChild.code);
delete sampleChild.newSampleJustCreated;
// 2. Set the Space the sample belongs to and with that the storage
if(sampleChild.newSampleJustCreated) {
sampleChild.identifier = IdentifierUtil.getSampleIdentifier(spaceCode, null, sampleChild.code);
delete sampleChild.newSampleJustCreated;
} else {
// On update the identifier should be set, fail if not
}
Util.unblockUI();
_this._dataGrid.refresh();
}
......
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