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

Commit

Permalink
First attempt at adding client status.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Jun 23, 2016
1 parent d6dfec2 commit c8da7c4
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 4 deletions.
18 changes: 18 additions & 0 deletions module/Client/src/Client/Controller/ClientController.php
Expand Up @@ -92,6 +92,24 @@ public function detailsAction()

}

public function statusAction()
{
$this->RequestURIPlugin()->setRequestURI();

if(!$this->SessionTimeoutPlugin()->isValid()) {
return $this->redirect()->toRoute('auth', array('action' => 'login'), array('query' => array('req' => $this->RequestURIPlugin()->getRequestURI())));
}

$clientname = $this->params()->fromQuery('client');
$result = $this->getClientModel()->statusClient($clientname);

return new ViewModel(
array(
'result' => $result
)
);
}

public function getDataAction()
{

Expand Down
13 changes: 13 additions & 0 deletions module/Client/src/Client/Model/ClientModel.php
Expand Up @@ -94,6 +94,19 @@ public function getClientBackups($client=null, $limit=null, $order=null)
}
}

public function statusClient($name=null)
{
if(isset($name)) {
$cmd = 'status client="'.$name;
$this->director = $this->getServiceLocator()->get('director');
$result = $this->director->send_command($cmd, 0, null);
return $result;
}
else {
return false;
}
}

public function enableClient($name=null)
{
if(isset($name)) {
Expand Down
6 changes: 6 additions & 0 deletions module/Client/view/client/client/details.phtml
Expand Up @@ -28,6 +28,12 @@ $this->headTitle($title);

?>

<ul class="nav nav-tabs">
<li class="active"><a href="<?php echo $this->url('client', array('action'=>'index')); ?>"><?php echo $this->translate('Show'); ?></a></li>
</ul>

<br />

<div class="row">

<div class="col-md-12">
Expand Down
11 changes: 7 additions & 4 deletions module/Client/view/client/client/index.phtml
Expand Up @@ -28,6 +28,12 @@ $this->headTitle($title);

?>

<ul class="nav nav-tabs">
<li class="active"><a href="<?php echo $this->url('client', array('action'=>'index')); ?>"><?php echo $this->translate('Show'); ?></a></li>
</ul>

<br />

<div class="row">

<div class="col-md-8">
Expand Down Expand Up @@ -136,7 +142,7 @@ $(document).ready(function() {
{
"targets": 2,
"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() . '/restore/index?type=client&client='; ?>'+data+'" title="<?php echo $this->translate("Restore"); ?>" id="btn-1"><span class="glyphicon glyphicon-import"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/client/index?action=enable&client='+data+'" 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(); ?>/client/index?action=disable&client='+data+'" title="<?php echo $this->translate("Disable"); ?>" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>';
return '<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath() . '/restore/index?type=client&client='; ?>'+data+'" title="<?php echo $this->translate("Restore"); ?>" id="btn-1"><span class="glyphicon glyphicon-import"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/client/status?client='+data+'" title="<?php echo $this->translate("Status"); ?>" id="btn-1"><span class="glyphicon glyphicon-zoom-in"></span></a>&nbsp;<a class="btn btn-default btn-xs" data-toggle="tooltip" data-placement="top" href="<?php echo $this->basePath(); ?>/client/index?action=enable&client='+data+'" 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(); ?>/client/index?action=disable&client='+data+'" title="<?php echo $this->translate("Disable"); ?>" id="btn-1"><span class="glyphicon glyphicon-remove"></span></a>';
}
}
]
Expand All @@ -145,9 +151,6 @@ $(document).ready(function() {
$('#clients tbody').on('mouseover', '#btn-1', function () {
$('[data-toggle="tooltip"]').tooltip();
})


} );

</script>

32 changes: 32 additions & 0 deletions module/Client/view/client/client/status.phtml
@@ -0,0 +1,32 @@
<?php

$title = 'Client Status';
$this->headTitle($title);

?>

<ul class="nav nav-tabs">
<li class="active"><a href="<?php echo $this->url('client', array('action'=>'index')); ?>"><?php echo $this->translate('Show'); ?></a></li>
</ul>

<br />

<div class="row">
<div class="col-md-8">

<div class="panel panel-default">

<div class="panel-heading">
<h3 class="panel-title"><?php echo $this->translate("Client Status"); ?></h3>
</div>

<div class="panel-body">
<pre class="dird-messages" style="height: 500px; font-size: 8pt;">
<code>
<?php echo $this->result; ?>
</code>
</pre>
</div>

</div>
</div>

0 comments on commit c8da7c4

Please sign in to comment.