Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/issue-78-and-68
Browse files Browse the repository at this point in the history
  • Loading branch information
steffjenl committed Oct 13, 2024
2 parents 474b926 + bd44346 commit 99b50dc
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 10 deletions.
8 changes: 6 additions & 2 deletions resources/views/components/incident.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@
</div>
</div>
@empty
<div class="mt-1 prose-sm md:prose prose-zinc dark:prose-invert prose-a:text-primary-500 prose-a:underline">
{{ __('No incidents reported.') }}
<div class="bg-white border divide-y rounded-lg ml-9 dark:divide-zinc-700 dark:border-zinc-700 dark:bg-zinc-800">
<div class="flex flex-col p-4 divide-y dark:divide-zinc-700">
<div class="prose-sm md:prose prose-zinc dark:prose-invert prose-a:text-primary-500 prose-a:underline prose-p:leading-normal">
{{ __('No incidents reported.') }}
</div>
</div>
</div>
@endforelse
</div>
13 changes: 13 additions & 0 deletions src/Filament/Resources/ComponentGroupResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@ public static function form(Form $form): Form
->schema([
Forms\Components\Section::make()->columns(2)->schema([
Forms\Components\TextInput::make('name')
->label(__('Name'))
->required()
->maxLength(255)
->columnSpanFull(),
Forms\Components\ToggleButtons::make('visible')
->label(__('Visible'))
->inline()
->options(ResourceVisibilityEnum::class)
->default(ResourceVisibilityEnum::guest)
->required()
->columnSpanFull(),
Forms\Components\ToggleButtons::make('collapsed')
->label(__('Collapsed'))
->required()
->inline()
->options(ComponentGroupVisibilityEnum::class)
Expand All @@ -49,17 +52,22 @@ public static function table(Table $table): Table
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label(__('Name'))
->searchable(),
Tables\Columns\TextColumn::make('visible')
->label(__('Visible'))
->badge()
->sortable(),
Tables\Columns\TextColumn::make('collapsed')
->label(__('Collapsed'))
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label(__('Created at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->label(__('Updated at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Expand Down Expand Up @@ -97,4 +105,9 @@ public static function getLabel(): ?string
{
return __('Component Group');
}

public static function getPluralLabel(): ?string
{
return __('Component Groups');
}
}
17 changes: 17 additions & 0 deletions src/Filament/Resources/ComponentResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ public static function form(Form $form): Form
->schema([
Forms\Components\Section::make()->columns(2)->schema([
Forms\Components\TextInput::make('name')
->label(__('Name'))
->required()
->maxLength(255),
Forms\Components\ToggleButtons::make('status')
->label(__('Status'))
->inline()
->columnSpanFull()
->options(ComponentStatusEnum::class)
->required(),
Forms\Components\MarkdownEditor::make('description')
->label(__('Description'))
->maxLength(255)
->columnSpanFull(),
Forms\Components\Select::make('component_group_id')
Expand All @@ -39,6 +42,7 @@ public static function form(Form $form): Form
->preload()
->label(__('Component Group')),
Forms\Components\TextInput::make('link')
->label(__('Link'))
->url()
->hint(__('An optional link to the component.')),
]),
Expand All @@ -57,28 +61,36 @@ public static function table(Table $table): Table
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label(__('Name'))
->searchable(),
Tables\Columns\TextColumn::make('status')
->label(__('Status'))
->badge()
->sortable(),
Tables\Columns\TextColumn::make('order')
->label(__('Order'))
->numeric()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('group.name')
->label(__('Group'))
->sortable(),
Tables\Columns\IconColumn::make('enabled')
->label(__('Enabled'))
->boolean()
->toggleable(isToggledHiddenByDefault: false),
Tables\Columns\TextColumn::make('created_at')
->label(__('Created at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->label(__('Updated at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->label(__('Deleted at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Expand Down Expand Up @@ -118,6 +130,11 @@ public static function getLabel(): ?string
return __('Component');
}

public static function getPluralLabel(): ?string
{
return __('Components');
}

public static function getNavigationBadge(): ?string
{
return static::getModel()::outage()->count();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,37 @@
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;

class ComponentsRelationManager extends RelationManager
{
protected static string $relationship = 'components';

public static function getTitle(Model $ownerRecord, string $pageClass): string
{
return __('Components');
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->label(__('Name'))
->required()
->maxLength(255),
Forms\Components\ToggleButtons::make('status')
->label(__('Status'))
->inline()
->columnSpanFull()
->options(ComponentStatusEnum::class)
->required(),
Forms\Components\MarkdownEditor::make('description')
->label(__('Description'))
->maxLength(255)
->columnSpanFull(),
Forms\Components\TextInput::make('link')
->label(__('Link'))
->url()
->hint(__('An optional link to the component.')),
]);
Expand All @@ -38,12 +48,17 @@ public function table(Table $table): Table
{
return $table
->recordTitleAttribute('name')
->modelLabel(__('Component'))
->pluralModelLabel(__('Components'))
->columns([
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('name')
->label(__('Name')),
Tables\Columns\TextColumn::make('status')
->label(__('Status'))
->badge()
->sortable(),
Tables\Columns\IconColumn::make('enabled')
->label(__('Enabled'))
->boolean()
->toggleable(isToggledHiddenByDefault: false),
])
Expand Down
24 changes: 23 additions & 1 deletion src/Filament/Resources/IncidentResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,24 @@ public static function form(Form $form): Form
->schema([
Section::make()->schema([
Forms\Components\TextInput::make('name')
->label(__('Name'))
->required()
->maxLength(255),
Forms\Components\ToggleButtons::make('status')
->label(__('Status'))
->inline()
->columnSpanFull()
->options(IncidentStatusEnum::class)
->required(),
Forms\Components\MarkdownEditor::make('message')
->label(__('Message'))
->required()
->columnSpanFull(),
Forms\Components\DateTimePicker::make('occurred_at')
->label(__('Occurred at'))
->helperText(__('The incident\'s created timestamp will be used if left empty.')),
Forms\Components\ToggleButtons::make('visible')
->label(__('Visible'))
->inline()
->options(ResourceVisibilityEnum::class)
->default(ResourceVisibilityEnum::guest)
Expand Down Expand Up @@ -85,39 +90,48 @@ public static function table(Table $table): Table
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label(__('Name'))
->searchable(),
Tables\Columns\TextColumn::make('status')
->label(__('Status'))
->sortable()
->badge(),
Tables\Columns\TextColumn::make('visible')
->label(__('Visible'))
->sortable()
->badge(),
Tables\Columns\IconColumn::make('stickied')
->label(__('Stickied'))
->toggleable(isToggledHiddenByDefault: true)
->boolean(),
Tables\Columns\TextColumn::make('occurred_at')
->label(__('Occurred at'))
->dateTime()
->sortable(),
Tables\Columns\IconColumn::make('notifications')
->label(__('Notified Subscribers'))
->boolean()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('created_at')
->label(__('Created at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: false),
Tables\Columns\TextColumn::make('updated_at')
->label(__('Updated at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->label(__('Deleted at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\TrashedFilter::make(),
Tables\Filters\SelectFilter::make('status')
->label(__('Status'))
->options(IncidentStatusEnum::class),
])
->actions([
Expand All @@ -135,8 +149,11 @@ public static function table(Table $table): Table
->send();
})
->form([
Forms\Components\MarkdownEditor::make('message')->required(),
Forms\Components\MarkdownEditor::make('message')
->label(__('Message'))
->required(),
Forms\Components\ToggleButtons::make('status')
->label(__('Status'))
->options(IncidentStatusEnum::class)
->inline()
->required(),
Expand Down Expand Up @@ -177,6 +194,11 @@ public static function getLabel(): ?string
return __('Incident');
}

public static function getPluralLabel(): ?string
{
return __('Incidents');
}

public static function getNavigationBadge(): ?string
{
return static::getModel()::unresolved()->count();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,26 @@
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;

class ComponentsRelationManager extends RelationManager
{
protected static string $relationship = 'components';

public static function getTitle(Model $ownerRecord, string $pageClass): string
{
return __('Components');
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->label(__('Name'))
->searchable(),
Forms\Components\ToggleButtons::make('status')
->label(__('Status'))
->inline()
->options(ComponentStatusEnum::class)
->required(),
Expand All @@ -31,9 +39,13 @@ public function table(Table $table): Table
{
return $table
->recordTitleAttribute('name')
->modelLabel(__('Component'))
->pluralModelLabel(__('Components'))
->columns([
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('name')
->label(__('Name')),
Tables\Columns\TextColumn::make('status')
->label(__('Status'))
->badge()
->sortable(),
])
Expand All @@ -45,6 +57,7 @@ public function table(Table $table): Table
->form(fn (Tables\Actions\AttachAction $action): array => [
$action->getRecordSelect(),
Forms\Components\ToggleButtons::make('status')
->label(__('Status'))
->inline()
->columnSpanFull()
->options(ComponentStatusEnum::class)
Expand Down
Loading

0 comments on commit 99b50dc

Please sign in to comment.