Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 10 additions & 7 deletions e2e_test/hawk_test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def test_set_fencing_maintenance(self):

# try to find the old RSC_ROWS for 10 seconds (Ruby hawk)
# if none --> search for RSC_ROWS_NEW (Go hawk)
if self.find_element(By.XPATH, Xpath.RSC_ROWS, 10):
if self.find_element(By.XPATH, Xpath.RSC_ROWS, 20):
totalrows = len(self.driver.find_elements(By.XPATH, Xpath.RSC_ROWS))
if not totalrows:
totalrows = 1
Expand Down Expand Up @@ -669,7 +669,8 @@ def test_copy_primitive(self):
resource_number_from_top = 1 # 1. cool_primitive, 2. fencing-sbd|stonith-sbd
copy_btn = None

if self.find_element(By.XPATH, Xpath.RSC_ROWS, 10):
time.sleep(BIG_TIMEOUT)
if self.find_element(By.XPATH, Xpath.RSC_ROWS, 20):
# First, click on Edit
time.sleep(2)
self.check_and_click_by_xpath(Error.COOL_PRIMITIVE_ERR, [Xpath.DROP_DOWN_FORMAT.format(resource_number_from_top),
Expand Down Expand Up @@ -724,7 +725,7 @@ def test_rename_primitive(self):
resource_number_from_top = 2 # 1. cool_primitive, 2. dum_primitive, 3. fencing-sbd|stonith-sbd
input_elem = None

if self.find_element(By.XPATH, Xpath.RSC_ROWS, 10):
if self.find_element(By.XPATH, Xpath.RSC_ROWS, 20):
# First, stop the cool_primitive
time.sleep(2)
self.check_and_click_by_xpath(Error.DUM_PRIMITIVE_ERR,[Xpath.STOP_PRIMITIVE_FORMAT.format(resource_number_from_top),
Expand Down Expand Up @@ -780,7 +781,7 @@ def test_rename_primitive(self):
input_elem.send_keys("dummy_primitive")

# There are 2 submit buttons, one on the main page and another on the popup (the one we need)
submit_btn = self.find_element(By.XPATH, '//button[@type="submit" and .//i[contains(@class, "fa-save")]]', 10)
submit_btn = self.find_element(By.XPATH, '//button[@type="submit" and .//i[contains(@class, "fa-save")]]')
if not submit_btn:
print("ERROR: Couldn't find Rename-Submit button")
return False
Expand All @@ -802,7 +803,8 @@ def test_delete_primitive(self):
print("TEST: test_delete_primitive: Delete the dummy_primitive")
resource_number_from_top = 2 # 1. cool_primitive, 2. dummy_primitive, 3. fencing-sbd|stonith-sbd

if self.find_element(By.XPATH, Xpath.RSC_ROWS, 10) or self.find_element(By.XPATH, Xpath.RSC_ROWS_NEW):
time.sleep(BIG_TIMEOUT)
if self.find_element(By.XPATH, Xpath.RSC_ROWS, 20) or self.find_element(By.XPATH, Xpath.RSC_ROWS_NEW):
# First, click on edit
time.sleep(2)
self.check_and_click_by_xpath(Error.DUMMY_PRIMITIVE_ERR, [
Expand All @@ -812,13 +814,14 @@ def test_delete_primitive(self):

# Second, click on Delete
time.sleep(2) # wait the redirect finishes
delete_btn = self.find_element(By.XPATH, '//button[.//i[contains(@class, "fa-trash")]] | //a[.//i[contains(@class, "fa-trash")]]', 10)
delete_btn = self.find_element(By.XPATH, '//button[.//i[contains(@class, "fa-trash")]] | //a[.//i[contains(@class, "fa-trash")]]')
if not delete_btn:
print("ERROR: Couldn't find Delete button")
return False
delete_btn.click()

# Third, confirm deleting
time.sleep(BIG_TIMEOUT)
commit_btn = self.find_element(By.CLASS_NAME, "commit")
if not commit_btn:
print("ERROR: Couldn't find OK-Commit button")
Expand Down Expand Up @@ -912,7 +915,7 @@ def test_add_clone(self, clone):
return False
elem.send_keys(clone)

elem = self.find_element(By.XPATH, Xpath.CLONE_CHILD, 10)
elem = self.find_element(By.XPATH, Xpath.CLONE_CHILD, 20)
if elem: # --> old ruby hawk
elem.click()
self.check_and_click_by_xpath(f"while adding clone [{clone}]",
Expand Down
4 changes: 4 additions & 0 deletions hawk/app/assets/javascripts/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
// See COPYING for license.

$( document ).ready(function() {
$(document).on("ajax:complete", ".remove-cluster", function() {
location.reload();
});

$(".status-wrapper").find(".status-table").each(function(index, element) { // jshint ignore:line
var id = $(this).attr("id");
var data = $(this).data("cluster");
Expand Down
2 changes: 1 addition & 1 deletion hawk/app/assets/javascripts/module/constraints.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $(function() {
var constraintResources = function(row) {
var flattenResourceList = null;
flattenResourceList = function(obj) {
var t = $.type(obj);
var t = Array.isArray(obj) ? "array" : (obj === null ? "null" : typeof obj);
var ret = [];
if (t === "string") {
ret.push(obj);
Expand Down
4 changes: 2 additions & 2 deletions hawk/app/assets/javascripts/module/oplist.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@

var tgtnode = self.$el.find(self.targets);
tgtnode.html([
'<div class="oplist-items"/>',
'<div class="oplist-adder"/>'
'<div class="oplist-items"></div>',
'<div class="oplist-adder"></div>'
].join(""));
var itemhook = tgtnode.find('.oplist-items');
var addhook = tgtnode.find('.oplist-adder');
Expand Down
10 changes: 5 additions & 5 deletions hawk/app/assets/javascripts/module/primitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ $(function() {
}

var format_longdesc = function(text) {
var longdesc = $.map(text.split('\n\n'), function(v) { return $.trim(v); });
var longdesc = $.map(text.split('\n\n'), function(v) { return v.trim(); });
var ret = [];
$.each(longdesc, function(i, v) {
if (v) {
Expand Down Expand Up @@ -227,9 +227,9 @@ $(function() {

var lookup = function(root, lstname, elemname) {
if (lstname in root) {
if ($.type(root[lstname]) == "object") {
if (root[lstname] !== null && typeof root[lstname] == "object" && !Array.isArray(root[lstname])) {
if (elemname in root[lstname]) {
if ($.type(root[lstname][elemname]) == "object") {
if (root[lstname][elemname] !== null && typeof root[lstname][elemname] == "object" && !Array.isArray(root[lstname][elemname])) {
return [root[lstname][elemname]];
} else {
return root[lstname][elemname];
Expand All @@ -248,9 +248,9 @@ $(function() {
$.each(lookup(data.resource_agent, "parameters", "parameter"), function(i, v) {
var name = v.name;
var longdesc = "";
if ($.trim(v.longdesc)) {
if (String(v.longdesc || '').trim()) {
longdesc = v.longdesc;
} else if ($.trim(v.shortdesc)) {
} else if (String(v.shortdesc || '').trim()) {
longdesc = v.shortdesc;
}
var type = "string";
Expand Down
2 changes: 1 addition & 1 deletion hawk/app/assets/javascripts/module/profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $(function() {
return $(element).html() + ' [' + $(element).val() + ']';
},
onChange: function(element) {
$(element.context.form)
element.closest('form')
.find('[name="revert"]')
.show()
.end()
Expand Down
4 changes: 2 additions & 2 deletions hawk/app/assets/javascripts/module/recipientlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@

var tgtnode = self.$el.find(self.targets);
tgtnode.html([
'<div class="recipientlist-items"/>',
'<div class="recipientlist-adder"/>'
'<div class="recipientlist-items"></div>',
'<div class="recipientlist-adder"></div>'
].join(""));
var itemhook = tgtnode.find('.recipientlist-items');
var addhook = tgtnode.find('.recipientlist-adder');
Expand Down
2 changes: 1 addition & 1 deletion hawk/app/assets/javascripts/module/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ $(function() {
$(e.currentTarget)
.closest('fieldset')
.siblings()
.andSelf()
.andBack()
.each(function(index, current) {
$(current)
.find('.form-control')
Expand Down
2 changes: 1 addition & 1 deletion hawk/app/assets/javascripts/module/statustable.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ var statusTable = {
});

that.inner_section.find(".search input").keyup(function(){
var val = $.trim( this.value ).toUpperCase();
var val = this.value.trim().toUpperCase();
that.set_search_state(val);
that.displayClusterStatus();
});
Expand Down
2 changes: 1 addition & 1 deletion hawk/app/assets/javascripts/module/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ $(function() {
enableFiltering: true,
buttonWidth: '100%',
onChange: function(element, checked) {
$(element.context.form)
element.closest('form')
.find('[name="revert"]')
.show()
.end()
Expand Down
2 changes: 1 addition & 1 deletion hawk/app/assets/javascripts/module/wizards.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ $(function() {
content.html('<pre>' + $('<div/>').text(data.output).html() + '</pre>');
});
}
vform.find(".submit").addClass("disabled").bind("click", false);
vform.find(".submit").addClass("disabled").on("click", false);
vform.find(".actions .list-group-item").removeClass("disabled").addClass("list-group-item-success");
vform.find(".notifications").html('<div class="alert alert-success">' + __("Changes applied successfully.") + '</div>');
});
Expand Down
2 changes: 1 addition & 1 deletion hawk/app/views/dashboards/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
</li>
<li><a class="cluster-link cluster-url" href="" target="_blank"><i class="fa fa-link" aria-hidden="true"></i></a></li>
<li>
<form action="/dashboard/remove" method="post" accept-charset="UTF-8" data-remote="true" class="pull-right">
<form action="/dashboard/remove" method="post" accept-charset="UTF-8" data-remote="true" class="pull-right remove-cluster">
<input type="hidden" name="name" value="<%= cluster.name %>">
<button type="submit" class="close" data-confirm="<%= _('Remove cluster %s from dashboard?') % cluster.name %>" aria-label="Close">
<span aria-hidden="true">&times;</span>
Expand Down
2 changes: 1 addition & 1 deletion hawk/vendor/assets/javascripts/bootstrap/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)

if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
if (!data && options.toggle && typeof option == 'string' && /show|hide/.test(option)) options.toggle = false
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
Expand Down
43 changes: 43 additions & 0 deletions hawk/vendor/assets/javascripts/jquery/compatibility.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Compatibility helpers removed in jQuery 4 and still used by Hawk's legacy
// third-party plugins. Keep this loaded immediately after jQuery itself.
;(function($) {
'use strict';

var classToType = {};

$.each('Boolean Number String Function Array Date RegExp Object Error Symbol'.split(' '), function(_, name) {
classToType['[object ' + name + ']'] = name.toLowerCase();
});

$.camelCase = function(value) {
return String(value)
.replace(/^-ms-/, 'ms-')
.replace(/-([a-z])/g, function(_, letter) {
return letter.toUpperCase();
});
};

$.isArray = Array.isArray;

$.isFunction = function(value) {
return typeof value === 'function';
};

$.type = function(value) {
if (value == null) {
return String(value);
}
return typeof value === 'object' || typeof value === 'function'
? classToType[Object.prototype.toString.call(value)] || 'object'
: typeof value;
};

$.isNumeric = function(value) {
var type = $.type(value);
return (type === 'number' || type === 'string') && !isNaN(value - parseFloat(value));
};

$.trim = function(value) {
return value == null ? '' : String(value).trim();
};
}(jQuery));
6 changes: 2 additions & 4 deletions hawk/vendor/assets/javascripts/jquery/jquery.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions hawk/vendor/assets/javascripts/jquery/rails.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
if (handleRemote === false) {
rails.enableElement(link);
} else {
handleRemote.error( function() { rails.enableElement(link); } );
handleRemote.fail( function() { rails.enableElement(link); } );
}
return false;

Expand All @@ -389,7 +389,7 @@
if (handleRemote === false) {
rails.enableFormElement(button);
} else {
handleRemote.error( function() { rails.enableFormElement(button); } );
handleRemote.fail( function() { rails.enableFormElement(button); } );
}
return false;
});
Expand Down
1 change: 1 addition & 0 deletions hawk/vendor/assets/javascripts/vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See COPYING for license.

//= require jquery/jquery
//= require jquery/compatibility
//= require jquery/rails
//= require jquery/validate
//= require jquery/matchheight
Expand Down
Loading