feat: add discord notifications
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="absolute hidden text-xs rounded group-hover:block border-coolgray-400 bg-coolgray-500">
|
||||
<div class="p-4 card-body">
|
||||
<div class="absolute z-40 hidden text-xs rounded group-hover:block border-coolgray-400 bg-coolgray-500">
|
||||
<div class="p-4">
|
||||
{!! $helper !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<x-forms.button type="submit">
|
||||
Save
|
||||
</x-forms.button>
|
||||
@if ($model->discord_enabled)
|
||||
@if ($team->discord_enabled)
|
||||
<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary"
|
||||
wire:click="sendTestNotification">
|
||||
Send Test Notifications
|
||||
@@ -13,26 +13,26 @@
|
||||
@endif
|
||||
</div>
|
||||
<div class="w-48">
|
||||
<x-forms.checkbox instantSave id="model.discord_enabled" label="Notification Enabled" />
|
||||
<x-forms.checkbox instantSave id="team.discord_enabled" label="Notification Enabled" />
|
||||
</div>
|
||||
<x-forms.input type="password"
|
||||
helper="Generate a webhook in Discord.<br>Example: https://discord.com/api/webhooks/...." required
|
||||
id="model.discord_webhook_url" label="Webhook" />
|
||||
id="team.discord_webhook_url" label="Webhook" />
|
||||
</form>
|
||||
@if (data_get($model, 'discord_enabled'))
|
||||
@if (data_get($team, 'discord_enabled'))
|
||||
<h3 class="mt-4">Subscribe to events</h3>
|
||||
<div class="w-64">
|
||||
@if (isDev())
|
||||
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications_test" label="Test" />
|
||||
<x-forms.checkbox instantSave="saveModel" id="team.discord_notifications_test" label="Test" />
|
||||
@endif
|
||||
<h4 class="mt-4">General</h4>
|
||||
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications_status_changes"
|
||||
<x-forms.checkbox instantSave="saveModel" id="team.discord_notifications_status_changes"
|
||||
label="Container Status Changes" />
|
||||
<h4 class="mt-4">Applications</h4>
|
||||
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications_deployments"
|
||||
<x-forms.checkbox instantSave="saveModel" id="team.discord_notifications_deployments"
|
||||
label="Deployments" />
|
||||
<h4 class="mt-4">Databases</h4>
|
||||
<x-forms.checkbox instantSave="saveModel" id="model.discord_notifications_database_backups"
|
||||
<x-forms.checkbox instantSave="saveModel" id="team.discord_notifications_database_backups"
|
||||
label="Backup Statuses" />
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<div>
|
||||
<form wire:submit.prevent='submit' class="flex flex-col">
|
||||
<div class="flex items-center gap-2">
|
||||
<h2>Telegram</h2>
|
||||
<x-forms.button type="submit">
|
||||
Save
|
||||
</x-forms.button>
|
||||
@if ($team->telegram_enabled)
|
||||
<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary"
|
||||
wire:click="sendTestNotification">
|
||||
Send Test Notifications
|
||||
</x-forms.button>
|
||||
@endif
|
||||
</div>
|
||||
<div class="w-48">
|
||||
<x-forms.checkbox instantSave id="team.telegram_enabled" label="Notification Enabled" />
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input type="password" helper="Get it from the <a class='inline-block text-white underline' href='https://t.me/botfather' target='_blank'>BotFather Bot</a> on Telegram." required
|
||||
id="team.telegram_token" label="Token" />
|
||||
<x-forms.input type="password" helper="Recommended to add your bot to a group chat and add its Chat ID here." required
|
||||
id="team.telegram_chat_id" label="Chat ID" />
|
||||
</div>
|
||||
</form>
|
||||
@if (data_get($team, 'telegram_enabled'))
|
||||
<h3 class="mt-4">Subscribe to events</h3>
|
||||
<div class="w-64">
|
||||
@if (isDev())
|
||||
<x-forms.checkbox instantSave="saveModel" id="team.telegram_notifications_test" label="Test" />
|
||||
@endif
|
||||
<h4 class="mt-4">General</h4>
|
||||
<x-forms.checkbox instantSave="saveModel" id="team.telegram_notifications_status_changes"
|
||||
label="Container Status Changes" />
|
||||
<h4 class="mt-4">Applications</h4>
|
||||
<x-forms.checkbox instantSave="saveModel" id="team.telegram_notifications_deployments"
|
||||
label="Deployments" />
|
||||
<h4 class="mt-4">Databases</h4>
|
||||
<x-forms.checkbox instantSave="saveModel" id="team.telegram_notifications_database_backups"
|
||||
label="Backup Statuses" />
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@@ -1,23 +1,25 @@
|
||||
<x-layout>
|
||||
<x-team.navbar/>
|
||||
<x-team.navbar />
|
||||
<h2 class="pb-4">Notifications</h2>
|
||||
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'email' }" class="flex h-full">
|
||||
<div class="flex flex-col gap-4 min-w-fit">
|
||||
<a :class="activeTab === 'email' && 'text-white'"
|
||||
@click.prevent="activeTab = 'email'; window.location.hash = 'email'" href="#">Email</a>
|
||||
<a :class="activeTab === 'Telegram' && 'text-white'"
|
||||
@click.prevent="activeTab = 'telegram'; window.location.hash = 'telegram'" href="#">Telegram</a>
|
||||
<a :class="activeTab === 'discord' && 'text-white'"
|
||||
@click.prevent="activeTab = 'discord'; window.location.hash = 'discord'" href="#">Discord</a>
|
||||
|
||||
</div>
|
||||
<div class="w-full pl-8">
|
||||
<div x-cloak x-show="activeTab === 'email'" class="h-full">
|
||||
<livewire:notifications.email-settings :team="auth()
|
||||
->user()
|
||||
->currentTeam()" />
|
||||
<livewire:notifications.email-settings />
|
||||
</div>
|
||||
<div x-cloak x-show="activeTab === 'telegram'" class="h-full">
|
||||
<livewire:notifications.telegram-settings />
|
||||
</div>
|
||||
<div x-cloak x-show="activeTab === 'discord'">
|
||||
<livewire:notifications.discord-settings :model="auth()
|
||||
->user()
|
||||
->currentTeam()" />
|
||||
<livewire:notifications.discord-settings />
|
||||
</div>
|
||||
</div>
|
||||
</x-layout>
|
||||
|
||||
Reference in New Issue
Block a user