Fix row style, add dashboard as default route

This commit is contained in:
Jannis Moßhammer 2013-10-23 14:20:32 +02:00
parent 8eea09ab53
commit 1a95e48deb
6 changed files with 39 additions and 17 deletions

View File

@ -43,7 +43,7 @@ class IndexController extends ActionController
public function preDispatch()
{
if ($this->getRequest()->getActionName() !== 'welcome') {
$this->redirect('index/welcome');
$this->redirect('dashboard/index');
}
}

View File

@ -52,6 +52,13 @@ class Component implements Widget
*/
private $url;
/**
* Determines whether this spans a complete row
*
* @var bool
*/
private $fullsize = false;
/**
* The title being displayed on top of the component
* @var
@ -85,7 +92,7 @@ class Component implements Widget
*/
private $template =<<<'EOD'
<div data-icinga-component="app/dashboard" style="overflow:hidden" class="dashboard-component" data-icinga-url="{URL}">
<div data-icinga-component="app/dashboard" style="overflow:hidden" class="dashboard-component {{IS_FULL}}" data-icinga-url="{URL}">
<h1 class="pull-left"><a data-icinga-target="self" href="{FULL_URL}"> {TITLE}</a></h1>
{REMOVE_BTN}
<div class="container" >
@ -205,6 +212,7 @@ EOD;
$html = str_replace('{FULL_URL}', $url->getUrlWithout('view')->getAbsoluteUrl(), $html);
$html = str_replace('{REMOVE_BTN}', $this->getRemoveForm($view), $html);
$html = str_replace('{DIMENSION}', $this->getBoxSizeAsCSS(), $html);
$html = str_replace('{{IS_FULL}}', $this->fullsize ? 'row' : '' , $html);
$html = str_replace('{TITLE}', htmlentities($this->getTitle()), $html);
return $html;
}
@ -238,6 +246,11 @@ EOD;
return $form->render($view);
}
public function setFullsize($bool)
{
$this->fullsize = $bool;
}
/**
* Return the height and width deifnition (if given) in CSS format
*
@ -283,6 +296,9 @@ EOD;
}
$cmp = new Component($title, Url::fromPath($url, $parameters), $pane);
if (isset($parameters['row'])) {
$cmp->setFullsize(true);
}
$cmp->setHeight($height);
$cmp->setWidth($width);
return $cmp;

View File

@ -1,5 +1,5 @@
<div style="width:<?= $this->width; ?>px;height:<?= $this->height; ?>px">
<div style="width:<?= $this->width; ?>px;height:<?= $this->height; ?>px;margin:auto;">
<?=
$chart->render();
?>

View File

@ -88,32 +88,32 @@
========================================================================== */
.status-up {
background-color: @colorUp;
background-color: @colorUp!important;
}
.status-warning {
background-color: @colorWarning;
background-color: @colorWarning!important;
}
.status-critical {
background-color: @colorCritical;
background-color: @colorCritical!important;
}
.status-unknown {
background-color: @colorUnknown;
background-color: @colorUnknown!important;
}
.status-pending {
background-color: @colorPending;
background-color: @colorPending!important;
}
/** Service status **/
.tacheader-status-pending {
background-color: @colorPending;
background-color: @colorPending!important;
}
.tacheader-status-critical {
background-color: @colorCritical;
background-color: @colorCritical!important;
}
.tacheader-status-ok {
@ -121,21 +121,21 @@
}
.tacheader-status-warning {
background-color: @colorWarning;
background-color: @colorWarning!important;
}
.tacheader-status-unknown {
background-color: @colorUnknown;
background-color: @colorUnknown!important;
}
/** Host status **/
.tacheader-status-unreachable {
background-color: @colorUnreachable;
background-color: @colorUnreachable!important;
}
.tacheader-status-down {
background-color: @colorDown;
background-color: @colorDown!important;
}
.tacheader-status-up {

View File

@ -466,3 +466,8 @@ select.input-sm {
padding:1%;
margin:1%;
}
.dashboard-component.row {
width:98%;
}

View File

@ -213,7 +213,7 @@ function(Container, $, logger, URI, tpl, urlMgr, Selectable, TableMultiSelection
}
break;
case 'none':
default:
// don't open the link
return;
}
@ -332,7 +332,8 @@ function(Container, $, logger, URI, tpl, urlMgr, Selectable, TableMultiSelection
this.initRowSelection();
this.registerControls();
};
this.construct(gridDomNode);
if (typeof $(gridDomNode).attr('id') === 'undefined') {
this.construct(gridDomNode);
}
};
});