Skip to content

Commit

Permalink
feat: basic task
Browse files Browse the repository at this point in the history
Basic task monitor integration.

Signed-off-by: Tim deBoer <[email protected]>
  • Loading branch information
deboer-tim committed Jan 9, 2024
1 parent db84ffd commit ac41334
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,27 @@ export async function activate(extensionContext: ExtensionContext): Promise<void

extensionContext.subscriptions.push(
extensionApi.commands.registerCommand('bootc.image.build', async image => {
const selectedType = await extensionApi.window.showQuickPick(['.oci', '.qcow2', '.ami','.iso'], {
const selectedType = await extensionApi.window.showQuickPick(['.oci', '.qcow2', '.ami', '.iso'], {
placeHolder: 'Select image type',
});

console.log("Build " + image.name + " to " + selectedType);

return Promise.resolve();
return extensionApi.window.withProgress(
{ location: extensionApi.ProgressLocation.TASK_WIDGET, title: 'Building disk image ' + image.name },
async progress => {
await doExec(image, selectedType);
// Mark the task as completed
progress.report({ increment: -1 });
},
);
}),
);
}

async function doExec(image, type: string) {
console.log('Building ' + image.name + ' to ' + type);
await new Promise(resolve => setTimeout(resolve, 5000));
}

export async function deactivate(): Promise<void> {
await bootc?.deactivate();
}

0 comments on commit ac41334

Please sign in to comment.