Skip to content

Commit f970d1a

Browse files
Remove angular grid code
1 parent 7f79b24 commit f970d1a

15 files changed

+28
-466
lines changed

app/controllers/application_controller.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,16 +1380,10 @@ def replace_gtl_main_div(_options = {})
13801380
if layout_uses_listnav?
13811381
page.replace(:listnav_div, :partial => "layouts/listnav") # Replace accordion, if list_nav_div is there
13821382
end
1383-
if @grid_hash
1384-
page.replace_html("list_grid", :partial => "layouts/list_grid", :locals => {:options => grid_options, :js_options => js_options})
1385-
# Reset the center buttons
1386-
page << "miqGridOnCheck();"
1387-
else
1388-
# No grid, replace the gtl div
1389-
# Replace the main div area contents
1390-
page.replace_html("main_div", :partial => "layouts/gtl")
1391-
page << "$('#adv_div').slideUp(0.3);" if params[:entry]
1392-
end
1383+
# No grid, replace the gtl div
1384+
# Replace the main div area contents
1385+
page.replace_html("main_div", :partial => "layouts/gtl")
1386+
page << "$('#adv_div').slideUp(0.3);" if params[:entry]
13931387
end
13941388
end
13951389

app/controllers/infra_networking_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ def replace_right_cell(options = {})
330330
partial_locals = {:controller =>'infra_networking'}
331331
if partial == 'layouts/x_gtl'
332332
partial_locals[:action_url] = @lastaction
333-
presenter[:parent_id] = @record.id # Set parent rec id for JS function miqGridSort to build URL
334333
presenter[:parent_class] = params[:controller] # Set parent class for URL also
335334
end
336335
presenter.update(:main_div, r[:partial => partial, :locals => partial_locals])

app/controllers/vm_common.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,10 +1001,6 @@ def replace_right_cell(options = {})
10011001
partial_locals = { :controller => 'vm' }
10021002
if partial == 'layouts/x_gtl'
10031003
partial_locals[:action_url] = @lastaction
1004-
1005-
# Set parent record id & class for JS function miqGridSort to build URL
1006-
presenter[:parent_id] = @record.id
1007-
presenter[:parent_class] = params[:controller]
10081004
end
10091005
presenter.update(:main_div, r[:partial => partial, :locals => partial_locals])
10101006

app/javascript/.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"miqSparkleOn": true,
1717
"miqToggleUserOptions": true,
1818
"miqTreeActivateNode": true,
19-
"miqOrderService": true,
2019
"miqQueueReport": true
2120
},
2221
"extends": ["airbnb", "plugin:jest/recommended"],

app/javascript/oldjs/application.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ require('./miq_c3_config.js');
2525
require('./miq_ujs_bindings.js');
2626
require('./miq_tree.js');
2727
require('./miq_formatters.js');
28-
require('./miq_grid.js');
2928
require('./miq_list_grid.js');
3029
require('./miq_toolbar.js');
3130
require('./miq_c3.js');

app/javascript/oldjs/miq_application.js

Lines changed: 18 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global add_flash getChartColumnDataValues getChartFormatedValue miqBrowserDetect miqExpressionPrefill miqFlashLater miqFlashSaved miqGridCheckAll miqGridGetCheckedRows miqMenu miqTreeObject miqValueStylePrefill recalculateChartYAxisLabels */
1+
/* global add_flash getChartColumnDataValues getChartFormatedValue miqBrowserDetect miqExpressionPrefill miqFlashLater miqFlashSaved miqMenu miqTreeObject miqValueStylePrefill recalculateChartYAxisLabels */
22

33
// MIQ specific JS functions
44

@@ -351,40 +351,6 @@ window.miqValidateButtons = function(h_or_s, prefix) {
351351
}
352352
};
353353

354-
// update all checkboxes on a form when the masterToggle checkbox is changed
355-
// parms: button_div=<id of div with buttons to update>
356-
window.miqUpdateAllCheckboxes = function(button_div) {
357-
if (!miqDomElementExists('masterToggle')) {
358-
return;
359-
}
360-
361-
const state = $('#masterToggle').prop('checked');
362-
363-
if (ManageIQ.grids.gtl_list_grid) {
364-
miqGridCheckAll(state);
365-
const crows = miqGridGetCheckedRows();
366-
367-
ManageIQ.gridChecks = crows;
368-
miqSetButtons(crows.length, button_div);
369-
} else if ($('input.listcheckbox').length) {
370-
// No list_grid on the screen
371-
const cbs = $('input.listcheckbox')
372-
.prop('checked', state)
373-
.trigger('change');
374-
375-
miqUpdateButtons(cbs[0], button_div);
376-
} else if ($("input[id^='storage_cb']").length) {
377-
// to handle check/uncheck all for C&U collection
378-
$("input[id^='storage_cb']")
379-
.prop('checked', state)
380-
.trigger('change');
381-
miqJqueryRequest(miqPassFields(
382-
'/configuration/form_field_changed',
383-
{ storage_cb_all: state }
384-
));
385-
}
386-
};
387-
388354
// Update buttons based on number of checkboxes that are checked
389355
// parms: obj=<checkbox element>, button_div=<id of div with buttons to update>
390356
window.miqUpdateButtons = function(obj, button_div) {
@@ -439,22 +405,22 @@ window.DoNav = function(theUrl) {
439405
};
440406

441407
// Routines to get the size of the window
442-
window.miqResetSizeTimer = function() {
443-
const height = window.innerHeight;
444-
const offset = 427;
445-
let h = height - offset;
446-
447-
if (h < 200) {
448-
h = 200;
449-
}
450-
451-
// Adjust certain elements, if present
452-
if (miqDomElementExists('list_grid')) {
453-
$('#list_grid').css({ height: `${h}px` });
454-
} else if (miqDomElementExists('logview')) {
455-
$('#logview').css({ height: `${h}px` });
456-
}
457-
};
408+
// window.miqResetSizeTimer = function() {
409+
// const height = window.innerHeight;
410+
// const offset = 427;
411+
// let h = height - offset;
412+
413+
// if (h < 200) {
414+
// h = 200;
415+
// }
416+
417+
// // Adjust certain elements, if present
418+
// if (miqDomElementExists('list_grid')) {
419+
// $('#list_grid').css({ height: `${h}px` });
420+
// } else if (miqDomElementExists('logview')) {
421+
// $('#logview').css({ height: `${h}px` });
422+
// }
423+
// };
458424

459425
// Pass fields to server given a URL and fields in name/value pairs
460426
window.miqPassFields = function(url, args) {
@@ -1460,7 +1426,7 @@ $(() => {
14601426

14611427
$(window).on('resize', miqInitAccordions);
14621428
$(window).on('resize', miqInitMainContent);
1463-
$(window).on('resize', _.debounce(miqResetSizeTimer, 1000));
1429+
// $(window).on('resize', _.debounce(miqResetSizeTimer, 1000));
14641430

14651431
check_for_ellipsis();
14661432
});

app/javascript/oldjs/miq_global.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
// global variables
22
if (!window.ManageIQ) {
33
window.ManageIQ = {
4-
actionUrl: null, // action URL used in JS function miqGridSort
54
afterOnload: null, // JS code to be evaluated after onload
65
angular: {
76
app: null, // angular application
87
eventNotificationsData: null, // used by the notification drawer
9-
rxSubject: null, // an observable
10-
scope: null, // a scope which will have .angularForm after loading, for miqCheckForChanges
8+
rxSubject: null, // an observable
9+
scope: null, // a scope which will have .angularForm after loading, for miqCheckForChanges
1110
},
1211
asynchronous_notifications: false, // disabled by default, server overrides it in application.html.haml
1312
browser: null, // browser name
1413
calendar: { // TODO about to be removed
1514
calDateFrom: null, // to limit calendar starting
1615
calDateTo: null, // to limit calendar ending
17-
calSkipDays: null, // to disable specific days of week
16+
calSkipDays: null, // to disable specific days of week
1817
},
1918
changes: null, // indicate if there are unsaved changes
2019
charts: {
@@ -49,13 +48,13 @@ if (!window.ManageIQ) {
4948
i18n: {
5049
mark_translated_strings: false,
5150
},
52-
logoutInProgress: false, // prevent redirectLogin *during* logout and group change
51+
logoutInProgress: false, // prevent redirectLogin *during* logout and group change
5352
menu: [],
5453
mouse: {
5554
x: null, // mouse X coordinate for popup menu
5655
y: null, // mouse Y coordinate for popup menu
5756
},
58-
move: { //methods to move elements between Arrays or in an Array
57+
move: { // methods to move elements between Arrays or in an Array
5958
},
6059
noCollapseEvent: false, // enable/disable events fired after collapsing an accordion
6160
observe: { // keeping track of data-miq_observe requests

app/javascript/oldjs/miq_grid.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

app/javascript/oldjs/miq_list_grid.js

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,4 @@
1-
/* global DoNav miqDomElementExists miqJqueryRequest miqSetButtons miqUpdateButtons */
2-
3-
// Handle row click (ajax or normal html trans)
4-
window.miqRowClick = function(row_id, row_url, row_url_ajax) {
5-
if (!row_url) {
6-
return;
7-
}
8-
9-
if (row_url_ajax) {
10-
miqJqueryRequest(row_url + row_id, { beforeSend: true, complete: true });
11-
} else {
12-
DoNav(row_url + row_id);
13-
}
14-
};
15-
16-
window.checkboxItemId = function($elem) {
17-
const val = $elem.val();
18-
const name = $elem.attr('name');
19-
20-
if (_.startsWith(name, 'check_')) {
21-
return name.substr(6);
22-
}
23-
24-
return val;
25-
};
26-
27-
// returns a list of checked row ids
28-
window.miqGridGetCheckedRows = function(grid) {
29-
grid = grid || 'list_grid';
30-
const crows = [];
31-
32-
$(`#${grid} .list-grid-checkbox`).each((_idx, elem) => {
33-
if (!$(elem).prop('checked')) {
34-
return;
35-
}
36-
37-
const item_id = checkboxItemId($(elem));
38-
crows.push(item_id);
39-
});
40-
41-
return crows;
42-
};
43-
44-
// checks/unchecks all grid rows
45-
window.miqGridCheckAll = function(state, grid) {
46-
grid = grid || 'list_grid';
47-
state = !!state;
48-
49-
$(`#${grid} .list-grid-checkbox`)
50-
.prop('checked', state)
51-
.trigger('change');
52-
};
53-
54-
// Order a service from the catalog list view
55-
window.miqOrderService = function(id) {
56-
const url = `/${ManageIQ.controller}/x_button/${id}?pressed=svc_catalog_provision`;
57-
miqJqueryRequest(url, { beforeSend: true, complete: true });
58-
};
59-
1+
// Needed for optimization page queue report button
602
window.miqQueueReport = function(id) {
613
const url = `/optimization/queue_report/${id}`;
624
window.miqSparkleOn();
@@ -68,45 +10,3 @@ window.miqQueueReport = function(id) {
6810
})
6911
.catch(() => window.miqSparkleOff());
7012
};
71-
72-
// Handle checkbox
73-
window.miqGridOnCheck = function(elem, button_div, grid) {
74-
if (elem) {
75-
miqUpdateButtons(elem, button_div);
76-
}
77-
78-
const crows = miqGridGetCheckedRows(grid);
79-
ManageIQ.gridChecks = crows;
80-
81-
miqSetButtons(crows.length, 'center_tb');
82-
};
83-
84-
// Handle sort
85-
window.miqGetSortUrl = function(col_id) {
86-
let controller = null;
87-
const action = ManageIQ.actionUrl;
88-
let id = null;
89-
90-
if (action === 'sort_ds_grid') {
91-
controller = 'miq_request';
92-
} else if (ManageIQ.record.parentId !== null) {
93-
controller = ManageIQ.record.parentClass;
94-
id = ManageIQ.record.parentId;
95-
}
96-
97-
let url = action;
98-
if (controller) {
99-
url = `/${controller}/${url}`;
100-
}
101-
if (id && (url.indexOf(id) < 0)) {
102-
url = `${url}/${id}`;
103-
}
104-
105-
url = `${url}?sortby=${col_id}&${window.location.search.substring(1)}`;
106-
return url;
107-
};
108-
109-
window.miqGridSort = function(col_id) {
110-
const url = miqGetSortUrl(col_id);
111-
miqJqueryRequest(url, { beforeSend: true, complete: true });
112-
};

0 commit comments

Comments
 (0)