So i have enabled autorefresh (set in the controller) to update the page but some parts should not be reloaded.
Why? Because the view script contains an iframe and the content in there needs some time to update.
I tried already the following (without effect):
Put iframe outside of content
Put iframe in controls div
Questions:
Is there a mechanism in Icinga Web2 to control which parts are reloaded?
Until now, i have my knowledge about writing a module from this talk (https://www.youtube.com/watch?v=GR1QguEdilg) … Is there a documentation of how to integrate a module and which further preferences are there?
<div class="controls">
<?= $this->tabs ?>
</div>
<div class="content">
<!-- Your iframe, or any other content only refreshed by user interaction -->
<iframe src="<?= $this->href('monitoring/list/services') ?>"></iframe>
<!--
The content that should be automatically refreshed.
It's wrapped by a container which will be refreshed.
id: Is required, but it can be arbitrary
class: Needs to have `container`, can hold additional classes
data-icinga-refresh: The initial refresh delay, once refreshed this will be what the controller sets
data-icinga-url: Where the new content should be loaded from. Must not provide layout
-->
<div id="<?= $this->protectId('separate-content') ?>"
class="container"
data-icinga-refresh="10"
data-icinga-url="<?= $this->href('test/separate-content') ?>"
>
<!-- The initial content. I've used partial() only to re-use the view script, feel free to not use it -->
<?= $this->partial('test/separate-content.phtml', ['content' => $content]); ?>
</div>
</div>
Thx for your reply. The solution looks good. To use two different controllers and include one view script in another makes sense.
I will try it and reply if it has worked.
Meanwhile i had a different approach (which is more or less “hacked”) and had limitations. But it worked for my special usecase and maybe it is helpful for someone else:
I have used the module.js file to place the iframe in an div inside of the main div of Icinga Web 2 during initial loading of the module.
It has worked, but it crashes navigation and window adaption.
And it breaks the Icinga Web 2 control of the frame/div.
So in the DOM it was some how like:
<div id="main">
<div id="iframe"></div><!-- added by me -->
<div id="col1"></div>
...
</div>