From 432bcc749fecff4a69fc033ed227d0f7bccb547d Mon Sep 17 00:00:00 2001 From: Binal Patel Date: Mon, 31 Aug 2020 17:17:53 -0700 Subject: [PATCH 1/2] Merge from wnprc18.3 svn r.64261 to r.65647 (#38) * Merge from wnprc18.3 svn r.64261-64312 * Merge from wnprc18.3 svn r.64313-64598 * Various test fixes, including: Customize source_material query directly instead of trying to mutate a locked FK lookup table Update to use new assay designer UI Move code from LabModuleHelper to only place that uses it, ViralLoadAssayTest Fix rate import codepath in WNPRC_EHRTest * Flip meaning of argument at controls de-duplication of IDs Fix up handling of drop-downs in WNPRC misc charges entry * Update AssayTemplatePanel.js * Fix ViralLoadAssayTest - restore WNPRC test code, updated to new DOM in 20.x line, and avoiding WNPRC_EHR query metadata if the module is deployed but not enabled in the container Co-authored-by: bbimber --- LDK/resources/web/LDK/StoreUtils.js | 12 +++++- LDK/resources/web/LDK/Utils.js | 6 ++- .../web/LDK/panel/TabbedReportPanel.js | 43 +++++++++++++------ LDK/resources/web/LDK/ux/DateTimeField.js | 6 +++ .../external/labModules/LabModuleHelper.java | 5 ++- .../laboratory/panel/AbstractAssayPanel.js | 2 +- .../laboratory/panel/AssayTemplatePanel.js | 20 ++++++--- .../web/laboratory/panel/WellLayoutPanel.js | 7 +-- 8 files changed, 74 insertions(+), 27 deletions(-) diff --git a/LDK/resources/web/LDK/StoreUtils.js b/LDK/resources/web/LDK/StoreUtils.js index f22fd5d3..60342944 100644 --- a/LDK/resources/web/LDK/StoreUtils.js +++ b/LDK/resources/web/LDK/StoreUtils.js @@ -60,6 +60,7 @@ LDK.StoreUtils = new function(){ * @param config.fileName * @param config.labelProperty * @param config.skippedColumns + * @param config.includeDescription */ createExcelTemplate: function(config){ Ext4.applyIf(config, { @@ -72,7 +73,16 @@ LDK.StoreUtils = new function(){ if (config.skippedColumns && Ext4.Array.contains(config.skippedColumns, field.name)) return; - header.push(field[config.labelProperty]); + //Sending label property and comment in case of including description + if (config.includeDescription){ + header.push({ + value: field[config.labelProperty], + cellComment: field['description'] + }); + } + else{ + header.push(field[config.labelProperty]); + } } }, this); diff --git a/LDK/resources/web/LDK/Utils.js b/LDK/resources/web/LDK/Utils.js index a051b2b2..43a2d027 100644 --- a/LDK/resources/web/LDK/Utils.js +++ b/LDK/resources/web/LDK/Utils.js @@ -538,7 +538,7 @@ LDK.Utils = new function(){ window.location = LABKEY.ActionURL.buildURL('ldk', 'updateQuery', null, params); }, - splitIds: function(subjectArray, unsorted){ + splitIds: function(subjectArray, unsorted, preserveDuplicates){ if (!subjectArray){ return []; } @@ -556,7 +556,9 @@ LDK.Utils = new function(){ } if (subjectArray.length > 0) { - subjectArray = Ext4.unique(subjectArray); + if (!preserveDuplicates) { + subjectArray = Ext4.unique(subjectArray); + } if (!unsorted) { subjectArray.sort(); } diff --git a/LDK/resources/web/LDK/panel/TabbedReportPanel.js b/LDK/resources/web/LDK/panel/TabbedReportPanel.js index af1dfda2..a9e6bb95 100644 --- a/LDK/resources/web/LDK/panel/TabbedReportPanel.js +++ b/LDK/resources/web/LDK/panel/TabbedReportPanel.js @@ -548,7 +548,7 @@ Ext4.define('LDK.panel.TabbedReportPanel', { }, this); } } - + return subjects; }, @@ -764,19 +764,34 @@ Ext4.define('LDK.panel.TabbedReportPanel', { scope: this }; - //special case these two properties because they are common - if (tab.report.viewName){ - queryConfig.viewName = tab.report.viewName; - } - - if (tab.report.containerPath){ - queryConfig.containerPath = tab.report.containerPath; - } - - //allow any other supported properties to be applied through here - if (tab.report.queryConfig){ - Ext4.apply(queryConfig, tab.report.queryConfig); - } + // + // Define a list of configuration options. These can be set on the report tab to override default values. + // This list can be obtained by going to the URL for the + // LABKEY.QueryWebPart API, and looking in the config summary table. If you'd like to get it programatically, // https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.QueryWebPart.html#constructor + // run the function commented out to the right of this message (you'll need to load jQuery first). It will // + // output an array of configuration options. //getConfigOptions = function() { + // // var summaryTable = jQuery('table.summaryTable') + var configOptions = [ // // Filter for the table with the config object + "aggregates", "allowChooseQuery", "allowChooseView", "bodyClass", // .filter(function(index,element){ return jQuery(element).attr("summary").match(/config object/); }); + "buttonBar", "buttonBarPosition", "containerFilter", "containerPath", // + "dataRegionName", "deleteURL", "detailsURL", "errorType", // var options = []; + "failure", "filters", "frame", "importURL", // + "insertURL", "linkTarget", "maskEl", "maxRows", // var configRegex = /^config\./; + "metadata", "offset", "parameters", "queryName", // summaryTable.find('td.nameDescription a').each(function(index,element){ + "removeableFilters", "removeableSort", "renderTo", "reportId", // var configOption = jQuery(element).text(); + "schemaName", "scope", "shadeAlternatingRows", "showBorders", // + "showDeleteButton", "showDetailsColumn", "showExportButtons", "showInsertNewButton", // + "showPagination", "showRecordSelectors", "showReports", "showRows", // if (configOption.match(configRegex)) { + "showSurroundingBorder", "showUpdateColumn", "showViewPanel", "sort", // options.push(configOption.replace(configRegex, '')); + "sql", "success", "suppressRenderErrors", "timeout", // } + "title", "titleHref", "updateURL", "viewName" // }); + ]; // + + Ext4.each(configOptions, function(option, index, list) { + if (option in tab.report) { + queryConfig[option] = tab.report[option]; + } + }); tab.add({ xtype: 'ldk-querycmp', diff --git a/LDK/resources/web/LDK/ux/DateTimeField.js b/LDK/resources/web/LDK/ux/DateTimeField.js index c49e3bba..9f713373 100644 --- a/LDK/resources/web/LDK/ux/DateTimeField.js +++ b/LDK/resources/web/LDK/ux/DateTimeField.js @@ -165,6 +165,12 @@ Ext4.define('Ext.ux.form.field.DateTime', { }, me.timeConfig)); me.items.push(me.timeField); + // Allow times in the style of "1423" to be accepted by the time field, instead of requiring colons + // for 24 hour fields. + var formats = me.timeField.altFormats.split("|"); + formats.push("Hi"); + me.timeField.altFormats = formats.join("|"); + for (; i < me.items.length; i++) { if(me.items[i].xtype == 'splitter') continue; diff --git a/LDK/test/src/org/labkey/test/util/external/labModules/LabModuleHelper.java b/LDK/test/src/org/labkey/test/util/external/labModules/LabModuleHelper.java index 57ce1386..90711493 100644 --- a/LDK/test/src/org/labkey/test/util/external/labModules/LabModuleHelper.java +++ b/LDK/test/src/org/labkey/test/util/external/labModules/LabModuleHelper.java @@ -19,6 +19,9 @@ import org.jetbrains.annotations.Nullable; import org.labkey.test.BaseWebDriverTest; import org.labkey.test.Locator; +import org.labkey.test.components.domain.DomainFormPanel; +import org.labkey.test.pages.ReactAssayDesignerPage; +import org.labkey.test.params.FieldDefinition; import org.labkey.test.util.DataRegionTable; import org.labkey.test.util.Ext4Helper; import org.labkey.test.util.UIAssayHelper; @@ -30,6 +33,7 @@ import java.io.File; import java.text.SimpleDateFormat; import java.util.List; +import java.util.Map; import java.util.Random; import static org.junit.Assert.assertEquals; @@ -190,7 +194,6 @@ public void addRecordsToAssayTemplate(String[][] data, List expectedColu } _test.waitForText("Sample Information"); - _test._ext4Helper.waitForMaskToDisappear(); _test.waitAndClick(Ext4Helper.Locators.ext4Button("Add From Spreadsheet")); _test.waitForElement(Ext4Helper.Locators.window("Spreadsheet Import")); diff --git a/laboratory/resources/web/laboratory/panel/AbstractAssayPanel.js b/laboratory/resources/web/laboratory/panel/AbstractAssayPanel.js index 07a012e1..c0b49398 100644 --- a/laboratory/resources/web/laboratory/panel/AbstractAssayPanel.js +++ b/laboratory/resources/web/laboratory/panel/AbstractAssayPanel.js @@ -584,7 +584,7 @@ Ext4.define('Laboratory.panel.AbstractAssayPanel', { importMethodToggle: importMethod }); - imf.fireEvent('change', this, imf.getValues, current); + imf.fireEvent('change', this, imf.getValue(), current); } var target = this.down('#templatePreviewPanel'); diff --git a/laboratory/resources/web/laboratory/panel/AssayTemplatePanel.js b/laboratory/resources/web/laboratory/panel/AssayTemplatePanel.js index 7f03e240..a2f4d60d 100644 --- a/laboratory/resources/web/laboratory/panel/AssayTemplatePanel.js +++ b/laboratory/resources/web/laboratory/panel/AssayTemplatePanel.js @@ -79,13 +79,13 @@ Ext4.define('Laboratory.panel.AssayTemplatePanel', { }, this); }, - appendDownloadMenuItems: function(){ + appendDownloadMenuItems: function() { var btn = this.down('#downloadBtn'); if(!this.templateMetadata.hideDownloadBtn) btn.setVisible(true); }, - validateForm: function(){ + validateForm: function() { var title = this.down('#templateTitle').getValue(); if (!title){ Ext4.Msg.alert('Error', 'Must choose a name for this run'); @@ -267,8 +267,18 @@ Ext4.define('Laboratory.panel.AssayTemplatePanel', { scope: this, failure: LDK.Utils.getErrorCallback(), success: function(results){ - if (results.rows.length) - this.setTemplate(results.rows[0], true); + if (results.rows.length) { + var row = results.rows[0]; + if (row.importMethod) { + this.selectedMethod = this.getImportMethodByName(row.importMethod); + var field = this.down('#templateImportMethod'); + if (field) { + field.setValue(this.selectedMethod.name); + } + this.toggleImportMethod(); + } + this.setTemplate(row, true); + } } }) }, @@ -456,4 +466,4 @@ Ext4.define('Laboratory.panel.AssayTemplatePanel', { resultFields.setVisible(false); } }, -}); \ No newline at end of file +}); diff --git a/laboratory/resources/web/laboratory/panel/WellLayoutPanel.js b/laboratory/resources/web/laboratory/panel/WellLayoutPanel.js index 9998d84e..4acf4177 100644 --- a/laboratory/resources/web/laboratory/panel/WellLayoutPanel.js +++ b/laboratory/resources/web/laboratory/panel/WellLayoutPanel.js @@ -50,13 +50,14 @@ Ext4.define('Laboratory.ext.WellLayoutPanel', { }, drawWell: function(){ - if (!this.store.getCount()){ + var platePanel = this.down('#plate'); + var legendPanel = this.down('#legend'); + + if (!this.store.getCount() || !platePanel || !legendPanel){ this.store.on('load', this.drawWell, this, {single: true}); return; } - var platePanel = this.down('#plate'); - var legendPanel = this.down('#legend'); var notAssigned = 0; var unknownWells = []; From 852959a8fd4849fd667593a0849c48f8f45c0458 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Tue, 1 Sep 2020 10:53:42 -0700 Subject: [PATCH 2/2] Remove unused imports (#48) --- .../labkey/test/util/external/labModules/LabModuleHelper.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/LDK/test/src/org/labkey/test/util/external/labModules/LabModuleHelper.java b/LDK/test/src/org/labkey/test/util/external/labModules/LabModuleHelper.java index 90711493..69db4ba8 100644 --- a/LDK/test/src/org/labkey/test/util/external/labModules/LabModuleHelper.java +++ b/LDK/test/src/org/labkey/test/util/external/labModules/LabModuleHelper.java @@ -19,9 +19,6 @@ import org.jetbrains.annotations.Nullable; import org.labkey.test.BaseWebDriverTest; import org.labkey.test.Locator; -import org.labkey.test.components.domain.DomainFormPanel; -import org.labkey.test.pages.ReactAssayDesignerPage; -import org.labkey.test.params.FieldDefinition; import org.labkey.test.util.DataRegionTable; import org.labkey.test.util.Ext4Helper; import org.labkey.test.util.UIAssayHelper; @@ -33,7 +30,6 @@ import java.io.File; import java.text.SimpleDateFormat; import java.util.List; -import java.util.Map; import java.util.Random; import static org.junit.Assert.assertEquals;