}
public function getComponents() {
- $components = array_keys($this->components);
+ return array_keys($this->components);
}
public function getMainComponentResource($type) {
"FieldType": "ListBox",
"Resource": "Job"
}
+ },
+ "Statistics": {
+ "Name": {
+ "Required": true,
+ "ValueType": "name",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Description": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Interval": {
+ "Required": false,
+ "ValueType": "time",
+ "DefaultValue": 300,
+ "FieldType": "TimePeriod"
+ },
+ "Type": {
+ "Required": true,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "ComboBox",
+ "Data": ["CSV", "Graphite"]
+ },
+ "Metrics": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "MultiTextBox"
+ },
+ "Prefix": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "File": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Host": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Port": {
+ "Required": false,
+ "ValueType": "pint32",
+ "DefaultValue": 0,
+ "FieldType": "Integer"
+ },
+ "MangleMetric": {
+ "Required": false,
+ "ValueType": "bool",
+ "DefaultValue": 0,
+ "FieldType": "CheckBox"
+ }
}
},
"sd": {
"DefaultValue": 0,
"FieldType": "TextBox"
}
+ },
+ "Statistics": {
+ "Name": {
+ "Required": true,
+ "ValueType": "name",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Description": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Interval": {
+ "Required": false,
+ "ValueType": "time",
+ "DefaultValue": 300,
+ "FieldType": "TimePeriod"
+ },
+ "Type": {
+ "Required": true,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "ComboBox",
+ "Data": ["CSV", "Graphite"]
+ },
+ "Metrics": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "MultiTextBox"
+ },
+ "Prefix": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "File": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Host": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Port": {
+ "Required": false,
+ "ValueType": "pint32",
+ "DefaultValue": 0,
+ "FieldType": "Integer"
+ },
+ "MangleMetric": {
+ "Required": false,
+ "ValueType": "bool",
+ "DefaultValue": 0,
+ "FieldType": "CheckBox"
+ }
}
},
"fd": {
"DefaultValue": 0,
"FieldType": "TextBox"
}
+ },
+ "Statistics": {
+ "Name": {
+ "Required": true,
+ "ValueType": "name",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Description": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Interval": {
+ "Required": false,
+ "ValueType": "time",
+ "DefaultValue": 300,
+ "FieldType": "TimePeriod"
+ },
+ "Type": {
+ "Required": true,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "ComboBox",
+ "Data": ["CSV", "Graphite"]
+ },
+ "Metrics": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "MultiTextBox"
+ },
+ "Prefix": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "File": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Host": {
+ "Required": false,
+ "ValueType": "str",
+ "DefaultValue": 0,
+ "FieldType": "TextBox"
+ },
+ "Port": {
+ "Required": false,
+ "ValueType": "pint32",
+ "DefaultValue": 0,
+ "FieldType": "Integer"
+ },
+ "MangleMetric": {
+ "Required": false,
+ "ValueType": "bool",
+ "DefaultValue": 0,
+ "FieldType": "CheckBox"
+ }
}
},
"bcons": {
msgid "Binary Bytes (1 mebi = 2<sup>20</sup>)"
msgstr "Binary Bytes (1 mebi = 2<sup>20</sup>)"
+
+msgid "Statistics list"
+msgstr "Statistics list"
+
+msgid "Add director statistics"
+msgstr "Add director statistics"
+
+msgid "Add storage statistics"
+msgstr "Add storage statistics"
+
+msgid "Add file daemon statistics"
+msgstr "Add file daemon statistics"
+
+msgid "Component type"
+msgstr "Component type"
+
+msgid "Component name"
+msgstr "Component name"
+
+msgid "Statistics details"
+msgstr "Statistics details"
+
+msgid "Statistics:"
+msgstr "Statistics:"
+
+msgid "Statistics"
+msgstr "Statistics"
msgid "Binary Bytes (1 mebi = 2<sup>20</sup>)"
msgstr "Binary Bytes (1 mebi = 2<sup>20</sup>)"
+
+msgid "Statistics list"
+msgstr "Statistics list"
+
+msgid "Add director statistics"
+msgstr "Add director statistics"
+
+msgid "Add storage statistics"
+msgstr "Add storage statistics"
+
+msgid "Add file daemon statistics"
+msgstr "Add file daemon statistics"
+
+msgid "Component type"
+msgstr "Component type"
+
+msgid "Component name"
+msgstr "Component name"
+
+msgid "Statistics details"
+msgstr "Statistics details"
+
+msgid "Statistics:"
+msgstr "Statistics:"
+
+msgid "Statistics"
+msgstr "Statistics"
msgid "Binary Bytes (1 mebi = 2<sup>20</sup>)"
msgstr "Binarne Bajty (1 mebi = 2<sup>20</sup>)"
+
+msgid "Statistics list"
+msgstr "Lista statystyk"
+
+msgid "Add director statistics"
+msgstr "Dodaj statystyki zarządcy"
+
+msgid "Add storage statistics"
+msgstr "Dodaj statystyki magazynu danych"
+
+msgid "Add file daemon statistics"
+msgstr "Dodaj statystyki klienta"
+
+msgid "Component type"
+msgstr "Typ komponentu"
+
+msgid "Component name"
+msgstr "Nazwa komponentu"
+
+msgid "Statistics details"
+msgstr "Szczegóły statystyk"
+
+msgid "Statistics:"
+msgstr "Statystyki:"
+
+msgid "Statistics"
+msgstr "Statystyki"
msgid "Binary Bytes (1 mebi = 2<sup>20</sup>)"
msgstr "Binary Bytes (1 mebi = 2<sup>20</sup>)"
+
+msgid "Statistics list"
+msgstr "Statistics list"
+
+msgid "Add director statistics"
+msgstr "Add director statistics"
+
+msgid "Add storage statistics"
+msgstr "Add storage statistics"
+
+msgid "Add file daemon statistics"
+msgstr "Add file daemon statistics"
+
+msgid "Component type"
+msgstr "Component type"
+
+msgid "Component name"
+msgstr "Component name"
+
+msgid "Statistics details"
+msgstr "Statistics details"
+
+msgid "Statistics:"
+msgstr "Statistics:"
+
+msgid "Statistics"
+msgstr "Statistics"
--- /dev/null
+<%@ MasterClass="Application.Web.Layouts.Main" Theme="Baculum-v2"%>
+<com:TContent ID="Main">
+ <!-- Header -->
+ <header class="w3-container">
+ <h5>
+ <strong><i class="fa fa-file-medical-alt"></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 ]
+ }],
+ order: [2, 'asc']
+ });
+ }
+};
+oStatisticsList.init();
+</script>
+</com:TContent>
--- /dev/null
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum - Bacula web interface
+ *
+ * Copyright (C) 2013-2019 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');
+
+class StatisticsList extends BaculumWebPage {
+
+ const USE_CACHE = true;
+
+ protected $admin = 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="fa fa-file-medical-alt"></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-2019 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');
+
+class StatisticsView extends BaculumWebPage {
+
+ const COMPONENT_TYPE = 'ComponentType';
+ const STATISTICS_NAME = 'StatisticsName';
+
+ protected $admin = true;
+
+ 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 onLoad($param) {
+ parent::onLoad($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('ConfigureHosts')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'ConfigureHosts' ? ' w3-blue': ''%><%=!$_SESSION['admin'] ? ' hide' : ''%>"><i class="fa fa-cog fa-fw"></i> <%[ Configure ]%></a>
<a href="<%=$this->Service->constructUrl('RestoreWizard')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'RestoreWizard' ? ' w3-blue': ''%>"><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': ''%>"><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': ''%><%=!$_SESSION['admin'] ? ' hide' : ''%>"><i class="fa fa-file-medical-alt 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': ''%><%=!$_SESSION['admin'] ? ' hide' : ''%>"><i class="fa fa-wrench fa-fw"></i> <%[ Settings ]%></a>
<a href="<%=$this->Service->constructUrl('Users')%>" class="w3-bar-item w3-button w3-padding<%=$this->Service->getRequestedPagePath() == 'Users' ? ' w3-blue': ''%><%=!$_SESSION['admin'] ? ' hide' : ''%>"><i class="fa fa-users fa-fw"></i> <%[ Users ]%></a>
</div>
Attributes.onclick="$(this).closest('div.config_new_resource').hide();$('div.config_directives').slideUp();"
/>
</li>
+ <li><com:TActiveLinkButton
+ OnCommand="Parent.SourceTemplateControl.newResource"
+ CommandParameter="Statistics|<%=$this->getHost()%>|<%=$this->getComponentType()%>|<%=$this->getComponentName()%>"
+ Text="Statistics"
+ ClientSide.OnComplete="BaculaConfig.show_new_config('<%=$this->getHost()%>new_resource', '<%=$this->getComponentType()%>', '<%=$this->getComponentName()%>', 'Statistics');"
+ Attributes.onclick="$(this).closest('div.config_new_resource').hide();$('div.config_directives').slideUp();"
+ />
+ </li>
</ul>
<ul style="display: <%=$this->getComponentType() === 'sd' ? 'block': 'none'%>; margin-top: 0;">
<li><com:TActiveLinkButton
Attributes.onclick="$(this).closest('div.config_new_resource').hide();$('div.config_directives').slideUp();"
/>
</li>
+ <li><com:TActiveLinkButton
+ OnCommand="Parent.SourceTemplateControl.newResource"
+ CommandParameter="Statistics|<%=$this->getHost()%>|<%=$this->getComponentType()%>|<%=$this->getComponentName()%>"
+ Text="Statistics"
+ ClientSide.OnComplete="BaculaConfig.show_new_config('<%=$this->getHost()%>new_resource', '<%=$this->getComponentType()%>', '<%=$this->getComponentName()%>', 'Statistics');"
+ Attributes.onclick="$(this).closest('div.config_new_resource').hide();$('div.config_directives').slideUp();"
+ />
+ </li>
</ul>
<ul style="display: <%=$this->getComponentType() === 'fd' ? 'block': 'none'%>; margin-top: 0;">
<li><com:TActiveLinkButton
Attributes.onclick="$(this).closest('div.config_new_resource').hide();$('div.config_directives').slideUp();"
/>
</li>
+ <li><com:TActiveLinkButton
+ OnCommand="Parent.SourceTemplateControl.newResource"
+ CommandParameter="Statistics|<%=$this->getHost()%>|<%=$this->getComponentType()%>|<%=$this->getComponentName()%>"
+ Text="Statistics"
+ ClientSide.OnComplete="BaculaConfig.show_new_config('<%=$this->getHost()%>new_resource', '<%=$this->getComponentType()%>', '<%=$this->getComponentName()%>', 'Statistics');"
+ Attributes.onclick="$(this).closest('div.config_new_resource').hide();$('div.config_directives').slideUp();"
+ />
+ </li>
</ul>
<ul style="display: <%=$this->getComponentType() === 'bcons' ? 'block': 'none'%>; margin-top: 0;">
<li><com:TActiveLinkButton
<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:.\-_ ]+" />