-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webui: analytics module: show stored data per jobname in treemap
- Loading branch information
Showing
14 changed files
with
20,937 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* bareos-webui - Bareos Web-Frontend | ||
* | ||
* @link https://github.com/bareos/bareos for the canonical source repository | ||
* @copyright Copyright (c) 2013-2022 Bareos GmbH & Co. KG (http://www.bareos.org/) | ||
* @license GNU Affero General Public License (http://www.gnu.org/licenses/) | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
namespace Analytics; | ||
|
||
use Analytics\Model\Analytics; | ||
use Analytics\Model\AnalyticsModel; | ||
|
||
class Module | ||
{ | ||
|
||
public function getAutoloaderConfig() | ||
{ | ||
return array( | ||
'Zend\Loader\ClassMapAutoloader' => array( | ||
__DIR__ . '/autoload_classmap.php', | ||
), | ||
'Zend\Loader\StandardAutoloader' => array( | ||
'namespaces' => array( | ||
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, | ||
), | ||
), | ||
); | ||
} | ||
|
||
public function getConfig() | ||
{ | ||
return include __DIR__ . '/config/module.config.php'; | ||
} | ||
|
||
public function getServiceConfig() | ||
{ | ||
return array( | ||
'factories' => array( | ||
'Analytics\Model\AnalyticsModel' => function() { | ||
$model = new AnalyticsModel(); | ||
return $model; | ||
} | ||
) | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* bareos-webui - Bareos Web-Frontend | ||
* | ||
* @link https://github.com/bareos/bareos for the canonical source repository | ||
* @copyright Copyright (c) 2013-2022 Bareos GmbH & Co. KG (http://www.bareos.org/) | ||
* @license GNU Affero General Public License (http://www.gnu.org/licenses/) | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
return array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* bareos-webui - Bareos Web-Frontend | ||
* | ||
* @link https://github.com/bareos/bareos for the canonical source repository | ||
* @copyright Copyright (C) 2013-2022 Bareos GmbH & Co. KG (http://www.bareos.org/) | ||
* @license GNU Affero General Public License (http://www.gnu.org/licenses/) | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
return array( | ||
|
||
'controllers' => array( | ||
'invokables' => array( | ||
'Analytics\Controller\Analytics' => 'Analytics\Controller\AnalyticsController', | ||
), | ||
), | ||
'controller_plugins' => array( | ||
'invokables' => array( | ||
'SessionTimeoutPlugin' => 'Application\Controller\Plugin\SessionTimeoutPlugin', | ||
), | ||
), | ||
'router' => array( | ||
'routes' => array( | ||
'analytics' => array( | ||
'type' => 'segment', | ||
'options' => array( | ||
'route' => '/analytics[/][:action][/][:id]', | ||
'constraints' => array( | ||
'action' => '[a-zA-Z][a-zA-Z0-9_-]*', | ||
'id' => '[a-zA-Z0-9][a-zA-Z0-9\._-]*', | ||
), | ||
'defaults' => array( | ||
'controller' => 'Analytics\Controller\Analytics', | ||
'action' => 'index', | ||
), | ||
), | ||
), | ||
), | ||
), | ||
'view_manager' => array( | ||
'template_path_stack' => array( | ||
'analytics' => __DIR__ . '/../view', | ||
), | ||
), | ||
|
||
); |
138 changes: 138 additions & 0 deletions
138
webui/module/Analytics/src/Analytics/Controller/AnalyticsController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* bareos-webui - Bareos Web-Frontend | ||
* | ||
* @link https://github.com/bareos/bareos for the canonical source repository | ||
* @copyright Copyright (c) 2013-2022 Bareos GmbH & Co. KG (http://www.bareos.org/) | ||
* @license GNU Affero General Public License (http://www.gnu.org/licenses/) | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
namespace Analytics\Controller; | ||
|
||
use Zend\Mvc\Controller\AbstractActionController; | ||
use Zend\View\Model\ViewModel; | ||
use Zend\Json\Json; | ||
|
||
class AnalyticsController extends AbstractActionController | ||
{ | ||
|
||
protected $analyticsModel = null; | ||
|
||
public function indexAction() | ||
{ | ||
$this->RequestURIPlugin()->setRequestURI(); | ||
|
||
if(!$this->SessionTimeoutPlugin()->isValid()) { | ||
return $this->redirect()->toRoute( | ||
'auth', | ||
array( | ||
'action' => 'login' | ||
), | ||
array( | ||
'query' => array( | ||
'req' => $this->RequestURIPlugin()->getRequestURI(), | ||
'dird' => $_SESSION['bareos']['director'] | ||
) | ||
) | ||
); | ||
} | ||
|
||
$module_config = $this->getServiceLocator()->get('ModuleManager')->getModule('Application')->getConfig(); | ||
$invalid_commands = $this->CommandACLPlugin()->getInvalidCommands( | ||
$module_config['console_commands']['Analytics']['mandatory'] | ||
); | ||
|
||
if(count($invalid_commands) > 0) { | ||
$this->acl_alert = true; | ||
return new ViewModel( | ||
array( | ||
'acl_alert' => $this->acl_alert, | ||
'invalid_commands' => implode(",", $invalid_commands) | ||
) | ||
); | ||
} | ||
|
||
return new ViewModel(); | ||
} | ||
|
||
public function getDataAction() | ||
{ | ||
$this->RequestURIPlugin()->setRequestURI(); | ||
|
||
if(!$this->SessionTimeoutPlugin()->isValid()) { | ||
return $this->redirect()->toRoute( | ||
'auth', | ||
array( | ||
'action' => 'login' | ||
), | ||
array( | ||
'query' => array( | ||
'req' => $this->RequestURIPlugin()->getRequestURI(), | ||
'dird' => $_SESSION['bareos']['director'] | ||
) | ||
) | ||
); | ||
} | ||
|
||
$result = null; | ||
|
||
$data = $this->params()->fromQuery('data'); | ||
|
||
if($data == "jobtotals") { | ||
try { | ||
$this->bsock = $this->getServiceLocator()->get('director'); | ||
$result = $this->getAnalyticsModel()->getJobTotals($this->bsock); | ||
$this->bsock->disconnect(); | ||
} | ||
catch(Exception $e) { | ||
echo $e->getMessage(); | ||
} | ||
} | ||
elseif($data == "overall-jobtotals") { | ||
try { | ||
$this->bsock = $this->getServiceLocator()->get('director'); | ||
$result = $this->getAnalyticsModel()->getOverallJobTotals($this->bsock); | ||
$this->bsock->disconnect(); | ||
} | ||
catch(Exception $e) { | ||
echo $e->getMessage(); | ||
} | ||
} | ||
|
||
$response = $this->getResponse(); | ||
$response->getHeaders()->addHeaderLine('Content-Type', 'application/json'); | ||
|
||
if(isset($result)) { | ||
$response->setContent(JSON::encode($result)); | ||
} | ||
|
||
return $response; | ||
|
||
} | ||
|
||
public function getAnalyticsModel() | ||
{ | ||
if(!$this->analyticsModel) { | ||
$sm = $this->getServiceLocator(); | ||
$this->analyticsModel = $sm->get('Analytics\Model\AnalyticsModel'); | ||
} | ||
return $this->analyticsModel; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/** | ||
* | ||
* bareos-webui - Bareos Web-Frontend | ||
* | ||
* @link https://github.com/bareos/bareos for the canonical source repository | ||
* @copyright Copyright (c) 2013-2022 Bareos GmbH & Co. KG (http://www.bareos.org/) | ||
* @license GNU Affero General Public License (http://www.gnu.org/licenses/) | ||
* | ||
* 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/>. | ||
* | ||
*/ | ||
|
||
namespace Analytics\Model; | ||
|
||
class Analytics | ||
{ | ||
} |
Oops, something went wrong.