fix: cancel any deployments + queue next

This commit is contained in:
Andras Bacsai 2023-10-17 11:10:33 +02:00
parent fbb5f2ca2e
commit 5d95d8b79a
2 changed files with 7 additions and 3 deletions

View File

@ -60,12 +60,16 @@ public function cancel()
$previous_logs[] = $new_log_entry;
$this->application_deployment_queue->update([
'logs' => json_encode($previous_logs, flags: JSON_THROW_ON_ERROR),
'current_process_id' => null,
'status' => ApplicationDeploymentStatus::CANCELLED_BY_USER->value,
]);
}
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->application_deployment_queue->update([
'current_process_id' => null,
'status' => ApplicationDeploymentStatus::CANCELLED_BY_USER->value,
]);
queue_next_deployment($this->application);
}
}
}

View File

@ -7,6 +7,6 @@
@endif
@if (data_get($application_deployment_queue, 'status') === 'in_progress' ||
data_get($application_deployment_queue, 'status') === 'queued')
<x-forms.button wire:click.prevent="cancel">Cancel deployment</x-forms.button>
<x-forms.button wire:click.prevent="cancel">Cancel Deployment</x-forms.button>
@endif
</div>