Skip to content

Commit

Permalink
Merge current master from bareos-webui repo
Browse files Browse the repository at this point in the history
Merge commit 'c028bb24fb971308e354894572c2993b0a1adc16'
  • Loading branch information
pstorz committed May 7, 2018
2 parents 4f2da27 + c028bb2 commit 4a96a77
Show file tree
Hide file tree
Showing 10 changed files with 368 additions and 229 deletions.
4 changes: 2 additions & 2 deletions webui/module/Client/view/client/client/details.phtml
Expand Up @@ -169,7 +169,7 @@ $this->headTitle($title);
field: 'jobid',
sortable: true,
formatter: function(value) {
return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+value+'">'+value+'</a>';
return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+value+'" title="<?php echo $this->translate("View Job Details"); ?>">'+value+'</a>';
}
},
{
Expand Down Expand Up @@ -218,7 +218,7 @@ $this->headTitle($title);
{
field: 'action',
formatter: function(value, row, index) {
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/restore/?type=client&mergefilesets=1&mergejobs=1&client='+row.client+'&jobid='+row.jobid+'" title="<?php echo $this->translate("Show Files"); ?>" id="btn-1"><span class="glyphicon glyphicon-folder-open"></span></a>';
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath();?>/job/details/'+row.jobid+'" title="<?php echo $this->translate("View Job Details"); ?>" id="btn-0"><span class="glyphicon glyphicon-search"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/restore/?type=client&mergefilesets=1&mergejobs=1&client='+row.client+'&jobid='+row.jobid+'" title="<?php echo $this->translate("Show Files"); ?>" id="btn-1"><span class="glyphicon glyphicon-folder-open"></span></a>';
}
}
]
Expand Down
Expand Up @@ -105,6 +105,7 @@ public function getDataAction()
$waiting = null;
$running = null;
$successful = null;
$warning = null;
$failed = null;
$result = null;

Expand Down Expand Up @@ -138,20 +139,24 @@ public function getDataAction()

// successful
$jobs_T = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'T', $days, $hours);
$successful = count($jobs_T);

// warning
$jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'A', $days, $hours);
$jobs_W = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'W', $days, $hours);
$successful = count($jobs_T) + count($jobs_W);
$warning = count($jobs_A) + count($jobs_W);

// failed
$jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'A', $days, $hours);
$jobs_E = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'E', $days, $hours);
$jobs_e = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'e', $days, $hours);
$jobs_f = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'f', $days, $hours);
$failed = count($jobs_A) + count($jobs_E) + count($jobs_e) + count($jobs_f);
$failed = count($jobs_E) + count($jobs_e) + count($jobs_f);

// json result
$result['waiting'] = $waiting;
$result['running'] = $running;
$result['successful'] = $successful;
$result['warning'] = $warning;
$result['failed'] = $failed;
}
catch(Exception $e) {
Expand Down
8 changes: 7 additions & 1 deletion webui/module/Dashboard/view/dashboard/dashboard/index.phtml
Expand Up @@ -65,6 +65,8 @@ $this->headTitle($title);
$('.running-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>");
$('.successful-jobs-field').empty();
$('.successful-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>");
$('.warning-jobs-field').empty();
$('.warning-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>");
$('.failed-jobs-field').empty();
$('.failed-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>");
});
Expand All @@ -89,6 +91,10 @@ $this->headTitle($title);
$('.successful-jobs-field').append(
data.successful
);
$('.warning-jobs-field').empty();
$('.warning-jobs-field').append(
data.warning
);
$('.failed-jobs-field').empty();
$('.failed-jobs-field').append(
data.failed
Expand Down Expand Up @@ -175,7 +181,7 @@ $this->headTitle($title);
field: 'jobid',
sortable: true,
formatter: function(value) {
return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+value+'">'+value+'</a>';
return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+value+'" title="<?php echo $this->translate("View Job Details"); ?>">'+value+'</a>';
}
},
{
Expand Down
23 changes: 19 additions & 4 deletions webui/module/Dashboard/view/partial/JobsPast24h.phtml
Expand Up @@ -37,9 +37,11 @@

<div class="container-fluid block">

<div class="center-block">

<div class="row">

<div class="col-md-3 text-center">
<div class="col-md-2 text-center">
<h4>
<span class="label label-info"><?php echo $this->translate('Running'); ?></span>
</h4>
Expand All @@ -50,7 +52,7 @@
</h3>
</div>

<div class="col-md-3 text-center">
<div class="col-md-2 text-center">
<h4>
<span class="label label-default"><?php echo $this->translate('Waiting'); ?></span>
</h4>
Expand All @@ -61,7 +63,7 @@
</h3>
</div>

<div class="col-md-3 text-center">
<div class="col-md-2 text-center">
<h4>
<span class="label label-success"><?php echo $this->translate('Successful'); ?></span>
</h4>
Expand All @@ -72,7 +74,18 @@
</h3>
</div>

<div class="col-md-3 text-center">
<div class="col-md-2 text-center">
<h4>
<span class="label label-warning"><?php echo $this->translate('Warning'); ?></span>
</h4>
<h3>
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'warning'))); ?>">
<span class="warning-jobs-field"></span>
</a>
</h3>
</div>

<div class="col-md-2 text-center">
<h4>
<span class="label label-danger"><?php echo $this->translate('Failed'); ?></span>
</h4>
Expand All @@ -85,6 +98,8 @@

</div>

</div>

</div>

</div>
Expand Down
14 changes: 11 additions & 3 deletions webui/module/Job/src/Job/Controller/JobController.php
Expand Up @@ -418,20 +418,28 @@ public function getDataAction()
elseif($data == "jobs" && $status == "successful") {
try {
$jobs_T = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'T', $period, null); // Terminated
$result = $jobs_T;
}
catch(Exception $e) {
echo $e->getMessage();
}
}
elseif($data == "jobs" && $status == "warning") {
try {
$jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'A', $period, null); // Terminated
$jobs_W = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'W', $period, null); // Terminated with warnings
$result = array_merge($jobs_T, $jobs_W);
$result = array_merge($jobs_A, $jobs_W);
}
catch(Exception $e) {
echo $e->getMessage();
}
}
elseif($data == "jobs" && $status == "unsuccessful") {
try {
$jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'A', $period, null); // Canceled jobs
$jobs_E = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'E', $period, null); //
$jobs_e = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'e', $period, null); //
$jobs_f = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'f', $period, null); //
$result = array_merge($jobs_A, $jobs_E, $jobs_e, $jobs_f);
$result = array_merge($jobs_E, $jobs_e, $jobs_f);
}
catch(Exception $e) {
echo $e->getMessage();
Expand Down
5 changes: 3 additions & 2 deletions webui/module/Job/src/Job/Form/JobForm.php
Expand Up @@ -98,12 +98,13 @@ public function __construct($jobs=null, $jobname=null, $period=null, $status=nul
'running' => _('running'),
'waiting' => _('waiting'),
'unsuccessful' => _('terminated unsuccessfully'),
'successful' => _('terminated successfully')
'successful' => _('terminated successfully'),
'warning' => _('warning')
)
),
'attributes' => array(
'class' => 'form-control selectpicker show-tick',
'data-size' => '5',
'data-size' => '6',
'id' => 'status',
'value' => $status
)
Expand Down
16 changes: 8 additions & 8 deletions webui/module/Job/view/job/job/index.phtml
Expand Up @@ -198,7 +198,7 @@ $this->headTitle($title);
field: 'jobid',
sortable: true,
formatter: function(value) {
return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+value+'">'+value+'</a>';
return '<a href="<?php echo $this->basePath() . '/job/details/'; ?>'+value+'" title="<?php echo $this->translate("View Job Details"); ?>">'+value+'</a>';
}
},
{
Expand Down Expand Up @@ -259,17 +259,17 @@ $this->headTitle($title);
case 'W':
switch(row.type) {
case 'B':
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/index?action=rerun&jobid='; ?>'+row.jobid+'" title="<?php echo $this->translate("Rerun"); ?>" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/restore/?type=client&mergefilesets=1&mergejobs=1&client='+row.client+'&jobid='+row.jobid+'" title="<?php echo $this->translate("Restore"); ?>" id="btn-1"><span class="glyphicon glyphicon-download-alt"></span></a>';
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath();?>/job/details/'+row.jobid+'" title="<?php echo $this->translate("View Job Details"); ?>" id="btn-0"><span class="glyphicon glyphicon-search"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/index?action=rerun&jobid='; ?>'+row.jobid+'" title="<?php echo $this->translate("Rerun"); ?>" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/restore/?type=client&mergefilesets=1&mergejobs=1&client='+row.client+'&jobid='+row.jobid+'" title="<?php echo $this->translate("Restore"); ?>" id="btn-1"><span class="glyphicon glyphicon-download-alt"></span></a>';
case 'C':
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/restore/?type=client&mergefilesets=1&mergejobs=1&client='+row.client+'&jobid='+row.jobid+'" title="<?php echo $this->translate("Restore"); ?>" id="btn-1"><span class="glyphicon glyphicon-download-alt"></span></a>';
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath();?>/job/details/'+row.jobid+'" title="<?php echo $this->translate("View Job Details"); ?>" id="btn-0"><span class="glyphicon glyphicon-search"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/restore/?type=client&mergefilesets=1&mergejobs=1&client='+row.client+'&jobid='+row.jobid+'" title="<?php echo $this->translate("Restore"); ?>" id="btn-1"><span class="glyphicon glyphicon-download-alt"></span></a>';
}
case 'E':
case 'e':
case 'f':
case 'A':
switch(row.type) {
case 'B':
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/index?action=rerun&jobid='; ?>'+row.jobid+'" title="<?php echo $this->translate("Rerun"); ?>" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>';
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath();?>/job/details/'+row.jobid+'" title="<?php echo $this->translate("View Job Details"); ?>" id="btn-0"><span class="glyphicon glyphicon-search"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/index?action=rerun&jobid='; ?>'+row.jobid+'" title="<?php echo $this->translate("Rerun"); ?>" id="btn-1"><span class="glyphicon glyphicon-repeat"></span></a>';
}
case 'F':
case 'S':
Expand All @@ -290,15 +290,15 @@ $this->headTitle($title);
switch(row.jobstatus) {
case 'R':
case 'l':
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+row.jobid+'" title="<?php echo $this->translate("Cancel"); ?>" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath();?>/job/details/'+row.jobid+'" title="<?php echo $this->translate("View Job Details"); ?>" id="btn-0"><span class="glyphicon glyphicon-search"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+row.jobid+'" title="<?php echo $this->translate("Cancel"); ?>" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
default:
return '';
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath();?>/job/details/'+row.jobid+'" title="<?php echo $this->translate("View Job Details"); ?>" id="btn-0"><span class="glyphicon glyphicon-search"></span></a>&nbsp;';
}
case 'B':
case 'C':
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+row.jobid+'" title="<?php echo $this->translate("Cancel"); ?>" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath();?>/job/details/'+row.jobid+'" title="<?php echo $this->translate("View Job Details"); ?>" id="btn-0"><span class="glyphicon glyphicon-search"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/cancel/'; ?>'+row.jobid+'" title="<?php echo $this->translate("Cancel"); ?>" id="btn-1"><span class="glyphicon glyphicon-trash"></span></a>';
default:
return '';
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath();?>/job/details/'+row.jobid+'" title="<?php echo $this->translate("View Job Details"); ?>" id="btn-0"><span class="glyphicon glyphicon-search"></span></a>&nbsp;';
}
default:
return '';
Expand Down

0 comments on commit 4a96a77

Please sign in to comment.