Skip to content

Commit 680948e

Browse files
committed
attempt to fix merge
1 parent e7e1c83 commit 680948e

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

LibreNMS/Services/LegacyService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function buildCommand(\App\Models\Service $service): array
5858
return parent::buildCommand($service);
5959
}
6060

61-
public function dataSets(string $rrd_filename = '', ?string $ds = null): array
61+
public function dataSets(string $rrd_filename = '', array $ds = []): array
6262
{
6363
$vars = $this->loadScript(['rrd_filename' => $rrd_filename]);
6464

LibreNMS/Services/Service.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,12 @@ public function parameters(): array
8282
}
8383

8484
/**
85+
* @param $ds string[]
8586
* @return array<ServiceDataSet>
8687
*/
87-
public function dataSets(string $rrd_filename = '', ?string $ds = null): array
88+
public function dataSets(string $rrd_filename = '', array $ds = []): array
8889
{
89-
if (empty($ds)) {
90-
return [];
91-
}
92-
93-
return [
94-
new ServiceDataSet($ds, '', $this->defaultGraphCommands($rrd_filename, $ds)),
95-
];
90+
return array_map(fn ($d) => new ServiceDataSet($d, '', $this->defaultGraphCommands($rrd_filename, $d)), $ds);
9691
}
9792

9893
protected function defaultGraphCommands(string $rrd_filename, string $ds): array

app/Models/Service.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Service extends DeviceRelatedModel
2727
'service_ignore' => 'bool',
2828
'service_disabled' => 'bool',
2929
'service_status' => 'int',
30+
'service_ds' => 'array',
3031
];
3132

3233
protected function serviceParam(): Attribute

includes/html/graphs/service/graph.inc.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
$rrd_options[] = 'COMMENT: Now Avg Max\\n';
3636

3737
$check = ServiceFactory::make($service->service_type);
38-
foreach ($check->dataSets($rrd_filename, $vars['ds'] ?? null) as $ds) {
38+
$dataSets = isset($vars['ds']) ? [$vars['ds']] : array_keys($service->service_ds);
39+
foreach ($check->dataSets($rrd_filename, $dataSets) as $ds) {
3940
$rrd_options = array_merge($rrd_options, $ds->graphCommands);
4041
}

0 commit comments

Comments
 (0)