feat: add redeploy endpoint — rebuild from latest git/zip source and deploy new version
- Backend: added redeployApplication() to DeploymentsService that creates a new deployment record and re-runs the full build+deploy pipeline - Backend: added POST /deployments/applications/:appId/redeploy endpoint - Frontend: added Redeploy button on app detail page, visible after first deploy when no build is in progress - For git-based apps: pulls latest code from repo on each redeploy - For zip-based apps: rebuilds from last uploaded source code
This commit is contained in:
@@ -94,6 +94,15 @@ export default function AppDetailPage() {
|
||||
onError: () => toast.error('Failed to restart application'),
|
||||
});
|
||||
|
||||
const redeployMutation = useMutation({
|
||||
mutationFn: () => api.post(`/deployments/applications/${appId}/redeploy`),
|
||||
onSuccess: () => {
|
||||
invalidateAll();
|
||||
toast.success('Redeploy triggered — building new version from latest source');
|
||||
},
|
||||
onError: () => toast.error('Failed to trigger redeploy'),
|
||||
});
|
||||
|
||||
const deleteMutation = useMutation({
|
||||
mutationFn: () => api.delete(`/applications/${appId}`),
|
||||
onSuccess: () => {
|
||||
@@ -230,6 +239,18 @@ export default function AppDetailPage() {
|
||||
{restartMutation.isPending ? '⏳...' : '🔄 Restart'}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* Redeploy: rebuild from latest git/code */}
|
||||
{!isInProgress && (
|
||||
<button
|
||||
onClick={() => redeployMutation.mutate()}
|
||||
disabled={redeployMutation.isPending}
|
||||
className="btn-primary text-sm disabled:opacity-50"
|
||||
title="Rebuild from latest source code and deploy new version"
|
||||
>
|
||||
{redeployMutation.isPending ? '⏳ Rebuilding...' : '🔄 Redeploy'}
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user