:100644 100644 e4a9fe9f2 000000000 M LibreNMS/Data/Graphing/AbstractGraph.php :100644 100644 a66f38799 000000000 M LibreNMS/Data/Graphing/Builders/MultiLineGraphBuilder.php :100644 100644 fa088eac2 000000000 M LibreNMS/Data/Graphing/Builders/MultiSimplexSeparatedGraphBuilder.php :100644 100644 dc3754d18 000000000 M LibreNMS/Data/Graphing/Device/ProcessorGraph.php :100644 100644 bab8ad240 000000000 M LibreNMS/Data/Graphing/GraphFactory.php :100644 100644 cee665eaa 000000000 M LibreNMS/Data/Graphing/LegacyGraph.php :100644 100644 6bb3ff163 000000000 M LibreNMS/Exceptions/InvalidGraph.php :100644 100644 eb73dec08 000000000 M LibreNMS/Interfaces/Data/Graphing/GraphInterface.php :100644 100644 7f6c1ec55 000000000 M app/Console/Commands/GraphDetail.php diff --git a/LibreNMS/Data/Graphing/AbstractGraph.php b/LibreNMS/Data/Graphing/AbstractGraph.php index e4a9fe9f2464e0f85434d1863c35649fdf0869c2..1b0392d9e4676e67e3eb03d6c451bee98ae78512 100644 --- a/LibreNMS/Data/Graphing/AbstractGraph.php +++ b/LibreNMS/Data/Graphing/AbstractGraph.php @@ -1,4 +1,5 @@ unitText = $unitText; + return $this; } public function units(string $units): self { $this->units = $units; + return $this; } public function totalUnits(string $totalUnits): self { $this->totalUnits = $totalUnits; + return $this; } public function colours(string $colours): self { $this->colours = $colours; + return $this; } public function scaleMin(float $scaleMin): self { $this->scaleMin = $scaleMin; + return $this; } public function scaleMax(float $scaleMax): self { $this->scaleMax = $scaleMax; + return $this; } public function noTotal(bool $noTotal = true): self { $this->nototal = $noTotal; + return $this; } public function descrLen(int $descrLen): self { $this->descrLen = $descrLen; + return $this; } @@ -108,6 +117,7 @@ class MultiLineGraphBuilder 'areacolour' => $areaColour, 'invert' => $invert, ]; + return $this; } diff --git a/LibreNMS/Data/Graphing/Builders/MultiSimplexSeparatedGraphBuilder.php b/LibreNMS/Data/Graphing/Builders/MultiSimplexSeparatedGraphBuilder.php index fa088eac262ee569a76c7092bca5fb8be71304f9..f7edb4b9d5dc241bcf9afa14b23f6cddc1c5712b 100644 --- a/LibreNMS/Data/Graphing/Builders/MultiSimplexSeparatedGraphBuilder.php +++ b/LibreNMS/Data/Graphing/Builders/MultiSimplexSeparatedGraphBuilder.php @@ -1,4 +1,5 @@ unitText = $unitText; + return $this; } public function units(string $units): self { $this->units = $units; + return $this; } public function totalUnits(string $totalUnits): self { $this->totalUnits = $totalUnits; + return $this; } public function colours(string $colours): self { $this->colours = $colours; + return $this; } public function scaleMin(float $scaleMin): self { $this->scaleMin = $scaleMin; + return $this; } public function scaleMax(float $scaleMax): self { $this->scaleMax = $scaleMax; + return $this; } public function divider(float $divider): self { $this->divider = $divider; + return $this; } public function multiplier(float $multiplier): self { $this->multiplier = $multiplier; + return $this; } public function textOrig(bool $textOrig = true): self { $this->textOrig = $textOrig; + return $this; } public function noTotal(bool $noTotal = true): self { $this->nototal = $noTotal; + return $this; } public function descrLen(int $descrLen): self { $this->descrLen = $descrLen; + return $this; } @@ -123,6 +135,7 @@ class MultiSimplexSeparatedGraphBuilder 'descr' => $description, 'colour' => $colour, ]; + return $this; } diff --git a/LibreNMS/Data/Graphing/Device/ProcessorGraph.php b/LibreNMS/Data/Graphing/Device/ProcessorGraph.php index dc3754d180583baba8a3cccec8d39089dad575bc..634a90a442ec87fe693abca018d9be522a5fb35b 100644 --- a/LibreNMS/Data/Graphing/Device/ProcessorGraph.php +++ b/LibreNMS/Data/Graphing/Device/ProcessorGraph.php @@ -1,4 +1,5 @@ processors as $proc) { $files[] = Rrd::name($this->device->hostname, ['processor', $proc->processor_type, $proc->processor_index]); } + return $files; } diff --git a/LibreNMS/Data/Graphing/GraphFactory.php b/LibreNMS/Data/Graphing/GraphFactory.php index bab8ad240b2f594dc961d811b0c894f313990b2d..0e9a7f99a29fe03e2088d5bbbce221c573e8a522 100644 --- a/LibreNMS/Data/Graphing/GraphFactory.php +++ b/LibreNMS/Data/Graphing/GraphFactory.php @@ -1,4 +1,5 @@ $vars]); } diff --git a/LibreNMS/Data/Graphing/LegacyGraph.php b/LibreNMS/Data/Graphing/LegacyGraph.php index cee665eaaefef2aa662ae956654a05bf22b0b38e..8487ee5e5a497bb059305096e5479d5d17978dde 100644 --- a/LibreNMS/Data/Graphing/LegacyGraph.php +++ b/LibreNMS/Data/Graphing/LegacyGraph.php @@ -1,4 +1,5 @@ loaded = true; + return; } @@ -145,19 +148,21 @@ class LegacyGraph extends AbstractGraph public function authorize(): bool { $this->load(); + return $this->authorized; } - public function definition(GraphParameters $graph_params): array { $this->load($graph_params->all()); + return $this->rrdOptions; } public function getPageTitle(): string { $this->load(); + return $this->pageTitle ?? $this->getGraphTitle(); } @@ -179,6 +184,7 @@ class LegacyGraph extends AbstractGraph public function getRrdFiles(): array { $this->load(); + return $this->rrdFiles; } } diff --git a/LibreNMS/Exceptions/InvalidGraph.php b/LibreNMS/Exceptions/InvalidGraph.php index 6bb3ff163fad70adae50cb2185c4c6bb907a4426..99bde5b5423c4aae2f11993a9ebcad565e1e259a 100644 --- a/LibreNMS/Exceptions/InvalidGraph.php +++ b/LibreNMS/Exceptions/InvalidGraph.php @@ -1,4 +1,5 @@ line("Type: $graph->type"); $this->line("Subtype: $graph->subtype"); $this->line('Authorized: ' . ($graph->authorize() ? 'true' : 'false')); - $this->line("Graph Title: " . $graph->getGraphTitle()); - $this->line("Page Title: " . substr($graph->getPageTitle(), 0, 80)); - $this->line("Rrd Files: " . implode(', ', array_map(fn($f) => basename($f), $graph->getRrdFiles()))); - $this->line("Definition: " . substr(implode(' ', $graph->definition()), 80)); - + $this->line('Graph Title: ' . $graph->getGraphTitle()); + $this->line('Page Title: ' . substr($graph->getPageTitle(), 0, 80)); + $this->line('Rrd Files: ' . implode(', ', array_map(fn ($f) => basename($f), $graph->getRrdFiles()))); + $this->line('Definition: ' . substr(implode(' ', $graph->definition()), 80)); return 0; }