fix(ui): resolve dependency 'Not found' issue when filtering
- now correctly displays dependencies that exist but are filtered out of view
This commit is contained in:
@@ -1346,10 +1346,6 @@ function registerCommands(programInstance) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
|
||||||
chalk.blue(`Setting status of task(s) ${taskId} to: ${status}`)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Find project root for tag resolution
|
// Find project root for tag resolution
|
||||||
const projectRoot = findProjectRoot();
|
const projectRoot = findProjectRoot();
|
||||||
if (!projectRoot) {
|
if (!projectRoot) {
|
||||||
@@ -1357,6 +1353,14 @@ function registerCommands(programInstance) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolve tag using standard pattern and show current tag context
|
||||||
|
const resolvedTag = tag || getCurrentTag(projectRoot) || 'master';
|
||||||
|
displayCurrentTagIndicator(resolvedTag);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
chalk.blue(`Setting status of task(s) ${taskId} to: ${status}`)
|
||||||
|
);
|
||||||
|
|
||||||
await setTaskStatus(tasksPath, taskId, status, { projectRoot, tag });
|
await setTaskStatus(tasksPath, taskId, status, { projectRoot, tag });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -96,10 +96,30 @@ async function setTaskStatus(
|
|||||||
const taskIds = taskIdInput.split(',').map((id) => id.trim());
|
const taskIds = taskIdInput.split(',').map((id) => id.trim());
|
||||||
const updatedTasks = [];
|
const updatedTasks = [];
|
||||||
|
|
||||||
// Update each task
|
// Update each task and capture old status for display
|
||||||
for (const id of taskIds) {
|
for (const id of taskIds) {
|
||||||
|
// Capture old status before updating
|
||||||
|
let oldStatus = 'unknown';
|
||||||
|
|
||||||
|
if (id.includes('.')) {
|
||||||
|
// Handle subtask
|
||||||
|
const [parentId, subtaskId] = id
|
||||||
|
.split('.')
|
||||||
|
.map((id) => parseInt(id, 10));
|
||||||
|
const parentTask = data.tasks.find((t) => t.id === parentId);
|
||||||
|
if (parentTask?.subtasks) {
|
||||||
|
const subtask = parentTask.subtasks.find((st) => st.id === subtaskId);
|
||||||
|
oldStatus = subtask?.status || 'pending';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Handle regular task
|
||||||
|
const taskId = parseInt(id, 10);
|
||||||
|
const task = data.tasks.find((t) => t.id === taskId);
|
||||||
|
oldStatus = task?.status || 'pending';
|
||||||
|
}
|
||||||
|
|
||||||
await updateSingleTaskStatus(tasksPath, id, newStatus, data, !isMcpMode);
|
await updateSingleTaskStatus(tasksPath, id, newStatus, data, !isMcpMode);
|
||||||
updatedTasks.push(id);
|
updatedTasks.push({ id, oldStatus, newStatus });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the raw data structure with the modified tasks
|
// Update the raw data structure with the modified tasks
|
||||||
@@ -126,16 +146,15 @@ async function setTaskStatus(
|
|||||||
|
|
||||||
// Display success message - only in CLI mode
|
// Display success message - only in CLI mode
|
||||||
if (!isMcpMode) {
|
if (!isMcpMode) {
|
||||||
for (const id of updatedTasks) {
|
for (const updateInfo of updatedTasks) {
|
||||||
const task = findTaskById(data.tasks, id);
|
const { id, oldStatus, newStatus: updatedStatus } = updateInfo;
|
||||||
const taskName = task ? task.title : id;
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
boxen(
|
boxen(
|
||||||
chalk.white.bold(`Successfully updated task ${id} status:`) +
|
chalk.white.bold(`Successfully updated task ${id} status:`) +
|
||||||
'\n' +
|
'\n' +
|
||||||
`From: ${chalk.yellow(task ? task.status : 'unknown')}\n` +
|
`From: ${chalk.yellow(oldStatus)}\n` +
|
||||||
`To: ${chalk.green(newStatus)}`,
|
`To: ${chalk.green(updatedStatus)}`,
|
||||||
{ padding: 1, borderColor: 'green', borderStyle: 'round' }
|
{ padding: 1, borderColor: 'green', borderStyle: 'round' }
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -145,9 +164,10 @@ async function setTaskStatus(
|
|||||||
// Return success value for programmatic use
|
// Return success value for programmatic use
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
updatedTasks: updatedTasks.map((id) => ({
|
updatedTasks: updatedTasks.map(({ id, oldStatus, newStatus }) => ({
|
||||||
id,
|
id,
|
||||||
status: newStatus
|
oldStatus,
|
||||||
|
newStatus
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -821,9 +821,8 @@ function formatTaskId(id) {
|
|||||||
* @param {Array} tasks - The tasks array
|
* @param {Array} tasks - The tasks array
|
||||||
* @param {string|number} taskId - The task ID to find
|
* @param {string|number} taskId - The task ID to find
|
||||||
* @param {Object|null} complexityReport - Optional pre-loaded complexity report
|
* @param {Object|null} complexityReport - Optional pre-loaded complexity report
|
||||||
* @returns {Object|null} The task object or null if not found
|
|
||||||
* @param {string} [statusFilter] - Optional status to filter subtasks by
|
* @param {string} [statusFilter] - Optional status to filter subtasks by
|
||||||
* @returns {{task: Object|null, originalSubtaskCount: number|null}} The task object (potentially with filtered subtasks) and the original subtask count if filtered, or nulls if not found.
|
* @returns {{task: Object|null, originalSubtaskCount: number|null, originalSubtasks: Array|null}} The task object (potentially with filtered subtasks), the original subtask count, and original subtasks array if filtered, or nulls if not found.
|
||||||
*/
|
*/
|
||||||
function findTaskById(
|
function findTaskById(
|
||||||
tasks,
|
tasks,
|
||||||
@@ -844,7 +843,7 @@ function findTaskById(
|
|||||||
const parentTask = tasks.find((t) => t.id === parentId);
|
const parentTask = tasks.find((t) => t.id === parentId);
|
||||||
|
|
||||||
if (!parentTask || !parentTask.subtasks) {
|
if (!parentTask || !parentTask.subtasks) {
|
||||||
return { task: null, originalSubtaskCount: null };
|
return { task: null, originalSubtaskCount: null, originalSubtasks: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
const subtask = parentTask.subtasks.find((st) => st.id === subtaskId);
|
const subtask = parentTask.subtasks.find((st) => st.id === subtaskId);
|
||||||
@@ -863,11 +862,16 @@ function findTaskById(
|
|||||||
addComplexityToTask(subtask, complexityReport);
|
addComplexityToTask(subtask, complexityReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { task: subtask || null, originalSubtaskCount: null };
|
return {
|
||||||
|
task: subtask || null,
|
||||||
|
originalSubtaskCount: null,
|
||||||
|
originalSubtasks: null
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let taskResult = null;
|
let taskResult = null;
|
||||||
const originalSubtaskCount = null;
|
let originalSubtaskCount = null;
|
||||||
|
let originalSubtasks = null;
|
||||||
|
|
||||||
// Find the main task
|
// Find the main task
|
||||||
const id = parseInt(taskId, 10);
|
const id = parseInt(taskId, 10);
|
||||||
@@ -875,13 +879,17 @@ function findTaskById(
|
|||||||
|
|
||||||
// If task not found, return nulls
|
// If task not found, return nulls
|
||||||
if (!task) {
|
if (!task) {
|
||||||
return { task: null, originalSubtaskCount: null };
|
return { task: null, originalSubtaskCount: null, originalSubtasks: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
taskResult = task;
|
taskResult = task;
|
||||||
|
|
||||||
// If task found and statusFilter provided, filter its subtasks
|
// If task found and statusFilter provided, filter its subtasks
|
||||||
if (statusFilter && task.subtasks && Array.isArray(task.subtasks)) {
|
if (statusFilter && task.subtasks && Array.isArray(task.subtasks)) {
|
||||||
|
// Store original subtasks and count before filtering
|
||||||
|
originalSubtasks = [...task.subtasks]; // Clone the original subtasks array
|
||||||
|
originalSubtaskCount = task.subtasks.length;
|
||||||
|
|
||||||
// Clone the task to avoid modifying the original array
|
// Clone the task to avoid modifying the original array
|
||||||
const filteredTask = { ...task };
|
const filteredTask = { ...task };
|
||||||
filteredTask.subtasks = task.subtasks.filter(
|
filteredTask.subtasks = task.subtasks.filter(
|
||||||
@@ -898,8 +906,8 @@ function findTaskById(
|
|||||||
addComplexityToTask(taskResult, complexityReport);
|
addComplexityToTask(taskResult, complexityReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the found task and original subtask count
|
// Return the found task, original subtask count, and original subtasks
|
||||||
return { task: taskResult, originalSubtaskCount };
|
return { task: taskResult, originalSubtaskCount, originalSubtasks };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user