Skip to content

Commit f3f94b0

Browse files
Make the UUID visible for incidents (#89)
Co-authored-by: James Brooks <[email protected]>
1 parent b8646cf commit f3f94b0

File tree

5 files changed

+34
-3
lines changed

5 files changed

+34
-3
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 Footer HTML": "Custom Footer HTML",
1515
"Custom Header HTML": "Custom Header HTML",
1616
"Dashboard": "Dashboard",
17+
"Edit Incident": "Edit Incident",
1718
"Fixed": "Fixed",
1819
"Guests": "Guests",
1920
"Identified": "Identified",

resources/views/components/incident.blade.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@
1515
<div class="text-xs font-medium">{{ $incident->components->pluck('name')->join(', ') }}</div>
1616
<div class="flex flex-col sm:flex-row justify-between gap-2 flex-col-reverse items-center">
1717
<div class="flex flex-col flex-1">
18-
<h3 class="max-w-full text-base font-semibold break-words sm:text-xl">
19-
<a href="{{ route('cachet.status-page.incident', $incident) }}">{{ $incident->name}}</a>
20-
</h3>
18+
<div class="flex gap-2 items-center">
19+
<h3 class="max-w-full text-base font-semibold break-words sm:text-xl">
20+
<a href="{{ route('cachet.status-page.incident', $incident) }}">{{ $incident->name}}</a>
21+
</h3>
22+
@auth
23+
<a href="{{ $incident->filamentDashboardEditUrl() }}" class="underline text-right text-sm text-zinc-500 hover:text-zinc-400 dark:text-zinc-400 dark:hover:text-zinc-300" title="{{ __('Edit Incident') }}">
24+
<x-heroicon-m-pencil-square class="size-4" />
25+
</a>
26+
@endauth
27+
</div>
2128
<span class="text-xs text-zinc-500 dark:text-zinc-400">
2229
{{ $incident->timestamp->diffForHumans() }} — <time datetime="{{ $incident->timestamp->toW3cString() }}" x-text="timestamp.toLocaleString()"></time>
2330
</span>

resources/views/status-page/incident.blade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
<x-cachet::incident :date="$incident->timestamp" :incidents="[$incident]" />
1010
</div>
1111
</div>
12+
13+
<p class="text-xs text-right">
14+
Incident UUID: {{ $incident->guid }}
15+
</p>
1216
</div>
1317

1418
<x-cachet::footer />

src/Filament/Resources/IncidentResource.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ public static function form(Form $form): Form
6868
Forms\Components\Toggle::make('stickied')
6969
->label(__('Sticky Incident?'))
7070
->required(),
71+
Forms\Components\TextInput::make('guid')
72+
->label('Incident UUID')
73+
->visibleOn(['edit'])
74+
->disabled()
75+
->readonly()
76+
->columnSpanFull(),
7177
])
7278
->columnSpan(1),
7379
])
@@ -135,6 +141,10 @@ public static function table(Table $table): Table
135141
->inline()
136142
->required(),
137143
]),
144+
Action::make('view-incident')
145+
->icon('heroicon-o-eye')
146+
->url(fn (Incident $record): string => route('cachet.status-page.incident', $record))
147+
->label(__('View Incident')),
138148
Tables\Actions\EditAction::make(),
139149
Tables\Actions\DeleteAction::make(),
140150
])

src/Models/Incident.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Cachet\Events\Incidents\IncidentCreated;
99
use Cachet\Events\Incidents\IncidentDeleted;
1010
use Cachet\Events\Incidents\IncidentUpdated;
11+
use Cachet\Filament\Resources\IncidentResource;
1112
use Illuminate\Database\Eloquent\Builder;
1213
use Illuminate\Database\Eloquent\Casts\Attribute;
1314
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -119,4 +120,12 @@ public function formattedMessage(): string
119120
{
120121
return Str::of($this->message)->markdown();
121122
}
123+
124+
/**
125+
* Get the URL to the incident page within the dashboard.
126+
*/
127+
public function filamentDashboardEditUrl(): string
128+
{
129+
return IncidentResource::getUrl(name: 'edit', parameters: ['record' => $this->id]);
130+
}
122131
}

0 commit comments

Comments
 (0)