Add archive command
This commit is contained in:
parent
0ea545202b
commit
66fac74eda
@ -1,6 +1,7 @@
|
|||||||
# 0.10.0
|
# 0.10.0
|
||||||
|
|
||||||
* Added task archive, tasks can now be sent to the archive folder and restored from the archive folder
|
* Added task archive, tasks can now be sent to the archive folder and restored from the archive folder
|
||||||
|
* Added commands to archive and restore multiple tasks
|
||||||
* Fixed debounced updates on burndown chart
|
* Fixed debounced updates on burndown chart
|
||||||
|
|
||||||
# 0.9.3
|
# 0.9.3
|
||||||
|
@ -54,7 +54,8 @@ The following commands are available:
|
|||||||
- `Kanbn: Open board` will open open the Kanbn board.
|
- `Kanbn: Open board` will open open the Kanbn board.
|
||||||
- `Kanbn: Open burndown chart` will open a burndown chart.
|
- `Kanbn: Open burndown chart` will open a burndown chart.
|
||||||
- `Kanbn: Add task` will open the task editor.
|
- `Kanbn: Add task` will open the task editor.
|
||||||
- `Kanbn: Restore task` will restore tasks from the archive.
|
- `Kanbn: Archive tasks` will send tasks to the archive.
|
||||||
|
- `Kanbn: Restore tasks` will restore tasks from the archive.
|
||||||
|
|
||||||
## Configuration settings
|
## Configuration settings
|
||||||
|
|
||||||
|
@ -136,9 +136,55 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Register a command to archive tasks.
|
||||||
|
context.subscriptions.push(
|
||||||
|
vscode.commands.registerCommand("kanbn.archiveTasks", async () => {
|
||||||
|
// If no workspace folder is opened, we can't archive tasks
|
||||||
|
if (vscode.workspace.workspaceFolders === undefined) {
|
||||||
|
vscode.window.showErrorMessage("You need to open a workspace before sending tasks to the archive.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the node process directory and import kanbn
|
||||||
|
process.chdir(vscode.workspace.workspaceFolders[0].uri.fsPath);
|
||||||
|
const kanbn = await import("@basementuniverse/kanbn/src/main");
|
||||||
|
|
||||||
|
// Get a list of tracked tasks
|
||||||
|
let tasks: string[] = [];
|
||||||
|
try {
|
||||||
|
tasks = [...(await kanbn.findTrackedTasks())];
|
||||||
|
} catch (e) {}
|
||||||
|
if (tasks.length === 0) {
|
||||||
|
vscode.window.showInformationMessage("There are no tasks to archive.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prompt for a selection of tasks to archive
|
||||||
|
const archiveTaskIds = await vscode.window.showQuickPick(
|
||||||
|
tasks,
|
||||||
|
{
|
||||||
|
placeHolder: 'Select tasks to archive...',
|
||||||
|
canPickMany: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (archiveTaskIds !== undefined && archiveTaskIds.length > 0) {
|
||||||
|
for (let archiveTaskId of archiveTaskIds) {
|
||||||
|
await kanbn.archiveTask(archiveTaskId);
|
||||||
|
}
|
||||||
|
KanbnBoardPanel.update();
|
||||||
|
kanbnStatusBarItem.update();
|
||||||
|
if (vscode.workspace.getConfiguration("kanbn").get("showTaskNotifications")) {
|
||||||
|
vscode.window.showInformationMessage(
|
||||||
|
`Archived ${archiveTaskIds.length} task${archiveTaskIds.length === 1 ? '' : 's'}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
// Register a command to restore a task from the archive.
|
// Register a command to restore a task from the archive.
|
||||||
context.subscriptions.push(
|
context.subscriptions.push(
|
||||||
vscode.commands.registerCommand("kanbn.restoreTask", async () => {
|
vscode.commands.registerCommand("kanbn.restoreTasks", async () => {
|
||||||
// If no workspace folder is opened, we can't restore tasks from the archive
|
// If no workspace folder is opened, we can't restore tasks from the archive
|
||||||
if (vscode.workspace.workspaceFolders === undefined) {
|
if (vscode.workspace.workspaceFolders === undefined) {
|
||||||
vscode.window.showErrorMessage("You need to open a workspace before restoring tasks from the archive.");
|
vscode.window.showErrorMessage("You need to open a workspace before restoring tasks from the archive.");
|
||||||
|
@ -61,8 +61,13 @@
|
|||||||
"category": "Kanbn"
|
"category": "Kanbn"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "kanbn.restoreTask",
|
"command": "kanbn.archiveTasks",
|
||||||
"title": "Restore task",
|
"title": "Archive tasks",
|
||||||
|
"category": "Kanbn"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "kanbn.restoreTasks",
|
||||||
|
"title": "Restore tasks",
|
||||||
"category": "Kanbn"
|
"category": "Kanbn"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user