Upgrade to Livewire 3 (#103)

* upgrade to livewire 3

* fix updater

* fix modal events

* fix modal events
This commit is contained in:
Saeed Vaziry
2024-02-04 18:11:22 +01:00
committed by GitHub
parent 3da1f4fe4c
commit 8bffefabef
98 changed files with 529 additions and 303 deletions

View File

@ -23,9 +23,9 @@ public function deploy(): void
$this->toast()->success(__('Deployment started!'));
$this->emitTo(DeploymentsList::class, '$refresh');
$this->dispatch('$refresh')->to(DeploymentsList::class);
$this->emitTo(DeploymentScript::class, '$refresh');
$this->dispatch('$refresh')->to(DeploymentScript::class);
} catch (SourceControlIsNotConnected $e) {
session()->flash('toast.type', 'error');
session()->flash('toast.message', $e->getMessage());

View File

@ -27,8 +27,8 @@ public function save(): void
session()->flash('status', 'script-updated');
$this->emitTo(Deploy::class, '$refresh');
$this->emitTo(AutoDeployment::class, '$refresh');
$this->dispatch('$refresh')->to(Deploy::class);
$this->dispatch('$refresh')->to(AutoDeployment::class);
}
public function render(): View

View File

@ -22,7 +22,7 @@ public function showLog(int $id): void
$deployment = $this->site->deployments()->findOrFail($id);
$this->logContent = $deployment->log->content;
$this->dispatchBrowserEvent('open-modal', 'show-log');
$this->dispatch('open-modal', 'show-log');
}
public function render(): View

View File

@ -27,7 +27,7 @@ public function save(): void
session()->flash('status', 'updating-env');
$this->emit(Deploy::class, '$refresh');
$this->dispatch('$refresh')->to(Deploy::class);
}
public function render(): View

View File

@ -13,7 +13,7 @@ public function render(): View
$event = Cache::get('broadcast');
if ($event) {
Cache::forget('broadcast');
$this->emit('broadcast', $event);
$this->dispatch('broadcast', $event);
}
return view('livewire.broadcast');

View File

@ -22,9 +22,9 @@ public function create(): void
{
app(\App\Actions\CronJob\CreateCronJob::class)->create($this->server, $this->all());
$this->emitTo(CronjobsList::class, '$refresh');
$this->dispatch('$refresh')->to(CronjobsList::class);
$this->dispatchBrowserEvent('created', true);
$this->dispatch('created');
}
public function render(): View

View File

@ -23,7 +23,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -45,7 +45,7 @@ public function restore(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('restored', true);
$this->dispatch('restored');
}
public function delete(): void
@ -55,7 +55,7 @@ public function delete(): void
$file->delete();
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -40,7 +40,7 @@ public function create(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('backup-created', true);
$this->dispatch('backup-created');
}
public function files(int $id): void
@ -48,7 +48,7 @@ public function files(int $id): void
$backup = Backup::query()->findOrFail($id);
$this->backup = $backup;
$this->files = $backup->files()->orderByDesc('id')->simplePaginate(1);
$this->dispatchBrowserEvent('show-files', true);
$this->dispatch('show-files');
}
public function backup(): void
@ -57,7 +57,7 @@ public function backup(): void
$this->files = $this->backup?->files()->orderByDesc('id')->simplePaginate();
$this->dispatchBrowserEvent('backup-running', true);
$this->dispatch('backup-running');
}
public function delete(): void
@ -67,7 +67,7 @@ public function delete(): void
$backup->delete();
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -40,7 +40,7 @@ public function create(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('database-created', true);
$this->dispatch('database-created');
}
public function delete(): void
@ -52,9 +52,9 @@ public function delete(): void
$this->refreshComponent([]);
$this->emitTo(DatabaseUserList::class, '$refresh');
$this->dispatch('$refresh')->to(DatabaseUserList::class);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -38,7 +38,7 @@ public function create(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('database-user-created', true);
$this->dispatch('database-user-created');
}
public function delete(): void
@ -50,9 +50,9 @@ public function delete(): void
$this->refreshComponent([]);
$this->emitTo(DatabaseList::class, '$refresh');
$this->dispatch('$refresh')->to(DatabaseList::class);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function viewPassword(int $id): void
@ -62,7 +62,7 @@ public function viewPassword(int $id): void
$this->viewPassword = $databaseUser->password;
$this->dispatchBrowserEvent('open-modal', 'database-user-password');
$this->dispatch('open-modal', 'database-user-password');
}
public function showLink(int $id): void
@ -73,7 +73,7 @@ public function showLink(int $id): void
$this->linkId = $id;
$this->link = $databaseUser->databases ?? [];
$this->dispatchBrowserEvent('open-modal', 'link-database-user');
$this->dispatch('open-modal', 'link-database-user');
}
public function link(): void
@ -85,7 +85,7 @@ public function link(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('linked', true);
$this->dispatch('linked');
}
public function render(): View

View File

@ -28,9 +28,9 @@ public function create(): void
{
app(CreateRule::class)->create($this->server, $this->all());
$this->emitTo(FirewallRulesList::class, '$refresh');
$this->dispatch('$refresh')->to(FirewallRulesList::class);
$this->dispatchBrowserEvent('created', true);
$this->dispatch('created');
}
public function render(): View

View File

@ -25,7 +25,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -26,9 +26,9 @@ public function add(): void
$this->all()
);
$this->emitTo(ChannelsList::class, '$refresh');
$this->dispatch('$refresh')->to(ChannelsList::class);
$this->dispatchBrowserEvent('added', true);
$this->dispatch('added');
}
public function render(): View

View File

@ -25,7 +25,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -56,7 +56,7 @@ public function uninstall(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function loadIni(int $id): void

View File

@ -33,7 +33,7 @@ public function submit(): void
session()->flash('status', 'profile-updated');
$this->emitTo(UserDropdown::class, '$refresh');
$this->dispatch('$refresh')->to(UserDropdown::class);
}
public function sendVerificationEmail(): void

View File

@ -21,9 +21,9 @@ public function create(): void
app(\App\Actions\Projects\CreateProject::class)
->create(auth()->user(), $this->inputs);
$this->emitTo(ProjectsList::class, '$refresh');
$this->dispatch('$refresh')->to(ProjectsList::class);
$this->dispatchBrowserEvent('created', true);
$this->dispatch('created');
}
public function render(): View

View File

@ -24,9 +24,9 @@ public function create(): void
{
app(\App\Actions\Queue\CreateQueue::class)->create($this->site, $this->all());
$this->emitTo(QueuesList::class, '$refresh');
$this->dispatch('$refresh')->to(QueuesList::class);
$this->dispatchBrowserEvent('created', true);
$this->dispatch('created');
}
public function render(): View

View File

@ -24,7 +24,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function start(Queue $queue): void

View File

@ -27,7 +27,7 @@ public function showLog(int $id): void
$log = $this->server->logs()->findOrFail($id);
$this->logContent = $log->content;
$this->dispatchBrowserEvent('open-modal', 'show-log');
$this->dispatch('open-modal', 'show-log');
}
public function render(): View

View File

@ -22,9 +22,9 @@ public function connect(): void
{
app(CreateServerProvider::class)->create(auth()->user(), $this->all());
$this->emitTo(ProvidersList::class, '$refresh');
$this->dispatch('$refresh')->to(ProvidersList::class);
$this->dispatchBrowserEvent('connected', true);
$this->dispatch('connected');
}
public function render(): View

View File

@ -25,7 +25,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -19,9 +19,9 @@ public function add(): void
$key->deployTo($this->server);
$this->emitTo(ServerKeysList::class, '$refresh');
$this->dispatch('$refresh')->to(ServerKeysList::class);
$this->dispatchBrowserEvent('added', true);
$this->dispatch('added');
}
public function render(): View

View File

@ -24,9 +24,9 @@ public function add(): void
$key->deployTo($this->server);
$this->emitTo(ServerKeysList::class, '$refresh');
$this->dispatch('$refresh')->to(ServerKeysList::class);
$this->dispatchBrowserEvent('added', true);
$this->dispatch('added');
}
public function render(): View

View File

@ -28,7 +28,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -21,7 +21,7 @@ public function refreshComponent(array $data): void
return;
}
$this->emit('refreshComponent');
$this->dispatch('refreshComponent');
}
public function render(): View

View File

@ -19,9 +19,9 @@ public function install(): void
{
app(InstallPHPMyAdminAction::class)->install($this->server, $this->all());
$this->dispatchBrowserEvent('started', true);
$this->dispatch('started');
$this->emitTo(ServicesList::class, '$refresh');
$this->dispatch('$refresh')->to(ServicesList::class);
}
public function render(): View

View File

@ -26,7 +26,7 @@ public function refreshComponent(array $data): void
return;
}
$this->emit('refreshComponent');
$this->dispatch('refreshComponent');
}
public function render(): View

View File

@ -20,9 +20,9 @@ public function connect(): void
{
app(ConnectSourceControl::class)->connect($this->all());
$this->emitTo(SourceControlsList::class, '$refresh');
$this->dispatch('$refresh')->to(SourceControlsList::class);
$this->dispatchBrowserEvent('connected', true);
$this->dispatch('connected');
}
public function render(): View

View File

@ -25,7 +25,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -19,9 +19,9 @@ public function add(): void
$this->all()
);
$this->emitTo(KeysList::class, '$refresh');
$this->dispatch('$refresh')->to(KeysList::class);
$this->dispatchBrowserEvent('added', true);
$this->dispatch('added');
}
public function render(): View

View File

@ -25,7 +25,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View

View File

@ -23,9 +23,9 @@ public function create(): void
{
app(\App\Actions\SSL\CreateSSL::class)->create($this->site, $this->all());
$this->emitTo(SslsList::class, '$refresh');
$this->dispatch('$refresh')->to(SslsList::class);
$this->dispatchBrowserEvent('created', true);
$this->dispatch('created');
}
public function render(): View

View File

@ -25,7 +25,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function refreshComponent(array $data): void
@ -34,7 +34,7 @@ public function refreshComponent(array $data): void
$this->toast()->error(__('SSL creation failed!'));
}
$this->emit('refreshComponent');
$this->dispatch('refreshComponent');
}
public function render(): View

View File

@ -32,9 +32,9 @@ public function connect(): void
{
app(CreateStorageProvider::class)->create(auth()->user(), $this->all());
$this->emitTo(ProvidersList::class, '$refresh');
$this->dispatch('$refresh')->to(ProvidersList::class);
$this->dispatchBrowserEvent('connected', true);
$this->dispatch('connected');
}
public function render(): View

View File

@ -25,7 +25,7 @@ public function delete(): void
$this->refreshComponent([]);
$this->dispatchBrowserEvent('confirmed', true);
$this->dispatch('confirmed');
}
public function render(): View