fix: force enable/disable server in case ultimate package quantity decreases

This commit is contained in:
Andras Bacsai
2024-02-26 10:25:21 +01:00
parent 453956172b
commit 678647f39a
25 changed files with 172 additions and 68 deletions

View File

@@ -1,24 +1,18 @@
<div>
@if ($server->isFunctional())
<div class="flex h-full pr-4">
<div class="flex flex-col w-48 gap-4 min-w-fit">
<a class="{{ request()->routeIs('server.proxy') ? 'text-white' : '' }}"
href="{{ route('server.proxy', $parameters) }}">
<button>Configuration</button>
</a>
@if (data_get($server, 'proxy.type') !== 'NONE')
<a class="{{ request()->routeIs('server.proxy.dynamic-confs') ? 'text-white' : '' }}"
href="{{ route('server.proxy.dynamic-confs', $parameters) }}">
<button>Dynamic Configurations</button>
</a>
<a class="{{ request()->routeIs('server.proxy.logs') ? 'text-white' : '' }}"
href="{{ route('server.proxy.logs', $parameters) }}">
<button>Logs</button>
</a>
@endif
</div>
</div>
@else
<div>Server is not validated. Validate first.</div>
@endif
<div class="flex h-full pr-4">
<div class="flex flex-col w-48 gap-4 min-w-fit">
<a class="{{ request()->routeIs('server.proxy') ? 'text-white' : '' }}"
href="{{ route('server.proxy', $parameters) }}">
<button>Configuration</button>
</a>
@if (data_get($server, 'proxy.type') !== 'NONE')
<a class="{{ request()->routeIs('server.proxy.dynamic-confs') ? 'text-white' : '' }}"
href="{{ route('server.proxy.dynamic-confs', $parameters) }}">
<button>Dynamic Configurations</button>
</a>
<a class="{{ request()->routeIs('server.proxy.logs') ? 'text-white' : '' }}"
href="{{ route('server.proxy.logs', $parameters) }}">
<button>Logs</button>
</a>
@endif
</div>
</div>

View File

@@ -0,0 +1,3 @@
<x-emails.layout>
Your server ({{ $name }}) is enabled again!
</x-emails.layout>

View File

@@ -12,8 +12,12 @@
</div>
@endif
@if (currentTeam()->serverOverflow())
<x-banner :closable=false>
<div><span class="font-bold text-red-500">WARNING:</span> The number of active servers exceeds the limit covered by your payment. If not resolved, some of your servers <span class="font-bold text-red-500">will be deactivated</span> in the next billing cycle. Visit <a href="{{route('subscription.show')}}" class="text-white underline">/subscription</a> to update your subscription.</div>
</x-banner>
<x-banner :closable=false>
<div><span class="font-bold text-red-500">WARNING:</span> The number of active servers exceeds the limit
covered by your payment. If not resolved, some of your servers <span class="font-bold text-red-500">will
be deactivated</span>. Visit <a href="{{ route('subscription.show') }}"
class="text-white underline">/subscription</a> to update your subscription or remove some servers.
</div>
</x-banner>
@endif
</div>

View File

@@ -7,10 +7,10 @@
back!
</div>
@if ($server->definedResources()->count() > 0)
<div class="pb-2 text-red-500">You need to delete all resources before deleting this server.</div>
<x-new-modal disabled isErrorButton buttonTitle="Delete">
This server will be deleted. It is not reversible. <br>Please think again.
</x-new-modal>
<div>You need to delete all resources before deleting this server.</div>
@else
<x-new-modal isErrorButton buttonTitle="Delete">
This server will be deleted. It is not reversible. <br>Please think again.

View File

@@ -47,6 +47,10 @@
Validate Server
</x-forms.button>
@endif
@if ($server->isForceDisabled() && isCloud())
<div class="pt-4 font-bold text-red-500">The system has disabled the server because you have exceeded the
number of servers for which you have paid.</div>
@endif
<div class="flex flex-col gap-2 pt-4">
<div class="flex flex-col w-full gap-2 lg:flex-row">
<x-forms.input id="server.name" label="Name" required />

View File

@@ -1,18 +1,18 @@
<div>
<div class="flex items-start gap-2">
<h1>Servers</h1>
<a class="text-white hover:no-underline" href="{{ route('server.create') }}">
<a class="text-white hover:no-underline" href="{{ route('server.create') }}">
<x-forms.button class="btn">+ Add</x-forms.button>
</a>
</div>
<div class="subtitle ">All Servers</div>
<div class="grid gap-2 lg:grid-cols-2">
@forelse ($servers as $server)
<a href="{{ route('server.show', ['server_uuid' => data_get($server, 'uuid')]) }}"
<a href="{{ route('server.show', ['server_uuid' => data_get($server, 'uuid')]) }}"
@class([
'gap-2 border cursor-pointer box group',
'border-transparent' => $server->settings->is_reachable,
'border-red-500' => !$server->settings->is_reachable,
'border-transparent' => $server->settings->is_reachable && $server->settings->is_usable && !$server->settings->force_disabled,
'border-red-500' => !$server->settings->is_reachable || $server->settings->force_disabled,
])>
<div class="flex flex-col mx-6">
<div class="font-bold text-white">
@@ -30,6 +30,9 @@
@if (!$server->settings->is_usable)
<span>Not usable by Coolify</span>
@endif
@if ($server->settings->force_disabled)
<span>Disabled by the system</span>
@endif
</div>
</div>
<div class="flex-1"></div>

View File

@@ -1,7 +1,7 @@
<div>
<x-server.navbar :server="$server" :parameters="$parameters" />
<x-server.sidebar :server="$server" :parameters="$parameters" />
<div class="flex gap-2">
<x-server.sidebar :server="$server" :parameters="$parameters" />
<div class="w-full">
@if ($server->isFunctional())
<div class="flex gap-2">
@@ -48,7 +48,6 @@
<div wire:loading.remove> No dynamic configurations found.</div>
@endif
</div>
@endif
</div>
</div>

View File

@@ -1,11 +1,13 @@
<div>
<x-server.navbar :server="$server" :parameters="$parameters" />
<div class="flex gap-2">
<x-server.sidebar :server="$server" :parameters="$parameters" />
<div class="w-full">
@if ($server->isFunctional())
@if ($server->isFunctional())
<div class="flex gap-2">
<x-server.sidebar :server="$server" :parameters="$parameters" />
<div class="w-full">
<livewire:server.proxy :server="$server" />
@endif
</div>
</div>
</div>
@else
<div>Server is not validated. Validate first.</div>
@endif
</div>

View File

@@ -17,7 +17,7 @@
<div class="py-4"><span class="font-bold text-red-500">WARNING:</span> You must delete
{{ currentTeam()->servers->count() - $server_limits }} servers,
or upgrade your subscription. {{ currentTeam()->servers->count() - $server_limits }} servers will be
deactivated in the next billing cycle.</div>
deactivated.</div>
@endif
<h2 class="pt-4">Manage your subscription</h2>
<div class="pb-4">Cancel, upgrade or downgrade your subscription.</div>