Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
ericenns committed Nov 4, 2022
2 parents 4395b5c + b8ada8b commit 47ee6d6
Show file tree
Hide file tree
Showing 35 changed files with 1,130 additions and 807 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

## [Unreleased]

## [22.09.2] - 2022/11/04
* [UI]: Fixed bug causing associated project samples to be added to the cart with the wrong project identifier. See [PR 1395](https://github.com/phac-nml/irida/pull/1395)
* [UI]: Fixed bug preventing the removal of locked samples within a project. See [PR 1396](https://github.com/phac-nml/irida/pull/1396)
* [Developer/UI]: Fixed bug preventing managers from sharing project samples. See [PR 1398](https://github.com/phac-nml/irida/pull/1398)
* [UI]: Fixed bug where a sample added to the cart from the sample detail viewer still had a `Add to Cart` button if the viewer was closed and relaunched. See [PR 1397](https://github.com/phac-nml/irida/pull/1397)
* [Galaxy]: Fixed missing "deferred" state found in the Galaxy API but not in the IRIDA API for getting status of Galaxy histories. See [PR 1402](https://github.com/phac-nml/irida/pull/1402).
* [UI]: Fixed a bug that allowed the sharing and moving of locked samples. See [PR 1403](https://github.com/phac-nml/irida/pull/1403)

## [22.09.1] - 2022/10/21
* [UI]: Fixed when sharing or exporting sample on the project sample page, and other minor bugs. See [PR 1382](https://github.com/phac-nml/irida/pull/1382)

Expand Down Expand Up @@ -135,8 +143,9 @@

## [...previous](https://github.com/phac-nml/irida/blob/21.09.2/CHANGELOG.md)

[Unreleased]: https://github.com/phac-nml/irida/compare/22.09.1...HEAD
[Unreleased]: https://github.com/phac-nml/irida/compare/22.09.2...HEAD

[22.09.2]: https://github.com/phac-nml/irida/compare/22.09.1...22.09.2
[22.09.1]: https://github.com/phac-nml/irida/compare/22.09...22.09.1
[22.09]: https://github.com/phac-nml/irida/compare/22.05.5...22.09
[22.05.5]: https://github.com/phac-nml/irida/compare/22.05.4...22.05.5
Expand Down
2 changes: 1 addition & 1 deletion doc/_includes/tutorials/common/ncbi-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Default values for all samples can be set by clicking on the "Default Sample Set

Once all fields and files are selected for a sample, the label will change from "MISSING DATA" to "VALID" indicating that the sample is ready for submission. All samples must be valid before submitting.

![Default Sample Settings]({{ site.baseurl}}/images/tutorials/common/ncbi-export/ncbi-export-sample-validation.png)
![Sample Validation]({{ site.baseurl}}/images/tutorials/common/ncbi-export/ncbi-export-sample-validation.png)

After entering this metadata you can select which files should be uploaded from each sample. Only files selected with checkboxes will be uploaded to NCBI.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
/**
* Defines the state of a workflow.
* Based off of states defined within Galaxy.
* @see <a href="https://bitbucket.org/galaxy/galaxy-dist/src/097bbb3b7d3246faaa5188a1fc2a79b01630025c/lib/galaxy/model/__init__.py#cl-1316">Galaxy Dataset Model</a>
* @see <a href="https://bitbucket.org/galaxy/galaxy-dist/src/097bbb3b7d3246faaa5188a1fc2a79b01630025c/lib/galaxy/web/base/controller.py#cl-429">Galaxy API</a>
* @see <a href="https://github.com/galaxyproject/galaxy/blob/21375c6b821b85863a6c95f4ed1ebd6a217495f1/lib/galaxy/model/__init__.py#L3410-L3427">Galaxy Dataset Model</a>
* @see <a href="https://github.com/galaxyproject/galaxy/blob/21375c6b821b85863a6c95f4ed1ebd6a217495f1/lib/galaxy/webapps/galaxy/api/histories.py#L181-L192">Galaxy API show_history</a>
* @see <a href="https://github.com/jmchilton/blend4j/blob/c5e3f157d402950a843d4e395e1daf889945d587/src/main/java/com/github/jmchilton/blend4j/galaxy/beans/HistoryDetails.java">HistoryDetails in blend4j</a>
*
*/
Expand All @@ -30,6 +30,7 @@ public enum GalaxyWorkflowState {
PAUSED("paused"),
SETTING_METADATA("setting_metadata"),
FAILED_METADATA("failed_metadata"),
DEFERRED("deferred"),
RESUBMITTED("resubmitted");

private static Map<String, GalaxyWorkflowState> stateMap = new HashMap<>();
Expand Down Expand Up @@ -66,4 +67,4 @@ public static GalaxyWorkflowState stringToState(String stateString) {
public String toString() {
return stateString;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
package ca.corefacility.bioinformatics.irida.ria.web.ajax.projects;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;

import ca.corefacility.bioinformatics.irida.ria.web.ajax.dto.CreateSampleRequest;
import ca.corefacility.bioinformatics.irida.ria.web.ajax.dto.SampleFilesResponse;
import ca.corefacility.bioinformatics.irida.ria.web.ajax.dto.SampleNameValidationResponse;
Expand All @@ -32,6 +20,16 @@
import ca.corefacility.bioinformatics.irida.ria.web.samples.dto.ShareSamplesRequest;
import ca.corefacility.bioinformatics.irida.ria.web.services.UIProjectSampleService;
import ca.corefacility.bioinformatics.irida.ria.web.services.UISampleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Locale;

/**
* AJAX Controller for handling asynchronous requests for project samples.
Expand Down Expand Up @@ -148,8 +146,8 @@ public ResponseEntity<AjaxResponse> mergeSamples(@PathVariable Long projectId, @
@DeleteMapping("/remove")
public ResponseEntity<AjaxResponse> removeSamplesFromProject(@PathVariable long projectId,
@RequestBody RemoveSamplesRequest request) {
String result = uiSampleService.removeSamplesFromProject(projectId, request.getSampleIds());
return ResponseEntity.ok(new AjaxSuccessResponse(result));
uiSampleService.removeSamplesFromProject(projectId, request.getSampleIds());
return ResponseEntity.ok(new AjaxSuccessResponse(""));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,80 +1,22 @@
package ca.corefacility.bioinformatics.irida.ria.web.services;

import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Path;
import java.text.SimpleDateFormat;
import java.time.Instant;

import java.io.OutputStreamWriter;
import java.nio.file.attribute.BasicFileAttributes;

import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException;

import ca.corefacility.bioinformatics.irida.exceptions.ConcatenateException;
import ca.corefacility.bioinformatics.irida.exceptions.EntityNotFoundException;
import ca.corefacility.bioinformatics.irida.model.assembly.GenomeAssembly;
import ca.corefacility.bioinformatics.irida.model.assembly.UploadedAssembly;
import ca.corefacility.bioinformatics.irida.model.enums.ProjectMetadataRole;
import ca.corefacility.bioinformatics.irida.model.sample.MetadataTemplateField;
import ca.corefacility.bioinformatics.irida.model.sample.metadata.MetadataRestriction;
import ca.corefacility.bioinformatics.irida.model.sequenceFile.*;
import ca.corefacility.bioinformatics.irida.repositories.sample.MetadataEntryRepository;
import ca.corefacility.bioinformatics.irida.repositories.sample.MetadataRestrictionRepository;
import ca.corefacility.bioinformatics.irida.ria.web.samples.SamplePairer;
import ca.corefacility.bioinformatics.irida.ria.web.samples.dto.*;
import ca.corefacility.bioinformatics.irida.service.sample.MetadataTemplateService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;

import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.DateFormatConverter;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;

import ca.corefacility.bioinformatics.irida.model.assembly.GenomeAssembly;

import ca.corefacility.bioinformatics.irida.model.joins.impl.ProjectSampleJoin;
import ca.corefacility.bioinformatics.irida.model.joins.impl.SampleGenomeAssemblyJoin;
import ca.corefacility.bioinformatics.irida.model.project.Project;
import ca.corefacility.bioinformatics.irida.model.sample.MetadataTemplateField;
import ca.corefacility.bioinformatics.irida.model.sample.QCEntry;
import ca.corefacility.bioinformatics.irida.model.sample.Sample;
import ca.corefacility.bioinformatics.irida.model.sample.SampleSequencingObjectJoin;
import ca.corefacility.bioinformatics.irida.model.sample.metadata.MetadataEntry;
import ca.corefacility.bioinformatics.irida.ria.web.samples.dto.SampleGenomeAssemblyFileModel;
import ca.corefacility.bioinformatics.irida.ria.web.samples.dto.SampleSequencingObjectFileModel;
import ca.corefacility.bioinformatics.irida.model.sequenceFile.Fast5Object;
import ca.corefacility.bioinformatics.irida.model.sequenceFile.SequenceFilePair;
import ca.corefacility.bioinformatics.irida.model.sequenceFile.SequencingObject;
import ca.corefacility.bioinformatics.irida.model.sequenceFile.SingleEndSequenceFile;
import ca.corefacility.bioinformatics.irida.ria.web.samples.dto.SampleDetails;
import ca.corefacility.bioinformatics.irida.ria.web.samples.dto.SampleFiles;
import ca.corefacility.bioinformatics.irida.ria.web.samples.dto.ShareMetadataRestriction;
import ca.corefacility.bioinformatics.irida.ria.web.samples.dto.ShareSamplesRequest;

import ca.corefacility.bioinformatics.irida.model.sample.metadata.MetadataRestriction;
import ca.corefacility.bioinformatics.irida.model.sequenceFile.*;
import ca.corefacility.bioinformatics.irida.repositories.sample.MetadataEntryRepository;
import ca.corefacility.bioinformatics.irida.repositories.sample.MetadataRestrictionRepository;
import ca.corefacility.bioinformatics.irida.repositories.specification.ProjectSampleJoinSpecification;
import ca.corefacility.bioinformatics.irida.repositories.specification.SearchCriteria;
import ca.corefacility.bioinformatics.irida.repositories.specification.SearchOperation;
Expand All @@ -92,19 +34,51 @@
import ca.corefacility.bioinformatics.irida.ria.web.projects.dto.samples.ProjectSamplesFilter;
import ca.corefacility.bioinformatics.irida.ria.web.projects.dto.samples.SampleObject;
import ca.corefacility.bioinformatics.irida.ria.web.projects.error.SampleMergeException;

import ca.corefacility.bioinformatics.irida.ria.web.samples.SamplePairer;
import ca.corefacility.bioinformatics.irida.ria.web.samples.dto.*;
import ca.corefacility.bioinformatics.irida.security.permissions.sample.UpdateSamplePermission;
import ca.corefacility.bioinformatics.irida.service.GenomeAssemblyService;
import ca.corefacility.bioinformatics.irida.service.ProjectService;
import ca.corefacility.bioinformatics.irida.service.SequencingObjectService;

import ca.corefacility.bioinformatics.irida.service.sample.MetadataTemplateService;
import ca.corefacility.bioinformatics.irida.service.sample.SampleService;

import com.google.common.base.Strings;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.util.DateFormatConverter;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.data.domain.Page;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;

import com.google.common.collect.ImmutableList;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

/**
* UI Service for samples
Expand Down Expand Up @@ -1215,12 +1189,10 @@ private SequenceFile createSequenceFile(MultipartFile file) throws IOException {
*
* @param projectId identifier for the project
* @param sampleIds list of sampleIds to remove
* @return result of the removal of samples
*/
public String removeSamplesFromProject(Long projectId, List<Long> sampleIds) {
public void removeSamplesFromProject(Long projectId, List<Long> sampleIds) {
Project project = projectService.read(projectId);
projectService.removeSamplesFromProject(project, sampleService.readMultiple(sampleIds));
return "FOOBAR";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public Sample getSampleBySampleName(Project project, String sampleName) {
*/
@Override
@Transactional(readOnly = true)
@PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_SEQUENCER') or hasPermission(#project, 'canReadProject')")
@PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_SEQUENCER') or hasPermission(#projectIds, 'canReadProject')")
public Map<String, List<Long>> getSampleIdsBySampleNameForProjects(List<Long> projectIds,
List<String> sampleNames) {
return sampleRepository.getSampleIdsBySampleNameInProjects(projectIds, sampleNames)
Expand Down Expand Up @@ -673,8 +673,9 @@ public List<QCEntry> getQCEntriesForSample(Sample sample) {
public Map<Long, List<QCEntry>> getQCEntriesForSamples(List<Sample> samples) {
return qcEntryRepository.getQCEntriesForSamples(samples)
.stream()
.collect(Collectors.groupingBy(sampleQCEntryTuple -> (Long) sampleQCEntryTuple.get(0), Collectors
.mapping(sampleQCEntryTuple -> (QCEntry) sampleQCEntryTuple.get(1), Collectors.toList())));
.collect(Collectors.groupingBy(sampleQCEntryTuple -> (Long) sampleQCEntryTuple.get(0),
Collectors.mapping(sampleQCEntryTuple -> (QCEntry) sampleQCEntryTuple.get(1),
Collectors.toList())));
}

/**
Expand Down Expand Up @@ -835,9 +836,7 @@ public List<GenericStatModel> getSamplesCreatedGrouped(Date createdDate, Statist
public Map<Long, Long> getCoverageForSamplesInProject(Project project, List<Long> sampleIds) {
return psjRepository.calculateCoverageForSamplesInProject(project, sampleIds)
.stream()
.collect(HashMap::new,
(sampleCoverageMap, sampleCoverageTuple) -> sampleCoverageMap
.put((Long) sampleCoverageTuple.get(0), (Long) sampleCoverageTuple.get(1)),
Map::putAll);
.collect(HashMap::new, (sampleCoverageMap, sampleCoverageTuple) -> sampleCoverageMap.put(
(Long) sampleCoverageTuple.get(0), (Long) sampleCoverageTuple.get(1)), Map::putAll);
}
}
5 changes: 3 additions & 2 deletions src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,8 @@ ShareSamples.title=Share Samples with Another Project
ShareSamples.projects=Select a project to share samples with
ShareSamples.ready=These samples are ready to copy
ShareSamples.exists=Samples that exist in the target project and will not be copied
ShareSamples.avatar.unlocked=This sample is modifiable in this project.
ShareSamples.avatar.locked=This sample is not modifiable in this project.
ShareSamples.remove=Remove
ShareSamples.locked=The follow samples are locked and cannot be shared
ShareSamplesList.title=Review samples to share
ShareSamples.no-samples.message=All samples exist in the target project
ShareSamples.no-samples.description=Since these samples exists, there is no reason to re-share them.
Expand Down Expand Up @@ -2872,6 +2871,8 @@ SampleMenu.excel=Export to Excel
SampleMenu.csv=Export to CSV
SampleMenu.fileFilter=Filter by File
SampleMenu.fileFilter.clear=Clear File Filter: {0}
SampleMenu.share-all-locked=All samples are locked and cannot be shared.
SampleMenu.share-some-locked={0} samples are locked and cannot be shared:
SampleIcon.locked=You do not have ownership of this sample and cannot modify it.
SamplesTable.Column.sampleName=Name
SamplesTable.Column.quality=QC
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/resources/js/apis/cart/cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const {
useRemoveSampleMutation,
} = cartApi;

const updateCart = (data: CartUpdated) => {
export const updateCart = (data: CartUpdated) => {
data.notifications.forEach((n) => notification[n.type](n));
cartUpdated(data.count);
return data.count;
Expand Down
Loading

0 comments on commit 47ee6d6

Please sign in to comment.