diff --git a/installation/resource/installer/bin/restore-config-from-backup.sh b/installation/resource/installer/bin/restore-config-from-backup.sh index 0f3b651a728f2b12bc87e3e905f319c3a8687654..db665da4e9e82ce73416b327f1ddd935fe6d2668 100755 --- a/installation/resource/installer/bin/restore-config-from-backup.sh +++ b/installation/resource/installer/bin/restore-config-from-backup.sh @@ -45,6 +45,7 @@ if [ -d $ROOT/openBIS-server ]; then copyConfig $CONF/core-plugins "html/etc$" $ROOT/core-plugins copyFolderIfExists $CONF/start.d $ROOT/openBIS-server/jetty/start.d + copyFolderIfExists $CONF/../openBIS-server/jetty/indices $ROOT/openBIS-server/jetty/indices fi # -- DSS 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 fd572d224fd285a552e935d30376e0d664c97bdc..2ab4398fbc07ecb634560b74312915b744522ed0 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 @@ -215,7 +215,7 @@ $.extend(DefaultProfile.prototype, { // this.jupyterIntegrationServerEndpoint = "https://bs-openbis-sis-dev.ethz.ch:8002"; // this.jupyterEndpoint = "https://bs-openbis-sis-dev.ethz.ch:8000/"; - this.systemProperties = ["$ANNOTATIONS_STATE", "$FREEFORM_TABLE_STATE"]; + this.systemProperties = ["$ANNOTATIONS_STATE", "FREEFORM_TABLE_STATE"]; this.forcedDisableRTF = []; this.forceMonospaceFont = []; this.imageViewerDataSetCodes = []; diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/SettingsManager.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/SettingsManager.js index ee84c275dfa6cdc722e8710c99f6c9b1a01787fa..0132e137bf2d5cd5cf59334d303bce0c04e5a2e1 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/SettingsManager.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/config/SettingsManager.js @@ -140,11 +140,6 @@ function SettingsManager(serverFacade) { if(!settings.sampleTypeDefinitionsExtension[sampleTypeCode].SHOW) { targetProfile.hideTypes["sampleTypeCodes"].push(sampleTypeCode); } - - // Show on navigation by default - if(targetProfile.sampleTypeDefinitionsExtension[sampleTypeCode]["SHOW_ON_NAV"] === undefined) { - targetProfile.sampleTypeDefinitionsExtension[sampleTypeCode]["SHOW_ON_NAV"] = true; - } } } 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 71cd78f2124619b078ec63e4a49d35aa6eb8a409..a0848120b09948e965b8f2e83b8526bdc6e9c43e 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 @@ -599,7 +599,7 @@ function MainController(profile) { var argsMap = JSON.parse(cleanText); var sampleTypeCode = argsMap["sampleTypeCode"]; var experimentIdentifier = argsMap["experimentIdentifier"]; - document.title = "Create " + ELNDictionary.Sample + " " + arg; + document.title = "Create " + Util.getDisplayNameFromCode(sampleTypeCode); this._showCreateSubExperimentPage(sampleTypeCode, experimentIdentifier); //window.scrollTo(0,0); break; @@ -638,7 +638,7 @@ function MainController(profile) { if(!data[0]) { window.alert("The item is no longer available, refresh the page, if the problem persists tell your admin that the Lucene index is probably corrupted."); } else { - document.title = "" + ELNDictionary.Sample + " " + data[0].code; + document.title = "" + Util.getDisplayNameFromCode(data[0].sampleTypeCode) + " " + data[0].code; var isELNSubExperiment = $.inArray(data[0].spaceCode, _this.profile.inventorySpaces) === -1 && _this.profile.inventorySpaces.length > 0; _this._showEditSamplePage(data[0], isELNSubExperiment, paginationInfo); //window.scrollTo(0,0); @@ -660,7 +660,7 @@ function MainController(profile) { if(!data[0]) { window.alert("The item is no longer available, refresh the page, if the problem persists tell your admin that the Lucene index is probably corrupted."); } else { - document.title = "" + ELNDictionary.Sample + " " + data[0].code; + document.title = "" + Util.getDisplayNameFromCode(data[0].sampleTypeCode) + " " + data[0].code; var isELNSubExperiment = $.inArray(data[0].spaceCode, _this.profile.inventorySpaces) === -1 && _this.profile.inventorySpaces.length > 0; _this._showViewSamplePage(data[0], isELNSubExperiment, paginationInfo); //window.scrollTo(0,0); @@ -682,7 +682,7 @@ function MainController(profile) { if(!data[0]) { window.alert("The item is no longer available, refresh the page, if the problem persists tell your admin that the Lucene index is probably corrupted."); } else { - document.title = "" + ELNDictionary.Sample + " " + data[0].code; + document.title = "" + Util.getDisplayNameFromCode(data[0].sampleTypeCode) + " " + data[0].code; var isELNSubExperiment = $.inArray(data[0].spaceCode, _this.profile.inventorySpaces) === -1&& _this.profile.inventorySpaces.length > 0; _this._showViewSamplePage(data[0], isELNSubExperiment, paginationInfo); //window.scrollTo(0,0); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js index 42cbc42728a7a1d64e13dbd477000880080d94a2..1990d21e8ea47a29f311a7346edda6dca5aeca40 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js @@ -1311,6 +1311,9 @@ function ServerFacade(openbisServer) { if(advancedFetchOptions.withParentsType) { parentFetchOptions.withType(); } + if (advancedFetchOptions.withParentsExperiment) { + parentFetchOptions.withExperiment(); + } } if(advancedFetchOptions.withChildren) { var childrenFetchOptions = fetchOptions.withChildren(); @@ -1318,8 +1321,11 @@ function ServerFacade(openbisServer) { childrenFetchOptions.withType(); } if(advancedFetchOptions.withChildrenProperties) { - childrenFetchOptions.withProperties(); - } + childrenFetchOptions.withProperties(); + } + if (advancedFetchOptions.withChildrenExperiment) { + childrenFetchOptions.withExperiment(); + } } if(advancedFetchOptions.withAncestors) { var ancestorsFetchOptions = fetchOptions.withParents(); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/AdminTests.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/AdminTests.js index b9ef1e42f4615e02436a204b9185fbdc3392ff46..5d07c73be797f5198196883ba2ac8bf0c8f89aa8 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/AdminTests.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/AdminTests.js @@ -86,8 +86,6 @@ var AdminTests = new function() { testChain = Promise.resolve(); testChain.then(() => e.waitForId("USER_MANAGER")) .then(() => e.click("USER_MANAGER")) - .then(() => e.waitForId("optionsMenu")) - .then(() => e.click("optionsMenu")) .then(() => e.waitForId("createUser")) .then(() => e.click("createUser")) .then(() => e.waitForId("userId")) diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/TestUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/TestUtil.js index 98f64900e7071964300504d7138146564ab02df8..535d2266442e29799d0780b4122e4914a6eba77c 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/TestUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/TestUtil.js @@ -56,10 +56,10 @@ var TestUtil = new function() { xhr.responseType = 'blob'; xhr.onload = function(e) { - if (this.status == 200) { + if (this.status == 200) { // get binary data as a response action(this.response); - } + } }; xhr.send(); @@ -85,7 +85,7 @@ var TestUtil = new function() { throw "CKEditor #" + elementId + " should be equal " + data; } } catch(error) { - reject(); + reject(error); } }); } 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 aa8dde9adbb4b384aaf6f013338d606aa6b36b09..1fc3a681305149d2be49806f5c055bc6d000b10e 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 @@ -16,6 +16,24 @@ var UserTests = new function() { .then(() => this.storageTest()) //16. Storage Manager - Moving Box .then(() => this.movingBoxTest()) + //17. Storage Manager - Moving Sample + .then(() => this.movingSampleTest()) + //18. Create Protocol + .then(() => this.createProtocol()) + //19. Project Form - Create/Update + .then(() => this.createProject()) + //20. Experiment Form - Create/Update + .then(() => this.createExperiment()) + //21. Experiment Step Form - Create/Update + .then(() => this.createExperimentStep()) + //22. is now disabled + //23. Experiment Step Form - Dataset Uploader and Viewer + .then(() => this.datasetUploader()) + //24. Experiment Step Form - Children Generator (not exist) + //25. Project Form - Show in project overview + .then(() => this.showInProjectOverview()) + //26. Search + .then(() => this.search()) .catch(error => { console.log(error) }); } @@ -66,36 +84,48 @@ var UserTests = new function() { this.createBacteria = function(code, name) { return new Promise(function executor(resolve, reject) { var e = EventUtil; + var testChain = Promise.resolve(); var richText = '<p><span style="color:#000080;"><strong>F- tonA21 thi-1 thr-1 leuB6 lacY1</strong></span><strong> </strong><span style="color:#008000;"><i><strong>glnV44 rfbC1 fhuA1 ?? mcrB e14-(mcrA-)</strong></i></span><i><strong> </strong></i><span style="color:#cc99ff;"><strong><u>hsdR(rK -mK +) λ-</u></strong></span></p>'; - Promise.resolve().then(() => e.waitForId("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) - .then(() => e.click("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) - .then(() => e.waitForId("create-btn")) - .then(() => e.click("create-btn")) - .then(() => e.waitForId("sampleFormTitle")) - .then(() => e.equalTo("sampleFormTitle", "Create Object Bacteria", true, false)) - .then(() => e.waitForId("codeId")) - .then(() => e.waitForFill("codeId")) - .then(() => e.equalTo("codeId", code, true, false)) - .then(() => e.waitForId("NAME")) - .then(() => e.change("NAME", name, false)) - //Paste from Word - .then(() => TestUtil.ckeditorSetData("BACTERIA.GENOTYPE", richText)) - .then(() => e.waitForId("save-btn")) - .then(() => e.click("save-btn")) - //Check saving results - .then(() => e.waitForId("edit-btn")) - .then(() => e.waitForId("NAME")) - .then(() => e.equalTo("NAME", name, true, false)) - .then(() => TestUtil.ckeditorTestData("BACTERIA.GENOTYPE", richText)) - .then(() => resolve()); + testChain.then(() => e.waitForId("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) + .then(() => e.click("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) + .then(() => e.waitForId("create-btn")) + .then(() => e.click("create-btn")) + .then(() => e.waitForId("sampleFormTitle")) + .then(() => e.equalTo("sampleFormTitle", "New Bacteria", true, false)); + + if (code === "BAC1") { + // Show Code + testChain.then(() => e.waitForId("options-menu-btn-sample-view-bacteria")) + .then(() => e.click("options-menu-btn-sample-view-bacteria")) + .then(() => e.waitForId("options-menu-btn-identification-info")) + .then(() => e.click("options-menu-btn-identification-info")); + } + + testChain.then(() => e.waitForId("codeId")) + .then(() => e.waitForFill("codeId")) + .then(() => e.equalTo("codeId", code, true, false)) + .then(() => e.waitForId("NAME")) + .then(() => e.change("NAME", name, false)) + //Paste from Word + .then(() => e.waitForCkeditor("BACTERIA.GENOTYPE")) + .then(() => TestUtil.ckeditorSetData("BACTERIA.GENOTYPE", richText)) + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + //Check saving results + .then(() => e.waitForId("edit-btn")) + .then(() => e.waitForId("NAME")) + .then(() => e.equalTo("NAME", name, true, false)) + .then(() => TestUtil.ckeditorTestData("BACTERIA.GENOTYPE", richText)) + .then(() => resolve()); }); } this.importsAutomaticCodes = function() { var baseURL = location.protocol + '//' + location.host + location.pathname; var pathToResource = "js/test/resources/bacteria_for_test_without_identifier.tsv"; + return new Promise(function executor(resolve, reject) { var e = EventUtil; Promise.resolve().then(() => UserTests.importBacteriasFromFile(baseURL + pathToResource)) @@ -111,6 +141,7 @@ var UserTests = new function() { this.importsGivenCodes = function() { var baseURL = location.protocol + '//' + location.host + location.pathname; var pathToResource = "js/test/resources/bacteria_for_test_with_identifier.tsv"; + return new Promise(function executor(resolve, reject) { var e = EventUtil; Promise.resolve().then(() => UserTests.importBacteriasFromFile(baseURL + pathToResource)) @@ -131,8 +162,8 @@ var UserTests = new function() { Promise.resolve().then(() => e.waitForId("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) .then(() => e.click("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) - .then(() => e.waitForId("options-menu-btn")) - .then(() => e.click("options-menu-btn")) + .then(() => e.waitForId("sample-options-menu-btn")) + .then(() => e.click("sample-options-menu-btn")) .then(() => e.waitForId("register-object-btn")) .then(() => e.click("register-object-btn")) .then(() => e.waitForId("choose-type-btn")) @@ -157,6 +188,7 @@ var UserTests = new function() { // we wait for the save-button, cause page contains add-storage-btn // even when page can't be edit. So we wait when page be reloaded. .then(() => e.waitForId("save-btn")) + .then(() => e.sleep(2000)) .then(() => e.waitForId("add-storage-btn")) .then(() => e.click("add-storage-btn")) .then(() => e.waitForId("storage-drop-down-id")) @@ -195,6 +227,320 @@ var UserTests = new function() { .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(() => e.sleep(3000)) + .then(() => resolve()); + }); + } + + this.movingSampleTest = function() { + return new Promise(function executor(resolve, reject) { + var e = EventUtil; + + 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", "BENCH", false)) + .then(() => e.waitForId("storage-drop-down-id-a-1-1")) + .then(() => e.waitForId("storage-drop-down-id-a-1-1-storage-box")) + .then(() => e.click("storage-drop-down-id-a-1-1-storage-box")) + .then(() => e.waitForId("storage-drop-down-id-a-C-2-storage-box")) + .then(() => e.dragAndDrop("storage-drop-down-id-a-C-2-storage-box", "storage-drop-down-id-a-A-3", false)) + .then(() => e.equalTo("change-log-container-id", "None", false, false)) + .then(() => e.click("save-changes-btn")) + // Open object BAC1 and verify storage. + .then(() => e.waitForId("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) + .then(() => e.click("_MATERIALS_BACTERIA_BACTERIA_COLLECTION")) + .then(() => e.waitForId("bac1-column-id")) + .then(() => e.click("bac1-column-id")) + .then(() => e.waitForId("testbox-a3-id")) + .then(() => e.equalTo("testbox-a3-id", "Test Box - A3", true, false)) + .then(() => e.sleep(3000)) + .then(() => resolve()); + }); + } + + this.createProtocol = function() { + return new Promise(function executor(resolve, reject) { + var e = EventUtil; + + Promise.resolve().then(() => e.waitForId("_METHODS_PROTOCOLS_GENERAL_PROTOCOLS")) + .then(() => e.click("_METHODS_PROTOCOLS_GENERAL_PROTOCOLS")) + .then(() => e.waitForId("create-btn")) + .then(() => e.click("create-btn")) + .then(() => e.waitForId("options-menu-btn-sample-view-general_protocol")) + .then(() => e.click("options-menu-btn-sample-view-general_protocol")) + .then(() => e.waitForId("options-menu-btn-identification-info")) + .then(() => e.click("options-menu-btn-identification-info")) + .then(() => e.waitForId("codeId")) + .then(() => e.waitForFill("codeId")) + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + .then(() => e.waitForId("edit-btn")) + .then(() => resolve()); + }); + } + + this.createProject = function() { + return new Promise(function executor(resolve, reject) { + var e = EventUtil; + + Promise.resolve().then(() => e.waitForId("TESTID")) + .then(() => e.click("TESTID")) + .then(() => e.waitForId("create-btn")) + .then(() => e.click("create-btn")) + .then(() => e.waitForId("project-code-id")) + .then(() => e.write("project-code-id", "PROJECT_101", false)) + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + .then(() => e.waitForId("edit-btn")) + .then(() => e.click("edit-btn")) + .then(() => e.waitForId("options-menu-btn-project-view")) + .then(() => e.click("options-menu-btn-project-view")) + .then(() => e.waitForId("options-menu-btn-description")) + .then(() => e.click("options-menu-btn-description")) + .then(() => e.waitForCkeditor("description-id")) + .then(() => TestUtil.ckeditorSetData("description-id", "Test Description 101")) + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + .then(() => e.waitForId("edit-btn")) + .then(() => resolve()); + }); + } + + this.createExperiment = function() { + return new Promise(function executor(resolve, reject) { + var e = EventUtil; + + var yesterday = Util.getFormatedDate(new Date(new Date().setDate(new Date().getDate() - 1))); + var tomorrow = Util.getFormatedDate(new Date(new Date().setDate(new Date().getDate() + 1))); + + Promise.resolve().then(() => e.waitForId("options-menu-btn")) + .then(() => e.click("options-menu-btn")) + // Create Default Experiment + .then(() => e.waitForId("default-experiment")) + .then(() => e.click("default-experiment")) + .then(() => e.waitForId("codeId")) + .then(() => e.waitForFill("codeId")) + // add Name + .then(() => e.waitForId("NAME")) + .then(() => e.change("NAME", "Experiment 101", false)) + // show in project overview checked + .then(() => e.waitForId("SHOW_IN_PROJECT_OVERVIEW")) + .then(() => e.checked("SHOW_IN_PROJECT_OVERVIEW", true)) + .then(() => e.change("SHOW_IN_PROJECT_OVERVIEW", true)) + // add first comment + .then(() => e.waitForId("add-comment-btn")) + .then(() => e.click("add-comment-btn")) + .then(() => e.waitForId("comment-0-box")) + .then(() => e.write("comment-0-box", "My first comment", false)) + .then(() => e.waitForId("save-comment-0-btn")) + .then(() => e.click("save-comment-0-btn")) + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + // Update date and name for Experiment + .then(() => e.waitForId("edit-btn")) + .then(() => e.click("edit-btn")) + .then(() => e.waitForId("save-btn")) + // edit name + .then(() => e.waitForId("NAME")) + .then(() => e.change("NAME", "Experiment 101 Bis", false)) + // set start date + .then(() => e.waitForId("START_DATE")) + .then(() => e.change("START_DATE", tomorrow, false)) + // set end date + .then(() => e.waitForId("END_DATE")) + .then(() => e.change("END_DATE", yesterday, false)) + // add second comment + .then(() => e.waitForId("add-comment-btn")) + .then(() => e.click("add-comment-btn")) + .then(() => e.waitForId("comment-0-box")) + .then(() => e.write("comment-0-box", "My second comment", false)) + .then(() => e.waitForId("save-comment-0-btn")) + .then(() => e.click("save-comment-0-btn")) + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + //You should see the error + .then(() => e.waitForId("jNotifyDismiss")) + .then(() => e.click("jNotifyDismiss")) + // fix the error (remove end date) and save experiment + .then(() => e.change("END_DATE", "", false)) + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + .then(() => resolve()); + }); + } + + this.createExperimentStep = function() { + return new Promise(function executor(resolve, reject) { + var e = EventUtil; + + var tomorrow = Util.getFormatedDate(new Date(new Date().setDate(new Date().getDate() + 1))); + + Promise.resolve().then(() => e.waitForId("options-menu-btn")) + .then(() => e.click("options-menu-btn")) + // add Experimental Step + .then(() => e.waitForId("experimental-step")) + .then(() => e.click("experimental-step")) + .then(() => e.waitForId("options-menu-btn-sample-view-experimental_step")) + .then(() => e.click("options-menu-btn-sample-view-experimental_step")) + .then(() => e.waitForId("codeId")) + .then(() => e.click("codeId")) + // add name + .then(() => e.waitForId("NAME")) + .then(() => e.change("NAME", "Step 101", false)) + // show in project overview checked + .then(() => e.waitForId("SHOW_IN_PROJECT_OVERVIEW")) + .then(() => e.checked("SHOW_IN_PROJECT_OVERVIEW", true)) + .then(() => e.change("SHOW_IN_PROJECT_OVERVIEW", true)) + // set start date + .then(() => e.waitForId("START_DATE")) + .then(() => e.change("START_DATE", tomorrow, false)) + // add protocol + .then(() => e.waitForId("plus-btn-general_protocol")) + .then(() => e.click("plus-btn-general_protocol")) + .then(() => e.waitForId("gen1-column-id")) + .then(() => e.click("gen1-column-id")) + // Operations + .then(() => e.waitForId("gen1-operations-column-id")) + .then(() => e.click("gen1-operations-column-id")) + .then(() => e.waitForId("gen1-operations-column-id-use-as-template")) + .then(() => e.click("gen1-operations-column-id-use-as-template")) + .then(() => e.waitForId("newSampleCodeForCopy")) + .then(() => e.write("newSampleCodeForCopy", "CODE1", false)) + .then(() => e.waitForId("copyAccept")) + .then(() => e.click("copyAccept")) + // add first comment + .then(() => e.waitForId("add-comment-btn")) + .then(() => e.click("add-comment-btn")) + .then(() => e.waitForId("comment-0-box")) + .then(() => e.write("comment-0-box", "My first comment", false)) + .then(() => e.waitForId("save-comment-0-btn")) + .then(() => e.click("save-comment-0-btn")) + .then(() => e.waitForId("code1-column-id")) + // save + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + // edit + .then(() => e.waitForId("edit-btn")) + .then(() => e.click("edit-btn")) + .then(() => e.waitForId("save-btn")) + // edit name + .then(() => e.waitForId("NAME")) + .then(() => e.change("NAME", "Step 101 Bis", false)) + // save + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + .then(() => resolve()); + }); + } + + this.datasetUploader = function() { + var baseURL = location.protocol + '//' + location.host + location.pathname; + var pathToResource = "js/test/resources/test-image.png"; + + return new Promise(function executor(resolve, reject) { + var e = EventUtil; + + Promise.resolve().then(() => e.waitForId("upload-btn")) + .then(() => e.click("upload-btn")) + // choose type + .then(() => e.waitForId("DATASET_TYPE")) + .then(() => e.changeSelect2("DATASET_TYPE", "ELN_PREVIEW", false)) + // add first comment + .then(() => e.waitForId("add-comment-btn")) + .then(() => e.click("add-comment-btn")) + .then(() => e.waitForId("comment-0-box")) + .then(() => e.write("comment-0-box", "My first comment", false)) + .then(() => e.waitForId("save-comment-0-btn")) + .then(() => e.click("save-comment-0-btn")) + // upload image + .then(() => e.dropFile("test-image.png", baseURL + pathToResource, "filedrop", false)) + .then(() => e.waitForClass("progressbar.ready")) + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + // open data set and edit it + .then(() => e.waitForId("dataSetPosInTree-0")) + .then(() => e.click("dataSetPosInTree-0")) + .then(() => e.waitForId("dataset-edit-btn")) + .then(() => e.click("dataset-edit-btn")) + .then(() => e.waitForId("save-btn")) + // change Name + .then(() => e.waitForId("NAME")) + .then(() => e.change("NAME", "New Name", false)) + .then(() => e.click("save-btn")) + .then(() => e.waitForId("dataset-edit-btn")) + .then(() => resolve()); + }); + } + + this.showInProjectOverview = function() { + return new Promise(function executor(resolve, reject) { + var e = EventUtil; + + Promise.resolve().then(() => e.waitForId("PATH_TESTID_PROJECT_101")) + .then(() => e.click("PATH_TESTID_PROJECT_101")) + // click "Show Experiments" + .then(() => e.waitForId("options-menu-btn-project-view")) + .then(() => e.waitForId("project-experiments")) + .then(() => e.waitForStyle("project-experiments", "display", "none", false)) + .then(() => e.click("options-menu-btn-project-view")) + .then(() => e.waitForId("options-menu-btn-experiments")) + .then(() => e.click("options-menu-btn-experiments")) + .then(() => e.waitForId("project-experiments")) + .then(() => e.waitForStyle("project-experiments", "display", "", false)) + // click "Show Objects" + .then(() => e.waitForId("options-menu-btn-project-view")) + .then(() => e.waitForId("project-samples")) + .then(() => e.waitForStyle("project-samples", "display", "none", false)) + .then(() => e.click("options-menu-btn-project-view")) + .then(() => e.waitForId("options-menu-btn-objects")) + .then(() => e.click("options-menu-btn-objects")) + .then(() => e.waitForId("project-samples")) + .then(() => e.waitForStyle("project-samples", "display", "", false)) + .then(() => resolve()); + }); + } + + this.search = function() { + return new Promise(function executor(resolve, reject) { + var e = EventUtil; + + Promise.resolve().then(() => e.waitForId("search")) + // start global search + .then(() => e.click("search")) + .then(() => e.change("search", "BAC5", false)) + .then(() => e.keypress("search", 13, false)) + .then(() => e.waitForId("save-btn")) + // check searching results + .then(() => e.waitForId("columns-dropdown-id")) + .then(() => e.click("columns-dropdown-id")) + .then(() => e.waitForId("code-cln")) + .then(() => e.checked("code-cln", true)) + // todo should be modified after test 10. and BAC5_BAC4 will be available + .then(() => e.waitForId("bac5-id")) + // save query + .then(() => e.waitForId("save-btn")) + .then(() => e.click("save-btn")) + .then(() => e.waitForId("Name")) + .then(() => e.write("Name", "Search for BAC5", false)) + .then(() => e.waitForId("advanced-entity-search-dropdown-id")) + .then(() => e.triggerSearchSelect2("advanced-entity-search-dropdown-id", "ba", false)) + .then(() => e.waitForId("search-query-save-btn")) + .then(() => e.click("search-query-save-btn")) + // wait for saving + .then(() => e.sleep(3000)) + // Click on BAC5 + .then(() => e.waitForId("bac5-id")) + .then(() => e.click("bac5-id")) + .then(() => e.waitForId("edit-btn")) + // Click on Advanced Search + .then(() => e.waitForId("ADVANCED_SEARCH")) + .then(() => e.click("ADVANCED_SEARCH")) + .then(() => e.waitForId("saved-search-dropdown-id")) + .then(() => e.triggerSelectSelect2("saved-search-dropdown-id", 0, false)) + .then(() => e.waitForId("search-btn")) + .then(() => e.click("search-btn")) + .then(() => e.waitForId("bac5-id")) .then(() => resolve()); }); } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/resources/test-image.png b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/resources/test-image.png new file mode 100644 index 0000000000000000000000000000000000000000..f39ca347e3721a748461bf5d8e7c185b89c00dd7 Binary files /dev/null and b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/test/resources/test-image.png differ 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 abe3051fd51783e5fba9f2a70b0d48fa7ea9c0d2..84520f191dda151db3378fc53bc12599d22de737 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 @@ -11,7 +11,7 @@ var EventUtil = new function() { element.trigger('click'); resolve(); } catch(error) { - reject(); + reject(error); } }); }; @@ -24,7 +24,55 @@ var EventUtil = new function() { element.val(value).change(); resolve(); } catch(error) { - reject(); + reject(error); + } + }); + }; + + this.changeSelect2 = function(elementId, value, ignoreError) { + return new Promise(function executor(resolve, reject) { + try { + var element = EventUtil.getElement(elementId, ignoreError, resolve); + element.select2(); + element.focus(); + element.val(value); + element.select2().trigger('change'); + resolve(); + } catch(error) { + reject(error); + } + }); + }; + + this.triggerSelectSelect2 = function(elementId, value, ignoreError) { + return new Promise(function executor(resolve, reject) { + try { + var element = EventUtil.getElement(elementId, ignoreError, resolve); + element.focus(); + element.val(value); + element.select2().trigger('select2:select'); + resolve(); + } catch(error) { + reject(error); + } + }); + }; + + this.triggerSearchSelect2 = function(elementId, value, ignoreError) { + return new Promise(function executor(resolve, reject) { + try { + var element = EventUtil.getElement(elementId, ignoreError, resolve); + element.select2('open'); + + var $search = element.data('select2').dropdown.$search || element.data('select2').selection.$search; + $search.val(value); + $search.trigger('input'); + setTimeout(function() { + $('.select2-results__option').trigger("mouseup"); + resolve(); + }, 2000); + } catch(error) { + reject(error); } }); }; @@ -37,7 +85,7 @@ var EventUtil = new function() { element.prop('checked', value); resolve(); } catch(error) { - reject(); + reject(error); } }); }; @@ -53,7 +101,7 @@ var EventUtil = new function() { throw "Element #" + elementId + " should" + (isEqual ? "" : " not") + " be equal " + value; } } catch(error) { - reject(); + reject(error); } }); }; @@ -70,11 +118,26 @@ var EventUtil = new function() { } resolve(); } catch(error) { - reject(); + reject(error); } }); }; + this.keypress = function(elementId, key, ignoreError) { + return new Promise(function executor(resolve, reject) { + try { + var element = EventUtil.getElement(elementId, ignoreError, resolve); + element.focus(); + var e = $.Event('keypress'); + e.which = key; + $(element).trigger(e); + resolve(); + } catch(error) { + reject(error); + } + }); + } + this.verifyExistence = function(elementId, isExist, ignoreError) { return new Promise(function executor(resolve, reject) { var elementExistence = $("#" + elementId).length > 0; @@ -102,6 +165,35 @@ var EventUtil = new function() { }); }; + this.waitForClass = function(className, ignoreError, timeout) { + return new Promise(function executor(resolve, reject) { + timeout = EventUtil.checkTimeout(className, timeout, ignoreError, resolve, reject); + + if($("." + className).length <= 0) { + setTimeout(executor.bind(null, resolve, reject), DEFAULT_TIMEOUT_STEP); + } else { + resolve(); + } + }); + }; + + this.waitForStyle = function(elementId, styleName, styleValue, ignoreError, timeout) { + return new Promise(function executor(resolve, reject) { + try { + timeout = EventUtil.checkTimeout(elementId, timeout, ignoreError, resolve, reject); + + var element = EventUtil.getElement(elementId, ignoreError, resolve); + if (element[0].style[styleName] === styleValue) { + resolve(); + } else { + setTimeout(executor.bind(null, resolve, reject), DEFAULT_TIMEOUT_STEP); + } + } catch(error) { + reject(error); + } + }); + } + this.waitForFill = function(elementId, ignoreError, timeout) { return new Promise(function executor(resolve, reject) { timeout = EventUtil.checkTimeout(elementId, timeout, ignoreError, resolve, reject); @@ -115,6 +207,19 @@ var EventUtil = new function() { }); }; + this.waitForCkeditor = function(id, data, timeout) { + return new Promise(function executor(resolve, reject) { + timeout = EventUtil.checkTimeout(elementId, timeout, ignoreError, resolve, reject); + editor = CKEditorManager.getEditorById(id); + + if(editor === undefined) { + setTimeout(executor.bind(null, resolve, reject), DEFAULT_TIMEOUT_STEP); + } else { + resolve(); + } + }); + } + this.checkTimeout = function(elementId, timeout, ignoreError, resolve, reject) { if (!timeout) { timeout = DEFAULT_TIMEOUT; @@ -131,6 +236,10 @@ var EventUtil = new function() { return timeout; } + this.sleep = function(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + this.dragAndDrop = function(dragId, dropId, ignoreError) { return new Promise(function executor(resolve, reject) { try { @@ -151,11 +260,32 @@ var EventUtil = new function() { dropElement.trigger(dropEvent); resolve(); } catch(error) { - reject(); + reject(error); } }); }; + this.dropFile = function(fileName, url, dropId, ignoreError) { + return new Promise(function executor(resolve, reject) { + try { + var dropElement = EventUtil.getElement(dropId, ignoreError, resolve).droppable(); + + TestUtil.fetchBytes(url, function(file) { + file.name = fileName; + + var dt = { files: [file] }; + + dropEvent = jQuery.Event("drop"); + dropEvent.originalEvent = jQuery.Event("DragEvent"); + dropEvent.originalEvent.dataTransfer = dt; + dropElement.trigger(dropEvent); + resolve(); + }); + } catch(error) { + reject(error); + } + }); + }; this.getElement = function(elementId, ignoreError, resolve) { var element = $( "#" + elementId ); @@ -168,5 +298,4 @@ var EventUtil = new function() { } return element; } - } \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js index 93a249d74d6902056773285df620888d03405be7..705c310c0e7d1f73c7602ce43a4989485a183a3e 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/FormUtil.js @@ -501,12 +501,15 @@ var FormUtil = new function() { return $btn; } - this.getButtonWithText = function(text, clickEvent, btnClass) { + this.getButtonWithText = function(text, clickEvent, btnClass, id) { var auxBtnClass = "btn-default"; if(btnClass) { auxBtnClass = btnClass; } var $pinBtn = $("<a>", { 'class' : 'btn ' + auxBtnClass }); + if(id) { + $pinBtn.attr("id", id); + } $pinBtn.append(text); $pinBtn.click(clickEvent); return $pinBtn; @@ -786,6 +789,11 @@ var FormUtil = new function() { // Form Fields // this._getBooleanField = function(id, alt, checked) { + if (id) { + if(id.charAt(0) === '$') { + id = id.substring(1); + } + } var attr = {'type' : 'checkbox', 'id' : id, 'alt' : alt, 'placeholder' : alt }; if(checked) { attr['checked'] = ''; @@ -1005,11 +1013,16 @@ var FormUtil = new function() { if(!title) { title = "More ... "; } + var id = 'options-menu-btn'; + if (namespace) { + id = id + "-" + namespace; + id = id.toLowerCase(); + } var $dropdownOptionsMenu = $("<span>", { class : 'dropdown' }); if(toolbarModel) { toolbarModel.push({ component : $dropdownOptionsMenu, tooltip: null }); } - var $dropdownOptionsMenuCaret = $("<a>", { 'href' : '#', 'data-toggle' : 'dropdown', class : 'dropdown-toggle btn btn-default', 'id' : 'options-menu-btn'}) + var $dropdownOptionsMenuCaret = $("<a>", { 'href' : '#', 'data-toggle' : 'dropdown', class : 'dropdown-toggle btn btn-default', 'id' : id}) .append(title).append($("<b>", { class : 'caret' })); var $dropdownOptionsMenuList = $("<ul>", { class : 'dropdown-menu', 'role' : 'menu' }); $dropdownOptionsMenu.append($dropdownOptionsMenuCaret); @@ -1021,7 +1034,8 @@ var FormUtil = new function() { } else { var label = option.label; var title = option.title ? option.title : label; - var $dropdownElement = $("<li>", { 'role' : 'presentation' }).append($("<a>", {'title' : title }).append(label)); + var id = title.split(" ").join("-").toLowerCase(); + var $dropdownElement = $("<li>", { 'role' : 'presentation' }).append($("<a>", {'title' : title, 'id' : id}).append(label)); $dropdownElement.click(option.action); $dropdownOptionsMenuList.append($dropdownElement); } @@ -1041,6 +1055,8 @@ var FormUtil = new function() { var sectionSetting = sectionsSettings[option.label]; if (sectionSetting !== undefined) { shown = sectionSetting === 'shown'; + } else if (option.showByDefault) { + shown = true; } else { shown = ! profile.hideSectionsByDefault; } @@ -1048,7 +1064,8 @@ var FormUtil = new function() { var $section = $(option.section); $section.toggle(shown); var $label = $("<span>").append((shown ? "Hide " : "Show ") + option.label); - var $dropdownElement = $("<li>", { 'role' : 'presentation' }).append($("<a>").append($label)); + var id = 'options-menu-btn-' + option.label.split(" ").join("-").toLowerCase(); + var $dropdownElement = $("<li>", { 'role' : 'presentation' }).append($("<a>", { 'id' : id }).append($label)); var action = function(event) { var option = event.data.option; var $label = event.data.label; @@ -1058,6 +1075,9 @@ var FormUtil = new function() { $label.text("Show " + option.label); sectionsSettings[option.label] = "hidden"; } else { + if (option.beforeShowingAction) { + option.beforeShowingAction(); + } $label.text("Hide " + option.label); sectionsSettings[option.label] = "shown"; } @@ -1158,7 +1178,9 @@ var FormUtil = new function() { entityPath.append("/").append(this.getFormLink(spaceCode, 'Space', spaceCode)); } if(projectCode) { - entityPath.append("/").append(this.getFormLink(projectCode, 'Project', IdentifierUtil.getProjectIdentifier(spaceCode, projectCode))); + var projectIdentifier = IdentifierUtil.getProjectIdentifier(spaceCode, projectCode); + var id = "PATH" + projectIdentifier.split(" ").join("-").split("/").join("_"); + entityPath.append("/").append(this.getFormLink(projectCode, 'Project', projectIdentifier, null, id)); } if(experimentCode) { entityPath.append("/").append(this.getFormLink(experimentCode, 'Experiment', IdentifierUtil.getExperimentIdentifier(spaceCode, projectCode, experimentCode))); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js index 22821e3fb66c7337c2003db056c9fda3bc952795..1c6fba5b79e9c0c96b2b6c6fc988cc19b6a269ae 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/util/PrintUtil.js @@ -66,7 +66,7 @@ var PrintUtil = new function() { var samplesListOfCodes = ""; for(var sampleTypeCode in allSamplesByType) { - samplesListOfCodes += sampleTypeCode + ": "; + samplesListOfCodes += Util.getDisplayNameFromCode(sampleTypeCode) + ": "; var samples = allSamplesByType[sampleTypeCode]; for(var i = 0; i < samples.length; i++) { var sample = samples[i]; @@ -76,13 +76,7 @@ var PrintUtil = new function() { if(sampleTypeCode === "STORAGE_POSITION") { samplesListOfCodes += Util.getStoragePositionDisplayName(sample); } else { - var name = sample.properties[profile.propertyReplacingCode]; - if(!name) { - samplesListOfCodes += sample.code; - } else { - samplesListOfCodes += sample.code + "(" + name + ")"; - } - + samplesListOfCodes += Util.getDisplayNameForEntity(sample); } } samplesListOfCodes += "</br>"; @@ -127,6 +121,7 @@ var PrintUtil = new function() { var $newInspectorTable = $("<table>", { "class" : "properties table table-condensed" }); $newInspector.append($newInspectorTable); + this._addLabelAndValue($newInspectorTable, "Code", entity.code); if(extraProperties) { for(code in extraProperties) { @@ -136,11 +131,7 @@ var PrintUtil = new function() { if(propLabel.length > 25) { propLabel = propLabel.substring(0, 23) + "..."; } - $newInspectorTable - .append($("<tr>") - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLabel"}).append(propLabel + ":"))) - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLineBreak"}).append(extraProp.value))) - ); + this._addLabelAndValue($newInspectorTable, propLabel, extraProp.value); } } @@ -197,11 +188,7 @@ var PrintUtil = new function() { .append($("<td>", { "class" : "property", "colspan" : "2" }).append($("<p>", { "class" : "inspectorLineBreak"}).append(propertyLabel + ":").append("<br>").append(propertyContent))) ); } else { - $newInspectorTable - .append($("<tr>") - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLabel"}).append(propertyLabel + ":"))) - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLineBreak" }).append(propertyContent))) - ); + this._addLabelAndValue($newInspectorTable, propertyLabel, propertyContent); } } } @@ -211,38 +198,22 @@ var PrintUtil = new function() { //Show Parent Codes var allParentCodesAsText = this._getCodesFromSamples(entity.parents); if(allParentCodesAsText.length > 0) { - $newInspectorTable - .append($("<tr>") - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLabel"}).append("Parents:"))) - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLineBreak" }).append(allParentCodesAsText))) - ); + this._addLabelAndValue($newInspectorTable, "Parents", allParentCodesAsText); } //Show Children Codes var allChildrenCodesAsText = this._getCodesFromSamples(entity.children); if(allChildrenCodesAsText.length > 0) { - $newInspectorTable - .append($("<tr>") - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLabel"}).append("Children:"))) - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLineBreak"}).append(allChildrenCodesAsText))) - ); + this._addLabelAndValue($newInspectorTable, "Children", allChildrenCodesAsText); } } //Show Modification Date if(entity.registrationDetails) { - $newInspectorTable - .append($("<tr>") - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLabel"}).append("Modification Date:"))) - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLineBreak"}).append(new Date(entity.registrationDetails["modificationDate"])))) - ); + this._addLabelAndValue($newInspectorTable, "Modification Date", new Date(entity.registrationDetails["modificationDate"])); //Show Creation Date - $newInspectorTable - .append($("<tr>") - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLabel"}).append("Registration Date:"))) - .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLineBreak"}).append(new Date(entity.registrationDetails["registrationDate"])))) - ); + this._addLabelAndValue($newInspectorTable, "Registration Date", new Date(entity.registrationDetails["registrationDate"])); } if(extraCustomId && extraContent) { @@ -251,6 +222,15 @@ var PrintUtil = new function() { return $newInspector; }; + + this._addLabelAndValue = function($newInspectorTable, label, value) { + $newInspectorTable + .append($("<tr>") + .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLabel"}).append(label + ":"))) + .append($("<td>", { "class" : "property", "colspan" : "1" }).append($("<p>", { "class" : "inspectorLineBreak" }).append(value))) + ); + + } this._convertJsonToHtml = function(json) { data = json["data"]; diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js index a32c9c1bcc816ce5c26244fbf67a947e9894da4d..262b93a35f2ba9acf86b16e033def36a69f1ae62 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js @@ -125,7 +125,7 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) {     }); } -     var $btnSave = $('<input>', { 'type': 'submit', 'class' : 'btn btn-primary', 'value' : 'Save' }); +     var $btnSave = $('<input>', { 'type': 'submit', 'class' : 'btn btn-primary', 'value' : 'Save', 'id' : 'search-query-save-btn' });     var $btnCancel = $('<a>', { 'class' : 'btn btn-default' }).append('Cancel');     $btnCancel.click(function() {       Util.unblockUI(); @@ -190,10 +190,11 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { }); } this._$savedSearchesDropdown = FormUtil.getPlainDropdown(savedSearchOptions); - this._$savedSearchesDropdown.change(function(change) { - var i = _this._$savedSearchesDropdown.val(); - _this._advancedSearchController.selectSavedSearch(i); - }); + this._$savedSearchesDropdown.attr("id", "saved-search-dropdown-id"); + this._$savedSearchesDropdown.on("select2:select", function () { + var i = _this._$savedSearchesDropdown.val(); + _this._advancedSearchController.selectSavedSearch(i); + }); $container.append(this._$savedSearchesDropdown); this._$savedSearchesDropdown.select2({ width: '400px', @@ -209,7 +210,7 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { var $buttonSave = FormUtil.getButtonWithIcon('glyphicon-floppy-disk', function() { _this._save(); - }, 'Save'); + }, 'Save', null, "save-btn"); $buttonSave.css({ 'margin-left': '8px'}); $container.append($buttonSave); @@ -243,7 +244,7 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { var $submitButton = FormUtil.getButtonWithIcon('glyphicon-search', function() { _this._advancedSearchController.search(); - }); + }, null, null, "search-btn"); $submitButton.css("margin-top", "22px"); var $submitButtonGroup = FormUtil.getFieldForComponentWithLabel($submitButton, "", null, true); @@ -743,7 +744,8 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { } } } - return _this._getLinkOnClick(data.code, data, paginationInfo); + var id = data.code.toLowerCase() + "-id"; + return _this._getLinkOnClick(data.code, data, paginationInfo, id); } }, { label : 'Identifier', @@ -901,16 +903,16 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { return dataGrid; } - this._getLinkOnClick = function(code, data, paginationInfo) { + this._getLinkOnClick = function(code, data, paginationInfo, id) { if(data.entityKind !== "Sample") { paginationInfo = null; // TODO - Only supported for samples for now } switch(data.entityKind) { case "Experiment": - return FormUtil.getFormLink(code, data.entityKind, data.identifier, paginationInfo); + return FormUtil.getFormLink(code, data.entityKind, data.identifier, paginationInfo, id); break; default: - return FormUtil.getFormLink(code, data.entityKind, data.permId, paginationInfo); + return FormUtil.getFormLink(code, data.entityKind, data.permId, paginationInfo, id); break; } } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js index cec7c15151fc7255427aa9088436df2f2844a8cd..5797ce89ac28b15e122bf355b97c452ce45d2f26 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/DataGridController.js @@ -57,6 +57,10 @@ function DataGridController(title, columnsFirst, columnsLast, columnsDynamicFunc }); } + this.refreshHeight = function() { + this._grid.calculateHeight(); + } + this.refresh = function() { this._dataGridModel.datagrid.repeater('render'); } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js index 2082287015c8e340fb9e0089cd0f4dc88a5dbfc7..d6bed74cc27f8916aba71e26cf33fa1322a99133 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataGrid/SampleDataGridUtil.js @@ -13,7 +13,9 @@ var SampleDataGridUtil = new function() { sortable : false, render : function(data) { var nameToUse = Util.getNameOrCode(data); - return (isLinksDisabled)?nameToUse:FormUtil.getFormLink(nameToUse, "Sample", data.permId); + var codeId = data.code.toLowerCase() + "-column-id"; + var $controlLabel = $('<label>', { 'id' : codeId }).html(nameToUse); + return (isLinksDisabled) ? $controlLabel : FormUtil.getFormLink(nameToUse, "Sample", data.permId, null, codeId); } }); @@ -191,8 +193,7 @@ var SampleDataGridUtil = new function() { } } } - var codeId = data.code.toLowerCase() + "-column-id"; - return (isLinksDisabled)?data.code:FormUtil.getFormLink(data.code, "Sample", data.permId, paginationInfo, codeId); + return (isLinksDisabled)?data.code:FormUtil.getFormLink(data.code, "Sample", data.permId, paginationInfo); }, filter : function(data, filter) { return data.identifier.toLowerCase().indexOf(filter) !== -1; diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormController.js index 9e3f3598df89aaeb6e3f4ece1d132b2d3d1165ff..9a8150f81661adfe1aa8ec8550f395dd07a3ef5b 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormController.js @@ -106,6 +106,10 @@ function DataSetFormController(parentController, mode, entity, dataSet, isMini, }); } + this._showError = function(errorMessage) { + Util.blockUI(); + Util.showUserError(errorMessage, function() { Util.unblockUI(); }); + } // // Form Submit // @@ -115,14 +119,16 @@ function DataSetFormController(parentController, mode, entity, dataSet, isMini, // if(this._dataSetFormModel.mode === FormMode.CREATE) { if(this._dataSetFormModel.files.length === 0) { - Util.blockUI(); - Util.showUserError("You should upload at least one file.", function() { Util.unblockUI(); }); + this._showError("You should upload at least one file."); + return; + } + if ($('#DATASET_TYPE').val() === "") { + this._showError("No Data Set Type specified."); return; } if(Uploader.uploadsInProgress()) { - Util.blockUI(); - Util.showUserError("Please wait the upload to finish.", function() { Util.unblockUI(); }); + this._showError("Please wait the upload to finish."); return; } } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js index d3b74ce13a9416a972b1c2978c8a39d8155a43f1..1c6b65ba1a828fcebe9749500ed1500ee166a8c8 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/DataSetFormView.js @@ -66,7 +66,7 @@ function DataSetFormView(dataSetFormController, dataSetFormModel) { //Edit Button var $editBtn = FormUtil.getButtonWithIcon("glyphicon-edit", function () { mainController.changeView('showEditDataSetPageFromPermId', _this._dataSetFormModel.dataSet.code); - }, "Edit"); + }, "Edit", null, "dataset-edit-btn"); if(toolbarConfig.EDIT) { toolbarModel.push({ component : $editBtn }); } @@ -158,7 +158,7 @@ function DataSetFormView(dataSetFormController, dataSetFormModel) { } else if(!this._dataSetFormModel.isMini) { var $saveBtn = FormUtil.getButtonWithIcon("glyphicon-floppy-disk", function() { _this._dataSetFormController.submitDataSet(); - }, "Save"); + }, "Save", null, "save-btn"); $saveBtn.removeClass("btn-default"); $saveBtn.addClass("btn-primary"); toolbarModel.push({ component : $saveBtn }); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/AdvancedEntitySearchDropdown.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/AdvancedEntitySearchDropdown.js index 6e8671454d92c3f14c65dc728b3692ad35eca014..53f93071e53f16b2238ee894f2f30b9806735cc3 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/AdvancedEntitySearchDropdown.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/AdvancedEntitySearchDropdown.js @@ -233,6 +233,7 @@ function AdvancedEntitySearchDropdown(isMultiple, // this.init = function($container) { $select.attr("multiple", "multiple"); + $select.attr("id", "advanced-entity-search-dropdown-id"); if(isRequired) { $select.attr("required", "required"); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerView.js index f7cf5d3e6686d1f62b481459e968edfa6183514a..72cfd53bfad5af6cbecf8b0878dcf2b3cf2b6fd9 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DataSetForm/widgets/DatasetViewerView.js @@ -96,6 +96,7 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) { $container.append($tree); var treeModel = []; + var dataSetPosInTree = 0; for(var datasetCode in this._dataSetViewerModel.entityDataSets) { var displayName = this._dataSetViewerModel.entityDataSets[datasetCode].properties[profile.propertyReplacingCode]; if(!displayName) { @@ -106,9 +107,10 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) { var dataset = this._dataSetViewerModel.entityDataSets[datasetCode]; var onClick = "mainController.changeView('showViewDataSetPageFromPermId', '" + datasetCode + "');"; - var dataSetTitle = "<span onclick=\"" + onClick + "\">" + var dataSetTitle = "<span id=\"dataSetPosInTree-" + dataSetPosInTree + "\" onclick=\"" + onClick + "\">" + dataset.dataSetTypeCode + " : " + displayName + "</span>"; treeModel.push({ title : dataSetTitle, key : "/", folder : true, lazy : true, datasetCode : datasetCode }); + dataSetPosInTree += 1; } var glyph_opts = { @@ -229,9 +231,12 @@ function DataSetViewerView(dataSetViewerController, dataSetViewerModel) { content : $tooltip, position : "left", functionFormat : function(instance, helper, content) { - - var containerWidth = $(helper.origin).offset().left*0.9; - var containerHeight = $(window).height()*0.9; + var containerWidth = $(helper.origin).offset().left; + if (containerWidth < 200) { + containerWidth = $(helper.origin).width(); + } + containerWidth *= 0.9; + var containerHeight = $(window).height() * 0.9; var $img = content.find("img"); var imageSize = Util.getImageSize(containerWidth, containerHeight, $img[0].width, $img[0].height); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js index 9426729a20e91ba56b22f5115e6a2d113f4017ce..3fab1fc232e282135364a5c578a1bdaad6e6c6f8 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentForm/ExperimentFormView.js @@ -85,7 +85,7 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { //Edit var $editBtn = FormUtil.getButtonWithIcon("glyphicon-edit", function () { mainController.changeView("showEditExperimentPageFromIdentifier", _this._experimentFormModel.experiment.identifier); - }, "Edit"); + }, "Edit", null, "edit-btn"); toolbarModel.push({ component : $editBtn }); } if (_this._allowedToMove()) { @@ -174,7 +174,7 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { } else { //Create and Edit var $saveBtn = FormUtil.getButtonWithIcon("glyphicon-floppy-disk", function() { _this._experimentFormController.updateExperiment(); - }, "Save"); + }, "Save", null, "save-btn"); $saveBtn.removeClass("btn-default"); $saveBtn.addClass("btn-primary"); toolbarModel.push({ component : $saveBtn }); @@ -234,7 +234,7 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { 'class' : 'zoomableImage', 'id' : 'preview-image', 'src' : './img/image_loading.gif', - 'style' : 'max-width:100%; display:none;' + 'style' : 'max-height:300px; display:none;' }); $previewImage.click(function() { Util.showImage($("#preview-image").attr("src")); @@ -316,12 +316,12 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { if(this._experimentFormModel.mode === FormMode.VIEW || this._experimentFormModel.mode === FormMode.EDIT) { $identificationInfo.append(FormUtil.getFieldForLabelWithText("Code", this._experimentFormModel.experiment.code)); - var $codeField = FormUtil._getInputField("text", null, "code", null, true); + var $codeField = FormUtil._getInputField("text", "codeId", "code", null, true); $codeField.val(IdentifierUtil.getCodeFromIdentifier(this._experimentFormModel.experiment.identifier)); $codeField.hide(); $identificationInfo.append($codeField); } else if(this._experimentFormModel.mode === FormMode.CREATE) { - var $codeField = FormUtil._getInputField("text", null, "code", null, true); + var $codeField = FormUtil._getInputField("text", "codeId", "code", null, true); $codeField.keyup(function() { _this._experimentFormModel.isFormDirty = true; var caretPosition = this.selectionStart; @@ -381,11 +381,6 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { } this._createSamplesSection = function(hideShowOptionsModel) { - hideShowOptionsModel.push({ - label : ELNDictionary.Samples, - section : "#experiment-samples" - }); - var _this = this; var $samples = $("<div>", { id : "experiment-samples" }); $samples.append($('<legend>').text(ELNDictionary.Samples)); @@ -400,6 +395,13 @@ function ExperimentFormView(experimentFormController, experimentFormModel) { var sampleList = new SampleTableController(this._experimentFormController, null, this._experimentFormModel.experiment.identifier, null, null, this._experimentFormModel.experiment); sampleList.init(views); $samples.hide(); + hideShowOptionsModel.push({ + label : ELNDictionary.Samples, + section : "#experiment-samples", + beforeShowingAction : function() { + sampleList.refreshHeight(); + } + }); return $samples; } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentTable/ExperimentTableController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentTable/ExperimentTableController.js index 9ffa01a89df825b562d0857ef2cd5a59dc775894..8174295b7a647f17c1083d460996eb7506ba89ff 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentTable/ExperimentTableController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ExperimentTable/ExperimentTableController.js @@ -81,8 +81,15 @@ function ExperimentTableController(parentController, title, project, showInProje var rowClick = null; //Create and display table - var dataGridController = ExperimentDataGridUtil.getExperimentDataGrid(selectedTypeCode, experiments, rowClick, 50); - dataGridController.init(this._experimentTableView.getTableContainer()); + this._dataGridController = ExperimentDataGridUtil.getExperimentDataGrid(selectedTypeCode, experiments, rowClick, 50); + this._dataGridController.init(this._experimentTableView.getTableContainer()); + } + } + + this.refreshHeight = function() + { + if (this._dataGridController) { + this._dataGridController.refreshHeight(); } } } \ 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/HierarchyTable/HierarchyTableView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/HierarchyTableView.js index 24877303093f678575a70a72f0291c1f4ad2584f..9835090f45922896464c9433814ad747f04a71cb 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/HierarchyTableView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/HierarchyTableView.js @@ -32,14 +32,7 @@ function HierarchyTableView(controller, model) { $containerColumn.append(this._container); views.content.append($containerColumn); - switch(this._model.entity["@type"]) { - case "as.dto.dataset.DataSet": - views.header.append($("<h1>").append("Dataset Hierarchy Table for " + this._model.entity.code)); - break; - case "as.dto.sample.Sample": - views.header.append($("<h1>").append("" + ELNDictionary.Sample + " Hierarchy Table for " + this._model.entity.identifier)); - break; - } + views.header.append($("<h1>").append("Dataset Hierarchy Table: " + Util.getDisplayNameForEntity(this._model.entity))); this._hierarchyFilterController = new HierarchyFilterController(this._model.entity, function() { _this._dataGrid.refresh(); }); this._hierarchyFilterController.init(views.header); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/widgets/HierarchyFilterView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/widgets/HierarchyFilterView.js index 0b85ab4e57946aaad1d8ad1023dccc7ced7b7481..58b169b00e3891c19750ddaa9c95eb1d34b2062b 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/widgets/HierarchyFilterView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/HierarchyTable/widgets/HierarchyFilterView.js @@ -41,7 +41,7 @@ function HierarchyFilterView(controller, model) { var types = this._model.getTypes(); var $filtersFormEntityTypes = $('<select>', { 'id' : 'entityTypesSelector' , class : 'multiselect' , 'multiple' : 'multiple'}); for (var type in types) { - $filtersFormEntityTypes.append($('<option>', { 'value' : type , 'selected' : ''}).html(type)); + $filtersFormEntityTypes.append($('<option>', { 'value' : type , 'selected' : ''}).html(Util.getDisplayNameFromCode(type))); } $filtersForm diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ProjectForm/ProjectFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ProjectForm/ProjectFormView.js index 8222fccf51c2bfe67c644099bc537d02b5417db7..817d2dd5958490714f22b0ee7016c31a04592301 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ProjectForm/ProjectFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/ProjectForm/ProjectFormView.js @@ -66,7 +66,6 @@ function ProjectFormView(projectFormController, projectFormModel) { _this._projectFormController.createNewExperiment(typeCode); }, 100); } - getNewSampleOfTypeWithParent(typeCode,); }); } if (_this._allowedToMove()) { @@ -83,7 +82,7 @@ function ProjectFormView(projectFormController, projectFormModel) { //Edit var $editBtn = FormUtil.getButtonWithIcon("glyphicon-edit", function () { _this._projectFormController.enableEditing(); - }, "Edit"); + }, "Edit", null, "edit-btn"); toolbarModel.push({ component : $editBtn }); } if(_this._allowedToDelete()) { @@ -152,7 +151,7 @@ function ProjectFormView(projectFormController, projectFormModel) { } else { var $saveBtn = FormUtil.getButtonWithIcon("glyphicon-floppy-disk", function() { _this._projectFormController.updateProject(); - }, "Save"); + }, "Save", null, "save-btn"); $saveBtn.removeClass("btn-default"); $saveBtn.addClass("btn-primary"); toolbarModel.push({ component : $saveBtn }); @@ -205,7 +204,7 @@ function ProjectFormView(projectFormController, projectFormModel) { } if (this._projectFormModel.mode === FormMode.CREATE) { - var $textField = FormUtil._getInputField('text', null, "Project Code", null, true); + var $textField = FormUtil._getInputField('text', "project-code-id", "Project Code", null, true); $textField.keyup(function(event){ var textField = $(this); var caretPosition = this.selectionStart; @@ -251,7 +250,7 @@ function ProjectFormView(projectFormController, projectFormModel) { $description.append($("<legend>").append("General")); var description = Util.getEmptyIfNull(this._projectFormModel.project.description); if(this._projectFormModel.mode !== FormMode.VIEW) { - var $textBox = FormUtil._getTextBox(null, "Description", false); + var $textBox = FormUtil._getTextBox("description-id", "Description", false); var textBoxEvent = function(jsEvent, newValue) { var valueToUse = null; if (newValue !== undefined && newValue !== null) { @@ -276,11 +275,6 @@ function ProjectFormView(projectFormController, projectFormModel) { this._createExperimentsSection = function(projectIdentifier, hideShowOptionsModel) { var entityKindName = ELNDictionary.getExperimentKindName(projectIdentifier, true); - hideShowOptionsModel.push({ - label : entityKindName, - section : "#project-experiments" - }); - var $experiments = $("<div>", { id : "project-experiments" }); var $experimentsContainer = $("<div>"); $experiments.append($("<legend>").append(entityKindName)); @@ -289,15 +283,18 @@ function ProjectFormView(projectFormController, projectFormModel) { var experimentTableController = new ExperimentTableController(this._projectFormController, null, jQuery.extend(true, {}, this._projectFormModel.project), true); experimentTableController.init($experimentsContainer); $experiments.hide(); + hideShowOptionsModel.push({ + label : entityKindName, + section : "#project-experiments", + beforeShowingAction : function() { + experimentTableController.refreshHeight(); + } + }); return $experiments; } this._createSamplesSection = function(hideShowOptionsModel) { var entityKindName = "" + ELNDictionary.Samples + ""; - hideShowOptionsModel.push({ - label : entityKindName, - section : "#project-samples" - }); var $samples = $("<div>", { id : "project-samples" }); var $experimentsContainer = $("<div>"); @@ -314,6 +311,13 @@ function ProjectFormView(projectFormController, projectFormModel) { var sampleTableController = new SampleTableController(this._projectFormController, null, null, this._projectFormModel.project.permId, true, null, 40); sampleTableController.init(views); $samples.hide(); + hideShowOptionsModel.push({ + label : entityKindName, + section : "#project-samples", + beforeShowingAction : function() { + sampleTableController.refreshHeight(); + } + }); return $samples; } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js index 6971e177f35525bc29782b9fedb58b5ba7adfce0..ef9822bec7a660d2e97850ab7594d91d25214283 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js @@ -1,4 +1,4 @@ -/* + /* * Copyright 2014 ETH Zuerich, Scientific IT Services * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -113,9 +113,10 @@ function SampleFormView(sampleFormController, sampleFormModel) { if(this._sampleFormModel.mode === FormMode.VIEW) { // New - if(_this._allowedToCreateChild() && toolbarConfig.CREATE) { + if(_this._allowedToCreateChild() && this._sampleFormModel.isELNSample && toolbarConfig.CREATE) { var sampleTypes = profile.getAllSampleTypes(true); - FormUtil.addCreationDropdown(toolbarModel, sampleTypes, ["ENTRY", "EXPERIMENTAL_STEP"], function(typeCode) { + var priorityTypes = ["ENTRY", "EXPERIMENTAL_STEP"]; + FormUtil.addCreationDropdown(toolbarModel, sampleTypes, priorityTypes, function(typeCode) { return function() { Util.blockUI(); setTimeout(function() { @@ -278,7 +279,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { //Create Dataset var $uploadBtn = FormUtil.getButtonWithIcon("glyphicon-upload", function () { mainController.changeView('showCreateDataSetPageFromPermId',_this._sampleFormModel.sample.permId); - }, "Upload"); + }, "Upload", null, "upload-btn"); if(toolbarConfig.UPLOAD_DATASET) { toolbarModel.push({ component : $uploadBtn, tooltip: null }); } @@ -619,7 +620,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { 'class' : 'zoomableImage', 'id' : 'preview-image', 'src' : './img/image_loading.gif', - 'style' : 'max-width:100%; display:none;' + 'style' : 'max-width:300px; display:none;' }); $previewImage.click(function() { Util.showImage($("#preview-image").attr("src")); @@ -699,7 +700,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { continue; } - if(propertyType.code === "$ANNOTATIONS_STATE" || propertyType.code === "$FREEFORM_TABLE_STATE" || propertyType.code === "$ORDER.ORDER_STATE" ) { + if(propertyType.code === "$ANNOTATIONS_STATE" || propertyType.code === "FREEFORM_TABLE_STATE" || propertyType.code === "$ORDER.ORDER_STATE" ) { continue; } else if(propertyType.code === "$XMLCOMMENTS") { var $commentsContainer = $("<div>"); @@ -902,12 +903,7 @@ function SampleFormView(sampleFormController, sampleFormModel) { } this._createParentsSection = function(hideShowOptionsModel, sampleTypeDefinitionsExtension, sampleTypeCode) { - hideShowOptionsModel.push({ - forceToShow : this._sampleFormModel.mode === FormMode.CREATE && (sampleTypeDefinitionsExtension && sampleTypeDefinitionsExtension["FORCE_TO_SHOW_PARENTS_SECTION"]), - label : "Parents", - section : "#sample-parents" - }); - + var _this = this; var requiredParents = []; if (sampleTypeDefinitionsExtension && sampleTypeDefinitionsExtension["SAMPLE_PARENTS_HINT"]) { requiredParents = sampleTypeDefinitionsExtension["SAMPLE_PARENTS_HINT"]; @@ -935,15 +931,21 @@ function SampleFormView(sampleFormController, sampleFormModel) { this._sampleFormModel.sampleLinksParents.init($sampleParentsWidget); } $sampleParentsWidget.hide(); + + hideShowOptionsModel.push({ + forceToShow : this._sampleFormModel.mode === FormMode.CREATE && (sampleTypeDefinitionsExtension && sampleTypeDefinitionsExtension["FORCE_TO_SHOW_PARENTS_SECTION"]), + label : "Parents", + section : "#sample-parents", + showByDefault : true, + beforeShowingAction : function() { + _this._sampleFormModel.sampleLinksParents.refreshHeight(); + } + }); + return $sampleParentsWidget; } this._createChildrenSection = function(hideShowOptionsModel, sampleTypeDefinitionsExtension, sampleTypeCode) { - hideShowOptionsModel.push({ - label : "Children", - section : "#sample-children" - }); - var _this = this; var requiredChildren = []; if(sampleTypeDefinitionsExtension && sampleTypeDefinitionsExtension["SAMPLE_CHILDREN_HINT"]) { @@ -994,6 +996,16 @@ function SampleFormView(sampleFormController, sampleFormModel) { $sampleChildrenWidget.append($generateChildrenBox); } $sampleChildrenWidget.hide(); + + hideShowOptionsModel.push({ + label : "Children", + section : "#sample-children", + showByDefault : true, + beforeShowingAction : function() { + _this._sampleFormModel.sampleLinksChildren.refreshHeight(); + } + }); + return $sampleChildrenWidget; } diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/CommentsView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/CommentsView.js index c8317cb392904530600a393be17a89047547db0f..d42b8e3dd377b1b92bea8fb4a942e21b06e25e18 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/CommentsView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/CommentsView.js @@ -77,19 +77,21 @@ function CommentsView(commentsController, commentsModel) { this.addAddButton = function() { if(this._commentsModel.mode !== FormMode.VIEW) { var _this = this; - var $buttonPlusOne = $("<a>", {"class" : "btn btn-default"}); + var commentNumber = 0; + var $buttonPlusOne = $("<a>", {"class" : "btn btn-default", "id" : "add-comment-btn"}); $buttonPlusOne.append($("<span>", { "class" : "glyphicon glyphicon-plus-sign"})); $buttonPlusOne.click(function() { - _this.addNewComment(); + _this.addNewComment(commentNumber); + commentNumber++; }); this.commentsAddButton.append(FormUtil.getFieldForComponentWithLabel($buttonPlusOne, null)); } } - this.addNewComment = function() { - var $textBox = FormUtil._getTextBox(null, null, false); + this.addNewComment = function(commentNumber) { + var $textBox = FormUtil._getTextBox("comment-" + commentNumber + "-box", null, false); var $textBoxGroup = FormUtil.getFieldForComponentWithLabel($textBox, null, null); - var $saveButton = FormUtil.getButtonWithText("Add Comment"); + var $saveButton = FormUtil.getButtonWithText("Add Comment", null, null, "save-comment-" + commentNumber + "-btn"); var $saveButtonGroup = FormUtil.getFieldForComponentWithLabel($saveButton, null, null); this.commentsContainer.append($textBoxGroup); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js index 66e618c48d8bea17245c8ddb040176d9126ef577..1becb0945bd0f4cb1f06094114b1a774ee143838 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksController.js @@ -61,6 +61,10 @@ function LinksController(title, sampleTypeHints, isDisabled, samplesToEdit, show } } + this.refreshHeight = function() { + linksView.refreshHeight(); + } + // // API - Used by Sample Form // diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js index 473a8b2fdd634ed5e38bbf3858add551c18dd1b7..ccf71b29b781fbe35f640697e3edce81fd5e022e 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js @@ -24,6 +24,8 @@ function LinksView(linksController, linksModel) { var $samplePicker = $("<div>"); var $savedContainer = null; + var dataGrids = []; + // // External API // @@ -154,6 +156,13 @@ function LinksView(linksController, linksModel) { var dataGrid = SampleDataGridUtil.getSampleDataGrid(containerCode, samplesOnGrid, null, linksView.getCustomOperationsForGrid(), allCustomAnnotations, postFix, linksModel.isDisabled, false, false, false, 40); dataGrid.init($dataGridContainer); linksModel.writeState(sample, null, null, false); + dataGrids.push(dataGrid); + } + + this.refreshHeight = function() { + dataGrids.forEach(function(dataGrid) { + dataGrid.refreshHeight(); + }); } this.repaint = function($container) { @@ -306,8 +315,13 @@ function LinksView(linksController, linksModel) { sortable : false, render : function(data) { //Dropdown Setup + var codeId = data.code.toLowerCase() + "-operations-column-id"; + var $dropDownMenu = $("<span>", { class : 'dropdown table-options-dropdown' }); - var $caret = $("<a>", { 'href' : '#', 'data-toggle' : 'dropdown', class : 'dropdown-toggle btn btn-default'}).append("Operations ").append($("<b>", { class : 'caret' })); + var $caret = $("<a>", { 'href' : '#', + 'data-toggle' : 'dropdown', + class : 'dropdown-toggle btn btn-default', + 'id' : codeId}).append("Operations ").append($("<b>", { class : 'caret' })); var $list = $("<ul>", { class : 'dropdown-menu', 'role' : 'menu', 'aria-labelledby' :'sampleTableDropdown' }); $dropDownMenu.append($caret); $dropDownMenu.append($list); @@ -321,7 +335,8 @@ function LinksView(linksController, linksModel) { $dropDownMenu.click(stopEventsBuble); if(profile.isSampleTypeProtocol(data["$object"].sampleTypeCode)) { - var $copyAndLink = $("<li>", { 'role' : 'presentation' }).append($("<a>", {'title' : 'Use as template'}).append("Use as template")); + var id = codeId + "-use-as-template"; + var $copyAndLink = $("<li>", { 'role' : 'presentation' }).append($("<a>", {'id' : id, 'title' : 'Use as template'}).append("Use as template")); $copyAndLink.click(function(e) { stopEventsBuble(e); var copyAndLink = function(code) { @@ -434,14 +449,16 @@ function LinksView(linksController, linksModel) { } var dataGrid = SampleDataGridUtil.getSampleDataGrid(sampleTypeCode, advancedSampleSearchCriteria, rowClick, null, null, null, true, true, true, false, 60); dataGrid.init($gridContainer, extraOptions); + dataGrids.push(dataGrid); } linksView.getAddBtn = function($container, sampleTypeCode) { var enabledFunction = function() { linksView.showSamplePicker($container, sampleTypeCode); }; - - var $addBtn = FormUtil.getButtonWithIcon("glyphicon-plus", (linksModel.isDisabled)?null:enabledFunction); + + var id = "plus-btn-" + sampleTypeCode.toLowerCase(); + var $addBtn = FormUtil.getButtonWithIcon("glyphicon-plus", (linksModel.isDisabled)?null:enabledFunction, null, null, id); if(linksModel.isDisabled) { return ""; } else { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js index c1d5b6f18b36f9864bf9cb0816f8c4450b251c2b..5c2e2d1c0e1b250f38dfcfd6c53321810fec30a2 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableController.js @@ -82,18 +82,19 @@ function SampleTableController(parentController, title, experimentIdentifier, pr } this._reloadTableWithAllSamples = function(advancedSampleSearchCriteria) { + var _this = this; //Create and display table var withExperiment = !this._sampleTableModel.experimentIdentifier && !this._sampleTableModel.experiment; var tableHeight = 90; if(this._sampleTableModel.heightOverride) { - tableHeight = this._sampleTableModel.heightOverride; + tableHeight = this._sampleTableModel.heightOverride; } - var dataGridController = SampleDataGridUtil.getSampleDataGrid(this._sampleTableModel.experimentIdentifier, advancedSampleSearchCriteria, null, null, null, null, null, null, true, withExperiment, tableHeight); + this._dataGridController = SampleDataGridUtil.getSampleDataGrid(this._sampleTableModel.experimentIdentifier, advancedSampleSearchCriteria, null, null, null, null, null, null, true, withExperiment, tableHeight); var extraOptions = []; extraOptions.push({ name : "Delete selected", action : function(selected) { - var grid = dataGridController._grid; + var grid = _this._dataGridController._grid; var selected = grid.getSelected(); if(selected != undefined && selected.length == 0){ Util.showUserError("Please select at least one sample to delete!"); @@ -138,6 +139,12 @@ function SampleTableController(parentController, title, experimentIdentifier, pr } }}); - dataGridController.init(this._sampleTableView.getTableContainer(), extraOptions); + this._dataGridController.init(this._sampleTableView.getTableContainer(), extraOptions); + } + + this.refreshHeight = function() { + if (this._dataGridController) { + this._dataGridController.refreshHeight(); + } } } \ 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/SampleTable/SampleTableView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js index 103139ff8d278cd59a9ccb5167e2e794d88e8e2c..af8ea71df9774cef57a591464df11e5b5fb7a306 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js @@ -124,7 +124,7 @@ function SampleTableView(sampleTableController, sampleTableModel) { this._getOptionsMenu = function() { var _this = this; var $dropDownMenu = $("<span>", { class : 'dropdown' }); - var $caret = $("<a>", { 'href' : '#', 'data-toggle' : 'dropdown', class : 'dropdown-toggle btn btn-default', 'id' : 'options-menu-btn'}).append("More ... ").append($("<b>", { class : 'caret' })); + var $caret = $("<a>", { 'href' : '#', 'data-toggle' : 'dropdown', class : 'dropdown-toggle btn btn-default', 'id' : 'sample-options-menu-btn'}).append("More ... ").append($("<b>", { class : 'caret' })); var $list = $("<ul>", { class : 'dropdown-menu', 'role' : 'menu', 'aria-labelledby' :'sampleTableDropdown' }); $dropDownMenu.append($caret); $dropDownMenu.append($list); 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 90c372ed1171ab3911f9b0c981e8ee861fd5fc80..60fa6fe72efe557c6062bfd7c5c7305be0ca8571 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 @@ -643,9 +643,13 @@ function SettingsFormView(settingsFormController, settingsFormModel) { } if (rowValues["Disable section"]) { settings["SAMPLE_PARENTS_DISABLED"] = true; + } else { + settings["SAMPLE_PARENTS_DISABLED"] = false; } if (rowValues["Disable addition of any " + ELNDictionary.sample + " type"]) { settings["SAMPLE_PARENTS_ANY_TYPE_DISABLED"] = true; + } else { + settings["SAMPLE_PARENTS_ANY_TYPE_DISABLED"] = false; } } else if (rowValues["Settings for"] === "Children") { if (rowValues["Section name"] && rowValues["Section name"].length > 0) { @@ -653,9 +657,13 @@ function SettingsFormView(settingsFormController, settingsFormModel) { } if (rowValues["Disable section"]) { settings["SAMPLE_CHILDREN_DISABLED"] = true; + } else { + settings["SAMPLE_CHILDREN_DISABLED"] = false; } if (rowValues["Disable addition of any " + ELNDictionary.sample + " type"]) { settings["SAMPLE_CHILDREN_ANY_TYPE_DISABLED"] = true; + } else { + settings["SAMPLE_CHILDREN_ANY_TYPE_DISABLED"] = false; } } } 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 e72bef3cc8866a17d6fca16023b45cd724193c56..ff6bc1831d09299d7d2d3a952483a7b2fd833752 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 @@ -611,7 +611,8 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) {         case "EXPERIMENT":             var sampleRules = { "UUIDv4" : { type : "Experiment", name : "ATTR.PERM_ID", value : permId } };             mainController.serverFacade.searchForSamplesAdvanced({ entityKind : "SAMPLE", logicalOperator : "AND", rules : sampleRules }, -             { only : true, withProperties : true, withType : true, withExperiment : true, withParents : true, withChildren : true, withParentsType : true, withChildrenType : true}, +             { only : true, withProperties : true, withType : true, withExperiment : true, withParents : true, + withParentsExperiment: true, withChildren : true, withParentsType : true, withChildrenType : true},             function(searchResult) {                 var samples = searchResult.objects;                 var samplesToShow = []; @@ -619,12 +620,16 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) {                     var sample = samples[sIdx];                     var sampleIsExperiment = sample.type.code.indexOf("EXPERIMENT") > -1;                     var sampleTypeOnNav = profile.showOnNav(sample.type.code); + var sampleExperimentIdentifier = sample.experiment.identifier.identifier;                     if(sampleIsExperiment || sampleTypeOnNav) {                         var parentInELN = false;                         if(sample.parents) {                             for(var pIdx = 0; pIdx < sample.parents.length; pIdx++) { -                             var parentIdentifier = sample.parents[pIdx].identifier.identifier; -                             parentInELN = profile.isELNIdentifier(parentIdentifier); + var parent = sample.parents[pIdx]; +                             var parentIdentifier = parent.identifier.identifier; + var parentExperimentIdentifier = parent.experiment.identifier.identifier; +                             parentInELN = profile.isELNIdentifier(parentIdentifier) + && parentExperimentIdentifier === sampleExperimentIdentifier;                             if(parentInELN) { break;                             } @@ -739,7 +744,9 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) {         case "SAMPLE":             var sampleRules = { "UUIDv4" : { type : "Attribute", name : "PERM_ID", value : permId } };             mainController.serverFacade.searchForSamplesAdvanced({ entityKind : "SAMPLE", logicalOperator : "AND", rules : sampleRules }, -             { only : true, withProperties : true, withType : true, withExperiment : true, withParents : true, withChildren : true, withChildrenProperties : true, withParentsType : true, withChildrenType : true} +             { only : true, withProperties : true, withType : true, withExperiment : true, withParents : true, + withChildren : true, withChildrenProperties : true, withChildrenExperiment : true, + withParentsType : true, withChildrenType : true}             , function(searchResult) {                 var results = [];                 var samples = searchResult.objects; @@ -749,7 +756,9 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) {     } else {         for(var cIdx = 0; cIdx < samples[0].children.length; cIdx++) {                         var sample = samples[0].children[cIdx]; -                         +                         if (sample.experiment.identifier.identifier !== samples[0].experiment.identifier.identifier) { + continue; + } var sampleIsExperiment = sample.type.code.indexOf("EXPERIMENT") > -1; var sampleIcon; if(sampleIsExperiment) { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SpaceForm/SpaceFormView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SpaceForm/SpaceFormView.js index 64cee57a6f0cba4fba16e756fa2b323900cec427..5e19141733f74d98cee163766f58a7ad0d872b2b 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SpaceForm/SpaceFormView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SpaceForm/SpaceFormView.js @@ -40,7 +40,7 @@ function SpaceFormView(spaceFormController, spaceFormModel) { if (_this._allowedToCreateProject()) { var $createProj = FormUtil.getButtonWithIcon("glyphicon-plus", function() { _this._spaceFormController.createProject(); - }, "New Project"); + }, "New Project", null, "create-btn"); toolbarModel.push({ component : $createProj}); } 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 59b4cf6a5a771eea2162486a95c859f2c818a5a4..708f9325e422ad528c6e10d03235debc7a74c267 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 @@ -147,7 +147,6 @@ function GridView(gridModel) { sample = jQuery.extend(true, {}, labels[i].data.samples[0]); } - extraProperties = null; if(sample && sample.sampleTypeCode === "STORAGE_POSITION" && sample.parents && sample.parents[0]) { if(profile.propertyReplacingCode && sample.parents[0].properties && sample.parents[0].properties[profile.propertyReplacingCode]) { // Label @@ -158,7 +157,6 @@ function GridView(gridModel) { } sample = sample.parents[0]; - extraProperties = {code : {label : "Code", value : sample.code}}; var href = Util.getURLFor(null, "showViewSamplePageFromPermId", sample.permId); optSampleTitle = $("<a>", { "href" : href, "class" : "browser-compatible-javascript-link" }).text(labels[i].displayName); @@ -167,7 +165,7 @@ function GridView(gridModel) { }).bind(this, sample)); } - var rowLabel = i + 1; + var rowLabel = posX; if(this._gridModel.useLettersOnRows) { rowLabel = Util.getLetterForNumber(rowLabel); } @@ -175,7 +173,7 @@ function GridView(gridModel) { 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, extraProperties); + 'colorEncodedWellAnnotations-holder-' + sample.permId, null, null); labelContainer.tooltipster({ content: $(tooltip), interactive: true, diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserManager/UserManagerView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserManager/UserManagerView.js index 015007f543e161c13b21799dd3e2ce421f6851e7..9a123a8c257b98165948379e856efc28a276cdfe 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserManager/UserManagerView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserManager/UserManagerView.js @@ -40,10 +40,10 @@ function UserManagerView(userManagerController, userManagerModel) { var $toolbox = $("<div>", { 'id' : 'toolBoxContainer', class : 'toolBox'}); var $createUser = FormUtil.getButtonWithIcon("glyphicon-plus", function() { _this._userManagerController.showCreateNewUserModal(); - }, "New User"); + }, "New User", null, "createUser"); $toolbox.append($createUser); $header.append($toolbox); - + // // Data Grid // diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js index b9dbfc5f1c39df96d9fdd55e2b3707ad23a0148b..f9cd29ef8287f469006da8acd8132a87ef68f358 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js @@ -43,7 +43,7 @@ function SampleHierarchy(serverFacade, views, profile, sample) { $form.append($formColumn); - views.header.append($("<h1>").append("" + ELNDictionary.Sample + " Hierarchy Graph for " + this.sample.identifier)); + views.header.append($("<h1>").append("Hierarchy Graph: " + Util.getDisplayNameForEntity(this.sample))); localInstance.hierarchyFilterController = new HierarchyFilterController(this.sample, function() { localInstance.filterSampleAndUpdate(); }); localInstance.hierarchyFilterController.init(views.header); @@ -311,12 +311,7 @@ function SampleHierarchy(serverFacade, views, profile, sample) { 'style' : 'cursor:pointer; width:13px; height:18px;', })); - var nameLabel = null; - if(sample.properties[profile.propertyReplacingCode]) { - nameLabel = sample.code + "(" + sample.properties[profile.propertyReplacingCode] + ")"; - } else { - nameLabel = sample.code; - } + var nameLabel = Util.getDisplayNameForEntity(sample); var $sampleLink = $('<a>', { 'href' : "javascript:mainController.changeView('showViewSamplePageFromPermId', '" + sample.permId + "')"}).text(nameLabel); @@ -326,7 +321,7 @@ function SampleHierarchy(serverFacade, views, profile, sample) { .append($hideLink) .append($dataLink) .append($addChildLink) - .append(sample.sampleTypeCode + ':') + .append(' ' + Util.getDisplayNameFromCode(sample.sampleTypeCode) + ':') .append($sampleLink); if(sample.showDataOnGraph) { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.html b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.html index 085d860a497a2b4f6991703dbef4fbe1d6797bb9..bf2b5ec23877c2a8c7107672618e76d6beb0c632 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.html +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.html @@ -60,7 +60,7 @@ </div> <div class="dropdown columnDropdown" style = "display: inline; padding-left: 10px;"> - <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"> + <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" id="columns-dropdown-id"> Columns <span class="caret"></span> </button> <ul style="max-height:500px; overflow:scroll; overflow-x: hidden;" class="dropdown-menu" role="menu"></ul> diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js index 8857fff7a1553269711c611b4c2a87930bc9d054..56c9306db251d760c6145afbf3ad3a64320b6f77 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/lib/grid/js/Grid.js @@ -175,10 +175,20 @@ $.extend(Grid.prototype, { columnsForDropdown.forEach(function(column, columnIndex) { if(!column.showByDefault && !column.hide) { + var checkbox = $("<input>") .attr("type", "checkbox") .attr("value", column.property) .attr("style", "margin-left: 5px;"); + + if (column.property != null) { + var id = column.property.split(" ").join("-") + "-cln"; + if (id[0] === '$') { + id = id.substring(1, id.length - 1); + } + id = id.toLowerCase(); + checkbox.attr("id", id) + } if(thisGrid.tableSettings && thisGrid.tableSettings.columns && Object.keys(thisGrid.tableSettings.columns).length !== 0) { if((thisGrid.tableSettings.columns[column.property] === true)) { //If settings are present @@ -752,17 +762,7 @@ $.extend(Grid.prototype, { // Fix table width since fuelux 3.1.0 // var newWidth = $(thisGrid.panel).find(".repeater-list-wrapper > .table").width(); // $(thisGrid.panel).find(".repeater").width(newWidth); - - var headerHeight = $(thisGrid.panel).find(".repeater-header").outerHeight(true); - var listHeight = Math.max(100, $(thisGrid.panel).find(".repeater-list").outerHeight(true)); - var footerHeight = $(thisGrid.panel).find(".repeater-footer").outerHeight(true); - var viewport = $(thisGrid.panel).find(".repeater-canvas")[0]; - var scrollbarHeight = viewport.scrollWidth > viewport.offsetWidth ? thisGrid.scrollbarWidth : 0; - var totalHeight = headerHeight + listHeight + footerHeight + scrollbarHeight; - totalHeight = Math.min(totalHeight, thisGrid.maxHeight); - if (thisGrid.viewOptions.staticHeight < totalHeight) { - thisGrid.viewOptions.staticHeight = totalHeight; - } + thisGrid.calculateHeight(); var optionsDropdowns = $(".dropdown.table-options-dropdown"); for(var i = 0; i < optionsDropdowns.length; i++) { @@ -784,6 +784,23 @@ $.extend(Grid.prototype, { }, 100); }, options); }, + + calculateHeight : function() { + var thisGrid = this; + var $panel = $(thisGrid.panel); + var $header = $panel.find(".repeater-header"); + var headerHeight = $header.outerHeight(true); + var listHeight = Math.max(144, $(thisGrid.panel).find(".repeater-list").outerHeight(true)); + var footerHeight = $panel.find(".repeater-footer").outerHeight(true); + var viewport = $panel.find(".repeater-canvas")[0]; + var scrollbarHeight = viewport.scrollWidth > viewport.offsetWidth ? thisGrid.scrollbarWidth : 0; + var totalHeight = headerHeight + listHeight + footerHeight + scrollbarHeight; + totalHeight = Math.min(totalHeight, thisGrid.maxHeight); + if (thisGrid.viewOptions.staticHeight < totalHeight) { + thisGrid.viewOptions.staticHeight = totalHeight; + } + + }, addRowClickListener : function(listener) { if (!this.rowClickListeners) { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/BBBServerFacade.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/BBBServerFacade.js new file mode 100644 index 0000000000000000000000000000000000000000..32c4989cf99266320443d5c48729e6440a8e559e --- /dev/null +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/BBBServerFacade.js @@ -0,0 +1,142 @@ +var BBBServerFacade = new function() { + this.getExperiment = function($container, model) { + require(["openbis", + "as/dto/sample/fetchoptions/SampleFetchOptions", + "as/dto/experiment/fetchoptions/ExperimentFetchOptions", + "as/dto/experiment/id/ExperimentIdentifier", + "as/dto/dataset/fetchoptions/DataSetFetchOptions"], + function(openbis, SampleFetchOptions, + ExperimentFetchOptions, + ExperimentIdentifier, + DataSetFetchOptions) { + + var v3 = new openbis(null); + v3._private.sessionToken = mainController.openbisV1._internal.sessionToken; + + var webAppContext = v3.getWebAppContext(); + + var dataSetFetchOptions = new DataSetFetchOptions(); + dataSetFetchOptions.withType(); + dataSetFetchOptions.withPhysicalData(); + + var experimentId = new ExperimentIdentifier(model.experiment.identifier); + var fetchOptions = new ExperimentFetchOptions(); + fetchOptions.withDataSetsUsing(dataSetFetchOptions); + fetchOptions.withType(); + + var sampleFetchOptions = new SampleFetchOptions(); + sampleFetchOptions.withType().withPropertyAssignments().withPropertyType(); + sampleFetchOptions.withProperties(); + fetchOptions.withSamplesUsing(sampleFetchOptions); + v3.getExperiments([experimentId], fetchOptions).done(function(result) { + var experiment = result[model.experiment.identifier]; + if (experiment.type.code == "BBB") { + SnakemakeTrigger.paintTriggerContainers($container, model, experiment); + } + }); + }); + } + + this.getExperiments = function($content) { + require(["openbis", "as/dto/sample/fetchoptions/SampleFetchOptions", + "as/dto/experiment/fetchoptions/ExperimentFetchOptions", + "as/dto/experiment/id/ExperimentIdentifier", + "as/dto/dataset/fetchoptions/DataSetFetchOptions", + "as/dto/experiment/search/ExperimentSearchCriteria", + "as/dto/project/fetchoptions/ProjectFetchOptions"], + function(openbis, SampleFetchOptions, + ExperimentFetchOptions, + ExperimentIdentifier, + DataSetFetchOptions, + ExperimentSearchCriteria, + ProjectFetchOptions) { + + var v3 = new openbis(); + + v3.loginAsAnonymousUser().done(function(sessionToken) { + v3._private.sessionToken = sessionToken; + var webAppContext = v3.getWebAppContext(); + + var fetchOptions = new ExperimentFetchOptions(); + fetchOptions.withType(); + fetchOptions.withProperties(); + fetchOptions.withRegistrator(); + + var projectFetchOptions = new ProjectFetchOptions(); + projectFetchOptions.withSpace(); + + fetchOptions.withProjectUsing(projectFetchOptions); + + var searchCriteria = new ExperimentSearchCriteria(); + searchCriteria.withType(); + + v3.searchExperiments(searchCriteria, fetchOptions).done(function(result) { + BBBServerFacade.getRoleAssignment($content, result.objects); + }); + }).fail(function(result) { + console.log("Call failed to server: " + JSON.stringify(result)); + }); + }); + } + + this.getRoleAssignment = function ($content, experiments) { + require(["openbis", "as/dto/roleassignment/fetchoptions/RoleAssignmentFetchOptions", + "as/dto/roleassignment/search/RoleAssignmentSearchCriteria"], + function(openbis, RoleAssignmentFetchOptions, RoleAssignmentSearchCriteria) { + + var v3 = new openbis(); + + v3.loginAsAnonymousUser().done(function(sessionToken) { + v3._private.sessionToken = sessionToken; + var webAppContext = v3.getWebAppContext(); + + var criteria = new RoleAssignmentSearchCriteria(); + criteria.withOrOperator(); + criteria.withProject(); + criteria.withSpace(); + + var fetchOptions = new RoleAssignmentFetchOptions(); + fetchOptions.withSpace(); + fetchOptions.withProject(); + fetchOptions.withUser(); + fetchOptions.withAuthorizationGroup(); + + v3.searchRoleAssignments(criteria, fetchOptions).done(function(result) { + SnakemakeTable.paintTable($content, experiments, result.objects); + }); + }).fail(function(result) { + console.log("Call failed to server: " + JSON.stringify(result)); + }); + }); + } + + this.callCustomASService = function(params, $model, action) { + var result_div = $('#callback_message'); + + require(["openbis", + "as/dto/service/id/CustomASServiceCode", + "as/dto/service/CustomASServiceExecutionOptions", + "as/dto/experiment/id/ExperimentIdentifier"], + function(openbis, CustomASServiceCode, CustomASServiceExecutionOptions, ExperimentIdentifier) { + + var v3 = new openbis(null); + v3._private.sessionToken = mainController.openbisV1._internal.sessionToken; + var webAppContext = mainController.openbisV3.getWebAppContext(); + webAppContext['entityIdentifier'] = $model.experiment.identifier; + + var serviceCode = new CustomASServiceCode("snakemake_service"); + var options = new CustomASServiceExecutionOptions(); + + options.withParameter("webapp_context", webAppContext) + Object.keys(params).forEach(function(key) { + options.withParameter(key, params[key]); + }); + + v3.executeCustomASService(serviceCode, options).done(function(result) { + result_json = JSON.parse(result); + action(result_json) + }); + }); + return false; + } +} \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/UiComponents.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/UiComponents.js new file mode 100644 index 0000000000000000000000000000000000000000..36e1f12a6404c1896e609c4d8c3292b65b86335e --- /dev/null +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/UiComponents.js @@ -0,0 +1,104 @@ +var UiComponents = new function() { + + this.addDropdown = function(label, options, $container, selectAction) { + var $dropdown = UiComponents.getDropdown(options); + $inputGroup = UiComponents.getInputGroup($dropdown, label); + $inputGroup.css("margin-top", "3px"); + $container.append($inputGroup); + $dropdown.select2({ width : "100%", theme : "bootstrap", minimumResultsForSearch: 10 }); + if (selectAction) { + $dropdown.on('select2:select', function (e) { + selectAction(e.params.data.id); + }); + } + $inputGroup.getValue = function() { + return $dropdown.val(); + } + return $inputGroup; + } + + this.getDropdown = function(options, value) { + var $input = $("<select>", { class : "form-control", type : "text" }); + $input.append($("<option>", { "disabled" : true, "selected" : true, "value" : true }).text(" -- select an option -- ")); + for (option of options) { + var $option = $("<option>"); + $option.text(option.label); + $option.attr("value", option.value); + $input.append($option); + } + if (value) { + $input.val(value); + } + return $input; + } + + this.getInputGroup = function($input, label) { + var $inputGroup = $("<div>", { class : "input-group" }); + $inputGroup.append($("<span>", { class : "input-group-addon" }).text(label).css({ 'min-width' : '150px' })); + $inputGroup.append($input); + return $inputGroup; + } + + this.getButton = function($html, action, size, icon) { + var buttonSize = size ? size : 'md'; + var $button = $('<button>', { + type : 'button', + class : 'btn btn-default btn-' + buttonSize, + 'aria-label' : 'Left Align' + }); + if(icon) { + var $icon = $('<span>', { class : 'glyphicon ' + icon }); + $icon.css("margin-right", "0.5rem"); + $button.append($icon); + } + if($html) { + $button.append($("<span>").text($html)); + } + if(action) { + $button.click(action); + } + return $button; + } + + this.getFieldset = function(legendText) { + var $fieldset = $('<fieldset>'); + if (legendText) { + var $legend = $('<legend>', { class : 'section-legend' }).append(legendText) + $fieldset.append($legend); + } + return $fieldset; + } + + this.getLoader = function() { + return $('<div>').attr('class', 'loader col-centered'); + } + + // blocks given $component or whole screen of none given + this.startLoading = function($component) { + var params = { + message : this.getLoader(), + css: { + border: 'none', + padding: '15px', + backgroundColor: 'transparent', + }, + overlayCSS: { + opacity : 0.1, + } + }; + if ($component) { + $component.block(params); + } else { + $.blockUI(params); + } + } + + // unblocks given $component or whole screen of none given + this.stopLoading = function($component) { + if ($component) { + $component.unblock(); + } else { + $.unblockUI(); + } + } +} \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/plugin.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/plugin.js new file mode 100644 index 0000000000000000000000000000000000000000..b6803e35362dff0ecd780bb4c5a171bc4d21425d --- /dev/null +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/plugin.js @@ -0,0 +1,37 @@ +function BBBHubTechnology() { + this.init(); +} + +$.extend(BBBHubTechnology.prototype, ELNLIMSPlugin.prototype, { + // This code is copy of openBis plugin. It was taken from here: + // https://sissource.ethz.ch/sis/bbb-hub/tree/master/openbis/core-plugins/bbb-hub/1/as/webapps/snakemake/html/js + // Now it is a ELN plugin. + + init: function() { + loadJSResorce("./plugins/bbb-hub/UiComponents.js"); + loadJSResorce("./plugins/bbb-hub/BBBServerFacade.js"); + loadJSResorce("./plugins/bbb-hub/snakemake-table.js"); + loadJSResorce("./plugins/bbb-hub/snakemake-trigger.js"); + }, + + experimentFormTop : function($container, model) { + BBBServerFacade.getExperiment($container, model); + }, + + experimentFormBottom : function($container, model) { + }, + + getExtraUtilities : function() { + return [{ + icon : "fa fa-table", + uniqueViewName : "BBB_VIEW_NAME_TEST", + label : "Snakemake", + paintView : function($header, $content) { + $header.append($("<h1>").append("Public Index Page")); + BBBServerFacade.getExperiments($content); + } + }]; + } +}); + +profile.plugins.push(new BBBHubTechnology()); \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-table.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-table.js new file mode 100644 index 0000000000000000000000000000000000000000..a6add5714f1bd889e0379b02921fe668b826fe0a --- /dev/null +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-table.js @@ -0,0 +1,169 @@ +var SnakemakeTable = new function() { + + this.paintTable = function(container, experiments, roles) { + var columns = []; + + columns.push({ + label : 'Code', + property : 'code', + isExportable: false, + sortable : true + }); + + columns.push({ + label : 'Description', + property : 'description', + isExportable: false, + sortable : true + }); + + columns.push({ + label : 'Group', + property : 'group', + isExportable: false, + sortable : true + }); + + columns.push({ + label : 'E-mail', + property : 'email', + isExportable: false, + sortable : true + }); + + columns.push({ + label : 'Special access', + property : 'specialAccess', + isExportable: false, + sortable : true + }); + + var getDataList = function(callback) { + var entities = []; + + var rolesMap = SnakemakeTable.rolesMap(roles); + + var dataList = []; + + for (i = 0; i < experiments.length; i++) { + if (experiments[i].type === undefined || experiments[i].type.code !== "BBB") { + continue; + } + + var desc = experiments[i].properties["BBB.DESCRIPTION"]; + var group = experiments[i].properties["BBB.GROUP"]; + var registrator = experiments[i].registrator; + var projectCode = experiments[i].project.code; + var spaceCode = experiments[i].project.space.code; + + var model = { 'code' : experiments[i].code, + 'description' : desc === undefined ? "" : desc, + 'group' : group === undefined ? "" : group, + 'email' : registrator === null ? "" : registrator.email, + 'specialAccess' : SnakemakeTable.getSpecialAccess(rolesMap, projectCode, spaceCode) + }; + + dataList.push(model); + } + callback(dataList); + }; + + var dataGridController = new DataGridController(null, columns, [], null, getDataList, null, true, "ENTITY_TABLE_BBB", null, 90); + dataGridController.init(container); + } + + this.prepareData = function(experiments, roles) { + var data = []; + + var rolesMap = SnakemakeTable.rolesMap(roles); + + for (i = 0; i < experiments.length; i++) { + var row = []; + + if (experiments[i].type === undefined || experiments[i].type.code !== "BBB") { + continue; + } + + var desc = experiments[i].properties["BBB.DESCRIPTION"]; + var group = experiments[i].properties["BBB.GROUP"]; + var registrator = experiments[i].registrator; + var projectCode = experiments[i].project.code; + var spaceCode = experiments[i].project.space.code; + + row.push(experiments[i].code); + row.push(desc === undefined ? "" : desc); + row.push(group === undefined ? "" : group); + row.push(registrator === null ? "" : registrator.email); + row.push(SnakemakeTable.getSpecialAccess(rolesMap, projectCode, spaceCode)); + + data.push(row); + } + + return data; + } + + this.getSpecialAccess = function(rolesMap, projectCode, spaceCode) { + var projectUsers = rolesMap["projects"][projectCode] === undefined ? "" : rolesMap["projects"][projectCode]["users"].join(", "); + var projectGroups = rolesMap["projects"][projectCode] === undefined ? "" : rolesMap["projects"][projectCode]["groups"].join(", "); + + var spaceUsers = rolesMap["space"][spaceCode] === undefined ? "" : rolesMap["space"][spaceCode]["users"].join(", "); + var spaceGroups = rolesMap["space"][spaceCode] === undefined ? "" : rolesMap["space"][spaceCode]["groups"].join(", "); + + var users = projectUsers + (projectUsers !== "" && spaceUsers !== "" ? ", " : "") + spaceUsers; + var groups = projectGroups + (projectGroups !== "" && spaceGroups !== "" ? ", " : "") + spaceGroups; + + var access = ""; + if (users !== "") { + access += "<span style='font-weight:bold'>Users: </span>" + users; + } + + if (groups !== "") { + if (access !== "") { + access += "<br/>"; + } + access += "<span style='font-weight:bold'>Groups: </span>" + groups; + } + + return access; + } + + this.rolesMap = function(roles) { + var rolesMap = new Map(); + + var projects = new Map(); + var spaces = new Map(); + + rolesMap["projects"] = projects; + rolesMap["space"] = spaces; + + for (i = 0; i < roles.length; i++) { + var user = roles[i].user == null ? null : roles[i].user.userId; + var group = roles[i].authorizationGroup == null ? null : roles[i].authorizationGroup.code; + + if (roles[i].project !== null) { + var value = projects[roles[i].project.code]; + projects[roles[i].project.code] = SnakemakeTable.appendValue(value, user, group); + } else { + var value = spaces[roles[i].space.code]; + spaces[roles[i].space.code] = SnakemakeTable.appendValue(value, user, group); + } + } + + return rolesMap; + } + + this.appendValue = function(value, user, group) { + if (value === undefined) { + value = new Map(); + value["users"] = new Array(); + value["groups"] = new Array(); + } + + if (user !== null) { + value["users"].push(user); + } else { + value["groups"].push(group); + } + return value; + } +} \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-trigger.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-trigger.js new file mode 100644 index 0000000000000000000000000000000000000000..a3756fdfc4a20c0d1432b9973209524ad2dbe27b --- /dev/null +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/bbb-hub/snakemake-trigger.js @@ -0,0 +1,161 @@ +var SnakemakeTrigger = new function() { + + var groups; + var propTypeCodeToLabelMap = {}; + var dataSetPaths; + var $formContainerAll; + var $formContainerGroups; + var $dropdownGroupBy; + var $dropdownGroup1; + var $dropdownGroup2; + var $button; + var $model; + + this.paintTriggerContainers = function($container, model, experiment) { + $model = model; + SnakemakeTrigger.paintFormContainers($container); + SnakemakeTrigger.paintProcessAll(); + SnakemakeTrigger.paintGroupBy(experiment); + SnakemakeTrigger.paintGroupValues(); + groups = SnakemakeTrigger.getGroups(experiment); + files = SnakemakeTrigger.getFiles(experiment); + } + + this.paintFormContainers = function($container) { + var $fieldsetAll = UiComponents.getFieldset("Process all comparisons"); + var $fieldsetGroups = UiComponents.getFieldset("Pick groups to compare"); + $formContainerAll = $('<div>').addClass('form-group'); + $formContainerGroups = $('<div>').addClass('form-group'); + $fieldsetAll.append($formContainerAll); + $fieldsetGroups.append($formContainerGroups); + $container.append($fieldsetAll).append($fieldsetGroups); + } + + this.paintProcessAll = function() { + var $buttonAll = UiComponents.getButton("Start processing", SnakemakeTrigger.startProcessingAll); + $formContainerAll.append($buttonAll); + } + + this.paintGroupBy = function(experiment) { + var groupByOptions = []; + if (experiment.samples.length > 0) { + var sample = experiment.samples[0]; + for (var i = 0; i < sample.type.propertyAssignments.length; i++) { + var propertyAssignment = sample.type.propertyAssignments[i]; + groupByOptions.push({ + label: propertyAssignment.propertyType.label, + value: propertyAssignment.propertyType.code, + }); + propTypeCodeToLabelMap[propertyAssignment.propertyType.code] = propertyAssignment.propertyType.label; + } + } + + $dropdownGroupBy = UiComponents.addDropdown("Group by", groupByOptions, $formContainerGroups, SnakemakeTrigger.paintGroupValues); + } + + this.paintGroupValues = function(propertyType) { + if (propertyType) { + var groupOptions = groups[propertyType].map(function(value) { return { + label: value, + value: value, + }}); + } else { + var groupOptions = []; + } + + if ($dropdownGroup1) { + $dropdownGroup1.remove(); + } + if ($dropdownGroup2) { + $dropdownGroup2.remove(); + } + if ($button) { + $button.remove(); + } + + $dropdownGroup1 = UiComponents.addDropdown("Group 1", groupOptions, $formContainerGroups); + $dropdownGroup2 = UiComponents.addDropdown("Group 2", groupOptions, $formContainerGroups); + + $button = UiComponents.getButton("Start processing", SnakemakeTrigger.startProcessing); + $button.css("margin-top", "20px"); + $formContainerGroups.append($button); + } + + this.getGroups = function(experiment) { + var groups = {}; + for (var i = 0; i < experiment.samples.length; i++) { + var sample = experiment.samples[i]; + // collect groups + for (var propertyKey in sample.properties) { + if (sample.properties.hasOwnProperty(propertyKey)) { + var propertyValue = sample.properties[propertyKey]; + if (groups.hasOwnProperty(propertyKey) == false) { + groups[propertyKey] = []; + } + if (groups[propertyKey].indexOf(propertyValue) == -1) { + groups[propertyKey].push(propertyValue); + } + } + } + } + return groups; + } + + this.getFiles = function(experiment) { + dataSetPaths = []; + for (var i = 0; i < experiment.dataSets.length; i++) { + var dataSet = experiment.dataSets[i]; + if (dataSet.type.code == "FASTQ" || dataSet.type.code == "METADATA") { + var path = dataSet.physicalData.shareId + "/" + dataSet.physicalData.location; + dataSetPaths.push(path); + } + } + } + + this.startProcessingAll = function() { + UiComponents.startLoading(); + var jsonrpc = { + "method": "start_processing_all", + "params": { + "data_set_paths": dataSetPaths + } + }; + BBBServerFacade.callCustomASService(jsonrpc, $model, function(result) { + UiComponents.stopLoading(); + if (result.success) { + alert("Processing started."); + } else { + alert("Error: " + result.data); + } + }); + } + + this.startProcessing = function() { + var groupSelection = { + groupBy: propTypeCodeToLabelMap[$dropdownGroupBy.getValue()], + group1: $dropdownGroup1.getValue(), + group2: $dropdownGroup2.getValue(), + } + if (!groupSelection.groupBy || !groupSelection.group1 || !groupSelection.group2) { + alert("Select both groups first."); + return; + } + UiComponents.startLoading(); + + var jsonrpc = { + "method": "start_processing", + "params": { + "group_selection": groupSelection, + "data_set_paths": dataSetPaths + } + }; + BBBServerFacade.callCustomASService(jsonrpc, $model, function(result) { + UiComponents.stopLoading(); + if (result.success) { + alert("Processing started."); + } else { + alert("Error: " + result.data); + } + }); + } +} \ No newline at end of file diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/generic/plugin.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/generic/plugin.js index 1540f3564172c0775d4705c8fe0bca07cd1789f9..6126b9586ff14e8b11e06b9df424cb7450244539 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/generic/plugin.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/plugins/generic/plugin.js @@ -19,6 +19,7 @@ $.extend(GenericTechnology.prototype, ELNLIMSPlugin.prototype, { }, "STORAGE_POSITION" : { "SHOW" : false, + "SHOW_ON_NAV" : false, "SAMPLE_CHILDREN_DISABLED" : true }, "REQUEST" : { diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exportsApi.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exportsApi.py index 5b2123c18abba4161fdb550f1d251723a0f50e0a..42682ce0df74fa840b961310fcbfc8379efc80a9 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exportsApi.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/exports-api/exportsApi.py @@ -21,14 +21,13 @@ import jarray from ch.systemsx.cisd.openbis.dss.generic.server import DataStoreServer from ch.systemsx.cisd.openbis.generic.client.web.client.exception import UserFailureException # Zip Format -from java.io import File +from java.io import File, BufferedInputStream from java.io import FileInputStream from java.io import FileOutputStream from java.lang import String from java.lang import StringBuilder from java.util import ArrayList -from java.util.zip import ZipEntry, Deflater -from java.util.zip import ZipOutputStream +from java.util.zip import ZipEntry, Deflater, ZipOutputStream, CRC32 from org.apache.commons.io import FileUtils # Java Core from org.apache.commons.io import IOUtils @@ -263,7 +262,7 @@ def cleanUp(tempDirPath, tempZipFilePath): FileUtils.forceDelete(File(tempZipFilePath)); -def generateFilesInZip(zos, entities, includeRoot, sessionToken, tempDirPath): +def generateFilesInZip(zos, entities, includeRoot, sessionToken, tempDirPath, deflated=True): # Services used during the export process v3 = ServiceProvider.getV3ApplicationService(); v3d = ServiceProvider.getApplicationContext().getBean(V3_DSS_BEAN); @@ -364,7 +363,7 @@ def generateFilesInZip(zos, entities, includeRoot, sessionToken, tempDirPath): rawFile = File(tempDirPath + filePath + ".json"); rawFile.getParentFile().mkdirs(); IOUtils.copyLarge(rawFileInputStream, FileOutputStream(rawFile)); - addToZipFile(filePath, rawFile, zos); + addToZipFile(filePath, rawFile, zos, deflated=deflated); emptyZip = False # To avoid empty directories on the zip file, it makes the first found entity the base directory @@ -382,20 +381,20 @@ def generateFilesInZip(zos, entities, includeRoot, sessionToken, tempDirPath): if entityObj is not None and entityFilePath is not None: # JSON entityJson = String(objectMapper.writeValueAsString(entityObj)); - fileMetadatum = addFile(tempDirPath, entityFilePath, "json", entityJson.getBytes(), zos); + fileMetadatum = addFile(tempDirPath, entityFilePath, "json", entityJson.getBytes(), zos, deflated=deflated); fileMetadata.append(fileMetadatum) emptyZip = False # TEXT entityTXT = String(getTXT(entityObj, v3, sessionToken, False)); - fileMetadatum = addFile(tempDirPath, entityFilePath, "txt", entityTXT.getBytes(), zos); + fileMetadatum = addFile(tempDirPath, entityFilePath, "txt", entityTXT.getBytes(), zos, deflated=deflated); fileMetadata.append(fileMetadatum) # DOCX entityDOCX = getDOCX(entityObj, v3, sessionToken, False); - fileMetadatum = addFile(tempDirPath, entityFilePath, "docx", entityDOCX, zos); + fileMetadatum = addFile(tempDirPath, entityFilePath, "docx", entityDOCX, zos, deflated=deflated); fileMetadata.append(fileMetadatum) # HTML entityHTML = getDOCX(entityObj, v3, sessionToken, True); - fileMetadatum = addFile(tempDirPath, entityFilePath, "html", entityHTML, zos); + fileMetadatum = addFile(tempDirPath, entityFilePath, "html", entityHTML, zos, deflated=deflated); fileMetadata.append(fileMetadatum) operationLog.info("--> Entity type: " + type + " permId: " + permId + " post html."); if emptyZip: @@ -651,12 +650,12 @@ def objToStrArray(objArray): return result -def addFile(tempDirPath, entityFilePath, extension, fileContent, zos): +def addFile(tempDirPath, entityFilePath, extension, fileContent, zos, deflated=True): entityFileNameWithExtension = entityFilePath + "." + extension entityFile = File(tempDirPath + entityFileNameWithExtension); entityFile.getParentFile().mkdirs(); IOUtils.write(fileContent, FileOutputStream(entityFile)); - addToZipFile(entityFileNameWithExtension, entityFile, zos); + addToZipFile(entityFileNameWithExtension, entityFile, zos, deflated=deflated); FileUtils.forceDelete(entityFile); extensionToMimeType = { @@ -685,19 +684,45 @@ def getFilePath(spaceCode, projCode, expCode, sampCode, dataCode): fileName += "/" + dataCode; return fileName; -def addToZipFile(path, file, zos): - fis = FileInputStream(file); - zipEntry = ZipEntry(path[1:]); # Making paths relative to make them compatible with Windows zip implementation - zos.putNextEntry(zipEntry); +def addToZipFile(path, file, zos, deflated=True): + zipEntry = ZipEntry(path[1:]) # Making paths relative to make them compatible with Windows zip implementation + if not deflated: + zipEntry.setMethod(ZipOutputStream.STORED) + zipEntry.setSize(file.length()) + zipEntry.setCompressedSize(-1) + crc = getFileCRC(file) + zipEntry.setCrc(crc) + else: + zipEntry.setMethod(ZipOutputStream.DEFLATED) + + zos.putNextEntry(zipEntry) - bytes = jarray.zeros(1024, "b"); - length = fis.read(bytes); - while length >= 0: - zos.write(bytes, 0, length); - length = fis.read(bytes); + try: + bis = BufferedInputStream(FileInputStream(file)) + bytes = jarray.zeros(1024, "b") + length = bis.read(bytes) + while length >= 0: + zos.write(bytes, 0, length) + length = bis.read(bytes) + finally: + zos.closeEntry() + if bis is not None: + bis.close() - zos.closeEntry(); - fis.close(); +def getFileCRC(file): + bis = None + crc = CRC32() + try: + bis = BufferedInputStream(FileInputStream(file)) + b = jarray.zeros(1024, "b") + length = bis.read(b) + while length != -1: + crc.update(b, 0, length) + length = bis.read(b) + finally: + if bis is not None: + bis.close() + return crc.getValue() def getConfigurationProperty(transaction, propertyName): threadProperties = transaction.getGlobalState().getThreadParameters().getThreadProperties(); @@ -719,9 +744,10 @@ def generateZipFile(entities, params, tempDirPath, tempZipFilePath, deflated=Tru fos = FileOutputStream(tempZipFilePath) zos = ZipOutputStream(fos) if not deflated: + zos.setMethod(ZipOutputStream.STORED) zos.setLevel(Deflater.NO_COMPRESSION) - fileMetadata = generateFilesInZip(zos, entities, includeRoot, sessionToken, tempDirPath) + fileMetadata = generateFilesInZip(zos, entities, includeRoot, sessionToken, tempDirPath, deflated=deflated) finally: if zos is not None: zos.close() diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/rc-exports-api/rcExports.py b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/rc-exports-api/rcExports.py index e7ec266b7609e990e4a8992e5563e7457dc9d623..2c48c58426a2dd243546ee575f825c3ae7296423 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/rc-exports-api/rcExports.py +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/dss/reporting-plugins/rc-exports-api/rcExports.py @@ -228,9 +228,10 @@ def generateExternalZipFile(params, exportDirPath, contentZipFilePath, contentZi fos = FileOutputStream(exportZipFileName) zos = ZipOutputStream(fos) if not deflated: + zos.setMethod(ZipOutputStream.STORED) zos.setLevel(Deflater.NO_COMPRESSION) - addToZipFile(' ' + contentZipFileName, File(contentZipFilePath), zos) + addToZipFile(' ' + contentZipFileName, File(contentZipFilePath), zos, deflated) generateXML(zipOutputStream=zos, fileMetadata=fileMetadata, exportDirPath=exportDirPath, userInformation=userInformation, entities=entities, params=params) diff --git a/openbis_standard_technologies/dist/tarball/installer/data/doc/getting-started-with-openBIS.html b/openbis_standard_technologies/dist/tarball/installer/data/doc/getting-started-with-openBIS.html index 279e4d88889bff95117328a2e2d69a42cac095d5..087d6e1a246b4999a231532fe4e89b5a1a6ce6b3 100644 --- a/openbis_standard_technologies/dist/tarball/installer/data/doc/getting-started-with-openBIS.html +++ b/openbis_standard_technologies/dist/tarball/installer/data/doc/getting-started-with-openBIS.html @@ -145,9 +145,12 @@ <ol> <li>Log in to <a href="https://${HOSTNAME}:8443/openbis/webapp/eln-lims">ELN/LIMS</a> interface as admin.</li> - <li>Using the navigation tree on the left hand-side go to LAB NOTEBOOK -> DEFAULT_LAB_NOTEBOOK -> DEFAULT_PROJECT -> DEFAULT_EXPERIMENT. </li> - <li>Click on the plus sign on the toolbar and create a new EXPERIMENTAL_STEP.</li> - <li>After creating it, a new component will appear on the right hand-side. Select "ELN Preview Image" from the dropdown and drop an image file in the Files Uploader.</li> + <li>Using the navigation tree on the left hand-side go to <em>Lab Notebook</em> -> <em>Others</em> + -> <em>Default Lab Notebook</em> -> <em>Default Project</em> -> <em>Default Experiment</em></li> + <li>Click on the Upload plus sign on the toolbar and create a new <em>Experimental Step</em>.</li> + <li>Click on the Upload button.</li> + <li>Choose <em>Eln Preview</em> as Data Set Type and drop an image file in the Files Uploader section.</li> + <li>Click the Save button.</li> <li>Now you have a basic lab notebook with an experiment, experimental step and one image used as preview.</li> </ol> diff --git a/pybis/src/python/CHANGELOG.md b/pybis/src/python/CHANGELOG.md index 8d7c4903179742ece72e4492062d01caf1335b7e..ddc9cefd6540d09e80d603c682be4513a9200b1a 100644 --- a/pybis/src/python/CHANGELOG.md +++ b/pybis/src/python/CHANGELOG.md @@ -1,3 +1,7 @@ +## Changes with pybis-1.11.1 + +- added automatically accepting host key, otherwise mount() will hang the first time + ## Changes with pybis-1.11.0 * implemented mount() and unmount() methods to mount openBIS dataStore server via SSHFS and FUSE diff --git a/pybis/src/python/pybis/__init__.py b/pybis/src/python/pybis/__init__.py index 264495435a19d4dd8c4c63f97115a4d484de6994..b0e578dcb1db65cd510e7b661f80be5f42689c29 100644 --- a/pybis/src/python/pybis/__init__.py +++ b/pybis/src/python/pybis/__init__.py @@ -1,7 +1,7 @@ name = 'pybis' __author__ = 'Swen Vermeul' __email__ = 'swen@ethz.ch' -__version__ = '1.11.0' +__version__ = '1.11.1' from . import pybis from .pybis import Openbis diff --git a/pybis/src/python/pybis/pybis.py b/pybis/src/python/pybis/pybis.py index 9354ad34bf216f2c68131cbad83f006277627454..4729f9e0d3c8beed22bcb9468c4baa0483e2204f 100644 --- a/pybis/src/python/pybis/pybis.py +++ b/pybis/src/python/pybis/pybis.py @@ -1106,8 +1106,8 @@ class Openbis: os_options = { - "darwin": "-oauto_cache,reconnect,defer_permissions,noappledouble,negative_vncache,volname={}".format(hostname), - "linux": "-oauto_cache,reconnect", + "darwin": "-oauto_cache,reconnect,defer_permissions,noappledouble,negative_vncache,volname={} -oStrictHostKeyChecking=no ".format(hostname), + "linux": "-oauto_cache,reconnect -oStrictHostKeyChecking=no", } if volname is None: diff --git a/pybis/src/python/setup.py b/pybis/src/python/setup.py index 43b0dc555b95a310ca05be6d47fc51986ab007e0..08a6e22b1766a31aa4cf8219855a2d1023e9b372 100644 --- a/pybis/src/python/setup.py +++ b/pybis/src/python/setup.py @@ -11,7 +11,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setup( name='PyBIS', - version= '1.11.0', + version= '1.11.1', author='Swen Vermeul • ID SIS • ETH Zürich', author_email='swen@ethz.ch', description='openBIS connection and interaction, optimized for using with Jupyter',