diff --git a/app/Livewire/Admin/Customers.php b/app/Livewire/Admin/Customers.php index 37fd7de..f52d1e1 100644 --- a/app/Livewire/Admin/Customers.php +++ b/app/Livewire/Admin/Customers.php @@ -10,6 +10,21 @@ use Livewire\Component; #[Layout('layouts.admin')] class Customers extends Component { + /** Suspend / reactivate a customer account (a guarded lifecycle action, not delete). */ + public function toggleSuspend(string $uuid): void + { + $customer = Customer::query()->where('uuid', $uuid)->first(); + if ($customer === null) { + return; + } + + $customer->update([ + 'status' => $customer->status === 'suspended' ? 'active' : 'suspended', + ]); + + $this->dispatch('notify', message: __('admin.customer_'.($customer->status === 'suspended' ? 'suspended' : 'reactivated'))); + } + public function render() { $locale = app()->getLocale(); @@ -31,7 +46,8 @@ class Customers extends Component 'plan' => $planKey !== null ? __('billing.plan.'.$planKey) : '—', 'mrr' => Number::currency($priceCents / 100, in: 'EUR', locale: $locale), 'instance' => $instance->subdomain ?? '—', - 'status' => $instance->status ?? $c->status ?? 'provisioning', + 'suspended' => $c->status === 'suspended', + 'status' => $c->status === 'suspended' ? 'suspended' : ($instance->status ?? $c->status ?? 'provisioning'), ]; })->all(); diff --git a/app/Livewire/Admin/HostDetail.php b/app/Livewire/Admin/HostDetail.php index 94defc2..5c27217 100644 --- a/app/Livewire/Admin/HostDetail.php +++ b/app/Livewire/Admin/HostDetail.php @@ -27,6 +27,28 @@ class HostDetail extends Component $this->host->refresh(); } + /** Adjust the capacity reserve (% of storage kept free for headroom). */ + public function saveReserve(int $reserve): void + { + $reserve = max(0, min(90, $reserve)); + $this->host->update(['reserve_pct' => $reserve]); + $this->dispatch('notify', message: __('hosts.detail.reserve_saved')); + } + + /** + * Drain / return a host: toggle between active and disabled. Disabled takes + * it out of placement (maintenance) without purging it — distinct from the + * destructive "remove host". Never touches a host mid-onboarding. + */ + public function toggleMaintenance(): void + { + if ($this->host->status === 'active') { + $this->host->update(['status' => 'disabled']); + } elseif ($this->host->status === 'disabled') { + $this->host->update(['status' => 'active']); + } + } + public function retry(): void { $run = $this->currentRun(); diff --git a/lang/de/admin.php b/lang/de/admin.php index 6306cb9..1baad03 100644 --- a/lang/de/admin.php +++ b/lang/de/admin.php @@ -55,6 +55,10 @@ return [ 'customers_sub' => 'Alle Kunden und ihre Pakete.', 'customers_empty' => 'Noch keine Kunden.', 'impersonate' => 'Verbinden', + 'suspend' => 'Sperren', + 'reactivate' => 'Entsperren', + 'customer_suspended' => 'Kunde gesperrt.', + 'customer_reactivated' => 'Kunde entsperrt.', 'by_plan' => 'Nach Paket', 'instances_sub' => 'Alle bereitgestellten Cloud-Instanzen.', 'instances_label' => 'Instanzen', diff --git a/lang/de/hosts.php b/lang/de/hosts.php index 93dfb4c..1f92a04 100644 --- a/lang/de/hosts.php +++ b/lang/de/hosts.php @@ -76,6 +76,11 @@ return [ 'never_seen' => 'Noch nie gesehen', 'committed' => ':gb GB belegt', 'reserve' => ':pct % Reserve', + 'reserve_label' => 'Reserve', + 'reserve_save' => 'Speichern', + 'reserve_saved' => 'Reserve aktualisiert.', + 'drain' => 'In Wartung', + 'activate' => 'Aktivieren', ], 'istatus' => [ diff --git a/lang/en/admin.php b/lang/en/admin.php index 0559a41..4fa41b3 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -55,6 +55,10 @@ return [ 'customers_sub' => 'All customers and their plans.', 'customers_empty' => 'No customers yet.', 'impersonate' => 'Connect', + 'suspend' => 'Suspend', + 'reactivate' => 'Reactivate', + 'customer_suspended' => 'Customer suspended.', + 'customer_reactivated' => 'Customer reactivated.', 'by_plan' => 'By plan', 'instances_sub' => 'All provisioned cloud instances.', 'instances_label' => 'instances', diff --git a/lang/en/hosts.php b/lang/en/hosts.php index e0def10..7992035 100644 --- a/lang/en/hosts.php +++ b/lang/en/hosts.php @@ -76,6 +76,11 @@ return [ 'never_seen' => 'Never seen', 'committed' => ':gb GB committed', 'reserve' => ':pct % reserve', + 'reserve_label' => 'Reserve', + 'reserve_save' => 'Save', + 'reserve_saved' => 'Reserve updated.', + 'drain' => 'Maintenance', + 'activate' => 'Activate', ], 'istatus' => [ diff --git a/resources/views/livewire/admin/customers.blade.php b/resources/views/livewire/admin/customers.blade.php index 92fe163..bffc8e6 100644 --- a/resources/views/livewire/admin/customers.blade.php +++ b/resources/views/livewire/admin/customers.blade.php @@ -27,15 +27,22 @@