mirror of
https://github.com/Cacti/cacti.git
synced 2026-11-02 18:17:00 +09:00
* fix(theme): enable graph opacity without selectmenu Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs(changelog): describe theme fix Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(graph): restore redraw URLs and retry realtime failures Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
155 lines
5.9 KiB
JavaScript
155 lines
5.9 KiB
JavaScript
/*
|
|
+-------------------------------------------------------------------------+
|
|
| Copyright (C) 2004-2026 The Cacti Group |
|
|
| |
|
|
| This program is free software; you can redistribute it and/or |
|
|
| modify it under the terms of the GNU General Public License |
|
|
| as published by the Free Software Foundation; either version 2 |
|
|
| of the License, or (at your option) any later version. |
|
|
| |
|
|
| This program is distributed in the hope that it will be useful, |
|
|
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
| GNU General Public License for more details. |
|
|
+-------------------------------------------------------------------------+
|
|
| Cacti: The Complete RRDTool-based Graphing Solution |
|
|
+-------------------------------------------------------------------------+
|
|
| This code is designed, written, and maintained by the Cacti Group. See |
|
|
| about.php and/or the AUTHORS file for specific developer information. |
|
|
+-------------------------------------------------------------------------+
|
|
| http://www.cacti.net/ |
|
|
+-------------------------------------------------------------------------+
|
|
*/
|
|
|
|
function themeReady() {
|
|
$('body').css('height', $(window).height());
|
|
$('.formItemDescription').hide();
|
|
|
|
keepWindowSize();
|
|
|
|
// Setup the navigation menu
|
|
setMenuVisibility();
|
|
|
|
// Add nice search filter to filters
|
|
if ($('input[id="filter"]').length > 0 && $('input[id="filter"]').next('i[class="ti ti-search filter"]').length < 1) {
|
|
$('input[id="filter"]').after("<i class='ti ti-search filter'/>").attr('autocomplete', 'off').attr('placeholder', searchFilter).parent('td').css('white-space', 'nowrap');
|
|
}
|
|
|
|
if ($('input[id="filterd"]').length > 0 && $('input[id="filterd"]').next('i[class="ti ti-search filter"]').length < 1) {
|
|
$('input[id="filterd"]').after("<i class='ti ti-search filter'/>").attr('autocomplete', 'off').attr('placeholder', searchFilter).parent('td').css('white-space', 'nowrap');
|
|
}
|
|
|
|
if ($('input[id="rfilter"]').length > 0 && $('input[id="rfilter"]').next('i[class="ti ti-search filter"]').length < 1 && $('input[id="rfilter"]').closest('.cactiFilterEditTable').length < 1) {
|
|
$('input[id="rfilter"]').after("<i class='ti ti-search filter'/>").attr('autocomplete', 'off').attr('placeholder', searchRFilter).parent('td').css('white-space', 'nowrap');
|
|
}
|
|
|
|
$('input#filter, input#rfilter').addClass('ui-state-default ui-corner-all');
|
|
|
|
$('input[type="text"], input[type="password"], input[type="checkbox"], textarea').not('image').addClass('ui-state-default ui-corner-all');
|
|
|
|
$('.colordropdown').on('change', function() {
|
|
id=$(this).attr('id');
|
|
color=$('#'+id+' option:selected').attr('data-color');
|
|
$('<span>', {
|
|
style: 'background-color:#'+color+',width:16px;height:16px;',
|
|
'class': 'color-icon'
|
|
}).appendTo($('#'+id+'-button'));
|
|
});
|
|
|
|
$('.checkboxgroup').children('br').remove();
|
|
$('.checkboxgroup').controlgroup();
|
|
|
|
// Turn file buttons into jQueryUI buttons
|
|
$('.import_label').button();
|
|
$('.import_button').on('change', function() {
|
|
text=this.value;
|
|
setImportFile(text);
|
|
});
|
|
setImportFile(noFileSelected);
|
|
|
|
function setImportFile(fileText) {
|
|
$('.import_text').text(fileText);
|
|
}
|
|
|
|
maxWidth = 300;
|
|
|
|
$('#drp_action').on('change', function() {
|
|
if ($(this).val() != '0') {
|
|
$('#submit').button('enable');
|
|
} else {
|
|
$('#submit').button('disable');
|
|
}
|
|
});
|
|
|
|
$('#graph_type_id').on('change', function() {
|
|
switch($(this).val()) {
|
|
case '4':
|
|
case '5':
|
|
case '6':
|
|
case '7':
|
|
case '8':
|
|
$('#alpha').prop('disabled', false);
|
|
}
|
|
});
|
|
|
|
setNavigationScroll();
|
|
}
|
|
|
|
function setMenuVisibility() {
|
|
const storage = Storages.sessionStorage;
|
|
|
|
// Initialize the navigation settings
|
|
// This will setup the initial visibility of the menu
|
|
$('li.menuitem').each(function() {
|
|
const id = $(this).attr('id');
|
|
|
|
const active = storage.isSet(id) ? storage.get(id) : null;
|
|
|
|
if (active != null && active == 'active') {
|
|
$(this).find('ul').attr('aria-hidden', 'false').attr('aria-expanded', 'true').show();
|
|
$(this).next('a').show();
|
|
} else {
|
|
$(this).find('ul').attr('aria-hidden', 'true').attr('aria-expanded', 'false').hide();
|
|
$(this).next('a').hide();
|
|
}
|
|
|
|
if ($(this).find('a.selected').length == 0) {
|
|
$(this).find('ul').attr('aria-hidden', 'true').attr('aria-expanded', 'false').hide();
|
|
$(this).next('a').hide();
|
|
storage.set($(this).closest('.menuitem').attr('id'), 'collapsed');
|
|
} else {
|
|
$(this).find('ul').attr('aria-hidden', 'false').attr('aria-expanded', 'true').show();
|
|
$(this).next('a').show();
|
|
storage.set($(this).closest('.menuitem').attr('id'), 'active');
|
|
}
|
|
});
|
|
|
|
// Function to give life to the Navigation pane
|
|
$('#nav li:has(ul) a.active').rebind('click', function(event) {
|
|
event.preventDefault();
|
|
|
|
const id = $(this).closest('.menuitem').attr('id');
|
|
|
|
if ($(this).next().is(':visible')) {
|
|
$(this).next('ul').attr('aria-hidden', 'true').attr('aria-expanded', 'false');
|
|
$(this).next().slideUp( { duration: 200, easing: 'swing' } );
|
|
storage.set(id, 'collapsed');
|
|
} else {
|
|
$(this).next('ul').attr('aria-hidden', 'false').attr('aria-expanded', 'true');
|
|
$(this).next().slideToggle( { duration: 200, easing: 'swing' } );
|
|
if ($(this).next().is(':visible')) {
|
|
storage.set($(this).closest('.menuitem').attr('id'), 'active');
|
|
} else {
|
|
storage.set(id, 'collapsed');
|
|
}
|
|
}
|
|
|
|
$('li.menuitem').not('#'+id).each(function() {
|
|
|
|
$(this).find('ul').attr('aria-hidden', 'true').attr('aria-expanded', 'false');
|
|
$(this).find('ul').slideUp( { duration: 200, easing: 'swing' } );
|
|
storage.set($(this).attr('id'), 'collapsed');
|
|
});
|
|
});
|
|
}
|