+++ /dev/null
-<%@ MasterClass="Application.Web.Layouts.Main" Theme="Baculum-v2"%>
-<com:TContent ID="Main">
- <!-- Header -->
- <header class="w3-container">
- <h5>
- <strong><i class="fas fa-chart-line"></i> <%[ Statistics list ]%></strong>
- </h5>
- </header>
- <div class="w3-margin-left w3-margin-bottom">
- <button type="button" class="w3-button w3-green<%=empty($_SESSION['dir']) ? ' hide': ''%>" onclick="document.location.href='<%=$this->Service->constructUrl('NewResource', array('component_type' => 'dir', 'component_name' => $_SESSION['dir'], 'resource_type' => 'Statistics'))%>';"><i class="fa fa-plus"></i> <%[ Add director statistics ]%></button>
- <button type="button" class="w3-button w3-green<%=empty($_SESSION['sd']) ? ' hide': ''%>" onclick="document.location.href='<%=$this->Service->constructUrl('NewResource', array('component_type' => 'sd', 'component_name' => $_SESSION['sd'], 'resource_type' => 'Statistics'))%>';"><i class="fa fa-plus"></i> <%[ Add storage statistics ]%></button>
- <button type="button" class="w3-button w3-green<%=empty($_SESSION['fd']) ? ' hide': ''%>" onclick="document.location.href='<%=$this->Service->constructUrl('NewResource', array('component_type' => 'fd', 'component_name' => $_SESSION['fd'], 'resource_type' => 'Statistics'))%>';"><i class="fa fa-plus"></i> <%[ Add file daemon statistics ]%></button>
- </div>
- <div class="w3-container">
- <table id="statistics_list" class="w3-table w3-striped w3-hoverable w3-white w3-margin-bottom">
- <thead>
- <tr>
- <th></th>
- <th><%[ Name ]%></th>
- <th><%[ Component type ]%></th>
- <th><%[ Component name ]%></th>
- <th class="w3-center"><%[ Actions ]%></th>
- </tr>
- </thead>
- </table>
- </div>
-<script type="text/javascript">
-var oStatisticsList = {
- ids: {
- statistics_list: 'statistics_list'
- },
- init: function() {
- this.set_table();
- },
- set_table: function() {
- var table = $('#' + this.ids.statistics_list).DataTable({
- data: <%=json_encode($this->statistics)%>,
- deferRender: true,
- columns: [
- {
- className: 'details-control',
- orderable: false,
- data: null,
- defaultContent: '<button type="button" class="w3-button w3-blue"><i class="fa fa-angle-down"></i></button>'
- },
- {data: 'statistics'},
- {data: 'component_type_full'},
- {data: 'component_name'},
- {
- data: 'statistics',
- render: function (data, type, row) {
- var btn = document.createElement('BUTTON');
- btn.className = 'w3-button w3-green';
- btn.type = 'button';
- var i = document.createElement('I');
- i.className = 'fa fa-list-ul';
- var label = document.createTextNode(' <%[ Details ]%>');
- btn.appendChild(i);
- btn.innerHTML += ' ';
- btn.appendChild(label);
- btn.setAttribute('onclick', "document.location.href = '/web/statistics/" + row.component_type + "/" + data + "/'");
- return btn.outerHTML;
- }
- }
- ],
- responsive: {
- details: {
- type: 'column'
- }
- },
- columnDefs: [{
- className: 'control',
- orderable: false,
- targets: 0
- },
- {
- className: "dt-center",
- targets: [ 2, 3, 4 ]
- }],
- order: [2, 'asc']
- });
- }
-};
-oStatisticsList.init();
-</script>
-</com:TContent>
+++ /dev/null
-<?php
-/*
- * Bacula(R) - The Network Backup Solution
- * Baculum - Bacula web interface
- *
- * Copyright (C) 2013-2020 Kern Sibbald
- *
- * The main author of Baculum is Marcin Haba.
- * The original author of Bacula is Kern Sibbald, with contributions
- * from many others, a complete list can be found in the file AUTHORS.
- *
- * You may use this file and others of this release according to the
- * license defined in the LICENSE file, which includes the Affero General
- * Public License, v3.0 ("AGPLv3") and some additional permissions and
- * terms pursuant to its AGPLv3 Section 7.
- *
- * This notice must be preserved when any source code is
- * conveyed and/or propagated.
- *
- * Bacula(R) is a registered trademark of Kern Sibbald.
- */
-
-Prado::using('Application.Web.Class.BaculumWebPage');
-
-/**
- * Statistics list page.
- *
- * @author Marcin Haba <marcin.haba@bacula.pl>
- * @category Page
- * @package Baculum Web
- */
-class StatisticsList extends BaculumWebPage {
-
- const USE_CACHE = true;
-
- public $statistics = array();
-
- public function onInit($param) {
- parent::onInit($param);
- if ($this->IsPostBack || $this->IsCallBack) {
- return;
- }
- $misc = $this->getModule('misc');
- $components = array('dir', 'sd', 'fd');
-
- for ($i = 0; $i < count($components); $i++) {
- if (empty($_SESSION[$components[$i]])) {
- continue;
- }
-
- $result = $this->getModule('api')->get(
- array('config', $components[$i], 'statistics'),
- null,
- true,
- self::USE_CACHE
- );
-
- if ($result->error === 0) {
- for ($j = 0; $j < count($result->output); $j++) {
- $this->statistics[] = array(
- 'statistics' => $result->output[$j]->Statistics->Name,
- 'component_type' => $components[$i],
- 'component_type_full' => $misc->getComponentFullName($components[$i]),
- 'component_name' => $_SESSION[$components[$i]]
- );
- }
- }
- }
- }
-}
-?>
+++ /dev/null
-<%@ MasterClass="Application.Web.Layouts.Main" Theme="Baculum-v2"%>
-<com:TContent ID="Main">
- <!-- Header -->
- <header class="w3-container">
- <h5>
- <strong><i class="fas fa-chart-line"></i> <%[ Statistics details ]%></strong>
- </h5>
- </header>
- <h3 class="w3-margin-left"><%[ Statistics: ]%> <%=$this->getStatisticsName()%></h3>
- <div class="w3-bar w3-green w3-margin-bottom">
- <a class="w3-button w3-bar-item" href="<%=$this->Service->constructUrl('StatisticsList')%>"><i class="fa fa-angle-left"></i></a>
- </div>
- <div class="w3-container">
- <com:Application.Web.Portlets.BaculaConfigDirectives
- ID="StatisticsConfig"
- ResourceType="Statistics"
- ShowCancelButton="false"
- />
- </div>
-</com:TContent>
+++ /dev/null
-<?php
-/*
- * Bacula(R) - The Network Backup Solution
- * Baculum - Bacula web interface
- *
- * Copyright (C) 2013-2020 Kern Sibbald
- *
- * The main author of Baculum is Marcin Haba.
- * The original author of Bacula is Kern Sibbald, with contributions
- * from many others, a complete list can be found in the file AUTHORS.
- *
- * You may use this file and others of this release according to the
- * license defined in the LICENSE file, which includes the Affero General
- * Public License, v3.0 ("AGPLv3") and some additional permissions and
- * terms pursuant to its AGPLv3 Section 7.
- *
- * This notice must be preserved when any source code is
- * conveyed and/or propagated.
- *
- * Bacula(R) is a registered trademark of Kern Sibbald.
- */
-
-Prado::using('Application.Web.Class.BaculumWebPage');
-
-/**
- * Statistics view page.
- *
- * @author Marcin Haba <marcin.haba@bacula.pl>
- * @category Page
- * @package Baculum Web
- */
-class StatisticsView extends BaculumWebPage {
-
- const COMPONENT_TYPE = 'ComponentType';
- const STATISTICS_NAME = 'StatisticsName';
-
- public function onInit($param) {
- parent::onInit($param);
- if ($this->IsPostBack || $this->IsCallBack) {
- return;
- }
-
- $components = $this->getModule('misc')->getComponents();
- if (in_array($this->Request['component_type'], $components)) {
- $this->setComponentType($this->Request['component_type']);
- } else {
- $wmsg = sprintf(
- 'Invalid component type "%s" on %s',
- $this->Request['component_type'],
- __CLASS__
- );
- $this->Application->getModule('logging')->log(
- __FUNCTION__,
- $wmsg,
- Logging::CATEGORY_SECURITY,
- __FILE__,
- __LINE__
- );
- $this->StatisticsConfig->setVisible(false);
- }
- $this->setStatisticsName($this->Request['statistics']);
- }
-
- public function onPreRender($param) {
- parent::onPreRender($param);
- if ($this->IsCallBack || $this->IsPostBack) {
- return;
- }
- $component_type = $this->getComponentType();
- if (key_exists($component_type, $_SESSION) && !empty($_SESSION[$component_type])) {
- $this->StatisticsConfig->setComponentType($component_type);
- $this->StatisticsConfig->setComponentName($_SESSION[$component_type]);
- $this->StatisticsConfig->setResourceName($this->getStatisticsName());
- $this->StatisticsConfig->setLoadValues(true);
- $this->StatisticsConfig->raiseEvent('OnDirectiveListLoad', $this, null);
- }
- }
-
- public function getComponentType() {
- return $this->getViewState(self::COMPONENT_TYPE, '');
- }
-
- public function setComponentType($component_type) {
- $this->setViewState(self::COMPONENT_TYPE, $component_type);
- }
-
- public function getStatisticsName() {
- return $this->getViewState(self::STATISTICS_NAME, '');
- }
-
- public function setStatisticsName($statistics_name) {
- $this->setViewState(self::STATISTICS_NAME, $statistics_name);
- }
-}
-?>
<a href="<%=$this->Service->constructUrl('ConsoleView')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'ConsoleView' ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'ConsoleView') ? '' : ' hide'%>"><i class="fa fa-laptop-code fa-fw"></i> <%[ Console ]%></a>
<a href="<%=$this->Service->constructUrl('RestoreWizard')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'RestoreWizard' ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'RestoreWizard') ? '' : ' hide'%>"><i class="fa fa-reply fa-fw"></i> <%[ Restore wizard ]%></a>
<a href="<%=$this->Service->constructUrl('Graphs')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'Graphs' ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'Graphs') ? '' : ' hide'%>"><i class="fa fa-chart-pie fa-fw"></i> <%[ Graphs ]%></a>
- <a href="<%=$this->Service->constructUrl('StatisticsList')%>" class="w3-bar-item w3-button w3-padding<%=in_array($this->Service->getRequestedPagePath(), array('StatisticsList', 'StatisticsView')) ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'StatisticsList') ? '' : ' hide'%>"><i class="fas fa-chart-line fa-fw"></i> <%[ Statistics ]%></a>
<a href="<%=$this->Service->constructUrl('WebConfigWizard')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'WebConfigWizard' ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'WebConfigWizard') ? '' : ' hide'%>"><i class="fa fa-wrench fa-fw"></i> <%[ Settings ]%></a>
<a href="<%=$this->Service->constructUrl('Security')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'Security' ? ' w3-blue': ''%><%=$this->getModule('users')->isPageAllowed($this->User, 'Security') ? '' : ' hide'%>"><i class="fa fa-lock fa-fw"></i> <%[ Security ]%></a>
</div>
<url ServiceParameter="ClientView" pattern="web/client/{client}/" parameters.client="[a-zA-Z0-9:.\-_ ]+" />
<url ServiceParameter="FileSetList" pattern="web/fileset/" />
<url ServiceParameter="FileSetView" pattern="web/fileset/{fileset}/" parameters.fileset="[a-zA-Z0-9:.\-_ ]+" />
- <url ServiceParameter="StatisticsList" pattern="web/statistics/" />
- <url ServiceParameter="StatisticsView" pattern="web/statistics/{component_type}/{statistics}/" parameters.component_type="\w+" parameters.statistics="[a-zA-Z0-9:.\-_ ]+"/>
<url ServiceParameter="ScheduleList" pattern="web/schedule/" />
<url ServiceParameter="ScheduleStatusList" pattern="web/schedule/status/" />
<url ServiceParameter="ScheduleView" pattern="web/schedule/{schedule}/" parameters.schedule="[a-zA-Z0-9:.\-_ ]+" />