Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
dashboard: introduces partials to widgetize the view
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergkemper committed May 19, 2016
1 parent cc90c49 commit a791f7e
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 91 deletions.
5 changes: 5 additions & 0 deletions module/Dashboard/config/module.config.php
Expand Up @@ -57,6 +57,11 @@
'template_path_stack' => array(
'dashboard' => __DIR__ . '/../view',
),
'template_map' => array(
'JobsPast24h' => __DIR__ . '/../view/partial/JobsPast24h.phtml',
'JobsLastStatus' => __DIR__ . '/../view/partial/JobsLastStatus.phtml',
'LastDirectorMessages' => __DIR__ . '/../view/partial/LastDirectorMessages.phtml',
),
),
'translator' => array(
'translation_file_patterns' => array(
Expand Down
95 changes: 4 additions & 91 deletions module/Dashboard/view/dashboard/dashboard/index.phtml
Expand Up @@ -31,99 +31,13 @@ $this->headTitle($title);

<div class="row">

<!-- Jobs during past 24 hours -->
<div class="col-md-4">

<div class="panel panel-default">

<div class="panel-heading">
<h3 class="panel-title"><?php echo $this->translate('Jobs during the past 24 hours') ?></h3>
</div>

<div class="panel-body" style="overflow-y: auto;">

<div class="row-md-6">
<div class="col-md-4">
<table class="table">
<tr>
<td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'running'))); ?>"><?php echo $this->translate("Running"); ?></a></td>
<td><span class="badge"><?php echo $this->runningJobs; ?></span></td>
</tr>
<tr>
<td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'waiting'))); ?>"><?php echo $this->translate("Waiting"); ?></a></td>
<td><span class="badge"><?php echo $this->waitingJobs; ?></span></td>
</tr>
<tr>
<td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'successful'))); ?>"><?php echo $this->translate("Successful"); ?></a></td>
<td><span class="badge"><?php echo $this->successfulJobs; ?></span></td>
</tr>
<tr>
<td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'unsuccessful'))); ?>"><?php echo $this->translate("Unsuccessful"); ?></a></td>
<td><span class="badge"><?php echo $this->unsuccessfulJobs; ?></span></td>
</tr>
</table>
</div>
<div class="col-md-2">
<div id="chart1" style="width:350px; height:250px;"></div>
</div>
</div>

</div>

</div>

<?php echo $this->partial('JobsPast24h'); ?>
<?php echo $this->partial('LastDirectorMessages'); ?>
</div>

<!-- LIST JOBS LAST -->
<div class="col-md-8">

<div class="panel panel-default">

<div class="panel-heading">
<h3 class="panel-title"><?php echo $this->translate('Jobs last status'); ?></h3>
</div>

<div class="panel-body">
<table class="table table-hover" id="jobs-last-status">
<thead class="bg-primary">
<th><?php echo $this->translate("Job"); ?></th>
<th><?php echo $this->translate("Status"); ?></th>
<th><?php echo $this->translate("Name"); ?></th>
<th><?php echo $this->translate("Client"); ?></th>
<th><?php echo $this->translate("Level"); ?></th>
<th><?php echo $this->translate("Start"); ?></th>
<th><?php echo $this->translate("End"); ?></th>
</thead>
</table>
</div>

</div>

</div>

</div>

<!-- DIRD MSG TICKER -->
<div class="row">

<div class="col-md-4">

<div class="panel panel-default">

<div class="panel-heading">
<h3 class="panel-title"><?php echo $this->translate('Last Director messages'); ?></h3>
</div>

<div class="panel-body" style="overflow-x: auto;">

<div class="dird-msg-ticker" style="height: 250px;">
<div class="msg" id="0"></div>
</div>

</div>

</div>

<?php echo $this->partial('JobsLastStatus'); ?>
</div>

</div>
Expand Down Expand Up @@ -194,7 +108,7 @@ $this->headTitle($title);
success: function(data) {
for(var i in data) {
if(data[i].logid > lastlogid) {
var msg = $('<div class="msg" id="'+data[i].logid+'"><strong>'+data[i].time+'</strong>&nbsp;'+data[i].logtext.replace(/(?:\r\n|\r|\n)/g, '<br />')+'</div>');
var msg = $('<div class="msg" id="'+data[i].logid+'">'+data[i].time+'&nbsp;'+data[i].logtext+'</div>');
msg.insertBefore('#'+lastlogid).fadeIn('slow');
lastlogid = data[i].logid;
}
Expand Down Expand Up @@ -270,4 +184,3 @@ $this->headTitle($title);
);

</script>

49 changes: 49 additions & 0 deletions module/Dashboard/view/partial/JobsLastStatus.phtml
@@ -0,0 +1,49 @@
<?php

/**
*
* bareos-webui - Bareos Web-Frontend
*
* @link https://github.com/bareos/bareos-webui for the canonical source repository
* @copyright Copyright (c) 2013-2016 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
* @author Frank Bergkemper
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

?>

<div class="panel panel-default">

<div class="panel-heading">
<h3 class="panel-title"><?php echo $this->translate('Jobs last status'); ?></h3>
</div>

<div class="panel-body">
<table class="table table-hover" id="jobs-last-status">
<thead class="bg-primary">
<th><?php echo $this->translate("Job"); ?></th>
<th><?php echo $this->translate("Status"); ?></th>
<th><?php echo $this->translate("Name"); ?></th>
<th><?php echo $this->translate("Client"); ?></th>
<th><?php echo $this->translate("Level"); ?></th>
<th><?php echo $this->translate("Start"); ?></th>
<th><?php echo $this->translate("End"); ?></th>
</thead>
</table>
</div>

</div>
65 changes: 65 additions & 0 deletions module/Dashboard/view/partial/JobsPast24h.phtml
@@ -0,0 +1,65 @@
<?php

/**
*
* bareos-webui - Bareos Web-Frontend
*
* @link https://github.com/bareos/bareos-webui for the canonical source repository
* @copyright Copyright (c) 2013-2016 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
* @author Frank Bergkemper
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

?>

<div class="panel panel-default">

<div class="panel-heading">
<h3 class="panel-title"><?php echo $this->translate('Jobs during the past 24 hours') ?></h3>
</div>

<div class="panel-body" style="overflow-y: auto;">

<div class="row-md-6">
<div class="col-md-4">
<table class="table">
<tr>
<td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'running'))); ?>"><?php echo $this->translate("Running"); ?></a></td>
<td><span class="badge"><?php echo $this->runningJobs; ?></span></td>
</tr>
<tr>
<td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'waiting'))); ?>"><?php echo $this->translate("Waiting"); ?></a></td>
<td><span class="badge"><?php echo $this->waitingJobs; ?></span></td>
</tr>
<tr>
<td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'successful'))); ?>"><?php echo $this->translate("Successful"); ?></a></td>
<td><span class="badge"><?php echo $this->successfulJobs; ?></span></td>
</tr>
<tr>
<td><a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'unsuccessful'))); ?>"><?php echo $this->translate("Unsuccessful"); ?></a></td>
<td><span class="badge"><?php echo $this->unsuccessfulJobs; ?></span></td>
</tr>
</table>
</div>
<div class="col-md-2">
<div id="chart1" style="width:350px; height:250px;"></div>
</div>
</div>

</div>

</div>
43 changes: 43 additions & 0 deletions module/Dashboard/view/partial/LastDirectorMessages.phtml
@@ -0,0 +1,43 @@
<?php

/**
*
* bareos-webui - Bareos Web-Frontend
*
* @link https://github.com/bareos/bareos-webui for the canonical source repository
* @copyright Copyright (c) 2013-2016 Bareos GmbH & Co. KG (http://www.bareos.org/)
* @license GNU Affero General Public License (http://www.gnu.org/licenses/)
* @author Frank Bergkemper
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

?>

<div class="panel panel-default">

<div class="panel-heading">
<h3 class="panel-title"><?php echo $this->translate('Last Director messages'); ?></h3>
</div>

<div class="panel-body">

<pre class="dird-msg-ticker" style="height: 225px; font-size: 8pt;">
<div class="msg" id="0"></div>
</pre>

</div>

</div>

0 comments on commit a791f7e

Please sign in to comment.