From 5ac4971785d5c6e4bd2fda05fe2d0f1834dfda9f Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Mon, 5 Sep 2022 15:16:34 +0200 Subject: [PATCH 1/4] Prepare version 1.13.0 (#59) * use latest version of exp design lib (#54) * only allow unique header columns for metadata update (#53) Co-authored-by: Steffengreiner * Add message if space already exists, re-enable button (#55) * remove parent pom (#49) * v1.6.0 of utils lib * fix workflows Co-authored-by: Steffengreiner Co-authored-by: Tobias Koch Co-authored-by: Sven F * add description for imaging support option (#57) * improve UI messages (#56) --- .github/ISSUE_TEMPLATE/bug_report.md | 28 --- .github/ISSUE_TEMPLATE/feature_request.md | 20 -- .github/ISSUE_TEMPLATE/general_question.md | 13 -- .github/workflows/build-package.yml | 4 +- .github/workflows/codeql-analysis.yml | 81 ++++---- .github/workflows/nexus-publish-snapshots.yml | 2 +- .github/workflows/run-tests.yml | 2 +- CHANGELOG.rst | 11 ++ docs/conf.py | 4 +- pom.xml | 181 +++++++++++++++++- .../qbic/portal/portlet/ProjectWizardUI.java | 5 +- .../steps/ProjectContextStep.java | 5 +- .../steps/SummaryRegisterStep.java | 2 +- .../ProjectInformationComponent.java | 2 +- .../uicomponents/UploadComponent.java | 1 + .../qbic/projectwizard/views/AdminView.java | 7 +- .../views/MetadataUploadView.java | 32 +++- 17 files changed, 266 insertions(+), 134 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/general_question.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index d162979e..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: Bug report -about: Create a bug report to help us improve -title: 'Bug Summary' -labels: 'bug' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. ... -2. ... -3. ... - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**System [please complete the following information]:** - - OS: e.g. [Ubuntu 18.04] - - Language Version: [e.g. Python 3.8] - - Virtual environment: [e.g. Conda] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 3bed8fc2..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest a new feature -title: 'Feature Request Summary' -labels: 'enhancement' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when ... - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/general_question.md b/.github/ISSUE_TEMPLATE/general_question.md deleted file mode 100644 index 37c39b39..00000000 --- a/.github/ISSUE_TEMPLATE/general_question.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: General question -about: Ask a question about anything related to this project -title: 'Question' -labels: 'question' -assignees: '' - ---- - -**Question** - -Please ask your question here. It can be about the usage of this project, the internals, the implementation or whatever interests you. -Please use the BUG template for bugs and the FEATURE REQUEST template for feature requests. diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index fcf076fb..d616186c 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -3,7 +3,7 @@ name: Build Maven Package on: push: branches: - - '*' + - '**' pull_request: # The branches below must be a subset of the branches above branches: [ main, master ] @@ -18,7 +18,6 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Load local Maven repository cache uses: actions/cache@v2 with: @@ -26,6 +25,5 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - - name: Run mvn package run: mvn -B package --file pom.xml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5a03f334..803f763e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,16 +13,15 @@ name: "CodeQL" on: push: - branches: [ master, development, patch/*, release/*, hotfix/* ] + branches: [ main, master, development, release/*, hotfix/* ] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [ main, master ] schedule: - cron: '21 1 * * 4' jobs: analyze: - name: analyze runs-on: ubuntu-latest permissions: actions: read @@ -37,47 +36,47 @@ jobs: # Learn more about CodeQL language support at https://git.io/codeql-language-support steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - settings-path: ${{ github.workspace }} + - name: Checkout repository + uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + settings-path: ${{ github.workspace }} - - name: Load local Maven repository cache - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + - name: Load local Maven repository cache + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - #- run: | - # make bootstrap - # make release + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/nexus-publish-snapshots.yml b/.github/workflows/nexus-publish-snapshots.yml index 4fc649bc..f5af5f15 100644 --- a/.github/workflows/nexus-publish-snapshots.yml +++ b/.github/workflows/nexus-publish-snapshots.yml @@ -10,7 +10,7 @@ on: - development jobs: - publish_snapshots: + publish_snapshot: runs-on: ubuntu-latest diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ab4e81d9..5708a258 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -3,7 +3,7 @@ name: Run Maven Tests on: push: branches: - - '*' + - '**' pull_request: # The branches below must be a subset of the branches above branches: [ main, master ] diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d99eb434..d1038007 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,17 @@ Changelog This project adheres to `Semantic Versioning `_. +1.13.0-SNAPSHOT (2021-06-07) +---------------------------- + +**Added** + +**Fixed** + +**Dependencies** + +**Deprecated** + 1.12.6 (2022-01-04) ------------------- diff --git a/docs/conf.py b/docs/conf.py index aedbdf64..2833094c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,9 +55,9 @@ # the built documents. # # The short X.Y version. -version = '1.12.2' +version = '1.13.0-SNAPSHOT' # The full version, including alpha/beta/rc tags. -release = '1.12.2' +release = '1.13.0-SNAPSHOT' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pom.xml b/pom.xml index 90d17d88..41bddf0a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,21 +4,37 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 projectwizard-portlet - 1.12.7 + life.qbic + 1.13.0-SNAPSHOT ProjectWizard Portlet https://github.com/qbicsoftware/projectwizard-portlet Creates hierarchical experiments using factorial design. war - - life.qbic - portlet-parent-pom - 3.1.4 - + 1.8 + 1.8 7.7.28 7.7.28 2.17.1 + 6.2.5 + 6.2.5 + 9.4.10.v20180503 + 2 + + + true + nexus-releases + QBiC Releases + https://qbic-repo.qbic.uni-tuebingen.de/repository/maven-releases + + + false + nexus-snapshots + QBiC Snapshots + https://qbic-repo.qbic.uni-tuebingen.de/repository/maven-snapshots + + @@ -73,6 +89,27 @@ + + + com.vaadin + vaadin-server + ${vaadin.version} + + + com.vaadin + vaadin-client-compiled + ${vaadin.version} + + + com.vaadin + vaadin-client + ${vaadin.version} + + + com.vaadin + vaadin-themes + ${vaadin.version} + org.apache.logging.log4j log4j-core @@ -88,9 +125,16 @@ core-utils-lib 1.7.0 + + com.liferay.portal + portal-service + ${liferay.version} + provided + org.mariadb.jdbc mariadb-java-client + 2.7.5 @@ -103,7 +147,7 @@ life.qbic experimental-design-lib - 0.20.1 + 0.20.2 @@ -166,4 +210,127 @@ + + + + com.vaadin + vaadin-maven-plugin + ${vaadin.plugin.version} + + -Xmx1024m -Xss1024k + + ${basedir}/src/main/webapp/VAADIN/widgetsets + ${basedir}/src/main/webapp/VAADIN/widgetsets + + ${project.build.directory} + ${project.build.directory}/gwt-deploy + + false + true + + false + + + + + + + + + clean + resources + update-theme + update-widgetset + compile-theme + compile + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.plugin.version} + + + ${jetty.scanIntervalSeconds} + true + 8005 + STOP + + + + start-jetty + pre-integration-test + + start + + + ${jetty.scanIntervalSeconds} + + + + stop-jetty + post-integration-test + + stop + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.2.2 + + + docx + pdf + + true + + WEB-INF/classes/VAADIN/widgetsets/WEB-INF/** + + + true + src/main/resources + WEB-INF/classes + + + true + src/main/webapp/WEB-INF + WEB-INF + + + + + + + com.liferay.maven.plugins + liferay-maven-plugin + ${liferay.maven.plugin.version} + + ${liferay.auto.deploy.dir} + ${liferay.app.server.deploy.dir} + ${liferay.app.server.lib.global.dir} + ${liferay.app.server.portal.dir} + ${liferay.version} + portlet + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + + diff --git a/src/main/java/life/qbic/portal/portlet/ProjectWizardUI.java b/src/main/java/life/qbic/portal/portlet/ProjectWizardUI.java index bc53c96d..c4fc3700 100644 --- a/src/main/java/life/qbic/portal/portlet/ProjectWizardUI.java +++ b/src/main/java/life/qbic/portal/portlet/ProjectWizardUI.java @@ -19,11 +19,11 @@ import org.vaadin.teemu.wizards.event.WizardStepSetChangedEvent; import com.liferay.portal.model.User; import com.liferay.portal.model.UserGroup; +import com.vaadin.ui.themes.ValoTheme; import com.vaadin.annotations.Theme; import com.vaadin.annotations.Widgetset; import com.vaadin.server.FontAwesome; import com.vaadin.server.VaadinRequest; -import com.vaadin.ui.themes.ValoTheme; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.TabSheet; @@ -51,7 +51,6 @@ import life.qbic.projectwizard.views.AdminView; import life.qbic.projectwizard.views.MetadataUploadView; - @Theme("mytheme") @Widgetset("life.qbic.portlet.AppWidgetSet") public class ProjectWizardUI extends QBiCPortletUI { @@ -88,7 +87,7 @@ protected Layout getPortletContent(final VaadinRequest request) { if (PortalUtils.isLiferayPortlet()) { // read in the configuration file logger.info("Wizard is running on Liferay and user is logged in."); - userID = PortalUtils.getUser().getScreenName(); + userID = PortalUtils.getScreenName(); } else { if (development) { logger.warn("Checks for local dev version successful. User is granted admin status."); diff --git a/src/main/java/life/qbic/projectwizard/steps/ProjectContextStep.java b/src/main/java/life/qbic/projectwizard/steps/ProjectContextStep.java index cb1e331c..ef415efd 100644 --- a/src/main/java/life/qbic/projectwizard/steps/ProjectContextStep.java +++ b/src/main/java/life/qbic/projectwizard/steps/ProjectContextStep.java @@ -70,9 +70,8 @@ public class ProjectContextStep implements WizardStep { private CheckBox pilotBox; /** - * Create a new Context Step for the wizard - * - * @param newProjectCode + * + * @param projSelect ProjectInformationComponent storing project name and basic metadata */ public ProjectContextStep(ProjectInformationComponent projSelect) { main = new VerticalLayout(); diff --git a/src/main/java/life/qbic/projectwizard/steps/SummaryRegisterStep.java b/src/main/java/life/qbic/projectwizard/steps/SummaryRegisterStep.java index 57ee8a1f..5b647d1f 100644 --- a/src/main/java/life/qbic/projectwizard/steps/SummaryRegisterStep.java +++ b/src/main/java/life/qbic/projectwizard/steps/SummaryRegisterStep.java @@ -100,7 +100,7 @@ public SummaryRegisterStep() { main.addComponent(Styles.questionize(tsvInfo, "You can download a technical spreadsheet to register your samples at a later time instead. More informative spreadsheets are available in the next step.", "TSV Download")); - + Container cont = new IndexedContainer(); cont.addContainerProperty("caption", String.class, ""); cont.getContainerProperty(cont.addItem(), "caption").setValue(paidOption); diff --git a/src/main/java/life/qbic/projectwizard/uicomponents/ProjectInformationComponent.java b/src/main/java/life/qbic/projectwizard/uicomponents/ProjectInformationComponent.java index 80a71cc1..46ceb9a4 100644 --- a/src/main/java/life/qbic/projectwizard/uicomponents/ProjectInformationComponent.java +++ b/src/main/java/life/qbic/projectwizard/uicomponents/ProjectInformationComponent.java @@ -79,7 +79,7 @@ public ProjectInformationComponent(List spaces, Set people) { addComponent(Styles.questionize(spaceBox, "Name of the project", "Project Name")); imgCheck = new CheckBox("Imaging Support"); - addComponent(imgCheck); + addComponent(Styles.questionize(imgCheck, "Needs to be checked to store imaging data in Omero", "Imaging Support")); ComboBox prBox = new ComboBox("Sub-Project"); prBox.setStyleName(Styles.boxTheme); diff --git a/src/main/java/life/qbic/projectwizard/uicomponents/UploadComponent.java b/src/main/java/life/qbic/projectwizard/uicomponents/UploadComponent.java index 842afb78..22eac226 100644 --- a/src/main/java/life/qbic/projectwizard/uicomponents/UploadComponent.java +++ b/src/main/java/life/qbic/projectwizard/uicomponents/UploadComponent.java @@ -153,6 +153,7 @@ public void uploadFailed(FailedEvent event) { } else { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); + if (event.getReason() != null) event.getReason().printStackTrace(pw); logger.error("Upload cancelled due to error."); diff --git a/src/main/java/life/qbic/projectwizard/views/AdminView.java b/src/main/java/life/qbic/projectwizard/views/AdminView.java index 5376ff79..5eca86c3 100644 --- a/src/main/java/life/qbic/projectwizard/views/AdminView.java +++ b/src/main/java/life/qbic/projectwizard/views/AdminView.java @@ -167,8 +167,13 @@ public void buttonClick(ClickEvent event) { "There seems to have been a problem while creating the space. Do the specified users already exist in openbis? If not, create them.", NotificationType.ERROR); } - createSpace.setEnabled(true); + + } else { + Styles.notification("Problem creating space", + "This space already exists.", + NotificationType.DEFAULT); } + createSpace.setEnabled(true); } } }); diff --git a/src/main/java/life/qbic/projectwizard/views/MetadataUploadView.java b/src/main/java/life/qbic/projectwizard/views/MetadataUploadView.java index dc3854dd..d5761c47 100644 --- a/src/main/java/life/qbic/projectwizard/views/MetadataUploadView.java +++ b/src/main/java/life/qbic/projectwizard/views/MetadataUploadView.java @@ -173,7 +173,7 @@ public MetadataUploadView(IOpenBisClient openbis, Vocabularies vocabularies, addComponent(separatorSelection); separatorSelection.select("Tab"); separatorSelection.setVisible(false); - upload = new UploadComponent("Upload Metadata (tab-separated)", "Upload", + upload = new UploadComponent("Upload Metadata", "Upload", ProjectWizardUI.tmpFolder, user, 200000); upload.setVisible(false); addComponent(upload); @@ -219,9 +219,10 @@ public void valueChange(ValueChangeEvent event) { @Override public void uploadFinished(FinishedEvent event) { - if (upload.wasSuccess()) + if (upload.wasSuccess()) { try { - send.setVisible(parseTSV(upload.getFile())); + boolean isTsvParsed = parseTSV(upload.getFile()); + send.setVisible(isTsvParsed); reload.setVisible(true); } catch (IOException e) { e.printStackTrace(); @@ -229,6 +230,7 @@ public void uploadFinished(FinishedEvent event) { // TODO Auto-generated catch block e.printStackTrace(); } + } } }); @@ -240,6 +242,7 @@ public void buttonClick(ClickEvent event) { ingestTable(new MetadataUpdateReadyRunnable(view), progressBar, progressInfo); send.setEnabled(false); } + }); } @@ -543,6 +546,17 @@ public void selectedTabChange(SelectedTabChangeEvent event) { } reader.close(); String[] header = data.get(0); + + Set uniqueHeaders = new HashSet<>(); + for (String currentHeader : header) { + if(!uniqueHeaders.add(currentHeader)) { + error = "Column names in your upload must be unique."; + Styles.notification(String.format("Duplicate header found: %s", currentHeader), error, NotificationType.ERROR); + reader.close(); + return false; + } + } + data.remove(0); int barcodeCol = -1; String projectCode = ""; @@ -557,7 +571,7 @@ public void selectedTabChange(SelectedTabChangeEvent event) { } if (barcodeCol == -1) { error = - "No barcode column found. Make sure one column contains QBiC Barcodes to map your information to existing samples!"; + "No barcode column found or first sample code is wrong. Make sure one column contains QBiC Barcodes to map your information to existing samples!"; Styles.notification("File Incomplete", error, NotificationType.ERROR); return false; } @@ -571,8 +585,7 @@ public void selectedTabChange(SelectedTabChangeEvent event) { } barcodeCol = 0; } - List projectSamples = - openbis.getSamplesOfProject(projectCode); + List projectSamples = openbis.getSamplesOfProject(projectCode); codesToSamples = new HashMap(); Map> sampleTypeToAttributes = new HashMap>(); @@ -652,9 +665,9 @@ public void selectedTabChange(SelectedTabChangeEvent event) { row.add("Properties -->"); for (int i = 1; i < header.length; i++) { String headline = header[i]; - List sortedOtions = new ArrayList<>(options); - Collections.sort(sortedOtions); - ComboBox attributeOptions = new ComboBox("", sortedOtions); + List sortedOptions = new ArrayList<>(options); + Collections.sort(sortedOptions); + ComboBox attributeOptions = new ComboBox("", sortedOptions); attributeOptions.setStyleName(Styles.boxTheme); attributeOptions.setImmediate(true); attributeOptions.setInputPrompt("