Skip to content

Commit

Permalink
chore(console): include hidden nodes (#5393)
Browse files Browse the repository at this point in the history
The console server api can now respond with all nodes including those that are hidden in the tree

## Checklist

- [ ] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [ ] Description explains motivation and solution
- [ ] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
eladcon authored Jan 2, 2024
1 parent 7ded3f8 commit d708396
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions apps/wing-console/console/server/src/router/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const createAppRouter = () => {
z
.object({
showTests: z.boolean().optional(),
includeHiddens: z.boolean().optional(),
})
.optional(),
)
Expand All @@ -116,6 +117,7 @@ export const createAppRouter = () => {
shakeTree(tree),
simulator,
input?.showTests,
input?.includeHiddens,
);
}),
"app.nodeIds": createProcedure
Expand Down Expand Up @@ -638,6 +640,7 @@ function createExplorerItemFromConstructTreeNode(
node: ConstructTreeNode,
simulator: Simulator,
showTests = false,
includeHiddens = false,
): ExplorerItem {
const label =
node.display?.sourceModule === "@winglang/sdk" && node.display?.title
Expand All @@ -653,11 +656,17 @@ function createExplorerItemFromConstructTreeNode(
? Object.values(node.children)
.filter((node) => {
return (
!node.display?.hidden && (showTests || !matchTest(node.path))
(includeHiddens || !node.display?.hidden) &&
(showTests || !matchTest(node.path))
);
})
.map((node) =>
createExplorerItemFromConstructTreeNode(node, simulator),
createExplorerItemFromConstructTreeNode(
node,
simulator,
showTests,
includeHiddens,
),
)
: undefined,
};
Expand Down

0 comments on commit d708396

Please sign in to comment.