Skip to content

Commit

Permalink
update regions icon when auto-expanded
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Twydell <[email protected]>
  • Loading branch information
AndrewTwydell committed Jan 6, 2025
1 parent 5f44e9b commit 4e41ef1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/vsce/src/trees/CICSRegionsContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class CICSRegionsContainer extends TreeItem {
const regionInfo = await ProfileManagement.getRegionInfoInPlex(this.parent);
this.addRegionsUtility(regionInfo);
this.collapsibleState = TreeItemCollapsibleState.Expanded;
this.iconPath = getIconPathInResources("folder-open-dark.svg", "folder-open-light.svg");
this.iconOpen(true);
tree._onDidChangeTreeData.fire(undefined);
if (!this.children.length) {
window.showInformationMessage(`No regions found for ${this.parent.getPlexName()}`);
Expand Down Expand Up @@ -128,6 +128,13 @@ export class CICSRegionsContainer extends TreeItem {
return regex;
}

public iconOpen(open: boolean) {
this.iconPath = getIconPathInResources(
`folder-${open ? "open" : "closed"}-dark.svg`,
`folder-${open ? "open" : "closed"}-light.svg`
);
}

public addRegion(region: CICSRegionTree) {
this.children.push(region);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/vsce/src/utils/expansionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function regionContainerExpansionHandler(regionContiner: CICSRegionsConta
});
regionContiner.clearChildren();
await regionContiner.loadRegionsInCICSGroup(tree);
regionContiner.iconOpen(true);
tree._onDidChangeTreeData.fire(undefined);
}
);
Expand All @@ -59,6 +60,7 @@ export function regionContainerExpansionHandler(regionContiner: CICSRegionsConta
});
regionContiner.clearChildren();
await regionContiner.loadRegionsInPlex();
regionContiner.iconOpen(true);
if (!regionContiner.getChildren().length) {
window.showInformationMessage(`No regions found for plex ${parentPlex.getPlexName()}`);
}
Expand Down

0 comments on commit 4e41ef1

Please sign in to comment.