mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-04 01:09:25 -05:00
js, Controller: allow to toggle fullscreen mode
This commit is contained in:
parent
5156c3fb93
commit
aba771f3aa
4 changed files with 48 additions and 4 deletions
|
|
@ -242,6 +242,19 @@ class ProcessController extends Controller
|
|||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->actions()->add(
|
||||
Link::create(
|
||||
$this->translate('Fullscreen'),
|
||||
$this->url()->with('showFullscreen', true),
|
||||
null,
|
||||
array(
|
||||
'class' => 'icon-resize-full-alt',
|
||||
'title' => $this->translate('Switch to fullscreen mode'),
|
||||
'data-base-target' => '_main',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function simulationForm()
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Controller extends ModuleController
|
|||
private $storage;
|
||||
|
||||
/** @var bool */
|
||||
private $showFullscreen;
|
||||
protected $showFullscreen;
|
||||
|
||||
/** @var Url */
|
||||
private $url;
|
||||
|
|
|
|||
|
|
@ -460,6 +460,10 @@ div.knightrider table.bp {
|
|||
.tiles.many { font-size: 0.9em; }
|
||||
}
|
||||
|
||||
#layout.fullscreen-layout .controls {
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
/** END of tiles **/
|
||||
|
||||
/** BEGIN breadcrumb **/
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* Tell Icinga about our event handlers
|
||||
*/
|
||||
this.module.on('beforerender', this.rememberOpenedBps);
|
||||
this.module.on('rendered', this.fixOpenedBps);
|
||||
this.module.on('rendered', this.onRendered);
|
||||
|
||||
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);
|
||||
|
|
@ -35,6 +35,12 @@
|
|||
this.module.icinga.logger.debug('BP module loaded');
|
||||
},
|
||||
|
||||
onRendered: function (event) {
|
||||
var $container = $(event.currentTarget);
|
||||
this.fixFullscreen($container);
|
||||
this.fixOpenedBps($container);
|
||||
},
|
||||
|
||||
processTitleClick: function (event) {
|
||||
event.stopPropagation();
|
||||
var $el = $(event.currentTarget).closest('table.bp');
|
||||
|
|
@ -133,8 +139,29 @@
|
|||
});*/
|
||||
},
|
||||
|
||||
fixOpenedBps: function(event) {
|
||||
var $bpDiv = $(event.currentTarget).find('div.bp');
|
||||
fixFullscreen: function($container) {
|
||||
var $controls = $container.find('div.controls');
|
||||
var $layout = $('#layout');
|
||||
var icinga = this.module.icinga;
|
||||
if ($controls.hasClass('want-fullscreen')) {
|
||||
if (!$layout.hasClass('fullscreen-layout')) {
|
||||
|
||||
$layout.addClass('fullscreen-layout');
|
||||
$controls.removeAttr('style');
|
||||
$container.find('.fake-controls').remove();
|
||||
icinga.ui.currentLayout = 'fullscreen';
|
||||
}
|
||||
} else {
|
||||
if ($layout.hasClass('fullscreen-layout')) {
|
||||
$layout.removeClass('fullscreen-layout');
|
||||
icinga.ui.layoutHasBeenChanged();
|
||||
icinga.ui.initializeControls($container);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
fixOpenedBps: function($container) {
|
||||
var $bpDiv = $container.find('div.bp');
|
||||
var bpName = $bpDiv.attr('id');
|
||||
|
||||
if (typeof this.idCache[bpName] === 'undefined') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue