Skip to content

Commit

Permalink
webui: move clientActionButtonsFormatter to custom-functions.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergkemper committed Mar 18, 2020
1 parent 54cb434 commit c623e46
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
17 changes: 4 additions & 13 deletions webui/module/Client/view/client/client/details.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,7 @@ $this->headTitle($title);

<script>

var clientdetails = null;
var clientbackups = null;

function clientActionButtonsFormatter(value, row, index) {

let clientRestoreButton = '<a href="<?php echo $this->basePath() . '/restore/index?client='; ?>'+row.name+'"><button type="button" class="btn btn-default btn-xs" id="btn-1" data-toggle="tooltip" data-placement="top" title="<?php echo $this->translate("Restore"); ?>"><span class="glyphicon glyphicon-import"></span></button></a>';
let clientStatusButton = '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/client/status?client='+row.name+'" title="<?php echo $this->translate("Status"); ?>" id="btn-1"><span class="glyphicon glyphicon-zoom-in"></span></a>';

return clientRestoreButton + '&nbsp;' + clientStatusButton;
}
var basePath = "<?php echo $this->basePath(); ?>";

function jobActionButtonsFormatter(value, row, index) {
let jobDetailsButton = '<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>';
Expand All @@ -183,7 +174,7 @@ $this->headTitle($title);
}

function attachClientDetails() {
clientdetails = $('#clientdetails').bootstrapTable({
$('#clientdetails').bootstrapTable({
locale: '<?php echo str_replace('_','-', $_SESSION['bareos']['locale']); ?>',
cookie: <?php echo $_SESSION['bareos']['dt_statesave']; ?>,
cookieIdTable: 'dashboard_table_jobs_last_status',
Expand Down Expand Up @@ -218,15 +209,15 @@ $this->headTitle($title);
{
field: 'action',
formatter: function(value, row, index) {
return clientActionButtonsFormatter(value, row, index);
return clientActionButtonsFormatter(value, row, index, basePath);
}
}
]
});
}

function attachClientBackups() {
clientbackups = $('#clientbackups').bootstrapTable({
$('#clientbackups').bootstrapTable({
locale: '<?php echo str_replace('_','-', $_SESSION['bareos']['locale']); ?>',
cookie: <?php echo $_SESSION['bareos']['dt_statesave']; ?>,
cookieIdTable: 'client_clientbackups',
Expand Down
23 changes: 15 additions & 8 deletions webui/public/js/custom-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,14 @@ function formatUpdateStatus(value, row, index) {
}
}

function formatScheduleName(value, basePath) {
return '<a href="' + basePath + '/schedule/details?schedule=' + value + '">' + value + '</a>';
}

function formatClientName(value, basePath) {
return '<a href="' + basePath + '/client/details/' + value + '">' + value + '</a>';
}

function clientsActionButtonsFormatter(value, row, index, basePath) {
let restoreButton = '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="' + basePath + '/restore/index?client=' + row.name + '" title="' + iJS._("Restore") + '" id="btn-1"><span class="glyphicon glyphicon-import"></span></a>';
let statusClientButton = '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="' + basePath + '/client/status?client=' + row.name + '" title="' + iJS._("Status") + '" id="btn-1"><span class="glyphicon glyphicon-search"></span></a>';
Expand All @@ -566,6 +574,13 @@ function clientsActionButtonsFormatter(value, row, index, basePath) {
}
}

function clientActionButtonsFormatter(value, row, index, basePath) {
let clientRestoreButton = '<a href="' + basePath + '/restore/index?client=' + row.name + '"><button type="button" class="btn btn-default btn-xs" id="btn-1" data-toggle="tooltip" data-placement="top" title="' + iJS._("Restore") + '"><span class="glyphicon glyphicon-import"></span></button></a>';
let clientStatusButton = '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="' + basePath + '/client/status?client=' + row.name + '" title="' + iJS._("Status") + '" id="btn-1"><span class="glyphicon glyphicon-search"></span></a>';

return clientRestoreButton + '&nbsp;' + clientStatusButton;
}

function scheduleActionButtonsFormatter(value, row, index, basePath) {
let disableButton = '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="' + basePath + '/schedule/index?action=disable&schedule=' + row.name + '" title="' + iJS._("Disable") + '" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>';
let enableButton = '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="' + basePath + '/schedule/index?action=enable&schedule=' + row.name + '" title="' + iJS._("Enable") + '" id="btn-1"><span class="glyphicon glyphicon-ok"></span></a>';
Expand All @@ -576,11 +591,3 @@ function scheduleActionButtonsFormatter(value, row, index, basePath) {
return enableButton;
}
}

function formatScheduleName(value, basePath) {
return '<a href="' + basePath + '/schedule/details?schedule=' + value + '">' + value + '</a>';
}

function formatClientName(value, basePath) {
return '<a href="' + basePath + '/client/details/' + value + '">' + value + '</a>';
}

0 comments on commit c623e46

Please sign in to comment.