diff --git a/app/Livewire/Notifications/EmailSettings.php b/app/Livewire/Notifications/EmailSettings.php index b6152907d..a45381b84 100644 --- a/app/Livewire/Notifications/EmailSettings.php +++ b/app/Livewire/Notifications/EmailSettings.php @@ -119,16 +119,18 @@ class EmailSettings extends Component { try { $this->resetErrorBag(); - $this->validate([ - 'team.smtp_from_address' => 'required|email', - 'team.smtp_from_name' => 'required', - 'team.smtp_host' => 'required', - 'team.smtp_port' => 'required|numeric', - 'team.smtp_encryption' => 'nullable', - 'team.smtp_username' => 'nullable', - 'team.smtp_password' => 'nullable', - 'team.smtp_timeout' => 'nullable', - ]); + if (!$this->team->use_instance_email_settings) { + $this->validate([ + 'team.smtp_from_address' => 'required|email', + 'team.smtp_from_name' => 'required', + 'team.smtp_host' => 'required', + 'team.smtp_port' => 'required|numeric', + 'team.smtp_encryption' => 'nullable', + 'team.smtp_username' => 'nullable', + 'team.smtp_password' => 'nullable', + 'team.smtp_timeout' => 'nullable', + ]); + } $this->team->save(); refreshSession(); $this->dispatch('success', 'Settings saved.'); diff --git a/app/Livewire/Project/Application/Deployment/Index.php b/app/Livewire/Project/Application/Deployment/Index.php index 520848a54..d8e033b24 100644 --- a/app/Livewire/Project/Application/Deployment/Index.php +++ b/app/Livewire/Project/Application/Deployment/Index.php @@ -9,7 +9,7 @@ use Livewire\Component; class Index extends Component { public Application $application; - public array|Collection $deployments = []; + public ?Collection $deployments; public int $deployments_count = 0; public string $current_url; public int $skip = 0; @@ -48,9 +48,9 @@ class Index extends Component } private function show_more() { - if (count($this->deployments) !== 0) { + if ($this->deployments->count() !== 0) { $this->show_next = true; - if (count($this->deployments) < $this->default_take) { + if ($this->deployments->count() < $this->default_take) { $this->show_next = false; } return; @@ -63,7 +63,6 @@ class Index extends Component } public function previous_page(?int $take = null) { - if ($take) { $this->skip = $this->skip - $take; } diff --git a/app/Livewire/Tags/Index.php b/app/Livewire/Tags/Index.php index eba25a750..75ed06f7b 100644 --- a/app/Livewire/Tags/Index.php +++ b/app/Livewire/Tags/Index.php @@ -2,14 +2,73 @@ namespace App\Livewire\Tags; +use App\Http\Controllers\Api\Deploy; +use App\Models\ApplicationDeploymentQueue; use App\Models\Tag; +use Illuminate\Support\Collection; +use Livewire\Attributes\Url; use Livewire\Component; class Index extends Component { - public $tags = []; - public function mount() { - $this->tags = Tag::where('team_id', currentTeam()->id)->get()->unique('name')->sortBy('name'); + #[Url()] + public ?string $tag = null; + + public Collection $tags; + public Collection $applications; + public Collection $services; + public $webhook = null; + public $deployments_per_tag_per_server = []; + + public function updatedTag() + { + $tag = $this->tags->where('name', $this->tag)->first(); + $this->webhook = generatTagDeployWebhook($tag->name); + $this->applications = $tag->applications()->get(); + $this->services = $tag->services()->get(); + $this->get_deployments(); + } + public function get_deployments() + { + try { + $resource_ids = $this->applications->pluck('id'); + $this->deployments_per_tag_per_server = ApplicationDeploymentQueue::whereIn("status", ["in_progress", "queued"])->whereIn('application_id', $resource_ids)->get([ + "id", + "application_id", + "application_name", + "deployment_url", + "pull_request_id", + "server_name", + "server_id", + "status" + ])->sortBy('id')->groupBy('server_name')->toArray(); + } catch (\Exception $e) { + return handleError($e, $this); + } + } + public function redeploy_all() + { + try { + $message = collect([]); + $this->applications->each(function ($resource) use ($message) { + $deploy = new Deploy(); + $message->push($deploy->deploy_resource($resource)); + }); + $this->services->each(function ($resource) use ($message) { + $deploy = new Deploy(); + $message->push($deploy->deploy_resource($resource)); + }); + $this->dispatch('success', 'Mass deployment started.'); + } catch (\Exception $e) { + return handleError($e, $this); + } + } + public function mount() + { + $this->tags = Tag::ownedByCurrentTeam()->get()->unique('name')->sortBy('name'); + if ($this->tag) { + $this->updatedTag(); + } } public function render() { diff --git a/app/View/Components/Forms/Checkbox.php b/app/View/Components/Forms/Checkbox.php index 5361be4e7..36b561eda 100644 --- a/app/View/Components/Forms/Checkbox.php +++ b/app/View/Components/Forms/Checkbox.php @@ -19,7 +19,7 @@ class Checkbox extends Component public ?string $helper = null, public string|bool $instantSave = false, public bool $disabled = false, - public string $defaultClass = "border-coolgray-500 text-warning focus:ring-warning bg-coolgray-100 rounded cursor-pointer", + public string $defaultClass = "border-coolgray-500 text-warning focus:ring-warning dark:bg-coolgray-100 rounded cursor-pointer dark:disabled:bg-base dark:disabled:cursor-not-allowed", ) { // } diff --git a/app/View/Components/Forms/Input.php b/app/View/Components/Forms/Input.php index c1c60e8a0..56349f6db 100644 --- a/app/View/Components/Forms/Input.php +++ b/app/View/Components/Forms/Input.php @@ -21,7 +21,7 @@ class Input extends Component public ?string $helper = null, public bool $allowToPeak = true, public bool $isMultiline = false, - public string $defaultClass = "block w-full py-1.5 rounded border-0 text-sm ring-inset ring-1 dark:ring-coolgray-300 dark:placeholder:text-neutral-700 focus:ring-2 focus:ring-inset dark:focus:ring-coolgray-500 dark:bg-coolgray-100 dark:text-white text-black dark:read-only:text-neutral-500 dark:read-only:bg-coolgray-100/20" + public string $defaultClass = "input", ) { } diff --git a/app/View/Components/Forms/Select.php b/app/View/Components/Forms/Select.php index eadb8dcac..99bcf1873 100644 --- a/app/View/Components/Forms/Select.php +++ b/app/View/Components/Forms/Select.php @@ -14,12 +14,12 @@ class Select extends Component * Create a new component instance. */ public function __construct( - public string|null $id = null, - public string|null $name = null, - public string|null $label = null, - public string|null $helper = null, - public bool $required = false, - public string $defaultClass = "block w-full py-1.5 rounded border-0 text-sm ring-inset ring-1 dark:ring-coolgray-300 dark:placeholder:text-neutral-700 focus:ring-2 focus:ring-inset dark:focus:ring-coolgray-500 dark:bg-coolgray-100 dark:text-white text-black " + public ?string $id = null, + public ?string $name = null, + public ?string $label = null, + public ?string $helper = null, + public bool $required = false, + public string $defaultClass = "block w-full py-1.5 rounded border-0 text-sm ring-inset ring-1 dark:ring-coolgray-300 dark:placeholder:text-neutral-700 focus:ring-2 focus:ring-inset dark:focus:ring-coolgray-500 dark:bg-coolgray-100 dark:text-white text-black " ) { // } diff --git a/app/View/Components/Forms/Textarea.php b/app/View/Components/Forms/Textarea.php index 58a1af67a..c9d2c26ba 100644 --- a/app/View/Components/Forms/Textarea.php +++ b/app/View/Components/Forms/Textarea.php @@ -25,8 +25,8 @@ class Textarea extends Component public ?string $helper = null, public bool $realtimeValidation = false, public bool $allowToPeak = true, - public string $defaultClass = "block w-full py-1.5 rounded border-0 text-sm ring-inset ring-1 dark:ring-coolgray-300 dark:placeholder:text-neutral-700 focus:ring-2 focus:ring-inset dark:focus:ring-coolgray-500 dark:bg-coolgray-100 dark:text-white text-black dark:read-only:text-neutral-500 dark:read-only:bg-coolgray-100/20 scrollbar", - public string $defaultClassInput = "block w-full py-1.5 rounded border-0 text-sm ring-inset ring-1 dark:ring-coolgray-300 dark:placeholder:text-neutral-700 focus:ring-2 focus:ring-inset dark:focus:ring-coolgray-500 dark:bg-coolgray-100 dark:text-white text-black dark:read-only:text-neutral-500 dark:read-only:bg-coolgray-100/20" + public string $defaultClass = "block w-full py-1.5 rounded border-0 text-sm ring-inset ring-1 dark:bg-coolgray-100 dark:text-white text-black focus:ring-2 dark:focus:ring-coolgray-300 dark:ring-coolgray-300 scrollbar dark:read-only:text-neutral-500", + public string $defaultClassInput = "block w-full py-1.5 rounded border-0 text-sm ring-inset ring-1 dark:bg-coolgray-100 dark:text-white text-black focus:ring-2 dark:focus:ring-coolgray-300 dark:ring-coolgray-300 dark:read-only:text-neutral-500" ) { // } diff --git a/resources/css/app.css b/resources/css/app.css index b7eec46fb..d0686191b 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -11,16 +11,20 @@ body { @apply text-sm antialiased scrollbar; } -button[isError] { +button[isError]:not(:disabled) { @apply bg-red-600 hover:bg-red-700; } -button[isHighlighted] { +button[isHighlighted]:not(:disabled) { @apply bg-coollabs hover:bg-coollabs-100; } +.button { + @apply px-3 py-1.5 text-sm font-normal normal-case rounded dark:bg-coolgray-200 dark:text-white dark:hover:bg-coolgray-100 dark:disabled:bg-coolgray-100/40 dark:disabled:text-neutral-800 min-w-fit flex items-center justify-center; +} + h1 { - @apply pb-6 text-2xl font-bold dark:text-white text-neutral-800; + @apply text-2xl font-bold dark:text-white text-neutral-800; } h2 { @@ -36,7 +40,7 @@ h4 { } a { - @apply dark:text-neutral-400 text-neutral-600; + @apply dark:hover:text-white dark:text-neutral-400 text-neutral-600; } label { @@ -75,28 +79,44 @@ tr td:first-child { @apply pl-4 pr-3 font-bold sm:pl-6; } -input.input-sm { +input { @apply pr-10; } +.input { + @apply block w-full py-1.5 rounded border-0 text-sm ring-inset ring-1 dark:bg-coolgray-100 dark:text-white text-black focus:ring-2 dark:focus:ring-coolgray-300 dark:ring-coolgray-300 dark:read-only:text-neutral-500 dark:read-only:ring-0 dark:read-only:bg-coolgray-100/40 dark:placeholder:text-neutral-700; +} option { @apply text-white; } -.badge { - @apply inline-block w-3 h-3 text-xs font-bold leading-none border border-black rounded-full ; +.alert-success { + @apply flex items-center gap-2 text-success; } +.alert-error { + @apply flex items-center gap-2 text-error; +} +.dropdown-item { + @apply relative flex cursor-pointer select-none dark:hover:text-white dark:hover:bg-coollabs items-center px-2 py-1.5 text-xs justify-center outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 gap-2 +} + +.badge { + @apply inline-block w-3 h-3 text-xs font-bold leading-none border border-black rounded-full; +} + .badge-success { @apply bg-success; } + .badge-warning { @apply bg-warning; } + .badge-error { @apply bg-error; } -.button { - @apply px-3 py-1 text-sm font-normal normal-case rounded dark:bg-coolgray-200 dark:text-white dark:hover:bg-coolgray-100; -} + + + [type='checkbox']:checked { background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='black' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e"); } @@ -104,12 +124,15 @@ option { .menu { @apply flex items-center gap-1; } + .menu-item { @apply flex items-center w-full gap-2 px-4 py-1 min-w-48 hover:bg-coolgray-100 dark:hover:text-white; } + .menu-item-active { - @apply rounded-none bg-coolgray-200 text-warning; + @apply rounded-none dark:bg-coolgray-200 dark:text-warning; } + .icon { @apply w-4 h-4; } @@ -123,10 +146,9 @@ option { } .custom-modal { - @apply flex flex-col gap-2 px-8 py-4 border bg-coolgray-100 border-coolgray-200; + @apply z-50 flex flex-col gap-2 px-8 py-4 border dark:bg-coolgray-100 dark:border-coolgray-200; } - .navbar-main { @apply flex items-end gap-6 py-2 border-b-2 border-solid border-coolgray-200; } @@ -197,12 +219,13 @@ option { @apply inline-block font-bold text-warning; } - - .buyme { @apply block px-3 py-2 mt-10 text-sm font-semibold leading-6 text-center text-white rounded-md shadow-sm bg-coolgray-200 hover:bg-coolgray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-coolgray-200 hover:no-underline; } +.title { + @apply hidden pb-0 lg:block lg:pb-8 ; +} .subtitle { @apply pt-2 pb-10; } diff --git a/resources/views/components/applications/links.blade.php b/resources/views/components/applications/links.blade.php index 7f3bed2da..d6a0d15d5 100644 --- a/resources/views/components/applications/links.blade.php +++ b/resources/views/components/applications/links.blade.php @@ -1,54 +1,76 @@ -