This commit is contained in:
Andras Bacsai
2023-06-15 09:15:41 +02:00
parent 384ab2dd18
commit f79b3841c7
40 changed files with 119 additions and 197 deletions

View File

@@ -12,7 +12,7 @@ class Danger extends Component
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function delete()
{

View File

@@ -3,7 +3,6 @@
namespace App\Http\Livewire\Project\Application;
use App\Jobs\ApplicationContainerStatusJob;
use App\Jobs\ContainerStopJob;
use App\Models\Application;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
@@ -17,7 +16,7 @@ class Deploy extends Component
public $destination;
public array $parameters;
protected string $deployment_uuid;
protected string $deploymentUuid;
protected array $command = [];
protected $source;
@@ -27,7 +26,7 @@ class Deploy extends Component
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
$this->application = Application::where('id', $this->applicationId)->first();
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
}
@@ -35,10 +34,9 @@ class Deploy extends Component
{
$this->application->refresh();
}
protected function set_deployment_uuid()
protected function setDeploymentUuid()
{
// Create Deployment ID
$this->deployment_uuid = new Cuid2(7);
$this->deploymentUuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deployment_uuid;
}
public function deploy(bool $force = false, bool|null $debug = null)
@@ -47,7 +45,7 @@ class Deploy extends Component
$this->application->settings->is_debug_enabled = true;
$this->application->settings->save();
}
$this->set_deployment_uuid();
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
@@ -65,7 +63,7 @@ class Deploy extends Component
public function stop()
{
instant_remote_process(["docker rm -f {$this->application->uuid}"], $this->application->destination->server);
$this->application->status = get_container_status(server: $this->application->destination->server, container_id: $this->application->uuid);
$this->application->status = 'stopped';
$this->application->save();
$this->emit('applicationStatusChanged');
}

View File

@@ -20,7 +20,7 @@ class Add extends Component
];
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function submit()
{

View File

@@ -17,7 +17,7 @@ class Show extends Component
];
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function submit()
{

View File

@@ -20,7 +20,7 @@ class Previews extends Component
public function mount()
{
$this->pull_requests = collect();
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function loadStatus($pull_request_id)
{
@@ -30,7 +30,7 @@ class Previews extends Component
pull_request_id: $pull_request_id
));
}
protected function set_deployment_uuid()
protected function setDeploymentUuid()
{
$this->deployment_uuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deployment_uuid;
@@ -49,7 +49,7 @@ class Previews extends Component
public function deploy(int $pull_request_id, string|null $pull_request_html_url = null)
{
try {
$this->set_deployment_uuid();
$this->setDeploymentUuid();
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
if (!$found && !is_null($pull_request_html_url)) {
ApplicationPreview::create([

View File

@@ -16,7 +16,7 @@ class Rollback extends Component
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function rollbackImage($commit)
{

View File

@@ -2,10 +2,6 @@
namespace App\Http\Livewire\Project\Application\Storages;
use App\Models\Application;
use App\Models\LocalPersistentVolume;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Route;
use Livewire\Component;
class Add extends Component
@@ -23,7 +19,7 @@ class Add extends Component
];
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function submit()
{