feat: dashboard live deployment view

This commit is contained in:
Andras Bacsai
2024-01-27 18:44:40 +01:00
parent c46d38907e
commit 561e424a7d
11 changed files with 118 additions and 41 deletions

View File

@@ -2,18 +2,35 @@
namespace App\Livewire;
use App\Models\ApplicationDeploymentQueue;
use App\Models\Project;
use App\Models\Server;
use Illuminate\Support\Collection;
use Livewire\Component;
class Dashboard extends Component
{
public $projects = [];
public $servers = [];
public Collection $servers;
public Collection $deployments_per_server;
public function mount()
{
$this->servers = Server::ownedByCurrentTeam()->get();
$this->projects = Project::ownedByCurrentTeam()->get();
$this->get_deployments();
}
public function get_deployments()
{
$this->deployments_per_server = ApplicationDeploymentQueue::whereIn("status", ["in_progress", "queued"])->whereIn("server_id", $this->servers->pluck("id"))->get([
"id",
"application_id",
"application_name",
"deployment_url",
"pull_request_id",
"server_name",
"server_id",
"status"
])->sortBy('id');
}
// public function getIptables()
// {

View File

@@ -54,8 +54,7 @@ class Heading extends Component
}
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
application: $this->application,
deployment_uuid: $this->deploymentUuid,
force_rebuild: false,
is_new_deployment: true,
@@ -83,8 +82,7 @@ class Heading extends Component
}
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
application: $this->application,
deployment_uuid: $this->deploymentUuid,
force_rebuild: $force_rebuild,
);
@@ -113,8 +111,7 @@ class Heading extends Component
{
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
application: $this->application,
deployment_uuid: $this->deploymentUuid,
restart_only: true,
is_new_deployment: true,
@@ -130,8 +127,7 @@ class Heading extends Component
{
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
application: $this->application,
deployment_uuid: $this->deploymentUuid,
restart_only: true,
);

View File

@@ -47,8 +47,7 @@ class Previews extends Component
]);
}
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
application: $this->application,
deployment_uuid: $this->deployment_uuid,
force_rebuild: false,
pull_request_id: $pull_request_id,

View File

@@ -24,8 +24,7 @@ class Rollback extends Component
$deployment_uuid = new Cuid2(7);
queue_application_deployment(
application_id: $this->application->id,
server_id: $this->application->destination->server->id,
application: $this->application,
deployment_uuid: $deployment_uuid,
commit: $commit,
force_rebuild: false,