Skip to content

Commit

Permalink
serviceconnector: Use createContextValue for tree items (#1576)
Browse files Browse the repository at this point in the history
* Add contextValuesToAdd

* Change to private
  • Loading branch information
motm32 authored Sep 5, 2023
1 parent 9ee913c commit c070598
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions serviceconnector/src/tree/ServiceConnectorGroupTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
*--------------------------------------------------------------------------------------------*/

import { uiUtils } from "@microsoft/vscode-azext-azureutils";
import { AzExtParentTreeItem, AzExtTreeItem, TreeItemIconPath, nonNullValue } from "@microsoft/vscode-azext-utils";
import { AzExtParentTreeItem, AzExtTreeItem, TreeItemIconPath, createContextValue, nonNullValue } from "@microsoft/vscode-azext-utils";
import * as vscode from 'vscode';
import { getIconPath } from "./IconPath";
import { ServiceConnectorTreeItem } from "./ServiceConnectorTreeItem";

export class ServiceConnectorGroupTreeItem extends AzExtParentTreeItem {
constructor(parent: AzExtParentTreeItem, public readonly resourceId: string) {
constructor(parent: AzExtParentTreeItem, public readonly resourceId: string, private readonly contextValuesToAdd: string[]) {
super(parent);
}

Expand All @@ -22,7 +22,7 @@ export class ServiceConnectorGroupTreeItem extends AzExtParentTreeItem {
linkers,
'invalidServiceConnector',
l => {
return new ServiceConnectorTreeItem(l, this)
return new ServiceConnectorTreeItem(l, this, this.contextValuesToAdd)
},
l => {
return l.name;
Expand All @@ -48,6 +48,6 @@ export class ServiceConnectorGroupTreeItem extends AzExtParentTreeItem {
}

public get contextValue(): string {
return 'serviceConnectorGroupItem';
return createContextValue(['serviceConnectorGroupItem', ...this.contextValuesToAdd]);
}
}
6 changes: 3 additions & 3 deletions serviceconnector/src/tree/ServiceConnectorTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import { LinkerResource } from "@azure/arm-servicelinker";
import { AzExtParentTreeItem, AzExtTreeItem, TreeItemIconPath, nonNullValue } from "@microsoft/vscode-azext-utils";
import { AzExtParentTreeItem, AzExtTreeItem, TreeItemIconPath, createContextValue, nonNullValue } from "@microsoft/vscode-azext-utils";
import { ThemeIcon } from "vscode";
import { getIconPath } from "./IconPath";
import { connectionIconPath } from "./ServiceConnectorItem";
Expand All @@ -14,7 +14,7 @@ export class ServiceConnectorTreeItem extends AzExtTreeItem {
public readonly linker: LinkerResource;
public readonly item: AzExtTreeItem;

constructor(linker: LinkerResource, parent: AzExtParentTreeItem) {
constructor(linker: LinkerResource, parent: AzExtParentTreeItem, private readonly contextValuesToAdd: string[]) {
super(parent);
this.linker = linker;
this.item = parent;
Expand All @@ -29,7 +29,7 @@ export class ServiceConnectorTreeItem extends AzExtTreeItem {
}

public get contextValue(): string {
return 'serviceConnectorItem';
return createContextValue(['serviceConnectorItem', ...this.contextValuesToAdd]);
}

public get iconPath(): TreeItemIconPath {
Expand Down

0 comments on commit c070598

Please sign in to comment.