diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/initializemasterdataminimum.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/initializemasterdataminimum.py index 60ab051d86cb87e62ffe5a273b48a8bb053dcb7b..fb994bab596049d948d04ab2c2d36636a74fe4d9 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/initializemasterdataminimum.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/initializemasterdataminimum.py @@ -67,19 +67,19 @@ def initBasicMasterData(tr): ## ## Ordering System ## -# elnTypes.createProperty(tr, "QUANTITY_OF_ITEMS", DataType.INTEGER, "Quantity", "", None); -# -# elnTypes.createVocabularyWithTerms(tr, elnTypes.LANGUAGE); -# elnTypes.createVocabularyWithTerms(tr, elnTypes.CURRENCY); -# elnTypes.createVocabularyWithTerms(tr, elnTypes.PREFERRED_ORDER_METHOD); -# elnTypes.createVocabularyWithTerms(tr, elnTypes.ORDER_STATUS); -# -# elnTypes.createExperimentTypeWithProperties(tr, elnTypes.STOCK); -# -# elnTypes.createSampleTypeWithProperties(tr, elnTypes.SUPPLIER); -# elnTypes.createSampleTypeWithProperties(tr, elnTypes.PRODUCT); -# elnTypes.createSampleTypeWithProperties(tr, elnTypes.REQUEST); -# elnTypes.createSampleTypeWithProperties(tr, elnTypes.ORDER); + elnTypes.createProperty(tr, "QUANTITY_OF_ITEMS", DataType.INTEGER, "Quantity", "", None); + + elnTypes.createVocabularyWithTerms(tr, elnTypes.LANGUAGE); + elnTypes.createVocabularyWithTerms(tr, elnTypes.CURRENCY); + elnTypes.createVocabularyWithTerms(tr, elnTypes.PREFERRED_ORDER_METHOD); + elnTypes.createVocabularyWithTerms(tr, elnTypes.ORDER_STATUS); + + elnTypes.createExperimentTypeWithProperties(tr, elnTypes.STOCK); + + elnTypes.createSampleTypeWithProperties(tr, elnTypes.SUPPLIER); + elnTypes.createSampleTypeWithProperties(tr, elnTypes.PRODUCT); + elnTypes.createSampleTypeWithProperties(tr, elnTypes.REQUEST); + elnTypes.createSampleTypeWithProperties(tr, elnTypes.ORDER); # This script can be executed alone or included into a longer master data script. # on the second case, service doesn't exist and will not execute if the initBasicMasterData is not called diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html index ae6e900431d4919eea046fa5db5320825aaf255b..64d9382f5ba3397d9993480ffeb1bd474ae679eb 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html @@ -218,6 +218,10 @@ <script type="text/javascript" src="./js/views/Inventory/InventoryController.js"></script> <script type="text/javascript" src="./js/views/Inventory/InventoryModel.js"></script> <script type="text/javascript" src="./js/views/Inventory/InventoryView.js"></script> + + <script type="text/javascript" src="./js/views/Stock/StockController.js"></script> + <script type="text/javascript" src="./js/views/Stock/StockModel.js"></script> + <script type="text/javascript" src="./js/views/Stock/StockView.js"></script> <script type="text/javascript" src="./js/views/UserProfile/UserProfileController.js"></script> <script type="text/javascript" src="./js/views/UserProfile/UserProfileModel.js"></script> 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 7a55073cc21af3aa931a9260fcfc77f17fc23a57..fd748a4ebcba9480d3ded7bd17c619c02bed2ade 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 @@ -39,6 +39,7 @@ $.extend(DefaultProfile.prototype, { this.mainMenu = { showLabNotebook : true, showInventory : true, + showStock : true, showOrders : true, // showDrawingBoard : false, showObjectBrowser : true, @@ -128,8 +129,8 @@ $.extend(DefaultProfile.prototype, { } this.searchDomains = [ { "@id" : -1, "@type" : "GobalSearch", label : "Global", name : "global"}]; - this.inventorySpaces = ["MATERIALS", "METHODS", "STORAGE"]; //"STOCK_CATALOG" - this.inventorySpacesReadOnly = ["ELN_SETTINGS"]; //"STOCK_ORDERS" + this.inventorySpaces = ["MATERIALS", "METHODS", "STORAGE", "STOCK_CATALOG"]; + this.inventorySpacesReadOnly = ["ELN_SETTINGS", "STOCK_ORDERS"]; this.sampleTypeProtocols = ["GENERAL_PROTOCOL", "PCR_PROTOCOL", "WESTERN_BLOTTING_PROTOCOL"]; this.sampleTypeStorageEnabled = ["ANTIBODY", "BACTERIA", "CHEMICAL", "ENZYME", "CELL_LINE", "FLY", "MEDIA", "OLIGO", "PLASMID", "YEAST", "SOLUTION_BUFFER", "RNA"]; this.searchSamplesUsingV3OnDropbox = 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 6bf1817b361dc051a2c3f493e2d146090739a4ea..e8a4a0449357a11a5c5f988c41c1b58e0247e83e 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 @@ -319,6 +319,13 @@ function MainController(profile) { document.title = "Main Menu"; this._showBlancPage(); break; + case "showStockPage": + document.title = "Stock"; + var newView = new StockController(this); + var views = this._getNewViewModel(true, true, false); + newView.init(views); + this.currentView = newView; + break; case "showSearchPage": document.title = "Search"; var cleanText = decodeURIComponent(arg); //If the JSON is written on the URL we need to clean special chars 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 80aa1d94ba5c27dd49a98f7cd529f528ed1dc351..9f0c5998c8ce9c7a699123ab91630b4c41314939 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,7 +40,7 @@ function InventoryView(inventoryController, inventoryView) { var labSpaces = []; for (var i = 0; i < spaces.length; i++) { var space = spaces[i]; - if(profile.isInventorySpace(space.code)) { + 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 }); } } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetView.js index 1e537b97759fefe89587a57b1fa13457b291a9d6..b84a8b2e671872e8b1b47aa4119f45dca05cc823 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetView.js @@ -161,6 +161,11 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) { treeModel.push({ title : inventoryLink, entityType: "INVENTORY", key : "INVENTORY", folder : true, lazy : true, view : "showInventoryPage" }); } + if(profile.mainMenu.showStock) { + var inventoryLink = _this.getLinkForNode("Stock", "STOCK", "showOrdersPage", null); + treeModel.push({ title : inventoryLink, entityType: "STOCK", key : "STOCK", folder : true, lazy : true, view : "showStockPage", icon: "fa fa-shopping-cart" }); + } + var treeModelUtils = []; if(profile.mainMenu.showUserProfile) { @@ -298,15 +303,32 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) { var spaceLink = _this.getLinkForNode(normalizedSpaceTitle, space.getCode(), "showSpacePage", space.getCode()); var spaceNode = { title : spaceLink, entityType: "SPACE", key : space.getCode(), folder : true, lazy : true, view : "showSpacePage", viewData: space.getCode() }; - if(space.getCode() === "STOCK_CATALOG" || space.getCode() === "STOCK_ORDERS") { - spaceNode.icon = "fa fa-shopping-cart"; + if(space.getCode() !== "STOCK_CATALOG" && space.getCode() !== "STOCK_ORDERS") { + results.push(spaceNode); } - results.push(spaceNode); } } dfd.resolve(results); }); break; + case "STOCK": + var spaceRules = { entityKind : "SPACE", logicalOperator : "AND", rules : { } }; + mainController.serverFacade.searchForSpacesAdvanced(spaceRules, null, function(searchResult) { + var results = []; + var spaces = searchResult.objects; + for (var i = 0; i < spaces.length; i++) { + var space = spaces[i]; + if(space.getCode() === "STOCK_CATALOG" || space.getCode() === "STOCK_ORDERS") { + var normalizedSpaceTitle = Util.getDisplayNameFromCode(space.code); + var spaceLink = _this.getLinkForNode(normalizedSpaceTitle, space.getCode(), "showSpacePage", space.getCode()); + var spaceNode = { title : spaceLink, entityType: "SPACE", key : space.getCode(), folder : true, lazy : true, view : "showSpacePage", viewData: space.getCode() }; + spaceNode.icon = "fa fa-shopping-cart"; + results.push(spaceNode); + } + } + dfd.resolve(results); + }); + break; case "SPACE": var projectRules = { "UUIDv4" : { type : "Attribute", name : "SPACE", value : permId } }; mainController.serverFacade.searchForProjectsAdvanced({ entityKind : "PROJECT", logicalOperator : "AND", rules : projectRules }, null, function(searchResult) { @@ -546,5 +568,9 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) { }) }); } + var stock = $tree.fancytree("getTree").getNodeByKey("STOCK"); + if (stock) { + stock.setExpanded(true); + } } } \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Stock/StockController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Stock/StockController.js new file mode 100644 index 0000000000000000000000000000000000000000..95cfea1306b4f4709aa777319bafab433e0eaba8 --- /dev/null +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Stock/StockController.js @@ -0,0 +1,25 @@ +/* + * Copyright 2016 ETH Zuerich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function StockController(parentController) { + var parentController = parentController; + var stockModel = new StockModel(); + var stockView = new StockView(this, stockModel); + + this.init = function(views) { + stockView.repaint(views); + } +} \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Stock/StockModel.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Stock/StockModel.js new file mode 100644 index 0000000000000000000000000000000000000000..1d681b159c65da2e2265aaa7d3e32ee4a10fd5f1 --- /dev/null +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Stock/StockModel.js @@ -0,0 +1,18 @@ +/* + * Copyright 2016 ETH Zuerich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function StockModel() { +} \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Stock/StockView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Stock/StockView.js new file mode 100644 index 0000000000000000000000000000000000000000..ecea2ecb66ea5e48c79f80696e849ab11f1c9bb8 --- /dev/null +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/Stock/StockView.js @@ -0,0 +1,64 @@ +/* + * Copyright 2016 ETH Zuerich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function StockView(stockController, stockView) { + var stockController = stockController; + var stockView = stockView; + + this.repaint = function(views) { + + var $form = $("<div>"); + var $formColumn = $("<div>"); + + $form.append($formColumn); + + var $formTitle = $("<h2>").append("Stock"); + + // + // Toolbar + // + var toolbarModel = []; + + var $export = FormUtil.getButtonWithIcon("glyphicon-export", function() { + Util.blockUI(); + var facade = mainController.serverFacade; + facade.listSpacesWithProjectsAndRoleAssignments(null, function(dataWithSpacesAndProjects) { + var spaces = dataWithSpacesAndProjects.result; + var stockSpaces = []; + for (var i = 0; i < spaces.length; i++) { + var space = spaces[i]; + if(space.code === "STOCK_CATALOG" || space.code === "STOCK_ORDERS") { + stockSpaces.push({ type: "SPACE", permId : space.code, expand : true }); + } + } + + facade.exportAll(stockSpaces, true, function(error, result) { + if(error) { + Util.showError(error); + } else { + Util.showSuccess("Export is being processed, you will receive an email when is ready, if you logout the process will stop.", function() { Util.unblockUI(); }); + } + }); + + }); + }); + toolbarModel.push({ component : $export, tooltip: "Export" }); + + views.header.append($formTitle); + views.header.append(FormUtil.getToolbar(toolbarModel)); + views.content.append($formColumn); + } +} \ No newline at end of file