Skip to content

Commit

Permalink
Better UX when Docker is not installed (#2621)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Jan 20, 2021
1 parent 13abed1 commit 5500ea0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/docker/ContextManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export class DockerContextManager implements ContextManager, Disposable {
// docker-context.initialize and docker-context.change should be treated as "activation events", in that they aren't real user action
actionContext.telemetry.properties.isActivationEvent = 'true';
actionContext.errorHandling.rethrow = true; // Errors are handled outside of this scope
actionContext.errorHandling.suppressDisplay = true;

ext.treeInitError = undefined;

Expand Down
15 changes: 15 additions & 0 deletions src/tree/registerTrees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export function registerTrees(): void {
/* eslint-disable-next-line @typescript-eslint/promise-function-async */
registerCommand(containersLoadMore, (context: IActionContext, node: AzExtTreeItem) => ext.containersTree.loadMore(node, context));
registerCommand('vscode-docker.containers.refresh', async (_context: IActionContext, node?: AzExtTreeItem) => {
if (ext.treeInitError) {
await ext.dockerContextManager.refresh();
}
await ext.containersTree.refresh(_context, node);
});

Expand All @@ -38,6 +41,9 @@ export function registerTrees(): void {
/* eslint-disable-next-line @typescript-eslint/promise-function-async */
registerCommand(networksLoadMore, (context: IActionContext, node: AzExtTreeItem) => ext.networksTree.loadMore(node, context));
registerCommand('vscode-docker.networks.refresh', async (_context: IActionContext, node?: AzExtTreeItem) => {
if (ext.treeInitError) {
await ext.dockerContextManager.refresh();
}
await ext.networksTree.refresh(_context, node);
});

Expand All @@ -50,6 +56,9 @@ export function registerTrees(): void {
/* eslint-disable-next-line @typescript-eslint/promise-function-async */
registerCommand(imagesLoadMore, (context: IActionContext, node: AzExtTreeItem) => ext.imagesTree.loadMore(node, context));
registerCommand('vscode-docker.images.refresh', async (_context: IActionContext, node?: AzExtTreeItem) => {
if (ext.treeInitError) {
await ext.dockerContextManager.refresh();
}
await ext.imagesTree.refresh(_context, node);
});

Expand All @@ -71,6 +80,9 @@ export function registerTrees(): void {
/* eslint-disable-next-line @typescript-eslint/promise-function-async */
registerCommand(volumesLoadMore, (context: IActionContext, node: AzExtTreeItem) => ext.volumesTree.loadMore(node, context));
registerCommand('vscode-docker.volumes.refresh', async (_context: IActionContext, node?: AzExtTreeItem) => {
if (ext.treeInitError) {
await ext.dockerContextManager.refresh();
}
await ext.volumesTree.refresh(_context, node);
});

Expand All @@ -85,6 +97,9 @@ export function registerTrees(): void {

// Refresh button will trigger a full refresh of context data from underlying source, the change event will actually refresh the tree
registerCommand('vscode-docker.contexts.refresh', async (_context: IActionContext, node?: AzExtTreeItem) => {
if (ext.treeInitError) {
await ext.dockerContextManager.refresh();
}
await ext.dockerContextManager.refresh();
});
// Refresh the contexts tree after contexts change
Expand Down

0 comments on commit 5500ea0

Please sign in to comment.