Skip to content

Commit

Permalink
Hide containers for which an action is invalid (microsoft#2500)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Nov 23, 2020
1 parent 63fefe8 commit 27820e6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/tree/containers/ContainerTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ export class ContainerTreeItem extends AzExtParentTreeItemIntermediate implement
return this.children ?? [];
}

public isAncestorOfImpl(expectedContextValue: string | RegExp): boolean {
// If we're looking for something matching `Container$` in the expectedContextValue, it will not be a child of this item (which is the container)
// The only children of this item have `containerFile` and `containerDirectory` as context values
if (/Container\$?$/i.test(typeof expectedContextValue === 'string' ? expectedContextValue : expectedContextValue.source)) {
return false;
}

return true;
}

private get isRunning(): boolean {
return this._item.State.toLowerCase() === 'running';
}
Expand Down

0 comments on commit 27820e6

Please sign in to comment.