Skip to content

Commit 83100ef

Browse files
authored
Merge pull request #9543 from GilbertCherrie/remove_angular_grid_code
Remove angular grid code
2 parents 3af103a + a254350 commit 83100ef

17 files changed

+23
-548
lines changed

app/controllers/application_controller.rb

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,20 +1171,9 @@ def get_view(db, options = {}, fetch_data = false)
11711171
view.extras[:auth_count] = attrs[:auth_count] if attrs[:auth_count]
11721172
@targets_hash = attrs[:targets_hash] if attrs[:targets_hash]
11731173

1174-
# Set up the grid variables for list view, with exception models below
1175-
if grid_hash_conditions(view) && fetch_data
1176-
@grid_hash = view_to_hash(view, fetch_data)
1177-
end
1178-
11791174
[view, get_view_pages(dbname, view)]
11801175
end
11811176

1182-
def grid_hash_conditions(view)
1183-
!%w[Job MiqProvision MiqReportResult MiqTask].include?(view.db) &&
1184-
!(view.db.ends_with?("Build") && view.db != "ContainerBuild") &&
1185-
!@force_no_grid_xml
1186-
end
1187-
11881177
def get_chart_where_clause(sb_controller = nil)
11891178
# If doing charts, limit the records to ones showing in the chart
11901179
sb_controller ||= params[:sb_controller]
@@ -1282,48 +1271,10 @@ def render_or_redirect_partial(pfx)
12821271
end
12831272
end
12841273

1285-
def replace_list_grid
1286-
view = @view
1287-
button_div = 'center_tb'
1288-
action_url = if @lastaction == "scan_history"
1289-
"scan_history"
1290-
elsif %w[all_jobs jobs ui_jobs all_ui_jobs].include?(@lastaction)
1291-
"jobs"
1292-
elsif @lastaction == "get_node_info"
1293-
nil
1294-
elsif !@lastaction.nil?
1295-
@lastaction
1296-
else
1297-
"show_list"
1298-
end
1299-
1300-
ajax_url = !%w[SecurityGroup CloudVolume].include?(view.db)
1301-
ajax_url = false if request.parameters[:controller] == "service" && view.db == "Vm"
1302-
ajax_url = false unless @explorer
1303-
1304-
url = @showlinks == false ? nil : view_to_url(view, @parent)
1305-
grid_options = {:grid_id => "list_grid",
1306-
:grid_name => "gtl_list_grid",
1307-
:grid_hash => @grid_hash,
1308-
:button_div => button_div,
1309-
:action_url => action_url}
1310-
js_options = {:sortcol => @sortcol || nil,
1311-
:sortdir => @sortdir ? @sortdir[0..2] : nil,
1312-
:row_url => url,
1313-
:row_url_ajax => ajax_url}
1314-
1315-
[grid_options, js_options]
1316-
end
1317-
13181274
# RJS code to show tag box effects and replace the main list view area
13191275
def replace_gtl_main_div(_options = {})
13201276
return if params[:action] == "button" && @lastaction == "show"
13211277

1322-
if @grid_hash
1323-
# need to call this outside render :update
1324-
grid_options, js_options = replace_list_grid
1325-
end
1326-
13271278
render :update do |page|
13281279
page << javascript_prologue
13291280
page.replace(:flash_msg_div, :partial => "layouts/flash_msg") # Replace the flash message
@@ -1332,16 +1283,9 @@ def replace_gtl_main_div(_options = {})
13321283
if layout_uses_listnav?
13331284
page.replace(:listnav_div, :partial => "layouts/listnav") # Replace accordion, if list_nav_div is there
13341285
end
1335-
if @grid_hash
1336-
page.replace_html("list_grid", :partial => "layouts/list_grid", :locals => {:options => grid_options, :js_options => js_options})
1337-
# Reset the center buttons
1338-
page << "miqGridOnCheck();"
1339-
else
1340-
# No grid, replace the gtl div
1341-
# Replace the main div area contents
1342-
page.replace_html("main_div", :partial => "layouts/gtl")
1343-
page << "$('#adv_div').slideUp(0.3);" if params[:entry]
1344-
end
1286+
# Replace the main div area contents
1287+
page.replace_html("main_div", :partial => "layouts/gtl")
1288+
page << "$('#adv_div').slideUp(0.3);" if params[:entry]
13451289
end
13461290
end
13471291

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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +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');
29-
require('./miq_list_grid.js');
3028
require('./miq_toolbar.js');
3129
require('./miq_c3.js');
3230
require('./miq_explorer.js');

app/javascript/oldjs/miq_application.js

Lines changed: 15 additions & 55 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) {
@@ -419,7 +385,7 @@ window.miqSetToolbarCount = function(count) {
419385
window.miqSetButtons = function(count, button_div) {
420386
if (button_div.match('_tb$') && count === 0) {
421387
// FIXME: this should be happening regardless of `count === 0`
422-
// ..but that needs more refactoring around miqUpdateAllCheckboxes, miqUpdateButtons, etc.
388+
// ..but that needs more refactoring around miqUpdateButtons, etc.
423389
miqSetToolbarCount(count);
424390
return;
425391
}
@@ -438,24 +404,6 @@ window.DoNav = function(theUrl) {
438404
document.location.href = theUrl;
439405
};
440406

441-
// 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-
};
458-
459407
// Pass fields to server given a URL and fields in name/value pairs
460408
window.miqPassFields = function(url, args) {
461409
return `${url}?${$.param(args)}`;
@@ -1460,7 +1408,6 @@ $(() => {
14601408

14611409
$(window).on('resize', miqInitAccordions);
14621410
$(window).on('resize', miqInitMainContent);
1463-
$(window).on('resize', _.debounce(miqResetSizeTimer, 1000));
14641411

14651412
check_for_ellipsis();
14661413
});
@@ -1493,3 +1440,16 @@ window.redirectLogin = function(msg) {
14931440
add_flash(msg, 'warning');
14941441
window.document.location.href = '/dashboard/login?timeout=true';
14951442
};
1443+
1444+
// Needed for optimization page queue report button
1445+
window.miqQueueReport = function(id) {
1446+
const url = `/optimization/queue_report/${id}`;
1447+
window.miqSparkleOn();
1448+
http
1449+
.post(url, {})
1450+
.then((data) => {
1451+
window.add_flash(data.flash, 'success');
1452+
window.miqSparkleOff();
1453+
})
1454+
.catch(() => window.miqSparkleOff());
1455+
};

app/javascript/oldjs/miq_global.js

Lines changed: 5 additions & 8 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
@@ -71,8 +70,6 @@ if (!window.ManageIQ) {
7170
debounced: {}, // running debounces
7271
},
7372
record: {
74-
parentClass: null, // parent record ID for JS function miqGridSort to build URL
75-
parentId: null, // parent record ID for JS function miqGridSort to build URL
7673
recordId: null, // record being displayed or edited
7774
},
7875
redux: { // Redux API - app/javascript/miq-redux

app/javascript/oldjs/miq_grid.js

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

0 commit comments

Comments
 (0)