Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove jQuery dependency #1756

Merged
merged 50 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
1eb9b0d
Start of jquery replacement
aestoltm Aug 9, 2023
d456f68
Remove the rest of the jquery calls and remove it from composer depen…
aestoltm Aug 10, 2023
0ffdc45
Fix AddDataPanel extend calls
aestoltm Aug 10, 2023
60ab3a1
Assignment bug in usage extend call
aestoltm Aug 10, 2023
55a46cc
Correct how we call deepExtend vs spread operation for shallow merges
aestoltm Aug 10, 2023
d5ad016
Have eslint ignore spread notation.
aestoltm Aug 10, 2023
21f4cea
Syntax error for spread operation
aestoltm Aug 10, 2023
a5dbe71
Have eslint be okay with spread operation
aestoltm Aug 10, 2023
b18da42
Start of jquery replacement
aestoltm Aug 9, 2023
3f51d7b
Remove the rest of the jquery calls and remove it from composer depen…
aestoltm Aug 10, 2023
b8ba26f
Fix AddDataPanel extend calls
aestoltm Aug 10, 2023
e157428
Assignment bug in usage extend call
aestoltm Aug 10, 2023
30c6f7a
Correct how we call deepExtend vs spread operation for shallow merges
aestoltm Aug 10, 2023
8f2c2d2
Have eslint ignore spread notation.
aestoltm Aug 10, 2023
857a1eb
Syntax error for spread operation
aestoltm Aug 10, 2023
b80b0ff
Have eslint be okay with spread operation
aestoltm Aug 10, 2023
1b866a4
Merge xdmod11.0 into branch
aestoltm Oct 11, 2023
ef81de9
Merge remote-tracking branch 'origin/replace_jquery' into replace_jquery
aestoltm Oct 11, 2023
ace9f61
Update XDMoD to 11.0 (#1777)
ryanrath Oct 4, 2023
eec7bf7
Merge remote-tracking branch 'origin/xdmod11.0' into replace_jquery
aestoltm Oct 11, 2023
10aa2a4
Merge remote-tracking branch 'origin/replace_jquery' into replace_jquery
aestoltm Oct 11, 2023
3981076
Start of jquery replacement
aestoltm Aug 9, 2023
ce5cf62
Rebase remove_jquery onto xdmod11.0
aestoltm Aug 10, 2023
6b7d531
Fix AddDataPanel extend calls
aestoltm Aug 10, 2023
924c4c4
Assignment bug in usage extend call
aestoltm Aug 10, 2023
e064eb7
Correct how we call deepExtend vs spread operation for shallow merges
aestoltm Aug 10, 2023
82b9e5b
Have eslint ignore spread notation.
aestoltm Aug 10, 2023
eeed057
Syntax error for spread operation
aestoltm Aug 10, 2023
02db81c
Have eslint be okay with spread operation
aestoltm Aug 10, 2023
9d5acdb
Merge remote-tracking branch 'refs/remotes/origin/replace_jquery' int…
aestoltm Oct 11, 2023
6c7b563
Remove JQuery Dependency
aestoltm Aug 9, 2023
b9e6896
Update license information in notice and code comment
aestoltm Oct 16, 2023
fbec068
Merge branch 'xdmod11.0' into replace_jquery
aestoltm Oct 16, 2023
285fde4
Merge updates
aestoltm Oct 18, 2023
a6e31ac
Merge branch 'ubccr:xdmod11.0' into replace_jquery
aestoltm Oct 18, 2023
79fd685
Move function into CCR.js and remove eslint ignore line comments
aestoltm Oct 18, 2023
7138818
Allow spread operators on objects. Clean up complaints about var vs let.
aestoltm Oct 18, 2023
2868b1a
Fix object spread notation parser.
aestoltm Oct 18, 2023
a0e1d20
Adjust some deepExtend calls
aestoltm Oct 18, 2023
d44aaeb
Merge branch 'xdmod11.0' into replace_jquery
aestoltm Apr 25, 2024
b22edf2
Fix merge conflicts with plotly update
aestoltm May 8, 2024
447b6cb
Fix lock file to only adjust jquery packages
aestoltm May 8, 2024
7bb621d
Merge branch 'xdmod11.0' into replace_jquery
aestoltm May 8, 2024
1b763be
Touch up deepExtend implementation with chart data
aestoltm May 9, 2024
01bec64
Remove extra code
aestoltm May 9, 2024
462802b
Update author
aestoltm May 10, 2024
f21c2c1
Merge branch 'xdmod11.0' into replace_jquery
aestoltm May 10, 2024
de080da
Replace double quote
aestoltm May 10, 2024
08ba191
Address feedback
aestoltm May 10, 2024
f5d0df7
Merge branch 'xdmod11.0' into replace_jquery
aestoltm May 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ License: New BSD License
Author: Zend Technologies USA, Inc.
Link: http://framework.zend.com/

Name: jQuery
Name: youmightnotneedjquery
License: MIT license
Author: jQuery Foundation and other contributors
Link: http://jquery.com/
Author: HubSpot, Inc.
Link: https://github.com/HubSpot/YouMightNotNeedjQuery

Name: Plotly.js
License: MIT license
Expand Down
48 changes: 0 additions & 48 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
},
"require": {
"php": "^5.4 || ^7.2",
"carlo/jquery-base64-file": "^1.0",
"egulias/email-validator": "^1.2",
"google/recaptcha": "~1.1",
"greenlion/php-sql-parser": "~4.2",
"ircmaxell/password-compat": "~1",
"jquery/jquery-min-file": "^1.12.4",
"justinrainbow/json-schema": "~5.2",
"moment/moment-min-file": "^2.13.0",
"moment/moment-timezone-min-file": "^0.5.4",
Expand Down Expand Up @@ -123,48 +121,6 @@
}
}
},
{
"type": "package",
"package": {
"name": "jquery/jquery-min-file",
"type": "vanilla-plugin",
"version": "1.12.4",
"license": "MIT",
"homepage": "https://jquery.com",
"dist": {
"url": "https://code.jquery.com/jquery-1.12.4.min.js",
"type": "file",
"shasum": "5a9dcfbef655a2668e78baebeaa8dc6f41d8dabb"
},
"require": {
"composer/installers": "~1.0"
},
"extra": {
"installer-name": "jquery"
}
}
},
{
"type": "package",
"package": {
"name": "carlo/jquery-base64-file",
"type": "vanilla-plugin",
"version": "1.0",
"license": "MIT",
"homepage": "https://github.com/carlo/jquery-base64",
"dist": {
"url": "https://github.com/carlo/jquery-base64/raw/master/jquery.base64.js",
"type": "file",
"shasum": "7f0ba311c1676b1b730b29b06e1a9e9e55760acc"
},
"require": {
"composer/installers": "~1.0"
},
"extra": {
"installer-name": "base64"
}
}
},
{
"type": "package",
"package": {
Expand Down Expand Up @@ -214,13 +170,9 @@
"sencha/extjs-gpl",
"moment/moment-min-file",
"moment/moment-timezone-min-file",
"jquery/jquery-min-file",
"tildeio/rsvpjs-min-file",
"plotly/plotly"
],
"html/gui/lib/jquery-plugins/{$name}": [
"carlo/jquery-base64-file"
],
"external_libraries/{$name}": [
"zendframework/zendframework-minimal"
]
Expand Down
42 changes: 1 addition & 41 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions docs/notices.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ where denoted. These software products are free for commercial use.
available under the [GPL 3.0][gpl3].
- [Zend Framework 1.12.0](http://framework.zend.com/), which is available
under the [New BSD License][new-bsd].
- [jQuery](http://jquery.com/), which is available under the
[MIT License][mit].
- [youmightnotneedjquery](https://github.com/HubSpot/YouMightNotNeedjQuery),
which is available under the [MIT License][mit].
- [RSVP.js](https://github.com/tildeio/rsvp.js), which is available
under the [MIT License][mit].
- [Silex](http://silex.sensiolabs.org), which is available under the
Expand Down Expand Up @@ -46,8 +46,6 @@ where denoted. These software products are free for commercial use.
available under the [MIT License][mit].
- [reCAPTCHA PHP Library](https://developers.google.com/recaptcha/old/docs/php),
which is available under the [MIT License][mit].
- [jquery-base64](https://github.com/carlo/jquery-base64), which is available
under the [MIT License][mit].
- \*[Ext.ux.form.GroupComboBox](https://www.sencha.com/forum/showthread.php?45412-Ext-ux-form-GroupComboBox),
which is available under a "BSD" license (it is not clear which BSD license
is being referred to).
Expand Down
1 change: 0 additions & 1 deletion html/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"ga": false,
"moment": false,
"_gaq": false,
"jQuery": false,
"truncateText": false,
"XDMoD": false,
"Dashboard": false,
Expand Down
10 changes: 5 additions & 5 deletions html/gui/js/AddDataPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ Ext.apply(CCR.xdmod.ui.AddDataPanel, {
},
initRecord: function (store, config, selectedFilters, timeseries) {
var conf = {};
jQuery.extend(true, conf, CCR.xdmod.ui.AddDataPanel.defaultConfig(timeseries));
if (config) jQuery.extend(true, conf, config);
XDMoD.utils.deepExtend(conf, CCR.xdmod.ui.AddDataPanel.defaultConfig(timeseries));
if (config) XDMoD.utils.deepExtend(conf, config);
conf.id = CCR.randomInt(Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);
conf.z_index = store.getCount();
conf.filters = selectedFilters ? selectedFilters : {
Expand All @@ -102,7 +102,7 @@ Ext.extend(CCR.xdmod.ui.AddDataPanel, Ext.Panel, {
if (this.filtersStore) {
this.filtersStore.each(
function (record) {
var data = jQuery.extend({}, record.data);
var data = { ...{}, ...record.data };
ret.push(data);
});
}
Expand All @@ -129,7 +129,7 @@ Ext.extend(CCR.xdmod.ui.AddDataPanel, Ext.Panel, {
this.record = CCR.xdmod.ui.AddDataPanel.initRecord(this.store, this.config, this.getSelectedFilters(), this.timeseries);
}
this.originalData = {};
jQuery.extend(this.originalData, this.record.data);
this.originalData = { ...this.originalData, ...this.record.data };
this.filtersMenu = new Ext.menu.Menu({
showSeparator: false,
ignoreParentClicks: true
Expand Down Expand Up @@ -305,7 +305,7 @@ Ext.extend(CCR.xdmod.ui.AddDataPanel, Ext.Panel, {
])
});
if (this.record.data.filters) {
var currentFilters = jQuery.extend({}, this.record.data.filters);
var currentFilters = { ...{}, ...this.record.data.filters };
this.filtersStore.loadData(currentFilters, false);
}
var selectAllButton = new Ext.Button({
Expand Down
32 changes: 32 additions & 0 deletions html/gui/js/CCR.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,38 @@ XDMoD.utils.format = {
}
};

// Taken from: https://github.com/HubSpot/YouMightNotNeedjQuery, which
// is available under the MIT license.
// Recommended by @versable on https://github.com/ubccr/xdmod/pull/1542
XDMoD.utils.deepExtend = function extend(out, ...arguments_) {
if (!out) {
return {};
}

for (let i = 0; i < arguments_.length; i++) {
const obj = arguments_[i];
if (!obj) {
continue;
}

Object.entries(obj).forEach(([key, value]) => {
switch (Object.prototype.toString.call(value)) {
case '[object Object]':
out[key] = out[key] || {};
out[key] = XDMoD.utils.deepExtend(out[key], value);
break;
case '[object Array]':
out[key] = XDMoD.utils.deepExtend(new Array(value.length), value);
break;
default:
out[key] = value;
}
});
}

return out;
};

// =====================================================================

Ext.Ajax.timeout = 86400000;
Expand Down
2 changes: 1 addition & 1 deletion html/gui/js/PlotlyChartWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Ext.namespace('XDMoD.utils');
XDMoD.utils.createChart = function (chartOptions, extraHandlers) {
const baseChartOptions = {};
const configs = { displayModeBar: false, doubleClick: 'reset', doubleClickDelay: 500 };
jQuery.extend(true, baseChartOptions, chartOptions);
XDMoD.utils.deepExtend(baseChartOptions, chartOptions);
const isEmpty = (!baseChartOptions.data) || (baseChartOptions.data && baseChartOptions.data.length === 0);

// Configure plot for 'No Data' image. We want to wipe the layout object except for a couple things
Expand Down
8 changes: 4 additions & 4 deletions html/gui/js/PlotlyPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Ext.extend(CCR.xdmod.ui.PlotlyPanel, Ext.Panel, {
}
};

this.baseChartOptions = jQuery.extend(true, {}, defaultOptions, this.baseChartOptions);
this.baseChartOptions = XDMoD.utils.deepExtend({}, defaultOptions, this.baseChartOptions);

this.on('render', function () {
this.initNewChart.call(this);
Expand All @@ -51,7 +51,7 @@ Ext.extend(CCR.xdmod.ui.PlotlyPanel, Ext.Panel, {
if (t.getCount() <= 0) {
return;
}
this.chartOptions = jQuery.extend(true, {}, t.getAt(0).data, this.baseChartOptions);
this.chartOptions = XDMoD.utils.deepExtend({}, t.getAt(0).data, this.baseChartOptions);
this.chartOptions.credits = this.credits;
this.initNewChart.call(this);

Expand Down Expand Up @@ -279,9 +279,9 @@ Ext.extend(CCR.xdmod.ui.PlotlyPanel, Ext.Panel, {
initNewChart: function (chartOptions) { /* eslint object-shorthand: "off" */
const finalChartOptions = {};
if (chartOptions) {
jQuery.extend(true, finalChartOptions, this.baseChartOptions, chartOptions);
XDMoD.utils.deepExtend(finalChartOptions, this.baseChartOptions, chartOptions);
} else {
jQuery.extend(true, finalChartOptions, this.baseChartOptions, this.chartOptions);
XDMoD.utils.deepExtend(finalChartOptions, this.baseChartOptions, this.chartOptions);
}
this.chart = XDMoD.utils.createChart(finalChartOptions);
},
Expand Down
3 changes: 1 addition & 2 deletions html/gui/js/modules/Summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,7 @@ Ext.extend(XDMoD.Module.Summary, XDMoD.PortalModule, {
t: 22,
b: 0
}
},
data: []
jpwhite4 marked this conversation as resolved.
Show resolved Hide resolved
}
},
store: new CCR.xdmod.CustomJsonStore({

Expand Down
5 changes: 2 additions & 3 deletions html/gui/js/modules/Usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ Ext.extend(XDMoD.Module.Usage, XDMoD.PortalModule, {
if (chartRecords.length > 0) {
chartOptions = chartRecords[0].get('hc_jsonstore');
}
jQuery.extend(true, chartOptions, baseChartOptions);
chartOptions = XDMoD.utils.deepExtend({}, chartOptions, baseChartOptions);

let axisLabels;
const isEmpty = chartOptions.data && chartOptions.data.length === 0;
Expand Down Expand Up @@ -2707,7 +2707,6 @@ Ext.extend(XDMoD.Module.Usage, XDMoD.PortalModule, {
width: chartWidth * chartScale,
height: chartHeight * chartScale
},
data: [],
exporting: {
enabled: false
},
Expand All @@ -2718,7 +2717,7 @@ Ext.extend(XDMoD.Module.Usage, XDMoD.PortalModule, {

var chartOptions = r.get('hc_jsonstore');

jQuery.extend(true, chartOptions, baseChartOptions);
chartOptions = XDMoD.utils.deepExtend({}, chartOptions, baseChartOptions);
chartOptions.exporting.enabled = false;
chartOptions.credits.enabled = true;

Expand Down
2 changes: 1 addition & 1 deletion html/gui/js/modules/dashboard/ChartComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ XDMoD.Module.Dashboard.ChartComponent = Ext.extend(CCR.xdmod.ui.Portlet, {
this.title += ' - ' + this.config.chart.start_date + ' to ' + this.config.chart.end_date;

var chartConfig = {};
jQuery.extend(true, chartConfig, this.config.chart);
XDMoD.utils.deepExtend(chartConfig, this.config.chart);
chartConfig.title = '';

this.store = new CCR.xdmod.CustomJsonStore({
Expand Down
2 changes: 1 addition & 1 deletion html/gui/js/modules/job_viewer/ChartTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ XDMoD.Module.JobViewer.ChartTab = Ext.extend(Ext.Panel, {
}
};

var storeSettings = jQuery.extend(true, {}, defaultStoreSettings, this.panelSettings.store);
var storeSettings = XDMoD.utils.deepExtend({}, defaultStoreSettings, this.panelSettings.store);

this.store = new Ext.data.JsonStore(storeSettings);

Expand Down
18 changes: 9 additions & 9 deletions html/gui/js/modules/metric_explorer/MetricExplorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,9 @@ Ext.apply(XDMoD.Module.MetricExplorer, {
if (datasetCount === 1) {
instance.filtersStore.add(new instance.filtersStore.recordType(filter));
} else if (datasetCount > 1) {
var filters = jQuery.extend(true, {}, record.get('filters')),
found = false;
for (var i = 0; i < filters.length; i++) {
var filters = XDMoD.utils.deepExtend({}, record.get('filters'));
let found = false;
for (let i = 0; i < filters.length; i++) {
if (filters[i].id == filter.id) {
found = true;
break;
Expand Down Expand Up @@ -812,9 +812,9 @@ Ext.apply(XDMoD.Module.MetricExplorer, {
id: Math.random(),
metric: this.met,
color: 'auto'
};
jQuery.extend(config, record.data);
jQuery.extend(config, defaultConfig);
};
config = { ...config, ...record.data };
config = { ...config, ...defaultConfig };
var newRecord = CCR.xdmod.ui.AddDataPanel.initRecord(
instance.datasetStore,
config,
Expand Down Expand Up @@ -1138,9 +1138,9 @@ Ext.apply(XDMoD.Module.MetricExplorer, {
});
if (dimension !== 'none') {
if (instance.filtersStore.getById(drillFilter.id) === undefined) {
var filters = jQuery.extend(true, {}, record.get('filters')),
found = false;
for (var k = 0; k < filters.length; k++) {
var filters = XDMoD.utils.deepExtend({}, record.get('filters'));
var found = false;
for (let k = 0; k < filters.length; k++) {
if (filters[k].id == drillFilter.id) {
found = true;
break;
Expand Down
Loading