Skip to content
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
181 changes: 94 additions & 87 deletions app/Filament/Pages/Settings/NotificationPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,95 @@ public function form(Form $form): Form
'md' => 2,
]),

Section::make('Mail')
->schema([
Toggle::make('mail_enabled')
->label('Enable mail notifications')
->reactive()
->columnSpanFull(),
Grid::make([
'default' => 1,
])
->hidden(fn (Forms\Get $get) => $get('mail_enabled') !== true)
->schema([
Fieldset::make('Triggers')
->schema([
Toggle::make('mail_on_speedtest_run')
->label('Notify on every speedtest run')
->columnSpanFull(),
Toggle::make('mail_on_threshold_failure')
->label('Notify on threshold failures')
->columnSpanFull(),
]),
Repeater::make('mail_recipients')
->label('Recipients')
->schema([
Forms\Components\TextInput::make('email_address')
->placeholder('[email protected]')
->email()
->required(),
])
->columnSpanFull(),
Actions::make([
Action::make('test mail')
->label('Test mail channel')
->action(fn (Forms\Get $get) => SendMailTestNotification::run(recipients: $get('mail_recipients')))
->hidden(fn (Forms\Get $get) => ! count($get('mail_recipients'))),
]),
]),
])
->compact()
->columns([
'default' => 1,
'md' => 2,
]),

Section::make('Webhook')
->schema([
Toggle::make('webhook_enabled')
->label('Enable webhook notifications')
->reactive()
->columnSpanFull(),
Grid::make([
'default' => 1,
])
->hidden(fn (Forms\Get $get) => $get('webhook_enabled') !== true)
->schema([
Fieldset::make('Triggers')
->schema([
Toggle::make('webhook_on_speedtest_run')
->label('Notify on every speedtest run')
->columnSpan(2),
Toggle::make('webhook_on_threshold_failure')
->label('Notify on threshold failures')
->columnSpan(2),
]),
Repeater::make('webhook_urls')
->label('Recipients')
->schema([
Forms\Components\TextInput::make('url')
->placeholder('https://webhook.site/longstringofcharacters')
->maxLength(2000)
->required()
->url(),
])
->columnSpanFull(),
Actions::make([
Action::make('test webhook')
->label('Test webhook channel')
->action(fn (Forms\Get $get) => SendWebhookTestNotification::run(webhooks: $get('webhook_urls')))
->hidden(fn (Forms\Get $get) => ! count($get('webhook_urls'))),
]),
]),
])
->compact()
->columns([
'default' => 1,
'md' => 2,
]),

Section::make('Pushover')
->description('⚠️ Pushover is deprecated and will be removed in a future release.')
->schema([
Toggle::make('pushover_enabled')
->label('Enable Pushover webhook notifications')
Expand Down Expand Up @@ -154,6 +242,7 @@ public function form(Form $form): Form
]),

Section::make('Discord')
->description('⚠️ Discord is deprecated and will be removed in a future release.')
->schema([
Toggle::make('discord_enabled')
->label('Enable Discord webhook notifications')
Expand Down Expand Up @@ -198,6 +287,7 @@ public function form(Form $form): Form
]),

Section::make('Gotify')
->description('⚠️ Gotify is deprecated and will be removed in a future release.')
->schema([
Toggle::make('gotify_enabled')
->label('Enable Gotify webhook notifications')
Expand Down Expand Up @@ -242,6 +332,7 @@ public function form(Form $form): Form
]),

Section::make('Slack')
->description('⚠️ Slack is deprecated and will be removed in a future release.')
->schema([
Toggle::make('slack_enabled')
->label('Enable Slack webhook notifications')
Expand Down Expand Up @@ -286,6 +377,7 @@ public function form(Form $form): Form
]),

Section::make('Ntfy')
->description('⚠️ Ntfy is deprecated and will be removed in a future release.')
->schema([
Toggle::make('ntfy_enabled')
->label('Enable Ntfy webhook notifications')
Expand Down Expand Up @@ -343,50 +435,8 @@ public function form(Form $form): Form
'md' => 2,
]),

Section::make('Mail')
->schema([
Toggle::make('mail_enabled')
->label('Enable mail notifications')
->reactive()
->columnSpanFull(),
Grid::make([
'default' => 1,
])
->hidden(fn (Forms\Get $get) => $get('mail_enabled') !== true)
->schema([
Fieldset::make('Triggers')
->schema([
Toggle::make('mail_on_speedtest_run')
->label('Notify on every speedtest run')
->columnSpanFull(),
Toggle::make('mail_on_threshold_failure')
->label('Notify on threshold failures')
->columnSpanFull(),
]),
Repeater::make('mail_recipients')
->label('Recipients')
->schema([
Forms\Components\TextInput::make('email_address')
->placeholder('[email protected]')
->email()
->required(),
])
->columnSpanFull(),
Actions::make([
Action::make('test mail')
->label('Test mail channel')
->action(fn (Forms\Get $get) => SendMailTestNotification::run(recipients: $get('mail_recipients')))
->hidden(fn (Forms\Get $get) => ! count($get('mail_recipients'))),
]),
]),
])
->compact()
->columns([
'default' => 1,
'md' => 2,
]),

Section::make('Healthcheck.io')
->description('⚠️ Healthcheck.io is deprecated and will be removed in a future release.')
->schema([
Toggle::make('healthcheck_enabled')
->label('Enable healthcheck.io webhook notifications')
Expand Down Expand Up @@ -432,6 +482,7 @@ public function form(Form $form): Form
]),

Section::make('Telegram')
->description('⚠️ Telegram is deprecated and will be removed in a future release.')
->schema([
Toggle::make('telegram_enabled')
->label('Enable telegram notifications')
Expand Down Expand Up @@ -480,50 +531,6 @@ public function form(Form $form): Form
'default' => 1,
'md' => 2,
]),

Section::make('Webhook')
->schema([
Toggle::make('webhook_enabled')
->label('Enable webhook notifications')
->reactive()
->columnSpanFull(),
Grid::make([
'default' => 1,
])
->hidden(fn (Forms\Get $get) => $get('webhook_enabled') !== true)
->schema([
Fieldset::make('Triggers')
->schema([
Toggle::make('webhook_on_speedtest_run')
->label('Notify on every speedtest run')
->columnSpan(2),
Toggle::make('webhook_on_threshold_failure')
->label('Notify on threshold failures')
->columnSpan(2),
]),
Repeater::make('webhook_urls')
->label('Recipients')
->schema([
Forms\Components\TextInput::make('url')
->placeholder('https://webhook.site/longstringofcharacters')
->maxLength(2000)
->required()
->url(),
])
->columnSpanFull(),
Actions::make([
Action::make('test webhook')
->label('Test webhook channel')
->action(fn (Forms\Get $get) => SendWebhookTestNotification::run(webhooks: $get('webhook_urls')))
->hidden(fn (Forms\Get $get) => ! count($get('webhook_urls'))),
]),
]),
])
->compact()
->columns([
'default' => 1,
'md' => 2,
]),
])
->columnSpan([
'md' => 2,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<div>
<p>
💡 Did you know, when a notification is triggered it's sent to channels.
Each channel can be configured separately to have the notification sent to a specific destination.
<h3 class="fi-section-header-heading text-base font-semibold leading-6 text-gray-950 dark:text-white">
⚠️ Deprecated Channels
</h3>

<p class="fi-section-header-description overflow-hidden break-words text-sm text-gray-500 dark:text-gray-400 mt-1">
Database, mail and webhook channels are considered core notification channels.

All other channels should be considered deprecated and will be replaced by Apprise in a future release.
</p>
</div>