mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-04 01:09:25 -05:00
js: add Director-related JavaScript helpers
This commit is contained in:
parent
9712065a6b
commit
803b2aa34d
1 changed files with 53 additions and 1 deletions
|
|
@ -26,19 +26,22 @@
|
|||
|
||||
this.module.on('click', 'table.bp.process > tbody > tr:first-child > td > a:last-child', this.processTitleClick);
|
||||
this.module.on('click', 'table.bp > tbody > tr:first-child > th', this.processOperatorClick);
|
||||
this.module.on('focus', 'form input, form textarea, form select', this.formElementFocus);
|
||||
|
||||
this.module.on('mouseenter', 'table.bp > tbody > tr > td > a', this.procMouseOver);
|
||||
this.module.on('mouseenter', 'table.bp > tbody > tr > th', this.procMouseOver);
|
||||
this.module.on('mouseenter', 'table.node.missing > tbody > tr > td > span', this.procMouseOver);
|
||||
this.module.on('mouseleave', 'div.bp', this.procMouseOut);
|
||||
|
||||
this.module.icinga.logger.debug('BP module loaded');
|
||||
this.module.icinga.logger.debug('BP module initialized');
|
||||
},
|
||||
|
||||
onRendered: function (event) {
|
||||
var $container = $(event.currentTarget);
|
||||
this.fixFullscreen($container);
|
||||
this.fixOpenedBps($container);
|
||||
this.highlightFormErrors($container);
|
||||
this.hideInactiveFormDescriptions($container);
|
||||
},
|
||||
|
||||
processTitleClick: function (event) {
|
||||
|
|
@ -70,6 +73,10 @@
|
|||
}
|
||||
},
|
||||
|
||||
hideInactiveFormDescriptions: function($container) {
|
||||
$container.find('dd').not('.active').find('p.description').hide();
|
||||
},
|
||||
|
||||
/**
|
||||
* Add 'hovered' class to hovered title elements
|
||||
*
|
||||
|
|
@ -202,7 +209,52 @@
|
|||
}
|
||||
|
||||
this.idCache[$bpName] = ids;
|
||||
},
|
||||
|
||||
/** BEGIN Form handling, borrowed from Director **/
|
||||
formElementFocus: function(ev)
|
||||
{
|
||||
var $input = $(ev.currentTarget);
|
||||
var $dd = $input.closest('dd');
|
||||
$dd.find('p.description').show();
|
||||
if ($dd.attr('id') && $dd.attr('id').match(/button/)) {
|
||||
return;
|
||||
}
|
||||
var $li = $input.closest('li');
|
||||
var $dt = $dd.prev();
|
||||
var $form = $dd.closest('form');
|
||||
|
||||
$form.find('dt, dd, li').removeClass('active');
|
||||
$li.addClass('active');
|
||||
$dt.addClass('active');
|
||||
$dd.addClass('active');
|
||||
$dd.find('p.description.fading-out')
|
||||
.stop(true)
|
||||
.removeClass('fading-out')
|
||||
.fadeIn('fast');
|
||||
|
||||
$form.find('dd').not($dd)
|
||||
.find('p.description')
|
||||
.not('.fading-out')
|
||||
.addClass('fading-out')
|
||||
.delay(2000)
|
||||
.fadeOut('slow', function() {
|
||||
$(this).removeClass('fading-out').hide()
|
||||
});
|
||||
},
|
||||
|
||||
highlightFormErrors: function($container)
|
||||
{
|
||||
$container.find('dd ul.errors').each(function(idx, ul) {
|
||||
var $ul = $(ul);
|
||||
var $dd = $ul.closest('dd');
|
||||
var $dt = $dd.prev();
|
||||
|
||||
$dt.addClass('errors');
|
||||
$dd.addClass('errors');
|
||||
});
|
||||
}
|
||||
/** END Form handling **/
|
||||
};
|
||||
|
||||
Icinga.availableModules.businessprocess = Bp;
|
||||
|
|
|
|||
Loading…
Reference in a new issue