mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
Revert "Merge branch 'bugfix/always-use-the-jquery-find-method-w/-node-context-10704'"
This reverts commit f517c62fdec880d5b905212ef4dbfe23a5cd033e, reversing changes made to d1fd7e4be78f3dda9734027dda53114b71a7a46d. refs #10704
This commit is contained in:
parent
f517c62fde
commit
875d42c0a6
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
rendered: function(event) {
|
rendered: function(event) {
|
||||||
var $container = $(event.currentTarget);
|
var $container = $(event.currentTarget);
|
||||||
if ($($container).find('> .content.styleguide').length) {
|
if ($('> .content.styleguide', $container).length) {
|
||||||
$container.removeClass('module-doc');
|
$container.removeClass('module-doc');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,11 +417,11 @@
|
|||||||
var _this = evt.data.self;
|
var _this = evt.data.self;
|
||||||
|
|
||||||
// initialize all rows with the correct row action
|
// initialize all rows with the correct row action
|
||||||
$(container).find('table.action tr, table.table-row-selectable tr').each(function(idx, el) {
|
$('table.action tr, table.table-row-selectable tr', container).each(function(idx, el) {
|
||||||
|
|
||||||
// decide which row action to use: links declared with the class rowaction take
|
// decide which row action to use: links declared with the class rowaction take
|
||||||
// the highest precedence before hrefs defined in the tr itself and regular links
|
// the highest precedence before hrefs defined in the tr itself and regular links
|
||||||
var $a = $(el).find('a[href].rowaction').first();
|
var $a = $('a[href].rowaction', el).first();
|
||||||
if ($a.length) {
|
if ($a.length) {
|
||||||
// TODO: Find out whether we leak memory on IE with this:
|
// TODO: Find out whether we leak memory on IE with this:
|
||||||
$(el).attr('href', $a.attr('href'));
|
$(el).attr('href', $a.attr('href'));
|
||||||
@ -430,14 +430,14 @@
|
|||||||
if ($(el).attr('href') && $(el).attr('href').length) {
|
if ($(el).attr('href') && $(el).attr('href').length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$a = $(el).find('a[href]').first();
|
$a = $('a[href]', el).first();
|
||||||
if ($a.length) {
|
if ($a.length) {
|
||||||
$(el).attr('href', $a.attr('href'));
|
$(el).attr('href', $a.attr('href'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// IE will not ignore user-select unless we cancel selectstart
|
// IE will not ignore user-select unless we cancel selectstart
|
||||||
$(container).find('table.action.multiselect tr, table.table-row-selectable.multiselect tr').each(function(idx, el) {
|
$('table.action.multiselect tr, table.table-row-selectable.multiselect tr', container).each(function(idx, el) {
|
||||||
$(el).on('selectstart', false);
|
$(el).on('selectstart', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
// of the navigation after the page has been opened.
|
// of the navigation after the page has been opened.
|
||||||
|
|
||||||
// initialise the menu selected by the backend as active.
|
// initialise the menu selected by the backend as active.
|
||||||
var $menus = $(e.target).find('#menu li.active');
|
var $menus = $('#menu li.active', e.target);
|
||||||
if ($menus.length) {
|
if ($menus.length) {
|
||||||
$menus.each(function() {
|
$menus.each(function() {
|
||||||
_this.setActive($(this));
|
_this.setActive($(this));
|
||||||
@ -179,10 +179,10 @@
|
|||||||
*/
|
*/
|
||||||
Navigation.prototype.clear = function() {
|
Navigation.prototype.clear = function() {
|
||||||
// menu items
|
// menu items
|
||||||
$(this.element).find('#menu li.active').removeClass('active');
|
$('#menu li.active', this.element).removeClass('active');
|
||||||
|
|
||||||
// search fields
|
// search fields
|
||||||
$(this.element).find('#menu input.active').removeClass('active');
|
$('#menu input.active', this.element).removeClass('active');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
Tooltip.prototype.onRendered = function(evt) {
|
Tooltip.prototype.onRendered = function(evt) {
|
||||||
var _this = evt.data.self, icinga = evt.data.icinga, el = evt.target;
|
var _this = evt.data.self, icinga = evt.data.icinga, el = evt.target;
|
||||||
|
|
||||||
$(el).find('[title]').each(function () {
|
$('[title]', el).each(function () {
|
||||||
var $el = $(this);
|
var $el = $(this);
|
||||||
$el.attr('title', $el.data('title-rich') || $el.attr('title'));
|
$el.attr('title', $el.data('title-rich') || $el.attr('title'));
|
||||||
});
|
});
|
||||||
$(el).find('svg .chart-data').tipsy({ gravity: 'se', html: true });
|
$('svg .chart-data', el).tipsy({ gravity: 'se', html: true });
|
||||||
$(el).find('i[title]').tipsy({ gravity: $.fn.tipsy.autoNS, offset: 2 });
|
$('i[title]', el).tipsy({ gravity: $.fn.tipsy.autoNS, offset: 2 });
|
||||||
$(el).find('[title]').each(function (i, el) {
|
$('[title]', el).each(function (i, el) {
|
||||||
var $el = $(el);
|
var $el = $(el);
|
||||||
var delay, gravity;
|
var delay, gravity;
|
||||||
if ($el.data('tooltip-delay') !== undefined) {
|
if ($el.data('tooltip-delay') !== undefined) {
|
||||||
@ -54,7 +54,7 @@
|
|||||||
|
|
||||||
// migrate or remove all orphaned tooltips
|
// migrate or remove all orphaned tooltips
|
||||||
$('.tipsy').each(function () {
|
$('.tipsy').each(function () {
|
||||||
var arrow = $(this).find('.tipsy-arrow')[0];
|
var arrow = $('.tipsy-arrow', this)[0];
|
||||||
if (!icinga.utils.elementsOverlap(arrow, $('#main')[0])) {
|
if (!icinga.utils.elementsOverlap(arrow, $('#main')[0])) {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
return;
|
return;
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$target.find('.icinga-module').each(function(idx, mod) {
|
$('.icinga-module', $target).each(function(idx, mod) {
|
||||||
moduleName = $(mod).data('icingaModule');
|
moduleName = $(mod).data('icingaModule');
|
||||||
if (icinga.hasModule(moduleName) && !icinga.isLoadedModule(moduleName)) {
|
if (icinga.hasModule(moduleName) && !icinga.isLoadedModule(moduleName)) {
|
||||||
loaded |= icinga.loadModule(moduleName);
|
loaded |= icinga.loadModule(moduleName);
|
||||||
@ -82,7 +82,7 @@
|
|||||||
_this.initializeModules = true;
|
_this.initializeModules = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$target.find('.dashboard > div').each(function(idx, el) {
|
$('.dashboard > div', $target).each(function(idx, el) {
|
||||||
var $element = $(el);
|
var $element = $(el);
|
||||||
var $url = $element.data('icingaUrl');
|
var $url = $element.data('icingaUrl');
|
||||||
if (typeof $url !== 'undefined') {
|
if (typeof $url !== 'undefined') {
|
||||||
@ -90,7 +90,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var $searchField = $target.find('#menu input.search');
|
var $searchField = $('#menu input.search', $target);
|
||||||
// Remember initial search field value if any
|
// Remember initial search field value if any
|
||||||
if ($searchField.length && $searchField.val().length) {
|
if ($searchField.length && $searchField.val().length) {
|
||||||
_this.searchValue = $searchField.val();
|
_this.searchValue = $searchField.val();
|
||||||
@ -154,7 +154,7 @@
|
|||||||
treeNodeToggle: function () {
|
treeNodeToggle: function () {
|
||||||
var $parent = $(this).closest('li');
|
var $parent = $(this).closest('li');
|
||||||
if ($parent.hasClass('collapsed')) {
|
if ($parent.hasClass('collapsed')) {
|
||||||
$parent.find('li').addClass('collapsed');
|
$('li', $parent).addClass('collapsed');
|
||||||
$parent.removeClass('collapsed');
|
$parent.removeClass('collapsed');
|
||||||
} else {
|
} else {
|
||||||
$parent.addClass('collapsed');
|
$parent.addClass('collapsed');
|
||||||
@ -219,7 +219,7 @@
|
|||||||
var url = $form.attr('action');
|
var url = $form.attr('action');
|
||||||
var method = $form.attr('method');
|
var method = $form.attr('method');
|
||||||
var encoding = $form.attr('enctype');
|
var encoding = $form.attr('enctype');
|
||||||
var $button = $form.find('input[type=submit]:focus').add('button[type=submit]:focus', $form);
|
var $button = $('input[type=submit]:focus', $form).add('button[type=submit]:focus', $form);
|
||||||
var progressTimer;
|
var progressTimer;
|
||||||
var $target;
|
var $target;
|
||||||
var data;
|
var data;
|
||||||
@ -268,7 +268,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($button.length === 0) {
|
if ($button.length === 0) {
|
||||||
$button = $form.find('input[type=submit]').add('button[type=submit]', $form).first();
|
$button = $('input[type=submit]', $form).add('button[type=submit]', $form).first();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($button.length) {
|
if ($button.length) {
|
||||||
@ -389,14 +389,14 @@
|
|||||||
}
|
}
|
||||||
}, null, 100);
|
}, null, 100);
|
||||||
} else if ($button.length && $button.next().hasClass('spinner')) {
|
} else if ($button.length && $button.next().hasClass('spinner')) {
|
||||||
$button.next().find('i').addClass('active');
|
$('i', $button.next()).addClass('active');
|
||||||
} else if ($form.attr('data-progress-element')) {
|
} else if ($form.attr('data-progress-element')) {
|
||||||
var $progressElement = $('#' + $form.attr('data-progress-element'));
|
var $progressElement = $('#' + $form.attr('data-progress-element'));
|
||||||
if ($progressElement.length) {
|
if ($progressElement.length) {
|
||||||
if ($progressElement.hasClass('spinner')) {
|
if ($progressElement.hasClass('spinner')) {
|
||||||
$progressElement.find('i').addClass('active');
|
$('i', $progressElement).addClass('active');
|
||||||
} else {
|
} else {
|
||||||
$progressElement.find('i.spinner').addClass('active');
|
$('i.spinner', $progressElement).addClass('active');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
$container.find('img.icon').each(function(idx, img) {
|
$('img.icon', $container).each(function(idx, img) {
|
||||||
var src = $(img).attr('src');
|
var src = $(img).attr('src');
|
||||||
if (typeof _this.iconCache[src] !== 'undefined') {
|
if (typeof _this.iconCache[src] !== 'undefined') {
|
||||||
return;
|
return;
|
||||||
@ -453,7 +453,7 @@
|
|||||||
|
|
||||||
if (req.autorefresh) {
|
if (req.autorefresh) {
|
||||||
// TODO: next container url
|
// TODO: next container url
|
||||||
active = req.$target.find('[href].active').attr('href');
|
active = $('[href].active', req.$target).attr('href');
|
||||||
}
|
}
|
||||||
|
|
||||||
var target = req.getResponseHeader('X-Icinga-Container');
|
var target = req.getResponseHeader('X-Icinga-Container');
|
||||||
@ -519,26 +519,26 @@
|
|||||||
// Handle search requests, still hardcoded.
|
// Handle search requests, still hardcoded.
|
||||||
if (req.url.match(/^\/search/) &&
|
if (req.url.match(/^\/search/) &&
|
||||||
req.$target.data('icingaUrl').match(/^\/search/) &&
|
req.$target.data('icingaUrl').match(/^\/search/) &&
|
||||||
$resp.find('.dashboard').length > 0 &&
|
$('.dashboard', $resp).length > 0 &&
|
||||||
req.$target.find('.dashboard .container').length > 0)
|
$('.dashboard .container', req.$target).length > 0)
|
||||||
{
|
{
|
||||||
// TODO: We need dashboard pane and container identifiers (not ids)
|
// TODO: We need dashboard pane and container identifiers (not ids)
|
||||||
var targets = [];
|
var targets = [];
|
||||||
req.$target.find('.dashboard .container').each(function (idx, el) {
|
$('.dashboard .container', req.$target).each(function (idx, el) {
|
||||||
targets.push($(el));
|
targets.push($(el));
|
||||||
});
|
});
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
// Searching for '.dashboard .container' in $resp doesn't dork?!
|
// Searching for '.dashboard .container' in $resp doesn't dork?!
|
||||||
$resp.find('.dashboard .container').each(function (idx, el) {
|
$('.dashboard .container', $resp).each(function (idx, el) {
|
||||||
var $el = $(el);
|
var $el = $(el);
|
||||||
if ($el.hasClass('dashboard')) {
|
if ($el.hasClass('dashboard')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var url = $el.data('icingaUrl');
|
var url = $el.data('icingaUrl');
|
||||||
targets[i].data('icingaUrl', url);
|
targets[i].data('icingaUrl', url);
|
||||||
var title = $el.find('h1').first();
|
var title = $('h1', $el).first();
|
||||||
$(targets[i]).find('h1').first().replaceWith(title);
|
$('h1', targets[i]).first().replaceWith(title);
|
||||||
|
|
||||||
_this.loadUrl(url, targets[i]);
|
_this.loadUrl(url, targets[i]);
|
||||||
i++;
|
i++;
|
||||||
@ -595,7 +595,7 @@
|
|||||||
var $el = $(el);
|
var $el = $(el);
|
||||||
if ($el.closest('#menu').length) {
|
if ($el.closest('#menu').length) {
|
||||||
if ($el.is('form')) {
|
if ($el.is('form')) {
|
||||||
$el.find('input').addClass('active');
|
$('input', $el).addClass('active');
|
||||||
}
|
}
|
||||||
// Interrupt .each, only one menu item shall be active
|
// Interrupt .each, only one menu item shall be active
|
||||||
return false;
|
return false;
|
||||||
@ -797,20 +797,20 @@
|
|||||||
// event.preventDefault();
|
// event.preventDefault();
|
||||||
// });
|
// });
|
||||||
|
|
||||||
$container.find('.container').each(function() {
|
$('.container', $container).each(function() {
|
||||||
_this.stopPendingRequestsFor($(this));
|
_this.stopPendingRequestsFor($(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (false &&
|
if (false &&
|
||||||
$content.find('.dashboard').length > 0 &&
|
$('.dashboard', $content).length > 0 &&
|
||||||
$container.find('.dashboard').length === 0
|
$('.dashboard', $container).length === 0
|
||||||
) {
|
) {
|
||||||
// $content.find('.dashboard')
|
// $('.dashboard', $content)
|
||||||
// $container.html(content);
|
// $container.html(content);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ($container.closest('.dashboard').length) {
|
if ($container.closest('.dashboard').length) {
|
||||||
var title = $container.find('h1').first().detach();
|
var title = $('h1', $container).first().detach();
|
||||||
$container.html(title).append(content);
|
$container.html(title).append(content);
|
||||||
} else if (action === 'replace') {
|
} else if (action === 'replace') {
|
||||||
$container.html(content);
|
$container.html(content);
|
||||||
|
@ -458,7 +458,7 @@
|
|||||||
* Initialize all TriStateCheckboxes in the given html
|
* Initialize all TriStateCheckboxes in the given html
|
||||||
*/
|
*/
|
||||||
initializeTriStates: function ($html) {
|
initializeTriStates: function ($html) {
|
||||||
$html.find('div.tristate').each(function(index, item) {
|
$('div.tristate', $html).each(function(index, item) {
|
||||||
var $target = $(item);
|
var $target = $(item);
|
||||||
|
|
||||||
// hide input boxess and remove text nodes
|
// hide input boxess and remove text nodes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user