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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user