Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #169

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions LibreNMS/Data/ChartData.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

class ChartData
{

protected function __construct(
protected string $format,
protected array $data,
protected array $map = [],
) {}
) {
}

public static function createFromRrd(array $legend, array $data): static
{
Expand All @@ -23,7 +23,7 @@ public static function createFromRrd(array $legend, array $data): static
}

/**
* @param ChartDataset[] $chartDatasets
* @param ChartDataset[] $chartDatasets
* @return array
*/
public function forChartJs(array $chartDatasets): array
Expand All @@ -34,15 +34,15 @@ public function forChartJs(array $chartDatasets): array
$timestamp_index = $this->map['_timestamp'];
$ds = array_diff_key($this->map, ['_timestamp' => null]);

foreach($this->data as $point) {
foreach($ds as $name => $index) {
foreach ($this->data as $point) {
foreach ($ds as $name => $index) {
$data[$name][] = ['x' => (int) $point[$timestamp_index], 'y' => $point[$index]];
}
}
}

$datasets = [];
foreach($chartDatasets as $ds) {
foreach ($chartDatasets as $ds) {
$datasets[] = [
'label' => $ds->label,
'data' => $data[$ds->name],
Expand Down
3 changes: 2 additions & 1 deletion LibreNMS/Data/ChartDataset.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ public function __construct(
public string $label,
public ?string $color = null,
public ?string $fill = null,
){}
) {
}
}
5 changes: 2 additions & 3 deletions LibreNMS/Data/Source/Rrd.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public static function make(int $start, ?int $end = null): static

public function get(): array
{

}

public function def(string $label, string $dataset, string $rrd = null, RrdCF $consolidationFunction = RrdCF::AVERAGE): static
Expand Down Expand Up @@ -55,7 +54,7 @@ public function graph(): string
public function xport(array $defs): ChartData
{
// set up XPORT options either ds only or ds => label
foreach($defs as $def) {
foreach ($defs as $def) {
$this->options[] = "XPORT:$def:$def";
}

Expand Down Expand Up @@ -86,7 +85,7 @@ private function run(string $command): string
$proc->run();

$error = $proc->getErrorOutput();
if($error) {
if ($error) {
throw new \Exception($error);
}

Expand Down
1 change: 0 additions & 1 deletion app/Filament/Pages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

class Dashboard extends \Filament\Pages\Dashboard
{

}
2 changes: 1 addition & 1 deletion app/Filament/Widgets/DeviceTypeCounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected function getStats(): array
->select('type', DB::raw('count(*) total'))
->groupBy('type')
->get()
->map(fn($t) => Stat::make(Str::title($t->type ?: 'None'), $t->total))
->map(fn ($t) => Stat::make(Str::title($t->type ?: 'None'), $t->total))
->all();
}
}
3 changes: 1 addition & 2 deletions app/Filament/Widgets/Graph.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Models\Device;
use Filament\Widgets\ChartWidget;
use LibreNMS\Data\ChartDataset;
use LibreNMS\Data\ChartDatasets;
use LibreNMS\Data\Source\Rrd;

class Graph extends ChartWidget
Expand Down Expand Up @@ -44,7 +43,7 @@ protected function getType(): string
return 'line';
}

protected int | string | array $columnSpan = [
protected int|string|array $columnSpan = [
'md' => 2,
'xl' => 3,
];
Expand Down
2 changes: 0 additions & 2 deletions app/Filament/Widgets/NetworkChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class NetworkChart extends ApexChartWidget
*/
protected static ?string $heading = 'NetworkChart';



/**
* Chart options (series, labels, types, size, animations...)
* https://apexcharts.com/docs/options
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/Filament/LibrenmsPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function panel(Panel $panel): Panel
'primary' => Color::Amber,
])
->plugins([
FilamentApexChartsPlugin::make()
FilamentApexChartsPlugin::make(),
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
Expand Down
Loading