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

Commit

Permalink
Jobs: Enable/Disable state
Browse files Browse the repository at this point in the history
Just display the action button which is needed according to the jobs
state. Also display the jobs state labeled in a separate column.
  • Loading branch information
fbergkemper committed Aug 9, 2016
1 parent 0989fa8 commit 7a5cd0b
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions module/Job/view/job/job/actions.phtml
Expand Up @@ -72,6 +72,7 @@ $this->headTitle($title);
<table class="table table-hover" id="backupjobs">
<thead class="bg-primary">
<th><?php echo $this->translate("Job name"); ?></th>
<th><?php echo $this->translate("Status"); ?></th>
<th><?php echo $this->translate("Actions"); ?></th>
</thead>
</table>
Expand Down Expand Up @@ -106,13 +107,9 @@ $this->headTitle($title);
"url": "<?php echo $this->basePath() . '/js/dataTables/language/'; ?>" + getLocale('<?php echo $_SESSION['bareos']['locale']; ?>')
},
"columns" : [
{
"data": null
},
{
"orderable": false,
"data": null
}
{ "data": null },
{ "data": "enabled", "orderable": true },
{ "data": null, "orderable": false }
],
"paging": true,
"pagingType": "full_numbers",
Expand All @@ -125,16 +122,30 @@ $this->headTitle($title);
"columnDefs": [
{
"targets": 0,
"data": null,
"render": function(data, type, full, meta) {
return data.name;
}
},
{
"targets": 1,
"data": null,
"render": function(data, type, full, meta) {
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/actions?action=queue&job='; ?>'+data.name+'" title="<?php echo $this->translate("Run"); ?>" id="btn-1"><span class="glyphicon glyphicon-play"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/job/actions?action=enable&job='+data.name+'" title="<?php echo $this->translate("Enable"); ?>" id="btn-1"><span class="glyphicon glyphicon-ok"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/job/actions?action=disable&job='+data.name+'" title="<?php echo $this->translate("Disable"); ?>" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>';
if(data) {
return '<span class="label label-success"><?php echo $this->translate("Enabled"); ?></span>';
}
else {
return '<span class="label label-danger"><?php echo $this->translate("Disabled"); ?></span>';
}
}
},
{
"targets": 2,
"render": function(data, type, full, meta) {
if(data.enabled) {
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/actions?action=queue&job='; ?>'+data.name+'" title="<?php echo $this->translate("Run"); ?>" id="btn-1"><span class="glyphicon glyphicon-play"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/job/actions?action=disable&job='+data.name+'" title="<?php echo $this->translate("Disable"); ?>" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>';
}
else {
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/job/actions?action=queue&job='; ?>'+data.name+'" title="<?php echo $this->translate("Run"); ?>" id="btn-1"><span class="glyphicon glyphicon-play"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/job/actions?action=enable&job='+data.name+'" title="<?php echo $this->translate("Enable"); ?>" id="btn-1"><span class="glyphicon glyphicon-ok"></span></a>';
}
}
}
]
Expand Down

0 comments on commit 7a5cd0b

Please sign in to comment.