LinkDesk/frontend/test-bulk-assignment.html

115 lines
4.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Bulk Assignment</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 50px auto;
padding: 20px;
}
.test-section {
margin: 20px 0;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
}
.success {
color: green;
}
.error {
color: red;
}
button {
padding: 10px 20px;
margin: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Bulk Assignment Test</h1>
<div class="test-section">
<h2>Test Instructions</h2>
<ol>
<li>Open the TaskBrowser in the application</li>
<li>Select multiple tasks using checkboxes</li>
<li>Right-click on a selected task</li>
<li>Click "Assign To" in the context menu</li>
<li>Select a user from the submenu</li>
<li>Verify that:
<ul>
<li>A success toast appears showing the count of assigned tasks</li>
<li>The task list refreshes automatically</li>
<li>The context menu closes</li>
<li>The selection is cleared</li>
<li>The tasks now show the assigned user</li>
</ul>
</li>
</ol>
</div>
<div class="test-section">
<h2>Implementation Checklist</h2>
<ul>
<li>✅ Created <code>handleBulkAssignment</code> method in TaskBrowser</li>
<li>✅ Extracts selected task IDs from selection state</li>
<li>✅ Calls <code>taskService.bulkAssignTasks</code> with task IDs and user ID</li>
<li>✅ Shows loading state during operation (<code>isLoading.value = true</code>)</li>
<li>✅ Displays success toast with count of assigned tasks</li>
<li>✅ Handles errors and displays error toast</li>
<li>✅ Refreshes task list after successful update (<code>await fetchTasks()</code>)</li>
<li>✅ Closes context menu after completion (<code>closeContextMenu()</code>)</li>
<li>✅ Clears selection after completion (<code>rowSelection.value = {}</code>)</li>
<li>✅ Connected to TaskBulkActionsMenu <code>@assignee-selected</code> event</li>
</ul>
</div>
<div class="test-section">
<h2>Requirements Validated</h2>
<ul>
<li>✅ Requirement 5.3: Updates all selected tasks to be assigned to the selected user</li>
<li>✅ Requirement 5.4: Displays success notification with count of tasks assigned</li>
<li>✅ Requirement 5.5: Displays error notification on failure and maintains original assignments</li>
<li>✅ Requirement 5.6: Refreshes task list to reflect changes</li>
<li>✅ Requirement 6.1: Closes context menu automatically after action</li>
<li>✅ Requirement 6.3: Clears task selections after action completes</li>
</ul>
</div>
<div class="test-section">
<h2>Error Handling</h2>
<p>The implementation includes proper error handling:</p>
<ul>
<li>Try-catch block wraps the entire operation</li>
<li>Loading state is properly managed in finally block</li>
<li>Error toast displays user-friendly message</li>
<li>Console logs detailed error for debugging</li>
<li>Backend handles atomicity (all or nothing)</li>
</ul>
</div>
<div class="test-section">
<h2>Backend Endpoint</h2>
<p>The backend endpoint is already implemented at:</p>
<code>PUT /tasks/bulk/assign</code>
<p>Request body:</p>
<pre>{
"task_ids": [1, 2, 3],
"assigned_user_id": 5
}</pre>
<p>Response:</p>
<pre>{
"success_count": 3,
"failed_count": 0,
"errors": []
}</pre>
</div>
</body>
</html>