mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-15 00:17:27 +00:00
fix(teams): hide progress bar on completed tasks
Clear progress_percent in DB on all terminal transitions (complete, cancel, fail, approve, reject). Also hide progress bar in UI for terminal statuses as a safety net (kanban, list, detail dialog).
This commit is contained in:
1 parent
99dd363b13
commit
8c662e7af4
4 files changed
+10
-4
No files matched your search
@@ -65,6 +65,7 @@ func (s *PGTeamStore) CompleteTask(ctx context.Context, taskID, teamID uuid.UUID
|
||||
res, err := tx.ExecContext(ctx,
|
||||
`UPDATE team_tasks SET status = $1, result = $2, locked_at = NULL, lock_expires_at = NULL,
|
||||
followup_at = NULL, followup_count = 0, followup_message = NULL, followup_channel = NULL, followup_chat_id = NULL,
|
||||
progress_percent = NULL,
|
||||
updated_at = $3
|
||||
WHERE id = $4 AND status = $5 AND team_id = $6`,
|
||||
store.TeamTaskStatusCompleted, result, time.Now(),
|
||||
@@ -98,6 +99,7 @@ func (s *PGTeamStore) CancelTask(ctx context.Context, taskID, teamID uuid.UUID,
|
||||
res, err := tx.ExecContext(ctx,
|
||||
`UPDATE team_tasks SET status = $1, result = $2, locked_at = NULL, lock_expires_at = NULL,
|
||||
followup_at = NULL, followup_count = 0, followup_message = NULL, followup_channel = NULL, followup_chat_id = NULL,
|
||||
progress_percent = NULL,
|
||||
updated_at = $3
|
||||
WHERE id = $4 AND status NOT IN ($5, $1) AND team_id = $6`,
|
||||
store.TeamTaskStatusCancelled, reason, now,
|
||||
@@ -131,6 +133,7 @@ func (s *PGTeamStore) FailTask(ctx context.Context, taskID, teamID uuid.UUID, er
|
||||
res, err := tx.ExecContext(ctx,
|
||||
`UPDATE team_tasks SET status = $1, result = $2, locked_at = NULL, lock_expires_at = NULL,
|
||||
followup_at = NULL, followup_count = 0, followup_message = NULL, followup_channel = NULL, followup_chat_id = NULL,
|
||||
progress_percent = NULL,
|
||||
updated_at = $3
|
||||
WHERE id = $4 AND status = $5 AND team_id = $6`,
|
||||
store.TeamTaskStatusFailed, "FAILED: "+errMsg, now,
|
||||
@@ -163,7 +166,8 @@ func (s *PGTeamStore) FailPendingTask(ctx context.Context, taskID, teamID uuid.U
|
||||
|
||||
now := time.Now()
|
||||
res, err := tx.ExecContext(ctx,
|
||||
`UPDATE team_tasks SET status = $1, result = $2, locked_at = NULL, lock_expires_at = NULL, updated_at = $3
|
||||
`UPDATE team_tasks SET status = $1, result = $2, locked_at = NULL, lock_expires_at = NULL,
|
||||
progress_percent = NULL, updated_at = $3
|
||||
WHERE id = $4 AND status IN ($5, $6) AND team_id = $7`,
|
||||
store.TeamTaskStatusFailed, "FAILED: "+errMsg, now,
|
||||
taskID, store.TeamTaskStatusPending, store.TeamTaskStatusBlocked, teamID,
|
||||
@@ -230,6 +234,7 @@ func (s *PGTeamStore) ApproveTask(ctx context.Context, taskID, teamID uuid.UUID,
|
||||
res, err := tx.ExecContext(ctx,
|
||||
`UPDATE team_tasks SET status = $1, locked_at = NULL, lock_expires_at = NULL,
|
||||
followup_at = NULL, followup_count = 0, followup_message = NULL, followup_channel = NULL, followup_chat_id = NULL,
|
||||
progress_percent = NULL,
|
||||
updated_at = $2
|
||||
WHERE id = $3 AND status = $4 AND team_id = $5`,
|
||||
store.TeamTaskStatusCompleted, now,
|
||||
@@ -263,6 +268,7 @@ func (s *PGTeamStore) RejectTask(ctx context.Context, taskID, teamID uuid.UUID,
|
||||
res, err := tx.ExecContext(ctx,
|
||||
`UPDATE team_tasks SET status = $1, result = $2, locked_at = NULL, lock_expires_at = NULL,
|
||||
followup_at = NULL, followup_count = 0, followup_message = NULL, followup_channel = NULL, followup_chat_id = NULL,
|
||||
progress_percent = NULL,
|
||||
updated_at = $3
|
||||
WHERE id = $4 AND status = $5 AND team_id = $6`,
|
||||
store.TeamTaskStatusCancelled, reason, now,
|
||||
|
||||
@@ -104,7 +104,7 @@ export const KanbanCard = memo(function KanbanCard({ task, isTeamV2, emojiLookup
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{isTeamV2 && task.progress_percent != null && task.progress_percent > 0 && (
|
||||
{isTeamV2 && task.progress_percent != null && task.progress_percent > 0 && !isTerminalStatus(task.status) && (
|
||||
<div className="mt-2 flex items-center gap-1.5">
|
||||
<div className="h-1.5 flex-1 rounded-full bg-muted">
|
||||
<div className="h-full rounded-full bg-primary transition-all" style={{ width: `${task.progress_percent}%` }} />
|
||||
|
||||
@@ -121,7 +121,7 @@ export function TaskDetailDialog({
|
||||
)}
|
||||
|
||||
{/* Progress bar (V2) */}
|
||||
{isTeamV2 && task.progress_percent != null && task.progress_percent > 0 && (
|
||||
{isTeamV2 && task.progress_percent != null && task.progress_percent > 0 && !isTerminalStatus(task.status) && (
|
||||
<div className="space-y-1">
|
||||
<div className="flex justify-between text-xs text-muted-foreground">
|
||||
<span>{t("tasks.detail.progress")}</span>
|
||||
|
||||
@@ -80,7 +80,7 @@ export function TaskList({
|
||||
{task.task_type && task.task_type !== "general" && (
|
||||
<Badge variant="outline" className="mt-0.5 text-[10px]">{task.task_type}</Badge>
|
||||
)}
|
||||
{isTeamV2 && task.progress_percent != null && task.progress_percent > 0 && (
|
||||
{isTeamV2 && task.progress_percent != null && task.progress_percent > 0 && !isTerminalStatus(task.status) && (
|
||||
<div className="mt-1 flex items-center gap-1.5">
|
||||
<div className="h-1.5 flex-1 rounded-full bg-muted">
|
||||
<div className="h-full rounded-full bg-primary transition-all" style={{ width: `${task.progress_percent}%` }} />
|
||||
|
||||
Reference in new issue
Block a user