clients_occupancy: {},
pools_occupancy: {},
jobs_summary: [],
- grab_statistics: function(data, jobstates) {
+ grab_statistics: function(data, opts) {
this.jobs = data.jobs;
this.clients = data.clients;
this.pools = data.pools;
running: []
};
var status_type;
+ const start_time = new Date(Date.now() - (opts.job_age * 1000));
+ const start_time_ts = start_time.getTime();
+ let job_time_ts;
for (var i = 0; i < jobs_count; i++) {
+ job_time_ts = iso_date_to_timestamp(this.jobs[i].starttime);
+ if (opts.job_age > 0 && job_time_ts < start_time_ts) {
+ continue;
+ }
if (typeof(clients_occupancy[this.jobs[i].clientid]) === 'undefined') {
clients_occupancy[this.jobs[i].clientid] = 1;
} else {
} else {
jobs_occupancy[this.jobs[i].name] += 1;
}
- if (jobstates.hasOwnProperty(this.jobs[i].jobstatus)) {
- status_type = jobstates[this.jobs[i].jobstatus].type;
+ if (opts.job_states.hasOwnProperty(this.jobs[i].jobstatus)) {
+ status_type = opts.job_states[this.jobs[i].jobstatus].type;
if (status_type == 'ok' && this.jobs[i].joberrors > 0) {
status_type = 'warning';
}
msgid "To"
msgstr "To"
+
+msgid "Job age on the job status graph"
+msgstr "Job age on the job status graph"
+
+msgid "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+msgstr "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+
+msgid "last %time %unit"
+msgstr "last %time %unit"
msgid "To"
msgstr "To"
+
+msgid "Job age on the job status graph"
+msgstr "Job age on the job status graph"
+
+msgid "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+msgstr "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+
+msgid "last %time %unit"
+msgstr "last %time %unit"
msgid "To"
msgstr "To"
+
+msgid "Job age on the job status graph"
+msgstr "Job age on the job status graph"
+
+msgid "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+msgstr "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+
+msgid "last %time %unit"
+msgstr "last %time %unit"
msgid "To"
msgstr "Para"
+
+msgid "Job age on the job status graph"
+msgstr "Job age on the job status graph"
+
+msgid "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+msgstr "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+
+msgid "last %time %unit"
+msgstr "last %time %unit"
msgid "To"
msgstr "Кому"
+
+msgid "Job age on the job status graph"
+msgstr "Job age on the job status graph"
+
+msgid "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+msgstr "Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation."
+
+msgid "last %time %unit"
+msgstr "last %time %unit"
</h5>
</header>
<div class="w3-container w3-row w3-padding">
- <div class="w3-third w3-col"><%[ Enable debug ]%></div>
- <div class="w3-third w3-col">
+ <div class="w3-quarter w3-col"><%[ Enable debug ]%></div>
+ <div class="w3-quarter w3-col">
<com:TCheckBox
ID="Debug"
CssClass="w3-check"
</div>
</div>
<div class="w3-container w3-row w3-padding">
- <div class="w3-third w3-col"><%[ Max. number of jobs visible in tables ]%></div>
- <div class="w3-third w3-col">
+ <div class="w3-quarter w3-col"><%[ Max. number of jobs visible in tables ]%></div>
+ <div class="w3-quarter w3-col">
<com:TTextBox
ID="MaxJobs"
CssClass="w3-input w3-border w3-show-inline-block"
</div>
</div>
<div class="w3-container w3-row w3-padding">
- <div class="w3-third w3-col"><%[ Show size values as: ]%></div>
- <div class="w3-third w3-col">
+ <div class="w3-quarter w3-col"><%[ Show size values as: ]%></div>
+ <div class="w3-quarter w3-col">
<p><com:TRadioButton
ID="DecimalBytes"
CssClass="w3-radio"
</div>
</div>
<div class="w3-container w3-row w3-padding">
- <div class="w3-third w3-col"><%[ Show time in job log: ]%></div>
- <div class="w3-third w3-col">
+ <div class="w3-quarter w3-col"><%[ Show time in job log: ]%></div>
+ <div class="w3-quarter w3-col">
<com:TCheckBox
ID="TimeInJobLog"
CssClass="w3-check"
</div>
</div>
<div class="w3-container w3-row w3-padding">
- <div class="w3-third w3-col"><%[ Date and time format: ]%></div>
- <div class="w3-third w3-col">
+ <div class="w3-quarter w3-col"><%[ Date and time format: ]%></div>
+ <div class="w3-quarter w3-col">
<com:TTextBox
ID="DateTimeFormat"
CssClass="w3-input w3-border w3-show-inline-block"
</script>
</div>
<div class="w3-container w3-row w3-padding">
- <div class="w3-third w3-col"><%[ Enable Bacula messages log window: ]%></div>
- <div class="w3-third w3-col">
+ <div class="w3-quarter w3-col"><%[ Enable Bacula messages log window: ]%></div>
+ <div class="w3-quarter w3-col">
<com:TCheckBox
ID="EnableMessagesLog"
CssClass="w3-check"
</div>
</div>
</div>
+ <div class="w3-container w3-row w3-padding">
+ <com:Application.Web.Portlets.DirectiveTimePeriod
+ ID="JobAgeOnJobStatusGraph"
+ DirectiveName="Age"
+ Label="<%[ Job age on the job status graph ]%>"
+ Show="true"
+ Required="false"
+ ShowResetButton="false"
+ ShowRemoveButton="false"
+ TimeFormat="hour"
+ Doc="<%[ Set age for jobs to display the job summary pie graph on the dashboard page. Setting zero means displaying the graph for all jobs without limitation. ]%>"
+ />
+ </div>
<div class="w3-center">
<com:TActiveLinkButton
CssClass="w3-button w3-green"
$this->DateTimeFormat->Text = WebConfig::DEF_DATE_TIME_FORMAT;
}
$this->EnableMessagesLog->Checked = $this->getModule('web_config')->isMessagesLogEnabled();
+ if (key_exists('job_age_on_job_status_graph', $this->web_config['baculum'])) {
+ $this->JobAgeOnJobStatusGraph->setDirectiveValue($this->web_config['baculum']['job_age_on_job_status_graph']);
+ } else {
+ $this->JobAgeOnJobStatusGraph->setDirectiveValue(0);
+ }
+ $this->JobAgeOnJobStatusGraph->createDirective();
}
}
$this->web_config['baculum']['time_in_job_log'] = ($this->TimeInJobLog->Checked === true) ? 1 : 0;
$this->web_config['baculum']['date_time_format'] = $this->DateTimeFormat->Text;
$this->web_config['baculum']['enable_messages_log'] = ($this->EnableMessagesLog->Checked === true) ? 1 : 0;
+ $this->web_config['baculum']['job_age_on_job_status_graph'] = $this->JobAgeOnJobStatusGraph->getValue();
$this->getModule('web_config')->setConfig($this->web_config);
}
}
prepare_job_summary: function() {
this.destroy_job_summary();
- Statistics.grab_statistics(oData, JobStatus.get_states());
+ Statistics.grab_statistics(oData, {
+ job_states: JobStatus.get_states(),
+ job_age: 0
+ });
this.graphs.job_summary = new GraphPieClass({
jobs: Statistics.jobs_summary,
container_id: this.ids.jobs_summary_graph,
const GROUP_NAME = 'GroupName';
const IS_DIRECTIVE_CREATED = 'IsDirectiveCreated';
const COPY_MODE = 'CopyMode';
+ const DOC = 'Doc';
public $doc;
if (!$this->getPage()->IsCallBack && !$this->getPage()->IsPostBack) {
$this->display_directive = $this->getShow();
}
- $this->setDoc();
+ $this->createDoc();
}
public function onLoad($param) {
$this->setViewState(self::COPY_MODE, $copy_mode, false);
}
- public function setDoc() {
- $component_type = $this->getComponentType();
- $resource_type = $this->getResourceType();
- $directive_name = $this->getDirectiveName();
- $this->doc = $this->Application->getModule('doc_dir')->getDoc(
- $component_type,
- $resource_type,
- $directive_name
- );
+ public function createDoc() {
+ $doc = $this->getDoc();
+ if (!empty($doc)) {
+ $this->doc = $doc;
+ } else {
+ $component_type = $this->getComponentType();
+ $resource_type = $this->getResourceType();
+ $directive_name = $this->getDirectiveName();
+ $this->doc = $this->Application->getModule('doc_dir')->getDoc(
+ $component_type,
+ $resource_type,
+ $directive_name
+ );
+ }
+ }
+
+ public function setDoc($doc) {
+ $this->setViewState(self::DOC, $doc);
+ }
+
+ public function getDoc() {
+ return $this->getViewState(self::DOC, '');
}
}
?>
const DISABLED = 'Disabled';
const SHOW_RESET_BUTTON = 'ShowResetButton';
const SHOW_REMOVE_BUTTON = 'ShowRemoveButton';
+ const DOC = 'Doc';
public $doc;
$this->createDirective();
$this->setIsDirectiveCreated(true);
$this->copyAttributes();
- $this->setDoc();
+ $this->createDoc();
}
// show directives existing in config or all
$this->setViewState(self::SHOW_REMOVE_BUTTON, $show);
}
- public function setDoc() {
- $component_type = $this->getComponentType();
- $resource_type = $this->getResourceType();
- $directive_name = $this->getDirectiveName();
- $this->doc = $this->Application->getModule('doc_dir')->getDoc(
- $component_type,
- $resource_type,
- $directive_name
- );
+ public function createDoc() {
+ $doc = $this->getDoc();
+ if (!empty($doc)) {
+ $this->doc = $doc;
+ } else {
+ $component_type = $this->getComponentType();
+ $resource_type = $this->getResourceType();
+ $directive_name = $this->getDirectiveName();
+ $this->doc = $this->Application->getModule('doc_dir')->getDoc(
+ $component_type,
+ $resource_type,
+ $directive_name
+ );
+ }
+ }
+
+ public function setDoc($doc) {
+ $this->setViewState(self::DOC, $doc);
+ }
+
+ public function getDoc() {
+ return $this->getViewState(self::DOC, '');
}
}
?>
* @package Baculum Web
*/
class ResourceMonitor extends Portlets {
+
+ public $job_age_on_job_status_graph = 0;
+
+ public function onInit($param) {
+ if (get_class($this->Service->getRequestedPage()) == 'Dashboard') {
+ $web_config = $this->getModule('web_config')->getConfig();
+
+ // set job age for job status summary graph
+ if (isset($web_config['baculum']['job_age_on_job_status_graph'])) {
+ $this->job_age_on_job_status_graph = $web_config['baculum']['job_age_on_job_status_graph'];
+ }
+ }
+ }
}
oData = response;
if ('<%=get_class($this->Service->getRequestedPage())%>' == 'Dashboard') {
- Statistics.grab_statistics(oData, JobStatus.get_states());
+ const job_age_on_job_status_graph = <%=$this->job_age_on_job_status_graph%>;
+ Statistics.grab_statistics(oData, {
+ job_states: JobStatus.get_states(),
+ job_age: job_age_on_job_status_graph
+ });
+ let age_label = '';
+ if (job_age_on_job_status_graph > 0) {
+ const job_age = Units.format_time_period(job_age_on_job_status_graph);
+ const job_age_unit = job_age.format + (job_age.value > 1 ? 's' : '');
+ const label_format = ' - <%[ last %time %unit ]%>';
+ age_label = label_format.replace('%time', job_age.value);
+ age_label = age_label.replace('%unit', job_age_unit);
+ }
Dashboard.set_text({
- js_sum_title: '<%[ Job status summary ]%>'
+ js_sum_title: '<%[ Job status summary ]%>' + age_label
});
Dashboard.update_all(Statistics);
}