Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions web/src/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ export default {
deleteTask(id) {
return api.delete(`/tasks/${id}`)
},
reassignTask(id, agentId) {
return api.put(`/tasks/${id}/reassign`, { assigned_to: agentId })
},

// Context/Documentation
createDocumentation(data) {
Expand Down
20 changes: 20 additions & 0 deletions web/src/stores/taskStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,25 @@ export const useTaskStore = defineStore('tasks', () => {
}
}

const reassignTask = async (id, agentId) => {
error.value = null
try {
const updatedTask = await api.reassignTask(id, agentId)
const index = tasks.value.findIndex(t => t.id === id)
if (index !== -1) {
tasks.value[index] = updatedTask
}
if (currentTask.value?.id === id) {
currentTask.value = updatedTask
}
return updatedTask
} catch (err) {
error.value = err.message || 'Failed to reassign task'
console.error('Error reassigning task:', err)
throw err
}
}

const clearError = () => {
error.value = null
}
Expand All @@ -162,6 +181,7 @@ export const useTaskStore = defineStore('tasks', () => {
updateTask,
updateTaskStatus,
deleteTask,
reassignTask,
clearError
}
})
23 changes: 1 addition & 22 deletions web/src/views/ProjectDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -978,28 +978,7 @@ get_project_contexts() {
if (!reassigningTask.value) return

try {
const response = await fetch(`/api/tasks/${reassignmentData.taskId}/reassign`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
assigned_to: reassignmentData.agentId
})
})

if (!response.ok) {
const error = await response.text()
throw new Error(error)
}

const updatedTask = await response.json()

// Update the task store with the new task data
const taskIndex = taskStore.tasks.findIndex(t => t.id === updatedTask.id)
if (taskIndex !== -1) {
taskStore.tasks[taskIndex] = updatedTask
}
await taskStore.reassignTask(reassignmentData.taskId, reassignmentData.agentId)

showReassignTaskModal.value = false
reassigningTask.value = null
Expand Down
Loading