Fix styling

This commit is contained in:
Thijmen
2024-06-10 20:43:34 +00:00
committed by github-actions[bot]
parent 41fb6a1fc9
commit d86274cc37
429 changed files with 5307 additions and 2831 deletions

View File

@@ -2,41 +2,49 @@
namespace App\Livewire\Settings;
use Livewire\Component;
use App\Models\OauthSetting;
use Livewire\Component;
class Auth extends Component {
class Auth extends Component
{
public $oauth_settings_map;
protected function rules() {
return OauthSetting::all()->reduce(function($carry, $setting) {
protected function rules()
{
return OauthSetting::all()->reduce(function ($carry, $setting) {
$carry["oauth_settings_map.$setting->provider.enabled"] = 'required';
$carry["oauth_settings_map.$setting->provider.client_id"] = 'nullable';
$carry["oauth_settings_map.$setting->provider.client_secret"] = 'nullable';
$carry["oauth_settings_map.$setting->provider.redirect_uri"] = 'nullable';
$carry["oauth_settings_map.$setting->provider.tenant"] = 'nullable';
return $carry;
}, []);
}
public function mount() {
$this->oauth_settings_map = OauthSetting::all()->sortBy('provider')->reduce(function($carry, $setting) {
public function mount()
{
$this->oauth_settings_map = OauthSetting::all()->sortBy('provider')->reduce(function ($carry, $setting) {
$carry[$setting->provider] = $setting;
return $carry;
}, []);
}
private function updateOauthSettings() {
private function updateOauthSettings()
{
foreach (array_values($this->oauth_settings_map) as &$setting) {
$setting->save();
}
}
public function instantSave() {
public function instantSave()
{
$this->updateOauthSettings();
}
public function submit() {
public function submit()
{
$this->updateOauthSettings();
$this->dispatch('success', 'Instance settings updated successfully!');
}

View File

@@ -13,9 +13,13 @@ use Livewire\Component;
class Backup extends Component
{
public InstanceSettings $settings;
public $s3s;
public StandalonePostgresql|null|array $database = [];
public ScheduledDatabaseBackup|null|array $backup = [];
public $executions = [];
protected $rules = [
@@ -26,6 +30,7 @@ class Backup extends Component
'database.postgres_password' => 'required',
];
protected $validationAttributes = [
'database.uuid' => 'uuid',
'database.name' => 'name',
@@ -39,6 +44,7 @@ class Backup extends Component
$this->backup = $this->database?->scheduledBackups->first() ?? null;
$this->executions = $this->backup?->executions ?? [];
}
public function add_coolify_database()
{
try {
@@ -83,6 +89,7 @@ class Backup extends Component
));
$this->dispatch('success', 'Backup queued. It will be available in a few minutes.');
}
public function submit()
{
$this->dispatch('success', 'Backup updated.');

View File

@@ -9,12 +9,18 @@ use Livewire\Component;
class Configuration extends Component
{
public ModelsInstanceSettings $settings;
public bool $do_not_track;
public bool $is_auto_update_enabled;
public bool $is_registration_enabled;
public bool $is_dns_validation_enabled;
// public bool $next_channel;
protected string $dynamic_config_path = '/data/coolify/proxy/dynamic';
protected Server $server;
protected $rules = [
@@ -24,6 +30,7 @@ class Configuration extends Component
'settings.public_port_max' => 'required',
'settings.custom_dns_servers' => 'nullable',
];
protected $validationAttributes = [
'settings.fqdn' => 'FQDN',
'settings.resale_license' => 'Resale License',
@@ -65,17 +72,20 @@ class Configuration extends Component
$this->resetErrorBag();
if ($this->settings->public_port_min > $this->settings->public_port_max) {
$this->addError('settings.public_port_min', 'The minimum port must be lower than the maximum port.');
return;
}
$this->validate();
if ($this->settings->is_dns_validation_enabled && $this->settings->fqdn) {
if (!validate_dns_entry($this->settings->fqdn, $this->server)) {
$this->dispatch('error', "Validating DNS failed.<br><br>Make sure you have added the DNS records correctly.<br><br>{$this->settings->fqdn}->{$this->server->ip}<br><br>Check this <a target='_blank' class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/dns-configuration'>documentation</a> for further help.");
if (! validate_dns_entry($this->settings->fqdn, $this->server)) {
$this->dispatch('error', "Validating DNS failed.<br><br>Make sure you have added the DNS records correctly.<br><br>{$this->settings->fqdn}->{$this->server->ip}<br><br>Check this <a target='_blank' class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/dns-configuration'>documentation</a> for further help.");
$error_show = true;
}
}
if ($this->settings->fqdn) check_domain_usage(domain: $this->settings->fqdn);
if ($this->settings->fqdn) {
check_domain_usage(domain: $this->settings->fqdn);
}
$this->settings->custom_dns_servers = str($this->settings->custom_dns_servers)->replaceEnd(',', '')->trim();
$this->settings->custom_dns_servers = str($this->settings->custom_dns_servers)->trim()->explode(',')->map(function ($dns) {
return str($dns)->trim()->lower();
@@ -85,7 +95,7 @@ class Configuration extends Component
$this->settings->save();
$this->server->setupDynamicProxyConfiguration();
if (!$error_show) {
if (! $error_show) {
$this->dispatch('success', 'Instance settings updated successfully!');
}
} catch (\Exception $e) {

View File

@@ -9,7 +9,9 @@ use Livewire\Component;
class Email extends Component
{
public InstanceSettings $settings;
public string $emails;
protected $rules = [
'settings.smtp_enabled' => 'nullable|boolean',
'settings.smtp_host' => 'required',
@@ -21,9 +23,10 @@ class Email extends Component
'settings.smtp_from_address' => 'required|email',
'settings.smtp_from_name' => 'required',
'settings.resend_enabled' => 'nullable|boolean',
'settings.resend_api_key' => 'nullable'
'settings.resend_api_key' => 'nullable',
];
protected $validationAttributes = [
'settings.smtp_from_address' => 'From Address',
'settings.smtp_from_name' => 'From Name',
@@ -34,14 +37,16 @@ class Email extends Component
'settings.smtp_username' => 'Username',
'settings.smtp_password' => 'Password',
'settings.smtp_timeout' => 'Timeout',
'settings.resend_api_key' => 'Resend API Key'
'settings.resend_api_key' => 'Resend API Key',
];
public function mount()
{
$this->emails = auth()->user()->email;
}
public function submitFromFields() {
public function submitFromFields()
{
try {
$this->resetErrorBag();
$this->validate([
@@ -54,22 +59,27 @@ class Email extends Component
return handleError($e, $this);
}
}
public function submitResend() {
public function submitResend()
{
try {
$this->resetErrorBag();
$this->validate([
'settings.smtp_from_address' => 'required|email',
'settings.smtp_from_name' => 'required',
'settings.resend_api_key' => 'required'
'settings.resend_api_key' => 'required',
]);
$this->settings->save();
$this->dispatch('success', 'Settings saved.');
} catch (\Throwable $e) {
$this->settings->resend_enabled = false;
return handleError($e, $this);
}
}
public function instantSaveResend() {
public function instantSaveResend()
{
try {
$this->settings->smtp_enabled = false;
$this->submitResend();
@@ -77,6 +87,7 @@ class Email extends Component
return handleError($e, $this);
}
}
public function instantSave()
{
try {

View File

@@ -10,8 +10,11 @@ use Livewire\Component;
class Index extends Component
{
public InstanceSettings $settings;
public StandalonePostgresql $database;
public $s3s;
public function mount()
{
if (isInstanceAdmin()) {
@@ -31,6 +34,7 @@ class Index extends Component
return redirect()->route('dashboard');
}
}
public function render()
{
return view('livewire.settings.index');

View File

@@ -9,29 +9,34 @@ use Livewire\Component;
class License extends Component
{
public InstanceSettings $settings;
public string|null $instance_id = null;
public ?string $instance_id = null;
protected $rules = [
'settings.resale_license' => 'nullable',
'settings.is_resale_license_active' => 'nullable',
];
protected $validationAttributes = [
'settings.resale_license' => 'License',
'instance_id' => 'Instance Id (Do not change this)',
'settings.is_resale_license_active' => 'Is License Active',
];
public function mount () {
if (!isCloud()) {
public function mount()
{
if (! isCloud()) {
abort(404);
}
$this->instance_id = config('app.id');
$this->settings = InstanceSettings::get();
}
public function render()
{
return view('livewire.settings.license');
}
public function submit()
{
$this->validate();
@@ -41,8 +46,9 @@ class License extends Component
CheckResaleLicense::run();
$this->dispatch('reloadWindow');
} catch (\Throwable $e) {
session()->flash('error', 'Something went wrong. Please contact support. <br>Error: ' . $e->getMessage());
session()->flash('error', 'Something went wrong. Please contact support. <br>Error: '.$e->getMessage());
ray($e->getMessage());
return redirect()->route('settings.license');
}
}