Skip to content

Commit 76b3fe0

Browse files
committed
Incident counts
1 parent 50fc945 commit 76b3fe0

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

resources/lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"Custom Header HTML": "Custom Header HTML",
1515
"Fixed": "Fixed",
1616
"Guests": "Guests",
17+
":incidents Incidents": ":incidents Incidents",
1718
"Identified": "Identified",
1819
"In Progress": "In Progress",
1920
"Investigating": "Investigating",

resources/views/components/component-group.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
<x-heroicon-o-chevron-up ::class="!$disclosure.isOpen && 'rotate-180'" class="h-6 w-6 transition" />
1515
</button>
1616

17-
<a href="#" class="rounded border border-zinc-800 px-2 py-1 text-xs font-semibold text-zinc-800 dark:border-zinc-600 dark:text-zinc-400">4 incidents</a>
17+
<a href="#" class="rounded border border-zinc-800 px-2 py-1 text-xs font-semibold text-zinc-800 dark:border-zinc-600 dark:text-zinc-400">
18+
{{ __(':incidents Incidents', ['incidents' => $componentGroup->components->sum('incidents_count')]) }}
19+
</a>
1820
</div>
1921

2022
<div x-disclosure:panel x-collapse class="flex flex-col divide-y bg-white dark:bg-zinc-800">

src/Http/Controllers/StatusPage/StatusPageController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class StatusPageController
1515
public function index(): View
1616
{
1717
return view('cachet::status-page.index', [
18-
'componentGroups' => ComponentGroup::with(['components' => fn ($query) => $query->orderBy('order')])
18+
'componentGroups' => ComponentGroup::query()
19+
->with(['components' => fn ($query) => $query->orderBy('order')->withCount('incidents')])
1920
->when(auth()->check(), fn ($query) => $query->users(), fn ($query) => $query->guests())
2021
->whereHas('components')
2122
->get(),

0 commit comments

Comments
 (0)