mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
Force SSL and Multi SSL (#456)
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Support\Enums\MaxWidth;
|
||||
|
||||
class Index extends Page
|
||||
@ -44,6 +45,24 @@ protected function getHeaderActions(): array
|
||||
->color('gray')
|
||||
->url('https://vitodeploy.com/sites/ssl')
|
||||
->openUrlInNewTab(),
|
||||
Action::make('force-ssl')
|
||||
->label('Force SSL')
|
||||
->tooltip(fn () => $this->site->force_ssl ? 'Disable force SSL' : 'Enable force SSL')
|
||||
->icon(fn () => $this->site->force_ssl ? 'icon-force-ssl-enabled' : 'icon-force-ssl-disabled')
|
||||
->requiresConfirmation()
|
||||
->modalSubmitActionLabel(fn () => $this->site->force_ssl ? 'Disable' : 'Enable')
|
||||
->action(function () {
|
||||
$this->site->update([
|
||||
'force_ssl' => ! $this->site->force_ssl,
|
||||
]);
|
||||
$this->site->webserver()->updateVHost($this->site);
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('SSL status has been updated.')
|
||||
->send();
|
||||
$this->dispatch('$refresh');
|
||||
})
|
||||
->color('gray'),
|
||||
CreateAction::make('create')
|
||||
->label('New Certificate')
|
||||
->icon('heroicon-o-lock-closed')
|
||||
|
@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Web\Pages\Servers\Sites\Pages\SSL\Widgets;
|
||||
|
||||
use App\Actions\SSL\ActivateSSL;
|
||||
use App\Actions\SSL\DeleteSSL;
|
||||
use App\Models\Site;
|
||||
use App\Models\Ssl;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Tables\Actions\Action;
|
||||
use Filament\Tables\Actions\DeleteAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Widgets\TableWidget as Widget;
|
||||
@ -27,6 +30,9 @@ protected function getTableQuery(): Builder
|
||||
protected function getTableColumns(): array
|
||||
{
|
||||
return [
|
||||
IconColumn::make('is_active')
|
||||
->color(fn (Ssl $record) => $record->is_active ? 'green' : 'gray')
|
||||
->icon(fn (Ssl $record) => $record->is_active ? 'heroicon-o-lock-closed' : 'heroicon-o-lock-open'),
|
||||
TextColumn::make('type')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
@ -52,6 +58,25 @@ public function table(Table $table): Table
|
||||
->query($this->getTableQuery())
|
||||
->columns($this->getTableColumns())
|
||||
->actions([
|
||||
Action::make('activate-ssl')
|
||||
->hiddenLabel()
|
||||
->visible(fn (Ssl $record) => ! $record->is_active)
|
||||
->tooltip('Activate SSL')
|
||||
->icon('heroicon-o-lock-closed')
|
||||
->authorize(fn (Ssl $record) => auth()->user()->can('update', [$record->site, $this->site->server]))
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Activate SSL')
|
||||
->modalSubmitActionLabel('Activate')
|
||||
->action(function (Ssl $record) {
|
||||
run_action($this, function () use ($record) {
|
||||
app(ActivateSSL::class)->activate($record);
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('SSL has been activated.')
|
||||
->send();
|
||||
});
|
||||
}),
|
||||
Action::make('logs')
|
||||
->hiddenLabel()
|
||||
->tooltip('Logs')
|
||||
|
@ -82,7 +82,9 @@ public function getHeaderActions(): array
|
||||
|
||||
if (in_array(SiteFeature::DEPLOYMENT, $this->site->type()->supportedFeatures())) {
|
||||
$actions[] = $this->deployAction();
|
||||
$actionsGroup[] = $this->autoDeploymentAction();
|
||||
if ($this->site->sourceControl) {
|
||||
$actionsGroup[] = $this->autoDeploymentAction();
|
||||
}
|
||||
$actionsGroup[] = $this->deploymentScriptAction();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user