mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 15:54:03 +02:00
ui.js: Don't require jQuery objects in getUniqueContainerId
This commit is contained in:
parent
fbf3a1f757
commit
ca74e14812
@ -536,24 +536,29 @@
|
|||||||
$('#layout').toggleClass('fullscreen-layout');
|
$('#layout').toggleClass('fullscreen-layout');
|
||||||
},
|
},
|
||||||
|
|
||||||
getUniqueContainerId: function ($cont) {
|
getUniqueContainerId: function (container) {
|
||||||
if (typeof $cont === 'undefined' || !$cont.length) {
|
if (typeof container.jquery !== 'undefined') {
|
||||||
|
if (! container.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
container = container[0];
|
||||||
|
} else if (typeof container === 'undefined') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var containerId = $cont.data('icingaContainerId');
|
var containerId = container.dataset.icingaContainerId || null;
|
||||||
if (typeof containerId === 'undefined') {
|
if (containerId === null) {
|
||||||
/**
|
/**
|
||||||
* Only generate an id if it's not for col1 or the menu (which are using the non-suffixed window id).
|
* Only generate an id if it's not for col1 or the menu (which are using the non-suffixed window id).
|
||||||
* This is based on the assumption that the server only knows about the menu and first column
|
* This is based on the assumption that the server only knows about the menu and first column
|
||||||
* and therefore does not need to protect its ids. (As the menu is most likely part of the sidebar)
|
* and therefore does not need to protect its ids. (As the menu is most likely part of the sidebar)
|
||||||
*/
|
*/
|
||||||
if ($cont.attr('id') === 'menu' || $cont.attr('id') === 'col1' || $cont.closest('#col1').length) {
|
var col1 = document.getElementById('col1');
|
||||||
return null;
|
if (container.id !== 'menu' && col1 !== null && ! col1.contains(container)) {
|
||||||
|
containerId = this.icinga.utils.generateId(6); // Random because the content may move
|
||||||
|
container.dataset.icingaContainerId = containerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
containerId = this.icinga.utils.generateId(6); // Random because the content may move
|
|
||||||
$cont.data('icingaContainerId', containerId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return containerId;
|
return containerId;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user