Skip to content

Move TargetedMS QC/chart UI off ExtJS to plain JS + HTML - #1257

Open
ankurjuneja wants to merge 5 commits into
developfrom
fb_1249_extJS
Open

Move TargetedMS QC/chart UI off ExtJS to plain JS + HTML#1257
ankurjuneja wants to merge 5 commits into
developfrom
fb_1249_extJS

Conversation

@ankurjuneja

@ankurjuneja ankurjuneja commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Rationale

We are gradually removing our dependency on ExtJS. ExtJS is old, heavy, and something we want to stop using. Each of these screens used ExtJS only as a wrapper around plain data or existing non-ExtJS chart code, so we can swap in simple HTML, plain JavaScript, and jQuery without changing what the user sees. This makes the code lighter, easier to read, and easier to maintain.

Related Pull Requests

Changes

  • Trace metric dialog (resources/web/PanoramaPremium/window/AddNewTraceMetricWindow.js)
  • Pareto plot (webapp/TargetedMS/js/ParetoPlotPanel.js)
  • Calibration curve (webapp/TargetedMS/js/CalibrationCurve.js)
  • Summary charts (src/org/labkey/targetedms/view/summaryChartsView.jsp)

public void addClientDependencies(ClientDependencies dependencies)
{
dependencies.add("Ext4");
dependencies.add("Ext4"); // LABKEY.vis (vis/vis) still uses Ext.isArray for log-scale axes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ankurjuneja this is the PR I was thinking of when I tagged you for the changes here LabKey/platform#7865. Not sure if that changes this dependency at all, but wanted to call it out.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cnathe, I will verify (and remove) if we need the Ext4 dependency for calibration curve.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to check on this.

* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/

Ext4.define('Panorama.Window.AddTraceMetricWindow', {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConfigureMetricsUIPage still has Ext locators.

const title = op === 'insert' ? 'Add New Trace Metric' : 'Edit Trace Metric';

// In update mode, pick the mode based on the stored values; default to the time-value mode.
const isTraceValueMode = op === 'update' && metric.TraceValue > 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check on line 79 allows zeros when saving, but this treats them as a sentinel. Probably best to make line 79 ensure a positive value, which matches the old validation.

return String(a.TextId).localeCompare(String(b.TextId));
});
let html = '<option value="">-- Select trace --</option>';
traces.forEach(function(row) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low priority, but if the previously saved value is no longer present, it won't be in the list. The old code always added the saved value. We could do the same here.

const metricName = $('#lk-trace-metric-name').val().trim();
checkMetricNameExists(metricName, function(exists) {
if (exists) {
showError('A metric with the name "' + LABKEY.Utils.encodeHtml(metricName) + '" already exists. Please choose a different name.');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showError uses .text() so this will be double-encoded. Remove the encoding here.

const rounded = Math.round(value * 100000) / 100000;
// Use scientific notation if the number is large or very small
if (exp && (rounded > 10000 || rounded < -10000 || (rounded > -0.00001 && rounded < 0.00001)))
rounded.toExponential(4)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rounded.toExponential(4)
return rounded.toExponential(4)

</tr>
<tr>
<td class="sc-label"><label for="sc-width">Width</label></td>
<td><input type="number" id="sc-width" value="<%= bean.getInitialWidth() %>"></td>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<td><input type="number" id="sc-width" value="<%= bean.getInitialWidth() %>"></td>
<td><input type="number" id="sc-width" value="<%= bean.getInitialWidth() %>" min="1" step="1"></td>

Comment on lines +387 to +390
areaElement.style.width = parseInt(widthInput.value) + 'px';
areaElement.style.height = parseInt(heightInput.value) + 'px';
timeElement.style.width = parseInt(widthInput.value) + 'px';
timeElement.style.height = parseInt(heightInput.value) + 'px';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we'd handle a NaN as type="number" isn't particularly strict.

this.queryError.setVisible(true);
}
});
LABKEY.Query.saveRows({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my local testing, this can be sluggish to save. There's no feedback for the user while it's working, which led me to click on Save a second time, which then produced a key violation. This change presumably hasn't impacted the perf, but it would be nice to show a spinner and disable the buttons to avoid a double-submit.

public void addClientDependencies(ClientDependencies dependencies)
{
dependencies.add("Ext4");
dependencies.add("Ext4"); // LABKEY.vis (vis/vis) still uses Ext.isArray for log-scale axes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to check on this.

public void addClientDependencies(ClientDependencies dependencies)
{
dependencies.add("Ext4");
dependencies.add("Ext4"); // still needed by QCMetricConfigLoader.js

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's just for JSON parsing. Can we migrate that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants