diff --git a/src/main/java/ca/corefacility/bioinformatics/irida/ria/web/services/UINcbiService.java b/src/main/java/ca/corefacility/bioinformatics/irida/ria/web/services/UINcbiService.java index dce3e7b7d1f..0998c4cba09 100644 --- a/src/main/java/ca/corefacility/bioinformatics/irida/ria/web/services/UINcbiService.java +++ b/src/main/java/ca/corefacility/bioinformatics/irida/ria/web/services/UINcbiService.java @@ -14,14 +14,13 @@ import ca.corefacility.bioinformatics.irida.model.export.NcbiBioSampleFiles; import ca.corefacility.bioinformatics.irida.model.project.Project; 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.model.user.User; import ca.corefacility.bioinformatics.irida.ria.web.ajax.dto.NcbiExportSubmissionTableModel; import ca.corefacility.bioinformatics.irida.ria.web.models.export.NcbiBioSampleModel; import ca.corefacility.bioinformatics.irida.ria.web.models.export.NcbiExportSubmissionAdminTableModel; -import ca.corefacility.bioinformatics.irida.ria.web.models.export.NcbiSubmissionRequest; import ca.corefacility.bioinformatics.irida.ria.web.models.export.NcbiSubmissionModel; +import ca.corefacility.bioinformatics.irida.ria.web.models.export.NcbiSubmissionRequest; import ca.corefacility.bioinformatics.irida.ria.web.models.tables.TableRequest; import ca.corefacility.bioinformatics.irida.ria.web.models.tables.TableResponse; import ca.corefacility.bioinformatics.irida.service.ProjectService; @@ -89,22 +88,8 @@ public TableResponse getNCBIExportsForAdmin */ public NcbiSubmissionModel getExportDetails(Long exportId) { NcbiExportSubmission submission = ncbiService.read(exportId); - Project project = projectService.read(submission.getProject() - .getId()); - List bioSamples = submission.getBioSampleFiles() - .stream() - .map(bioSampleFile -> { - List pairs = bioSampleFile.getPairs() - .stream() - .peek(pair -> uiSampleService.enhanceQcEntries(pair, project)) - .collect(Collectors.toList()); - List singles = bioSampleFile.getFiles() - .stream() - .peek(single -> uiSampleService.enhanceQcEntries(single, project)) - .collect(Collectors.toList()); - return new NcbiBioSampleModel(bioSampleFile); - }) + List bioSamples = submission.getBioSampleFiles().stream().map(NcbiBioSampleModel::new) .collect(Collectors.toList()); return new NcbiSubmissionModel(submission, bioSamples); diff --git a/src/main/webapp/resources/js/components/ncbi/details/utils.tsx b/src/main/webapp/resources/js/components/ncbi/details/utils.tsx index 95d23fc83f7..b9bf7ce6ce7 100644 --- a/src/main/webapp/resources/js/components/ncbi/details/utils.tsx +++ b/src/main/webapp/resources/js/components/ncbi/details/utils.tsx @@ -17,8 +17,14 @@ import ExportUploadStateTag from "../ExportUploadStateTag"; export const formatNcbiSubmissionDetails = ( submission: Omit ): BasicListItem[] => { + const LOCALE = window.TL?.LANGUAGE_TAG || "en"; const releaseDate = submission.releaseDate - ? formatInternationalizedDateTime(submission.releaseDate) + ? new Date(submission.releaseDate).toLocaleDateString(LOCALE, { + month: "short", + year: "numeric", + day: "numeric", + timeZone: "UTC", // ignoring timezone + }) : i18n("NcbiExportDetailsView.not-released"); return [ diff --git a/src/main/webapp/resources/js/pages/projects/ncbi/create/CreateNcbiExport.tsx b/src/main/webapp/resources/js/pages/projects/ncbi/create/CreateNcbiExport.tsx index 5f5bcf79bbc..1175d092323 100644 --- a/src/main/webapp/resources/js/pages/projects/ncbi/create/CreateNcbiExport.tsx +++ b/src/main/webapp/resources/js/pages/projects/ncbi/create/CreateNcbiExport.tsx @@ -234,7 +234,7 @@ function CreateNcbiExport(): JSX.Element { bioProject, namespace, organization, - releaseDate: releaseDate.valueOf(), + releaseDate: releaseDate.endOf("day").valueOf(), samples: Object.values(_samples).map( ({ pairs = [], diff --git a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/pages/projects/NcbiExportPage.java b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/pages/projects/NcbiExportPage.java index 0c52f7691a8..900f63208c1 100644 --- a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/pages/projects/NcbiExportPage.java +++ b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/pages/projects/NcbiExportPage.java @@ -4,6 +4,7 @@ import java.util.List; import org.openqa.selenium.By; +import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -30,6 +31,9 @@ public class NcbiExportPage extends AbstractPage { @FindBy(xpath = "//*[@id=\"namespace\"]") private WebElement namespaceInput; + @FindBy(xpath = "//*[@id=\"releaseDate\"]") + private WebElement releaseDateInput; + @FindBy(className = "t-defaults-panel") private WebElement defaultsPanel; @@ -73,6 +77,12 @@ public void enterNamespace(String value) { namespaceInput.sendKeys(value); } + public void setReleaseDateInput(String value) { + releaseDateInput.sendKeys(Keys.chord(Keys.CONTROL, "a")); + releaseDateInput.sendKeys(value); + releaseDateInput.sendKeys(Keys.ENTER); + } + public void toggleDefaultsPanel() { defaultsPanel.click(); } diff --git a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/pages/projects/NcbiExportsListingPage.java b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/pages/projects/NcbiExportsListingPage.java index fa8dafeb272..f3a53f1ca01 100644 --- a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/pages/projects/NcbiExportsListingPage.java +++ b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/pages/projects/NcbiExportsListingPage.java @@ -1,11 +1,15 @@ package ca.corefacility.bioinformatics.irida.ria.integration.pages.projects; +import java.time.Duration; import java.util.List; +import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; import ca.corefacility.bioinformatics.irida.ria.integration.pages.AbstractPage; @@ -25,4 +29,11 @@ public static NcbiExportsListingPage goTo(WebDriver driver) { public int getNumberOfBioSampleIdsDisplayed() { return biodamplesIds.size(); } + + public void gotoSubmissionPage(String bioprojectId) { + WebElement link = driver.findElement(By.xpath("//table/tbody//a[text() = '" + bioprojectId + "']")); + link.click(); + WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5)); + wait.until(ExpectedConditions.urlMatches("/projects/\\d+/export/\\d+")); + } } diff --git a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/NcbiExportPageIT.java b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/NcbiExportPageIT.java index d3408724ac4..4591e9dc5c5 100644 --- a/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/NcbiExportPageIT.java +++ b/src/test/java/ca/corefacility/bioinformatics/irida/ria/integration/projects/NcbiExportPageIT.java @@ -4,7 +4,9 @@ import ca.corefacility.bioinformatics.irida.ria.integration.AbstractIridaUIITChromeDriver; import ca.corefacility.bioinformatics.irida.ria.integration.pages.LoginPage; +import ca.corefacility.bioinformatics.irida.ria.integration.pages.projects.ExportDetailsPage; import ca.corefacility.bioinformatics.irida.ria.integration.pages.projects.NcbiExportPage; +import ca.corefacility.bioinformatics.irida.ria.integration.pages.projects.NcbiExportsListingPage; import ca.corefacility.bioinformatics.irida.ria.integration.pages.projects.ProjectSamplesPage; import com.github.springtestdbunit.annotation.DatabaseSetup; @@ -22,6 +24,7 @@ void testCreateNcbiSubmission() throws Exception { String SAMPLE_3 = "sample3"; String BIOPROJECT = "BIOPROJECT-1"; String NAMESPACE = "NAMESPACE-FOOBAR"; + String RELEASE_DATE = "2030-06-15"; String ORGANIZATION = "ORGANIZATION-FOOBAR"; String PROTOCOL = "AMAZING_PROTOCOL"; String DEFAULT_PROTOCOL = "DEFAULT_PROTOCOL"; @@ -40,6 +43,7 @@ void testCreateNcbiSubmission() throws Exception { page.enterBioProject(BIOPROJECT); page.enterNamespace(NAMESPACE); page.enterOrganization(ORGANIZATION); + page.setReleaseDateInput(RELEASE_DATE); // Test default sample settings. page.toggleDefaultsPanel(); @@ -84,5 +88,16 @@ void testCreateNcbiSubmission() throws Exception { assertTrue(page.isSuccessAlertDisplayed(), "Success notification should be displayed"); assertTrue(page.isUserRedirectedToProjectSamplesPage(PROJECT_ID), "User should be redirected within 5 seconds of submission"); + + // Make sure all fields submitted successfully + NcbiExportsListingPage listingPage = NcbiExportsListingPage.goTo(driver()); + listingPage.gotoSubmissionPage(BIOPROJECT); + + ExportDetailsPage detailsPage = ExportDetailsPage.initPage(driver()); + assertEquals(BIOPROJECT, detailsPage.getBioproject()); + assertEquals(NAMESPACE, detailsPage.getNamespace()); + + assertEquals(ORGANIZATION, detailsPage.getOrganization()); + assertTrue(detailsPage.getReleaseDate().equals("Jun 15, 2030")); } }