Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
Merged
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
10 changes: 8 additions & 2 deletions app/Models/Projects/Projects/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ public function getClusterStatisticsAttribute(): array
{
$clusterMetrics = $this->clusters->map(function (Cluster $cluster) {
return $cluster->statistics;
});
})->filter();

return [
'unknown' => $clusterMetrics->isEmpty(),
'metrics' => [
'capacity' => [
'cpu' => (clone $clusterMetrics)->sum('metrics.capacity.cpu'),
Expand Down Expand Up @@ -155,9 +156,14 @@ public static function allStatistics(): array

$clusterStatistics = $projects->map(function (Project $project) {
return $project->clusterStatistics;
});
})->filter();

$hasStatistics = (clone $clusterStatistics)->map(function ($clusterStatistics) {
return $clusterStatistics['unknown'];
})->contains(false);

return [
'unknown' => !$hasStatistics,
'metrics' => [
'capacity' => [
'cpu' => (clone $clusterStatistics)->sum('metrics.capacity.cpu'),
Expand Down
8 changes: 4 additions & 4 deletions resources/views/cluster/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<div class="d-flex flex-column gap-1 flex-grow-1">
<span class="small fw-bold">{{ __('CPU') }}</span>
<div class="border rounded d-flex gap-3 align-items-center">
<i class="bi bi-exclamation-circle text-danger fs-4 bg-light p-3 lh-1 rounded"></i>
<i class="bi bi-question-circle fs-4 bg-light p-3 lh-1 rounded"></i>
<span class="me-3">
<span class="lh-1">{{ __('N/A') }}</span>
</span>
Expand All @@ -123,7 +123,7 @@
<div class="d-flex flex-column gap-1 flex-grow-1">
<span class="small fw-bold">{{ __('Memory') }}</span>
<div class="border rounded d-flex gap-3 align-items-center">
<i class="bi bi-exclamation-circle text-danger fs-4 bg-light p-3 lh-1 rounded"></i>
<i class="bi bi-question-circle fs-4 bg-light p-3 lh-1 rounded"></i>
<span class="me-3">
<span class="lh-1">{{ __('N/A') }}</span>
</span>
Expand All @@ -132,7 +132,7 @@
<div class="d-flex flex-column gap-1 flex-grow-1">
<span class="small fw-bold">{{ __('Storage') }}</span>
<div class="border rounded d-flex gap-3 align-items-center">
<i class="bi bi-exclamation-circle text-danger fs-4 bg-light p-3 lh-1 rounded"></i>
<i class="bi bi-question-circle fs-4 bg-light p-3 lh-1 rounded"></i>
<span class="me-3">
<span class="lh-1">{{ __('N/A') }}</span>
</span>
Expand All @@ -141,7 +141,7 @@
<div class="d-flex flex-column gap-1 flex-grow-1">
<span class="small fw-bold">{{ __('Pods') }}</span>
<div class="border rounded d-flex gap-3 align-items-center">
<i class="bi bi-exclamation-circle text-danger fs-4 bg-light p-3 lh-1 rounded"></i>
<i class="bi bi-question-circle fs-4 bg-light p-3 lh-1 rounded"></i>
<span class="me-3">
<span class="lh-1">{{ __('N/A') }}</span>
</span>
Expand Down
Loading