mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
Lighter HTML in the dashboard component, handle missing URLs
This commit is contained in:
parent
9e66d22c76
commit
3faf1ec725
@ -37,6 +37,7 @@ use Zend_View_Abstract;
|
|||||||
use Zend_Config;
|
use Zend_Config;
|
||||||
use Zend_Form_Element_Submit;
|
use Zend_Form_Element_Submit;
|
||||||
use Zend_Form_Element_Button;
|
use Zend_Form_Element_Button;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dashboard pane component
|
* A dashboard pane component
|
||||||
@ -93,16 +94,11 @@ class Component implements Widget
|
|||||||
*/
|
*/
|
||||||
private $template =<<<'EOD'
|
private $template =<<<'EOD'
|
||||||
|
|
||||||
<div data-icinga-component="app/dashboard" style="overflow:hidden" class="dashboard-component {{IS_FULL}}" data-icinga-url="{URL}">
|
<div class="container" data-icinga-url="{URL}">
|
||||||
<h1 class="pull-left"><a data-icinga-target="self" href="{FULL_URL}"> {TITLE}</a></h1>
|
<h1><a href="{FULL_URL}">{TITLE}</a></h1>
|
||||||
{REMOVE_BTN}
|
|
||||||
<div class="container" >
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<noscript>
|
<noscript>
|
||||||
<iframe src="{URL}" style="height:100%; width:99%" frameborder="no"></iframe>
|
<iframe src="{URL}" style="height:100%; width:99%" frameborder="no"></iframe>
|
||||||
</noscript>
|
</noscript>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
EOD;
|
EOD;
|
||||||
|
|
||||||
@ -119,8 +115,15 @@ EOD;
|
|||||||
$this->pane = $pane;
|
$this->pane = $pane;
|
||||||
if ($url instanceof Url) {
|
if ($url instanceof Url) {
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
} else {
|
} elseif ($url) {
|
||||||
$this->url = Url::fromPath($url);
|
$this->url = Url::fromPath($url);
|
||||||
|
} else {
|
||||||
|
throw new Exception(
|
||||||
|
sprintf(
|
||||||
|
'Cannot create dashboard component "%s" without valid URL',
|
||||||
|
$title
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user