- 2.x - sites finishing

This commit is contained in:
Saeed Vaziry
2024-10-06 16:06:51 +02:00
parent 3c50e2c947
commit c24b4b7333
82 changed files with 1250 additions and 345 deletions

View File

@ -79,11 +79,19 @@ public function getWidgets(): array
public function getHeaderActions(): array
{
$actions = [];
$actions = [
Action::make('read-the-docs')
->label('Read the Docs')
->icon('heroicon-o-document-text')
->color('gray')
->url('https://vitodeploy.com/sites/application.html')
->openUrlInNewTab(),
];
$actionsGroup = [];
if (in_array(SiteFeature::DEPLOYMENT, $this->site->type()->supportedFeatures())) {
$actions[] = $this->deployAction();
$actionsGroup[] = $this->autoDeploymentAction();
$actionsGroup[] = $this->deploymentScriptAction();
}
@ -130,6 +138,27 @@ private function deployAction(): Action
});
}
private function autoDeploymentAction(): Action
{
return Action::make('auto-deployment')
->label(fn () => $this->site->isAutoDeployment() ? 'Disable Auto Deployment' : 'Enable Auto Deployment')
->modalHeading(fn () => $this->site->isAutoDeployment() ? 'Disable Auto Deployment' : 'Enable Auto Deployment')
->modalIconColor(fn () => $this->site->isAutoDeployment() ? 'red' : 'green')
->requiresConfirmation()
->action(function () {
run_action($this, function () {
$this->site->isAutoDeployment()
? $this->site->disableAutoDeployment()
: $this->site->enableAutoDeployment();
Notification::make()
->success()
->title('Auto deployment '.($this->site->isAutoDeployment() ? 'disabled' : 'enabled').'!')
->send();
});
});
}
private function deploymentScriptAction(): Action
{
return Action::make('deployment-script')