Merge pull request #1387 from Dokploy/1347-see-all-the-10-last-deployments-for-this-compose-show-all

feat(deployments): improve deployment list display and cleanup logic
This commit is contained in:
Mauricio Siu 2025-03-02 03:52:44 -06:00 committed by GitHub
commit 9c74b18e37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 7 deletions

View File

@ -73,15 +73,14 @@ export const ShowDeployments = ({ applicationId }: Props) => {
</div> </div>
) : ( ) : (
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
{deployments?.map((deployment) => ( {deployments?.map((deployment, index) => (
<div <div
key={deployment.deploymentId} key={deployment.deploymentId}
className="flex items-center justify-between rounded-lg border p-4 gap-2" className="flex items-center justify-between rounded-lg border p-4 gap-2"
> >
<div className="flex flex-col"> <div className="flex flex-col">
<span className="flex items-center gap-4 font-medium capitalize text-foreground"> <span className="flex items-center gap-4 font-medium capitalize text-foreground">
{deployment.status} {index + 1}. {deployment.status}
<StatusTooltip <StatusTooltip
status={deployment?.status} status={deployment?.status}
className="size-2.5" className="size-2.5"

View File

@ -306,7 +306,7 @@ const removeLastTenDeployments = async (
}); });
if (deploymentList.length > 10) { if (deploymentList.length > 10) {
const deploymentsToDelete = deploymentList.slice(10); const deploymentsToDelete = deploymentList.slice(9);
if (serverId) { if (serverId) {
let command = ""; let command = "";
for (const oldDeployment of deploymentsToDelete) { for (const oldDeployment of deploymentsToDelete) {
@ -342,7 +342,7 @@ const removeLastTenComposeDeployments = async (
if (deploymentList.length > 10) { if (deploymentList.length > 10) {
if (serverId) { if (serverId) {
let command = ""; let command = "";
const deploymentsToDelete = deploymentList.slice(10); const deploymentsToDelete = deploymentList.slice(9);
for (const oldDeployment of deploymentsToDelete) { for (const oldDeployment of deploymentsToDelete) {
const logPath = path.join(oldDeployment.logPath); const logPath = path.join(oldDeployment.logPath);
@ -354,7 +354,7 @@ const removeLastTenComposeDeployments = async (
await execAsyncRemote(serverId, command); await execAsyncRemote(serverId, command);
} else { } else {
const deploymentsToDelete = deploymentList.slice(10); const deploymentsToDelete = deploymentList.slice(9);
for (const oldDeployment of deploymentsToDelete) { for (const oldDeployment of deploymentsToDelete) {
const logPath = path.join(oldDeployment.logPath); const logPath = path.join(oldDeployment.logPath);
if (existsSync(logPath)) { if (existsSync(logPath)) {
@ -376,7 +376,7 @@ export const removeLastTenPreviewDeploymenById = async (
}); });
if (deploymentList.length > 10) { if (deploymentList.length > 10) {
const deploymentsToDelete = deploymentList.slice(10); const deploymentsToDelete = deploymentList.slice(9);
if (serverId) { if (serverId) {
let command = ""; let command = "";
for (const oldDeployment of deploymentsToDelete) { for (const oldDeployment of deploymentsToDelete) {