deployments
This commit is contained in:
@@ -10,16 +10,32 @@ class Deployments extends Component
|
||||
public int $application_id;
|
||||
public $deployments = [];
|
||||
public string $current_url;
|
||||
public int $skip = 0;
|
||||
public int $default_take = 8;
|
||||
public bool $show_next = true;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->current_url = url()->current();
|
||||
}
|
||||
public function reloadDeployments()
|
||||
public function reload_deployments()
|
||||
{
|
||||
$this->loadDeployments();
|
||||
$this->load_deployments();
|
||||
}
|
||||
public function loadDeployments()
|
||||
public function load_deployments(int|null $take = null)
|
||||
{
|
||||
$this->deployments = Application::find($this->application_id)->deployments();
|
||||
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);
|
||||
|
||||
if (count($this->deployments) !== 0 && count($this->deployments) < $take) {
|
||||
$this->show_next = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,9 +144,10 @@ class Application extends BaseModel
|
||||
return $this->morphMany(LocalPersistentVolume::class, 'resource');
|
||||
}
|
||||
|
||||
public function deployments()
|
||||
public function deployments(int $skip = 0, int $take = 10)
|
||||
{
|
||||
return ApplicationDeploymentQueue::where('application_id', $this->id)->orderBy('created_at', 'desc')->get();
|
||||
ray('Skip ' . $skip . ' Take ' . $take);
|
||||
return ApplicationDeploymentQueue::where('application_id', $this->id)->orderBy('created_at', 'desc')->skip($skip)->take($take)->get();
|
||||
}
|
||||
public function get_deployment(string $deployment_uuid)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user