This commit is contained in:
Andras Bacsai 2023-06-07 17:24:37 +02:00
parent 881bae0a15
commit 1fa077fc8a
11 changed files with 43 additions and 37 deletions

View File

@ -17,7 +17,7 @@ class DiscordSettings extends Component
'model.extra_attributes.discord_webhook' => 'required|url',
];
protected $validationAttributes = [
'model.extra_attributes.discord_webhook' => '',
'model.extra_attributes.discord_webhook' => 'Discord Webhook',
];
public function instantSave()

View File

@ -2,7 +2,10 @@
namespace App\Http\Livewire\Notifications;
use App\Models\InstanceSettings;
use App\Models\Team;
use App\Notifications\TestNotification;
use Illuminate\Support\Facades\Notification;
use Livewire\Component;
class EmailSettings extends Component
@ -33,6 +36,22 @@ class EmailSettings extends Component
'model.extra_attributes.smtp_password' => '',
'model.extra_attributes.smtp_test_recipients' => '',
];
public function copySMTP()
{
$settings = InstanceSettings::get();
$this->model->extra_attributes->smtp_active = true;
$this->model->extra_attributes->smtp_from_address = $settings->extra_attributes->smtp_from_address;
$this->model->extra_attributes->smtp_from_name = $settings->extra_attributes->smtp_from_name;
$this->model->extra_attributes->smtp_recipients = $settings->extra_attributes->smtp_recipients;
$this->model->extra_attributes->smtp_host = $settings->extra_attributes->smtp_host;
$this->model->extra_attributes->smtp_port = $settings->extra_attributes->smtp_port;
$this->model->extra_attributes->smtp_encryption = $settings->extra_attributes->smtp_encryption;
$this->model->extra_attributes->smtp_username = $settings->extra_attributes->smtp_username;
$this->model->extra_attributes->smtp_password = $settings->extra_attributes->smtp_password;
$this->model->extra_attributes->smtp_timeout = $settings->extra_attributes->smtp_timeout;
$this->model->extra_attributes->smtp_test_recipients = $settings->extra_attributes->smtp_test_recipients;
$this->saveModel();
}
public function submit()
{
$this->resetErrorBag();
@ -48,6 +67,10 @@ private function saveModel()
session(['currentTeam' => $this->model]);
}
}
public function sendTestNotification()
{
Notification::send($this->model, new TestNotification);
}
public function instantSave()
{
try {

View File

@ -1,19 +0,0 @@
<?php
namespace App\Http\Livewire\Notifications;
use App\Models\Server;
use App\Models\Team;
use App\Notifications\TestNotification;
use Livewire\Component;
use Notification;
class Test extends Component
{
public Team $model;
public function sendTestNotification()
{
Notification::send($this->model, new TestNotification);
$this->emit('saved', 'Test notification sent.');
}
}

View File

@ -2,7 +2,8 @@
<h1>Team</h1>
<div class="text-sm breadcrumbs pb-11">
<ul>
<li>{{ session('currentTeam.name') }}</li>
<li>Currently Active Team</li>
<li class="font-bold">{{ session('currentTeam.name') }}</li>
</ul>
</div>
<nav class="flex items-center gap-4 py-2 border-b-2 border-solid border-coolgray-200">

View File

@ -1,2 +1,2 @@
Use the magic
<br><br>Use the magic
bar (press <span class="kbd-custom">/</span>) to create a new one.

View File

@ -5,6 +5,10 @@
<x-forms.button type="submit">
Save
</x-forms.button>
<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary"
wire:click="sendTestNotification">
Send Test Notifications
</x-forms.button>
</div>
<div class="flex flex-col gap-2 xl:flex-row w-96">
<x-forms.checkbox instantSave id="model.extra_attributes.discord_active" label="Notification Enabled" />

View File

@ -5,6 +5,15 @@
<x-forms.button type="submit">
Save
</x-forms.button>
@if (auth()->user()->isAdmin())
<x-forms.button wire:click='copySMTP'>
Copy from Instance Settings
</x-forms.button>
@endif
<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary"
wire:click="sendTestNotification">
Send Test Notifications
</x-forms.button>
</div>
<div class="flex flex-col w-96">
<x-forms.checkbox instantSave id="model.extra_attributes.smtp_active" label="Notification Enabled" />

View File

@ -1,6 +0,0 @@
<div class="flex items-center gap-2">
<h2>Notifications</h2>
<x-forms.button class="text-white normal-case btn btn-xs no-animation btn-primary" wire:click="sendTestNotification">
Send Test Notifications
</x-forms.button>
</div>

View File

@ -16,10 +16,6 @@ class="box">{{ $project->name }}</a>
No project found.
<x-use-magic-bar />
</div>
<div>
If you do not have a project yet, just create a resource (application, database, etc.) first, it will
create a new project for you automatically.
</div>
@endforelse
</div>
</x-layout>

View File

@ -19,10 +19,9 @@
</div>
</a>
@empty
<div class="flex flex-col">
<div>Without a server, you won't be able to do much.</div>
<div>Let's <a class="text-lg underline text-warning" href="{{ route('server.create') }}">create</a> your
first one.</div>
<div>
<div>No servers found. Without a server, you won't be able to do much.</div>
<x-use-magic-bar />
</div>
@endforelse
</div>

View File

@ -1,6 +1,5 @@
<x-layout>
<x-team.navbar :team="session('currentTeam')" />
{{-- <livewire:notifications.test :model="session('currentTeam')" /> --}}
<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'"