Add real-time deployment updates and refactor JavaScript

- Add deploy stats (last deploy time, total count) to dashboard
- Add recent-deployments API endpoint for real-time updates
- Add live build logs to deployments history page
- Fix git clone regression (preserve entrypoint for simple clones)
- Refactor JavaScript into shared app.js with page init functions
- Deploy button disables immediately on click
- Auto-refresh deployment list and logs during builds
- Format JavaScript with Prettier (4-space indent)
This commit is contained in:
2026-01-01 05:22:56 +07:00
parent 307955dae1
commit ab7e917b03
9 changed files with 837 additions and 398 deletions

View File

@@ -302,3 +302,24 @@ func LatestDeploymentForApp(
return deploy, nil
}
// CountDeploymentsByAppID returns the total number of deployments for an app.
func CountDeploymentsByAppID(
ctx context.Context,
deployDB *database.Database,
appID string,
) (int, error) {
var count int
row := deployDB.QueryRow(ctx,
"SELECT COUNT(*) FROM deployments WHERE app_id = ?",
appID,
)
err := row.Scan(&count)
if err != nil {
return 0, fmt.Errorf("counting deployments: %w", err)
}
return count, nil
}