Skip to content

Commit 0c0dff1

Browse files
Issue 53623: Improve QC metrics config UI
1 parent b656d2d commit 0c0dff1

7 files changed

Lines changed: 73 additions & 162 deletions

File tree

resources/views/configureQCMetric.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
LABKEY.internal = {};
1212

1313
LABKEY.internal.ConfigureQCMetrics = new function () {
14-
var qcMetrics;
15-
var qcMetricsTable ='';
16-
var configRows = [];
14+
let qcMetrics;
15+
let qcMetricsTable ='';
16+
let configRows = [];
1717

1818
function showQCMetrics() {
1919
qcMetricsTable += '<form id="qcMetricsForm" >';
@@ -37,7 +37,11 @@
3737
qcMetricsTable += '<td>' + (editLock ? '<a id="editLink' + row.id + '" href="#">' : '' ) + LABKEY.Utils.encodeHtml(row.name) + '</td>' + (editLock ? '</a>' : '' );
3838
qcMetricsTable += '<td>' + (row.PrecursorScoped ? 'Precursor' : 'Run') + '</td>';
3939

40-
if (row.EffectiveStatus === 'NoData') {
40+
// remove all paired metric configs
41+
if (row.Series2QueryName !== null) {
42+
qcMetricsTable += '<td id=\"' + LABKEY.Utils.encodeHtml(row.name) + '\">Dual-metrics cannot be configured</td>';
43+
}
44+
else if (row.EffectiveStatus === 'NoData') {
4145
qcMetricsTable += '<td id=\"' + LABKEY.Utils.encodeHtml(row.name) + '\">No data in this folder</td>';
4246
}
4347
else {
@@ -121,10 +125,6 @@
121125
sort: 'name',
122126
scope: this,
123127
success: function (result) {
124-
// remove all paired metric configs
125-
result.rows = result.rows.filter(function(row) {
126-
return row.Series2QueryName === null;
127-
});
128128
result.rows.sort(function(row1, row2) { return row1.name.toLowerCase().localeCompare(row2.name.toLowerCase()); });
129129
qcMetrics = result.rows;
130130
showQCMetrics();

resources/web/PanoramaPremium/window/AddNewMetricWindow.js

Lines changed: 18 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Ext4.define('Panorama.Window.AddCustomMetricWindow', {
1414
update: 'update',
1515
insert: 'insert',
1616

17+
SCHEMA_NAME: 'targetedms',
18+
19+
1720
initComponent: function() {
1821
var title = this.operation === this.insert ? 'Add New Metric' : 'Edit Metric';
1922
this.setTitle(title);
@@ -28,41 +31,27 @@ Ext4.define('Panorama.Window.AddCustomMetricWindow', {
2831
}]
2932

3033
this.callParent();
31-
if(this.operation === this.update) {
32-
if(this.metric.Series1SchemaName) {
33-
this.getQueriesForSchema(this.metric.Series1SchemaName, function (queries, scope) {
34-
scope.series1queries = queries;
35-
scope.queries1Combo.bindStore(scope.getQueriesStore());
3634

37-
});
38-
}
39-
if(this.metric.Series2SchemaName) {
40-
this.getQueriesForSchema(this.metric.Series2SchemaName, function (queries, scope) {
41-
scope.series2queries = queries;
42-
scope.queries2Combo.bindStore(scope.getQueriesStore());
43-
});
44-
}
45-
if(this.metric.EnabledSchemaName) {
46-
this.getQueriesForSchema(this.metric.EnabledSchemaName, function (queries, scope) {
47-
scope.enabledqueries = queries;
48-
scope.enabledQueriesCombo.bindStore(scope.getQueriesStore());
49-
});
35+
LABKEY.Query.getQueries({
36+
scope: this,
37+
schemaName: this.SCHEMA_NAME,
38+
success: function(queriesInfo) {
39+
this.series1queries = queriesInfo.queries;
40+
this.series2queries = queriesInfo.queries;
41+
this.enabledqueries = queriesInfo.queries;
5042
}
51-
}
43+
});
5244

5345
},
5446

5547
getItems: function() {
5648
return [
5749
this.getMetricNameField(),
58-
this.getSchema1Combo(),
5950
this.getQueries1Combo(),
6051
this.getSeries1AxisLabelField(),
61-
this.getSchema2Combo(),
6252
this.getQueries2Combo(),
6353
this.getSeries2AxisLabelField(),
6454
this.getMetricTypeCombo(),
65-
this.getEnabledSchemaCombo(),
6655
this.getEnabledQueriesCombo(),
6756
this.getQueryError(),
6857
];
@@ -107,47 +96,14 @@ Ext4.define('Panorama.Window.AddCustomMetricWindow', {
10796
};
10897
},
10998

110-
getSchema1Combo: function() {
111-
if(!this.schema1Combo) {
112-
var config = Ext4.apply(this.getSchemaConfig('Series 1', 'series1'), {
113-
listeners: {
114-
scope: this,
115-
select: function(combo, recs){
116-
var rec = recs[0];
117-
this.series1schema = rec.data.field1;
118-
this.queries1Combo.setValue(null);
119-
120-
LABKEY.Query.getQueries({
121-
scope: this,
122-
schemaName: this.series1schema,
123-
success: function(queriesInfo) {
124-
this.series1queries = queriesInfo.queries;
125-
}
126-
});
127-
}
128-
}
129-
});
130-
131-
this.schema1Combo = Ext4.create('Ext.form.field.ComboBox', config);
132-
133-
if(this.operation === this.update) {
134-
this.schema1Combo.setValue(this.metric.Series1SchemaName);
135-
this.schema1Combo.bindStore(this.schemas);
136-
}
137-
}
138-
139-
return this.schema1Combo;
140-
},
141-
14299
getQueriesConfig: function(label, name) {
143100
return {
144101
fieldLabel: label + ' Query',
145102
name: name + 'Query',
146103
labelWidth: 150,
147104
width: 400,
148105
displayField : 'title',
149-
valueField : 'name',
150-
emptyText: 'Please select ' + label + ' Schema.'
106+
valueField : 'name'
151107
};
152108
},
153109

@@ -224,37 +180,6 @@ Ext4.define('Panorama.Window.AddCustomMetricWindow', {
224180
return this.series2AxisLabelField;
225181
},
226182

227-
getSchema2Combo: function() {
228-
if(!this.schema2Combo) {
229-
var config = Ext4.apply(this.getSchemaConfig('Series 2', 'series2'), {
230-
listeners: {
231-
scope: this,
232-
select: function(combo, recs){
233-
var rec = recs[0];
234-
this.series2schema = rec.data.field1;
235-
this.queries2Combo.setValue(null);
236-
237-
LABKEY.Query.getQueries({
238-
scope: this,
239-
schemaName: this.series2schema,
240-
success: function(queriesInfo) {
241-
this.series2queries = queriesInfo.queries;
242-
}
243-
});
244-
}
245-
}
246-
});
247-
248-
this.schema2Combo = Ext4.create('Ext.form.field.ComboBox', config);
249-
250-
if(this.operation === this.update) {
251-
this.schema2Combo.setValue(this.metric.Series2SchemaName);
252-
}
253-
}
254-
255-
return this.schema2Combo;
256-
},
257-
258183
getQueries2Combo: function() {
259184
if(!this.queries2Combo) {
260185
var config = Ext4.apply(this.getQueriesConfig('Series 2', 'series2'), {
@@ -280,37 +205,6 @@ Ext4.define('Panorama.Window.AddCustomMetricWindow', {
280205
return this.queries2Combo;
281206
},
282207

283-
getEnabledSchemaCombo: function() {
284-
if(!this.enabledSchemaCombo) {
285-
var config = Ext4.apply(this.getSchemaConfig('Enabled', 'enabled'), {
286-
listeners: {
287-
scope: this,
288-
select: function(combo, recs){
289-
var rec = recs[0];
290-
this.enabledschema = rec.data.field1;
291-
this.enabledQueriesCombo.setValue(null);
292-
293-
LABKEY.Query.getQueries({
294-
scope: this,
295-
schemaName: this.enabledschema,
296-
success: function(queriesInfo) {
297-
this.enabledqueries = queriesInfo.queries;
298-
}
299-
});
300-
}
301-
}
302-
});
303-
304-
this.enabledSchemaCombo = Ext4.create('Ext.form.field.ComboBox', config);
305-
306-
if(this.operation === this.update) {
307-
this.enabledSchemaCombo.setValue(this.metric.EnabledSchemaName);
308-
}
309-
}
310-
311-
return this.enabledSchemaCombo;
312-
},
313-
314208
getEnabledQueriesCombo: function() {
315209
if(!this.enabledQueriesCombo) {
316210
var config = Ext4.apply(this.getQueriesConfig('Enabled', 'enabled'), {
@@ -426,32 +320,17 @@ Ext4.define('Panorama.Window.AddCustomMetricWindow', {
426320
isValid = false;
427321
}
428322

429-
if(!this.schema1Combo.getValue()) {
430-
this.schema1Combo.setActiveError(errorText);
431-
isValid = false;
432-
}
433-
434-
if(this.schema1Combo.getValue() && !this.queries1Combo.getValue()) {
323+
if(!this.queries1Combo.getValue()) {
435324
this.queries1Combo.setActiveError(errorText);
436325
isValid = false;
437326
}
438327

439-
if(this.schema1Combo.getValue() && !this.series1AxisLabelField.getValue().length > 0) {
328+
if(!this.series1AxisLabelField.getValue().length > 0) {
440329
this.series1AxisLabelField.setActiveError(errorText);
441330
isValid = false;
442331
}
443332

444-
if(this.schema2Combo.getValue() && !this.queries2Combo.getValue()) {
445-
this.queries2Combo.setActiveError("Required when series 2 schema is provided.");
446-
isValid = false;
447-
}
448-
449-
if(this.schema2Combo.getValue() && !this.series2AxisLabelField.getValue().length > 0) {
450-
this.series2AxisLabelField.setActiveError("Required when series 2 schema is provided.");
451-
isValid = false;
452-
}
453-
454-
if(this.schema1Combo.getValue() && this.metricTypeCombo.getValue() == null) {
333+
if(this.metricTypeCombo.getValue() == null) {
455334
this.metricTypeCombo.setActiveError(errorText);
456335
isValid = false;
457336
}
@@ -510,17 +389,17 @@ Ext4.define('Panorama.Window.AddCustomMetricWindow', {
510389
var records = [];
511390
var newMetric = {};
512391
newMetric.Name = this.metricNameField.getValue();
513-
newMetric.Series1SchemaName = this.schema1Combo.getValue();
392+
newMetric.Series1SchemaName = this.SCHEMA_NAME;
514393
newMetric.Series1QueryName = this.queries1Combo.getValue();
515394
newMetric.Series1Label = this.series1AxisLabelField.getValue();
516395
newMetric.PrecursorScoped = this.metricTypeCombo.getValue();
517396

518397

519-
newMetric.Series2SchemaName = this.schema2Combo.getValue();
398+
newMetric.Series2SchemaName = this.SCHEMA_NAME;
520399
newMetric.Series2QueryName = this.queries2Combo.getValue();
521400
newMetric.Series2Label = this.series2AxisLabelField.getValue();
522401

523-
newMetric.EnabledSchemaName = this.enabledSchemaCombo.getValue();
402+
newMetric.EnabledSchemaName = this.SCHEMA_NAME;
524403
newMetric.EnabledQueryName = this.enabledQueriesCombo.getValue();
525404

526405
if(this.operation === this.update) {

src/org/labkey/targetedms/TargetedMSDataHandler.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.labkey.api.exp.api.ExpRun;
3131
import org.labkey.api.exp.api.ExperimentService;
3232
import org.labkey.api.pipeline.PipeRoot;
33+
import org.labkey.api.pipeline.PipelineJob;
3334
import org.labkey.api.pipeline.PipelineJobException;
3435
import org.labkey.api.pipeline.PipelineService;
3536
import org.labkey.api.security.User;
@@ -105,7 +106,14 @@ public void importFile(ExpData data, Path dataFile, ViewBackgroundInfo info, @No
105106

106107
TargetedMSManager.updateRun(run, info.getUser());
107108

108-
TargetedMSService.get().getSkylineDocumentImportListener().forEach(listener -> listener.onDocumentImport(context.getContainer(), info.getUser(), run));
109+
try
110+
{
111+
TargetedMSService.get().getSkylineDocumentImportListener().forEach(listener -> listener.onDocumentImport(context.getContainer(), info.getUser(), run));
112+
}
113+
catch (RuntimeException e)
114+
{
115+
context.getJob().warn("Error calling SkylineDocumentImportListener.onDocumentImport", e);
116+
}
109117

110118
transaction.commit();
111119
}

src/org/labkey/targetedms/outliers/OutlierGenerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,13 @@ public List<SampleFileInfo> getSampleFiles(List<RawMetricDataSet> dataRows, Map<
504504
public String getMetricLabel(Map<Integer, QCMetricConfiguration> metrics, RawMetricDataSet dataRow)
505505
{
506506
QCMetricConfiguration metric = metrics.get(dataRow.getMetricId());
507-
return switch (dataRow.getMetricSeriesIndex())
507+
String result = switch (dataRow.getMetricSeriesIndex())
508508
{
509509
case 1 -> metric.getSeries1Label();
510510
case 2 -> metric.getSeries2Label();
511511
default -> throw new IllegalArgumentException("Unexpected metric series index: " + dataRow.getMetricSeriesIndex());
512512
};
513+
return result == null ? "Unlabeled" : result;
513514
}
514515
/**
515516
* returns the separated plots data per peptide

test/src/org/labkey/test/pages/panoramapremium/ConfigureMetricsUIPage.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,24 @@ public void addNewTraceMetric(Map<TraceMetricProperties, String> traceProperties
126126
}
127127

128128
public void editMetric(String metric, Map<CustomMetricProperties, String> metricProperties)
129+
{
130+
Window<?> metricWindow = openForEdit(metric);
131+
editCustomMetricValues(metricWindow, metricProperties);
132+
}
133+
134+
public void deleteMetric(String metric)
135+
{
136+
openForEdit(metric);
137+
clickButton("Delete", 0);
138+
clickButton("Yes");
139+
waitForPage();
140+
}
141+
142+
private Window<?> openForEdit(String metric)
129143
{
130144
waitAndClick(Locator.linkWithText(metric));
131145
waitForElement(Ext4Helper.Locators.window("Edit Metric"));
132-
Window<?> metricWindow = new Window.WindowFinder(getDriver()).withTitle("Edit Metric").waitFor();
133-
editCustomMetricValues(metricWindow, metricProperties);
146+
return new Window.WindowFinder(getDriver()).withTitle("Edit Metric").waitFor();
134147
}
135148

136149
private void editCustomMetricValues(Window<?> metricWindow, Map<CustomMetricProperties, String> metricProperties)
@@ -186,8 +199,6 @@ public enum MetricType
186199
public enum CustomMetricProperties
187200
{
188201
metricName("Name", false),
189-
series1Schema("Series 1 Schema", true),
190-
series2Schema("Series 2 Schema", true),
191202
series1Query("Series 1 Query", true),
192203
series2Query("Series 2 Query", true),
193204
series1AxisLabel("Series 1 Axis Label", false),

test/src/org/labkey/test/tests/panoramapremium/TargetedMSQCFolderImportExport.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void testQCFolderImport()
6464
String annotationType = "Test QC Annotation type";
6565
log("Updating the folder to be exported with data points");
6666
createGuideSet(getProjectName());
67-
addCustomMetric(getProjectName(), customMetricName, "targetedms", "AQCTest_Metric");
67+
addCustomMetric(getProjectName(), customMetricName, "AQCTest_Metric");
6868
addAnnotationType(getProjectName(), annotationType);
6969
excludePrecursors(getProjectName(), 0);
7070

@@ -118,12 +118,11 @@ private void createGuideSet(String projectName)
118118
Assert.assertEquals("Guide Set was not added correctly", 1, table.getDataRowCount());
119119
}
120120

121-
private void addCustomMetric(String projectName, String metricName, String schema1Name, String series1Query)
121+
private void addCustomMetric(String projectName, String metricName, String series1Query)
122122
{
123123
goToProjectHome(projectName);
124124
Map<ConfigureMetricsUIPage.CustomMetricProperties, String> metricProperties = new LinkedHashMap<>();
125125
metricProperties.put(ConfigureMetricsUIPage.CustomMetricProperties.metricName, metricName);
126-
metricProperties.put(ConfigureMetricsUIPage.CustomMetricProperties.series1Schema, schema1Name);
127126
metricProperties.put(ConfigureMetricsUIPage.CustomMetricProperties.series1Query, series1Query);
128127
metricProperties.put(ConfigureMetricsUIPage.CustomMetricProperties.series1AxisLabel, metricName);
129128
metricProperties.put(ConfigureMetricsUIPage.CustomMetricProperties.metricType, ConfigureMetricsUIPage.MetricType.Precursor.name());

0 commit comments

Comments
 (0)