diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/ELNDictionary.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/ELNDictionary.js index a6031495ca185131cacc0def43cf84e2f16c3a0e..d9431aae0189e7706e45c89e135ede80b1ac97dd 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/ELNDictionary.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/ELNDictionary.js @@ -46,7 +46,7 @@ ELNDictionary.settingsView = { }, inventorySpaces : { title : "Inventory Spaces", - info : "By default all new spaces created in openBIS are shown under the Lab Notebook in the main menu. Spaces listed here are shown under the Inventory.", + info : "By default all new spaces created in openBIS are shown under the Lab Notebook in the main menu. Spaces ending with postfixes listed here are shown under the Inventory.", }, dataSetTypeForFileName : { title : "Dataset types for filenames", @@ -54,7 +54,7 @@ ELNDictionary.settingsView = { }, sampleTypeDefinitionsExtension : { title : ELNDictionary.Sample +" Type definitions Extension", - info : "This section is used to extend the common openBIS definitions to: 1. Enable the storage. 2. Specify if the object type is a protocol. 3. Add intended parent/children hints. 4. Support annotations for these links using properties.", + info : "This section is used to extend the common openBIS definitions to: 1. Enable the storage. 2. Specify if the object type is a protocol. 3. Add intended parent/children hints. 4. Support annotations for these links using properties. 5. Show in dropdowns.", }, } } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js index b47239423dd824d9cf416d133be1362132615cf0..cd48ebacf0bef302feb08414cd4d50222653da28 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/Profile.js @@ -168,7 +168,18 @@ $.extend(DefaultProfile.prototype, { } this.isInventorySpace = function(spaceCode) { - return ($.inArray(spaceCode, this.inventorySpaces) !== -1) || ($.inArray(spaceCode, this.inventorySpacesReadOnly) !== -1); + for(var iIdx = 0; iIdx < this.inventorySpaces.length; iIdx++) { + if(spaceCode.endsWith(this.inventorySpaces[iIdx])) { + return true; + } + } + for(var iIdx = 0; iIdx < this.inventorySpacesReadOnly.length; iIdx++) { + if(spaceCode.endsWith(this.inventorySpacesReadOnly[iIdx])) { + return true; + } + } + + return false; } this.isFileAuthenticationService = false; diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js index 00229d926a19791d18292bbf9face605f400cd90..9ba3f9492877034a08b5dd51a74f71ee1ed49e22 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js @@ -311,11 +311,11 @@ function MainController(profile) { break; case "showSettingsPage": document.title = "Settings"; - this._showSettingsPage(FormMode.VIEW); + this._showSettingsPage(FormMode.VIEW, arg); break; case "showEditSettingsPage": document.title = "Edit Settings"; - this._showSettingsPage(FormMode.EDIT); + this._showSettingsPage(FormMode.EDIT, arg); break; case "showExportTreePage": document.title = "Export Builder"; @@ -802,18 +802,61 @@ function MainController(profile) { this.currentView = newView; } - this._showSettingsPage = function(mode) { - var _this = this; - this.serverFacade.searchSamples({ "sampleIdentifier" : "/ELN_SETTINGS/GENERAL_ELN_SETTINGS", "withProperties" : true }, function(data) { - if(!data[0]) { - window.alert("Settings sample doesn't exist, settings can't be edited, this is not supposed to happen, contact your admin."); + this._showSettingsPage = function(mode, sampleIdentifier) { + if(!sampleIdentifier) { + this._selectSettings(); + } else { + var _this = this; + this.serverFacade.searchSamples({ "sampleIdentifier" : sampleIdentifier, "withProperties" : true }, function(data) { + if(!data[0]) { + window.alert("Settings object doesn't exist, settings can't be edited, this is not supposed to happen, contact your admin."); + } else { + var newView = new SettingsFormController(_this, data[0], mode); + var views = _this._getNewViewModel(true, true, false); + newView.init(views); + _this.currentView = newView; + } + }); + } + } + + this._selectSettings = function() { + this.serverFacade.searchSamples({ "sampleTypeCode" : "GENERAL_ELN_SETTINGS", + "withProperties" : false }, (function(settingsObjects) { + if(settingsObjects && settingsObjects.length > 0) { + settingsObjects.sort(function(a, b) { + if(a.identifier === "/ELN_SETTINGS/GENERAL_ELN_SETTINGS") { // Global settings are first on the list + return 1; + } else { + return -1; + } + }); + + var settingsForDropdown = []; + for(var sIdx = 0; sIdx < settingsObjects.length; sIdx++) { + settingsForDropdown.push({ label: settingsObjects[sIdx].identifier, value: settingsObjects[sIdx].identifier}) + } + + var $dropdown = FormUtil.getDropdown(settingsForDropdown, "Select settigs"); + $dropdown.attr("id", "settingsDropdown"); + Util.blockUI("Select settings: <br><br>" + $dropdown[0].outerHTML + "<br> or <a class='btn btn-default' id='settingsDropdownCancel'>Cancel</a>"); + + $("#settingsDropdown").on("change", function(event) { + var sampleIdentifier = $("#settingsDropdown")[0].value; + Util.unblockUI(); + mainController.changeView("showSettingsPage", sampleIdentifier); + }); + + $("#settingsDropdownCancel").on("click", function(event) { + Util.unblockUI(); + }); + } else { - var newView = new SettingsFormController(_this, data[0], mode); - var views = _this._getNewViewModel(true, true, false); - newView.init(views); - _this.currentView = newView; + window.alert("Settings object doesn't exist, settings can't be edited, this is not supposed to happen, contact your admin."); } - }); + }).bind(this)) + + } this._showStorageManager = function() { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Inventory/InventoryView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Inventory/InventoryView.js index 9f0c5998c8ce9c7a699123ab91630b4c41314939..55dc883461fb9efe0766aab3a6308c0e3a4b9847 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Inventory/InventoryView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Inventory/InventoryView.js @@ -40,8 +40,8 @@ function InventoryView(inventoryController, inventoryView) { var labSpaces = []; for (var i = 0; i < spaces.length; i++) { var space = spaces[i]; - if(profile.isInventorySpace(space.code) && space.code !== "STOCK_CATALOG" && space.code !== "STOCK_ORDERS" && space.code !== "ELN_SETTINGS") { - labSpaces.push({ type: "SPACE", permId : space.code, expand : true }); + if(profile.isInventorySpace(space.code) && !space.code.endsWith("STOCK_CATALOG") && !space.code.endsWith("STOCK_ORDERS") && !space.code.endsWith("ELN_SETTINGS")) { + labSpaces.push({ type: "SPACE", permId : space.code, expand : true }); } } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormController.js index 3015e629d9cfdc2a6dc526b30de5a0b1fa9feaed..fce3682ddc92eb14801cfcc3ae62cae7b95df31d 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormController.js @@ -35,7 +35,7 @@ function SettingsFormController(mainController, settingsSample, mode) { this.save = function(settings) { this._settingsManager.validateAndsave(this._settingsFormModel.settingsSample, settings, (function() { - this._mainController.changeView("showSettingsPage"); + this._mainController.changeView("showSettingsPage", this._settingsFormModel.settingsSample.identifier); }).bind(this)); } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js index bfbc46d129e264a9a5e61e59a7651abc634578c9..4859aa4f9ee63347efff6d1b60e25d8c977d24ee 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SettingsForm/SettingsFormView.js @@ -29,7 +29,7 @@ function SettingsFormView(settingsFormController, settingsFormModel) { this._sampleTypeDefinitionsHintsTableModels = {}; // key: sample type; value: table model this.repaint = function(views, profileToEdit) { - + var _this = this; this._profileToEdit = profileToEdit; var $container = views.content; @@ -53,7 +53,7 @@ function SettingsFormView(settingsFormController, settingsFormModel) { if(this._settingsFormModel.mode === FormMode.VIEW) { //Edit var $editButton = FormUtil.getButtonWithIcon("glyphicon-edit", function () { - mainController.changeView("showEditSettingsPage"); + mainController.changeView("showEditSettingsPage", _this._settingsFormModel.settingsSample.identifier); }); toolbarModel.push({ component : $editButton, tooltip: "Edit" }); } else { //Create and Edit