diff --git a/luminex/src/org/labkey/luminex/LeveyJenningsMenuForm.java b/luminex/src/org/labkey/luminex/LeveyJenningsMenuForm.java new file mode 100644 index 000000000..72f782f2d --- /dev/null +++ b/luminex/src/org/labkey/luminex/LeveyJenningsMenuForm.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.labkey.luminex; + +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.Nullable; +import org.labkey.api.assay.actions.ProtocolIdForm; + +public class LeveyJenningsMenuForm extends ProtocolIdForm +{ + private String _analyte; + + public @Nullable String getAnalyte() + { + return StringUtils.isBlank(_analyte) ? null : _analyte; + } + + public void setAnalyte(String analyte) + { + _analyte = analyte; + } +} diff --git a/luminex/src/org/labkey/luminex/LeveyJenningsMenuView.java b/luminex/src/org/labkey/luminex/LeveyJenningsMenuView.java index 702db167f..21fff3548 100644 --- a/luminex/src/org/labkey/luminex/LeveyJenningsMenuView.java +++ b/luminex/src/org/labkey/luminex/LeveyJenningsMenuView.java @@ -15,9 +15,11 @@ */ package org.labkey.luminex; +import org.jetbrains.annotations.Nullable; import org.labkey.api.data.ContainerFilter; import org.labkey.api.data.SQLFragment; import org.labkey.api.data.SqlSelector; +import org.labkey.api.data.TableInfo; import org.labkey.api.exp.api.ExpProtocol; import org.labkey.api.exp.api.ExperimentService; import org.labkey.api.view.JspView; @@ -35,14 +37,23 @@ public static class Bean { private final ExpProtocol _protocol; + private final String _analyte; private final List _titrations; private final List _singlePointControls; + private final List _analytes; - public Bean(ExpProtocol protocol, List titrations, List singlePointControls) + public Bean(ExpProtocol protocol, @Nullable String analyte, List titrations, List singlePointControls, List analytes) { _protocol = protocol; + _analyte = analyte; _titrations = titrations; _singlePointControls = singlePointControls; + _analytes = analytes; + } + + public @Nullable String getAnalyte() + { + return _analyte; } public List getTitrations() @@ -55,40 +66,94 @@ public List getSinglePointControls() return _singlePointControls; } + public List getAnalytes() + { + return _analytes; + } + public ExpProtocol getProtocol() { return _protocol; } } - public LeveyJenningsMenuView(ExpProtocol protocol) + public LeveyJenningsMenuView(ExpProtocol protocol, @Nullable String analyte) { super("/org/labkey/luminex/view/leveyJenningsMenu.jsp"); ContainerFilter.AllFolders containerFilter = new ContainerFilter.AllFolders(getViewContext().getUser()); - SQLFragment containerSQL = containerFilter.getSQLFragment(LuminexProtocolSchema.getSchema(), new SQLFragment("r.Container")); - - SQLFragment titrationSQL = new SQLFragment("SELECT DISTINCT t.Name FROM "); - titrationSQL.append(LuminexProtocolSchema.getTableInfoTitration(), "t"); - titrationSQL.append(", "); - titrationSQL.append(ExperimentService.get().getTinfoExperimentRun(), "r"); - titrationSQL.append(" WHERE r.RowId = t.RunId AND r.ProtocolLSID = ? AND (t.Standard = ? OR t.QCControl = ?) AND "); - titrationSQL.add(protocol.getLSID()); - titrationSQL.add(true); - titrationSQL.add(true); - titrationSQL.append(containerSQL); - titrationSQL.append(" ORDER BY t.Name"); - List titrations = new SqlSelector(LuminexProtocolSchema.getTableInfoTitration().getSchema(), titrationSQL).getArrayList(String.class); - - SQLFragment singlePointControlSQL = new SQLFragment("SELECT DISTINCT s.Name FROM "); - singlePointControlSQL.append(LuminexProtocolSchema.getTableInfoSinglePointControl(), "s"); - singlePointControlSQL.append(", "); - singlePointControlSQL.append(ExperimentService.get().getTinfoExperimentRun(), "r"); - singlePointControlSQL.append(" WHERE s.RunId = r.RowId AND r.ProtocolLSID = ? AND "); - singlePointControlSQL.add(protocol.getLSID()); - singlePointControlSQL.append(containerSQL); - singlePointControlSQL.append(" ORDER BY s.Name"); - List singlePointControls = new SqlSelector(LuminexProtocolSchema.getTableInfoTitration().getSchema(), singlePointControlSQL).getArrayList(String.class); - - setModelBean(new Bean(protocol, titrations, singlePointControls)); + SQLFragment containerSQL = containerFilter.getSQLFragment(LuminexProtocolSchema.getSchema(), SQLFragment.unsafe("r.Container")); + + ControlSource titrationSource = new ControlSource(LuminexProtocolSchema.getTableInfoTitration(), + SQLFragment.unsafe(" AND (c.Standard = ? OR c.QCControl = ?)", true, true), + LuminexProtocolSchema.getTableInfoAnalyteTitration(), "TitrationId"); + ControlSource singlePointControlSource = new ControlSource(LuminexProtocolSchema.getTableInfoSinglePointControl(), null, + LuminexProtocolSchema.getTableInfoAnalyteSinglePointControl(), "SinglePointControlId"); + + List titrations = getControlNames(titrationSource, protocol, containerSQL, analyte); + List singlePointControls = getControlNames(singlePointControlSource, protocol, containerSQL, analyte); + + List analytes = List.of(); + if (analyte == null) + { + SQLFragment analyteSQL = getAnalyteNamesSQL(titrationSource, protocol, containerSQL); + analyteSQL.append(SQLFragment.unsafe(" UNION ")); + analyteSQL.append(getAnalyteNamesSQL(singlePointControlSource, protocol, containerSQL)); + analyteSQL.append(SQLFragment.unsafe(" ORDER BY Name")); + analytes = new SqlSelector(LuminexProtocolSchema.getSchema(), analyteSQL).getArrayList(String.class); + } + + setModelBean(new Bean(protocol, analyte, titrations, singlePointControls, analytes)); + } + + private record ControlSource(TableInfo controlTable, @Nullable SQLFragment controlFilter, TableInfo analyteJunctionTable, String junctionControlColumn) {} + + private static List getControlNames(ControlSource source, ExpProtocol protocol, SQLFragment containerSQL, @Nullable String analyte) + { + SQLFragment sql = SQLFragment.unsafe("SELECT DISTINCT c.Name"); + sql.append(getControlsFromSQL(source, protocol, containerSQL)); + if (analyte != null) + { + sql.append(SQLFragment.unsafe(" AND EXISTS (SELECT 1")); + sql.append(getAnalyteJunctionFromSQL(source)); + sql.append(SQLFragment.unsafe(" = c.RowId AND a.Name = ?)", analyte)); + } + sql.append(SQLFragment.unsafe(" ORDER BY c.Name")); + return new SqlSelector(LuminexProtocolSchema.getSchema(), sql).getArrayList(String.class); + } + + private static SQLFragment getAnalyteNamesSQL(ControlSource source, ExpProtocol protocol, SQLFragment containerSQL) + { + SQLFragment sql = SQLFragment.unsafe("SELECT a.Name"); + sql.append(getAnalyteJunctionFromSQL(source)); + sql.append(SQLFragment.unsafe(" IN (SELECT c.RowId")); + sql.append(getControlsFromSQL(source, protocol, containerSQL)); + sql.append(SQLFragment.unsafe(")")); + return sql; + } + + /** FROM/WHERE for the protocol's controls (alias c) and their runs (alias r) in the container scope */ + private static SQLFragment getControlsFromSQL(ControlSource source, ExpProtocol protocol, SQLFragment containerSQL) + { + SQLFragment sql = SQLFragment.unsafe(" FROM "); + sql.append(source.controlTable(), "c"); + sql.append(SQLFragment.unsafe(" JOIN ")); + sql.append(ExperimentService.get().getTinfoExperimentRun(), "r"); + sql.append(SQLFragment.unsafe(" ON r.RowId = c.RunId WHERE r.ProtocolLSID = ? AND ", protocol.getLSID())); + sql.append(containerSQL); + if (source.controlFilter() != null) + sql.append(source.controlFilter()); + return sql; + } + + /** FROM the analyte junction (alias j) and analytes (alias a), ending with the junction's control column so the caller adds the comparison */ + private static SQLFragment getAnalyteJunctionFromSQL(ControlSource source) + { + SQLFragment sql = SQLFragment.unsafe(" FROM "); + sql.append(source.analyteJunctionTable(), "j"); + sql.append(SQLFragment.unsafe(" JOIN ")); + sql.append(LuminexProtocolSchema.getTableInfoAnalytes(), "a"); + sql.append(SQLFragment.unsafe(" ON a.RowId = j.AnalyteId WHERE ")); + sql.append(source.analyteJunctionTable().getColumn(source.junctionControlColumn()).getValueSql("j")); + return sql; } } diff --git a/luminex/src/org/labkey/luminex/LuminexController.java b/luminex/src/org/labkey/luminex/LuminexController.java index 588c60afb..85932e4c6 100644 --- a/luminex/src/org/labkey/luminex/LuminexController.java +++ b/luminex/src/org/labkey/luminex/LuminexController.java @@ -323,17 +323,17 @@ public void addNavTrail(NavTree root) } @RequiresPermission(ReadPermission.class) - public static class LeveyJenningsMenuAction extends SimpleViewAction + public static class LeveyJenningsMenuAction extends SimpleViewAction { - private ProtocolIdForm _form; + private LeveyJenningsMenuForm _form; @Override - public ModelAndView getView(ProtocolIdForm form, BindException errors) + public ModelAndView getView(LeveyJenningsMenuForm form, BindException errors) { _form = form; VBox result = new VBox(); result.addView(new AssayHeaderView(form.getProtocol(), form.getProvider(), false, true, null)); - result.addView(new LeveyJenningsMenuView(form.getProtocol())); + result.addView(new LeveyJenningsMenuView(form.getProtocol(), form.getAnalyte())); return result; } diff --git a/luminex/src/org/labkey/luminex/view/leveyJenningsMenu.jsp b/luminex/src/org/labkey/luminex/view/leveyJenningsMenu.jsp index 8711a1789..5d0daf7a6 100644 --- a/luminex/src/org/labkey/luminex/view/leveyJenningsMenu.jsp +++ b/luminex/src/org/labkey/luminex/view/leveyJenningsMenu.jsp @@ -27,17 +27,22 @@ LeveyJenningsMenuView.Bean bean = me.getModelBean(); %> +

+ Click on a titration or single point control to view its Levey-Jennings report. + Click on an antigen to filter the Titrations and Single Point Controls lists to those used with that antigen. +

+
- - - -
+ Titrations - - + + Single Point Controls - +
+ <% if (bean.getTitrations().isEmpty()) { %> No titrations <% } @@ -47,10 +52,12 @@ url.addParameter("rowId", bean.getProtocol().getRowId()); url.addParameter("controlName", titrationName); url.addParameter("controlType", LeveyJenningsForm.ControlType.Titration.toString()); + if (bean.getAnalyte() != null) + url.addParameter("analyte", bean.getAnalyte()); %><%= link(titrationName, url) %>
<% }%>
+ <% if (bean.getSinglePointControls().isEmpty()) { %> No single point controls <% } @@ -60,8 +67,41 @@ url.addParameter("rowId", bean.getProtocol().getRowId()); url.addParameter("controlName", singlePointControl); url.addParameter("controlType", LeveyJenningsForm.ControlType.SinglePoint.toString()); + if (bean.getAnalyte() != null) + url.addParameter("analyte", bean.getAnalyte()); %><%= link(singlePointControl, url) %>
<% }%>
\ No newline at end of file + + + + + + + + +
+ Antigens +
+ <% if (bean.getAnalyte() != null) { + ActionURL clearUrl = new ActionURL(LuminexController.LeveyJenningsMenuAction.class, getContainer()); + clearUrl.addParameter("rowId", bean.getProtocol().getRowId()); + %> + Selected: <%=h(bean.getAnalyte())%> <%=iconLink("fa fa-times", "Clear selection", clearUrl)%> <% + } + else if (bean.getAnalytes().isEmpty()) { %> + No antigens <% + } + else + { + for (String analyte : bean.getAnalytes()) + { + ActionURL url = new ActionURL(LuminexController.LeveyJenningsMenuAction.class, getContainer()); + url.addParameter("rowId", bean.getProtocol().getRowId()); + url.addParameter("analyte", analyte); + %><%= link(analyte, url) %>
<% + } + }%> +
+
\ No newline at end of file diff --git a/luminex/test/src/org/labkey/test/pages/luminex/LeveyJenningsMenuPage.java b/luminex/test/src/org/labkey/test/pages/luminex/LeveyJenningsMenuPage.java new file mode 100644 index 000000000..5b9a43836 --- /dev/null +++ b/luminex/test/src/org/labkey/test/pages/luminex/LeveyJenningsMenuPage.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.labkey.test.pages.luminex; + +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.Nullable; +import org.labkey.test.Locator; +import org.labkey.test.WebDriverWrapper; +import org.labkey.test.WebTestHelper; +import org.labkey.test.pages.LabKeyPage; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * The Levey-Jennings Reports menu page (luminex-leveyJenningsMenu.view): the Titrations / Single Point Controls + * lists that link to the Levey-Jennings report, and the Antigens filter beside them. + */ +public class LeveyJenningsMenuPage extends LabKeyPage +{ + public LeveyJenningsMenuPage(WebDriver driver) + { + super(driver); + } + + public static LeveyJenningsMenuPage beginAt(WebDriverWrapper webDriverWrapper, String containerPath, String protocolRowId, @Nullable String analyte) + { + Map params = new HashMap<>(); + params.put("rowId", protocolRowId); + if (analyte != null) + params.put("analyte", analyte); + webDriverWrapper.beginAt(WebTestHelper.buildURL("luminex", containerPath, "leveyJenningsMenu", params)); + return new LeveyJenningsMenuPage(webDriverWrapper.getDriver()); + } + + @Override + protected void waitForPage() + { + waitForElement(Locators.antigensTable); + } + + public List getAntigens() + { + return getLinkTexts(elementCache().antigensCell); + } + + public String getAntigensText() + { + return elementCache().antigensCell.getText().trim(); + } + + public LeveyJenningsMenuPage selectAntigen(String antigen) + { + clickAndWait(Locator.linkWithText(antigen).findElement(elementCache().antigensCell)); + return new LeveyJenningsMenuPage(getDriver()); + } + + public LeveyJenningsMenuPage clearAntigen() + { + clickAndWait(Locator.tagWithAttribute("a", "aria-label", "Clear selection").findElement(elementCache().antigensCell)); + return new LeveyJenningsMenuPage(getDriver()); + } + + public List getTitrations() + { + return getLinkTexts(elementCache().titrationsCell); + } + + public String getTitrationsText() + { + return elementCache().titrationsCell.getText().trim(); + } + + public List getSinglePointControls() + { + return getLinkTexts(elementCache().singlePointControlsCell); + } + + // labkey-text-link uppercases its text with CSS, so read textContent rather than the rendered text + private List getLinkTexts(WebElement container) + { + return Locator.tag("a").findElements(container).stream() + .map(link -> StringUtils.trimToEmpty(link.getDomProperty("textContent"))) + .toList(); + } + + public String getSinglePointControlsText() + { + return elementCache().singlePointControlsCell.getText().trim(); + } + + public String getTitrationHref(String titration) + { + return Locator.linkWithText(titration).findElement(elementCache().titrationsCell).getAttribute("href"); + } + + public void clickTitration(String titration) + { + clickAndWait(Locator.linkWithText(titration).findElement(elementCache().titrationsCell)); + } + + @Override + protected ElementCache newElementCache() + { + return new ElementCache(); + } + + protected class ElementCache extends LabKeyPage.ElementCache + { + final WebElement antigensCell = Locator.xpath(".//tr[2]/td").findWhenNeeded(Locators.antigensTable.findWhenNeeded(this)); + final WebElement controlsTable = Locators.controlsTable.findWhenNeeded(this); + final WebElement titrationsCell = Locator.xpath(".//tr[2]/td[1]").findWhenNeeded(controlsTable); + final WebElement singlePointControlsCell = Locator.xpath(".//tr[2]/td[2]").findWhenNeeded(controlsTable); + } + + private static class Locators + { + static final Locator.XPathLocator antigensTable = Locator.xpath("//table[.//th[normalize-space()='Antigens']]"); + static final Locator.XPathLocator controlsTable = Locator.xpath("//table[.//th[normalize-space()='Titrations']]"); + } +} diff --git a/luminex/test/src/org/labkey/test/tests/luminex/LuminexLeveyJenningsMenuTest.java b/luminex/test/src/org/labkey/test/tests/luminex/LuminexLeveyJenningsMenuTest.java new file mode 100644 index 000000000..a343f665f --- /dev/null +++ b/luminex/test/src/org/labkey/test/tests/luminex/LuminexLeveyJenningsMenuTest.java @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.labkey.test.tests.luminex; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.labkey.test.Locator; +import org.labkey.test.TestFileUtils; +import org.labkey.test.TestTimeoutException; +import org.labkey.test.categories.Assays; +import org.labkey.test.categories.Daily; +import org.labkey.test.pages.luminex.LeveyJenningsMenuPage; +import org.labkey.test.util.LogMethod; + +import java.io.File; +import java.util.Calendar; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +@Category({Daily.class, Assays.class}) +public final class LuminexLeveyJenningsMenuTest extends LuminexTest +{ + private static final String ISOTYPE_A = isotype; + private static final String ISOTYPE_B = "IgA"; + private static final String CONJUGATE_A = conjugate; + private static final String CONJUGATE_B = "Biotin"; + + private static final String STANDARD1 = "Standard1"; + private static final String STANDARD2 = "Standard2"; + private static final String SINGLE_POINT_CONTROL = "IH5672"; + + private static final List ALL_ANTIGENS = List.of("Blank", "ENV1", "ENV2", "ENV3", "ENV4", "ENV5", "ENV6", "ENV7", "GS Analyte A", "GS Analyte B"); + + private static final Locator ISOTYPE_COMBO = Locator.id("isotype-combo-box"); + private static final Locator CONJUGATE_COMBO = Locator.id("conjugate-combo-box"); + + @BeforeClass + public static void importRuns() + { + ((LuminexLeveyJenningsMenuTest) getCurrentTest()).doImportRuns(); + } + + private void doImportRuns() + { + // Standard1 and single point control IH5672 with Blank and ENV1-ENV5 + importRun(1, TestFileUtils.getSampleData("luminex/01-11A12-IgA-Biotin.xls"), ISOTYPE_A, CONJUGATE_A, true); + // same titration and antigens as run 1 with a second isotype + importRun(2, TestFileUtils.getSampleData("luminex/02-14A22-IgA-Biotin.xls"), ISOTYPE_B, CONJUGATE_A, true); + // Standard2 (plus Sample 1, which is neither a standard nor a QC control) with Blank and ENV4-ENV7 + importRun(3, TEST_ASSAY_MULTIPLE_STANDARDS_1, ISOTYPE_A, CONJUGATE_B, false); + // Standard1 (plus Standard1-CrossplateTitration, which is neither) with GS Analyte A and B + importRun(4, TEST_ASSAY_LUM_FILE5, ISOTYPE_A, CONJUGATE_A, false); + } + + @Test + public void testAntigenList() + { + LeveyJenningsMenuPage menuPage = goToMenuPage(); + + assertEquals("Wrong antigens", ALL_ANTIGENS, menuPage.getAntigens()); + assertEquals("Wrong titrations", List.of(STANDARD1, STANDARD2), menuPage.getTitrations()); + assertEquals("Wrong single point controls", List.of(SINGLE_POINT_CONTROL), menuPage.getSinglePointControls()); + assertFalse("Report links should not include an antigen", menuPage.getTitrationHref(STANDARD1).contains("analyte=")); + } + + @Test + public void testAntigenFilter() + { + LeveyJenningsMenuPage menuPage = goToMenuPage().selectAntigen("ENV1"); + assertEquals("Wrong selection", "Selected: ENV1", menuPage.getAntigensText()); + assertEquals("Wrong titrations for ENV1", List.of(STANDARD1), menuPage.getTitrations()); + assertEquals("Wrong single point controls for ENV1", List.of(SINGLE_POINT_CONTROL), menuPage.getSinglePointControls()); + assertTrue("Report link should include the antigen", menuPage.getTitrationHref(STANDARD1).contains("analyte=ENV1")); + + menuPage = menuPage.clearAntigen(); + assertEquals("Clearing the selection should restore the antigen list", ALL_ANTIGENS, menuPage.getAntigens()); + + menuPage = menuPage.selectAntigen("ENV6"); + assertEquals("Wrong titrations for ENV6", List.of(STANDARD2), menuPage.getTitrations()); + assertEquals("Wrong single point controls for ENV6", "No single point controls", menuPage.getSinglePointControlsText()); + + menuPage = menuPage.clearAntigen().selectAntigen("GS Analyte A"); + assertEquals("Wrong titrations for GS Analyte A", List.of(STANDARD1), menuPage.getTitrations()); + assertEquals("Wrong single point controls for GS Analyte A", "No single point controls", menuPage.getSinglePointControlsText()); + + menuPage = LeveyJenningsMenuPage.beginAt(this, getProjectName(), getUrlParam("rowId"), "NotAnAntigen"); + assertEquals("Wrong selection", "Selected: NotAnAntigen", menuPage.getAntigensText()); + assertEquals("Wrong titrations for unknown antigen", "No titrations", menuPage.getTitrationsText()); + assertEquals("Wrong single point controls for unknown antigen", "No single point controls", menuPage.getSinglePointControlsText()); + } + + @Test + public void testReportPreSelectsSingleOptions() + { + // ENV6 with Standard2 is only in run 3, so the isotype and conjugate are pre-selected + goToMenuPage().selectAntigen("ENV6").clickTitration(STANDARD2); + waitForAnalyteSelected("ENV6"); + waitForFormElementToEqual(ISOTYPE_COMBO, ISOTYPE_A); + waitForFormElementToEqual(CONJUGATE_COMBO, CONJUGATE_B); + assertElementPresent(Locator.extButtonEnabled("Apply")); + + // ENV1 with Standard1 has two isotypes (runs 1 and 2), so nothing is pre-selected until the user picks one + goToMenuPage().selectAntigen("ENV1").clickTitration(STANDARD1); + waitForAnalyteSelected("ENV1"); + assertEquals("Isotype should not be pre-selected", "", getFormElement(ISOTYPE_COMBO)); + assertEquals("Conjugate should not be pre-selected", "", getFormElement(CONJUGATE_COMBO)); + assertElementNotPresent(Locator.extButtonEnabled("Apply")); + + _extHelper.selectComboBoxItem("Isotype:", ISOTYPE_B); + waitForFormElementToEqual(CONJUGATE_COMBO, CONJUGATE_A); + assertElementPresent(Locator.extButtonEnabled("Apply")); + } + + private LeveyJenningsMenuPage goToMenuPage() + { + goToQCAnalysisPage(TEST_ASSAY_LUM, "view levey-jennings reports"); + return new LeveyJenningsMenuPage(getDriver()); + } + + private void waitForAnalyteSelected(String analyte) + { + waitForElement(Locator.tagWithId("div", "analyte-grid-panel") + .descendant(Locator.byClass("x-grid3-row-selected").withDescendant(Locator.tagWithText("span", analyte)))); + } + + @LogMethod + private void importRun(int runNumber, File file, String isotype, String conjugate, boolean includeSinglePointControl) + { + goToTestAssayHome(); + clickButton("Import Data"); + setFormElement(Locator.name("Network"), "NETWORK" + runNumber); + clickButton("Next"); + + Calendar testDate = Calendar.getInstance(); + testDate.add(Calendar.DATE, runNumber - 10); + importLuminexRunPageTwo("LJ Menu Run " + runNumber, isotype, conjugate, "", "", "Notebook" + runNumber, + "Experimental", "TECH", df.format(testDate.getTime()), file, 0); + + if (includeSinglePointControl) + checkCheckbox(Locator.name("_singlePointControl_" + SINGLE_POINT_CONTROL)); + + clickButton("Save and Finish"); + } +} diff --git a/luminex/webapp/luminex/LeveyJenningsGraphParamsPanel.js b/luminex/webapp/luminex/LeveyJenningsGraphParamsPanel.js index a7e648340..44ee943e3 100644 --- a/luminex/webapp/luminex/LeveyJenningsGraphParamsPanel.js +++ b/luminex/webapp/luminex/LeveyJenningsGraphParamsPanel.js @@ -146,6 +146,10 @@ LABKEY.LeveyJenningsGraphParamsPanel = Ext.extend(Ext.FormPanel, { } }); this.isotypeCombobox.getStore().on('load', function(store, records, options) { + // pre-select the isotype when there is only one option + if (store.getCount() === 1 && store.findExact('value', this.isotype) === -1) + this.isotype = store.getAt(0).get('value'); + var index = store.findExact('value', this.isotype); if (this.isotype != undefined && index > -1) { @@ -186,6 +190,10 @@ LABKEY.LeveyJenningsGraphParamsPanel = Ext.extend(Ext.FormPanel, { } }); this.conjugateCombobox.getStore().on('load', function(store, records, options) { + // pre-select the conjugate when there is only one option + if (store.getCount() === 1 && store.findExact('value', this.conjugate) === -1) + this.conjugate = store.getAt(0).get('value'); + if (this.conjugate != undefined && store.findExact('value', this.conjugate) > -1) { this.conjugateCombobox.setValue(this.conjugate);