This commit is contained in:
Andras Bacsai
2023-05-31 14:57:42 +02:00
parent 25870dadd8
commit 8991de2610
8 changed files with 20 additions and 19 deletions

View File

@@ -9,6 +9,7 @@ class Deployments extends Component
{
public int $application_id;
public $deployments = [];
public int $deployments_count = 0;
public string $current_url;
public int $skip = 0;
public int $default_take = 8;
@@ -24,15 +25,14 @@ class Deployments extends Component
}
public function load_deployments(int|null $take = null)
{
ray('Take' . $take);
if ($take) {
ray('Take is not null');
$this->skip = $this->skip + $take;
}
$take = $this->default_take;
$this->deployments = Application::find($this->application_id)->deployments($this->skip, $take);
['deployments' => $deployments, 'count' => $count] = Application::find($this->application_id)->deployments($this->skip, $take);
$this->deployments = $deployments;
$this->deployments_count = $count;
if (count($this->deployments) !== 0 && count($this->deployments) < $take) {
$this->show_next = false;
return;

View File

@@ -37,7 +37,6 @@ class Form extends Component
{
$this->validate();
$this->application->preview_url_template = str_replace(' ', '', $this->application->preview_url_template);
ray($this->application->preview_url_template);
$this->application->save();
$this->generate_real_url();
}

View File

@@ -41,12 +41,12 @@ class Previews extends Component
$this->rate_limit_remaining = $rate_limit_remaining;
$this->pull_requests = $data->sortBy('number')->values();
}
public function deploy(int $pull_request_id, string|null $pull_request_html_url)
public function deploy(int $pull_request_id, string|null $pull_request_html_url = null)
{
try {
$this->set_deployment_uuid();
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
if (!$found) {
if (!$found && !is_null($pull_request_html_url)) {
ApplicationPreview::create([
'application_id' => $this->application->id,
'pull_request_id' => $pull_request_id,