Skip to content

Commit 4ed7086

Browse files
committed
attempt to flatten hierarchy and comment out unused methods/variables for now
1 parent 6d549fd commit 4ed7086

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/connectionconfig/connectionconfig.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ export class ConnectionConfig implements IConnectionConfig {
351351
// Get all connections and groups from both user and workspace
352352
const userConnections = this.getConnectionsFromSettings(ConfigurationTarget.Global);
353353
const workspaceConnections = this.getConnectionsFromSettings(ConfigurationTarget.Workspace);
354-
const allConnections = [...userConnections, ...workspaceConnections];
355354
const groups = this.getAllConnectionGroups();
356355
const rootGroup = this.getRootGroup();
357356

src/reactviews/pages/ConnectionDialog/connectionFormPage.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,29 @@ export const ConnectionFormPage = () => {
3131
return undefined;
3232
}
3333

34-
// Helper to flatten group hierarchy for dropdown
34+
// Helper to flatten group hierarchy for dropdown, excluding ROOT group
3535
function getGroupOptions(): SearchableDropdownOptions[] {
3636
if (!context?.state?.connectionGroups) return [];
37+
// Find the root group id (assuming name is "ROOT")
38+
const rootGroup = context.state.connectionGroups.find((g) => g.name === "ROOT");
39+
const rootGroupId = rootGroup?.id;
3740
// Recursively build hierarchical options, skipping ROOT
3841
function buildOptions(
3942
groups: IConnectionGroup[],
4043
parentId?: string,
4144
prefix: string = "",
4245
): SearchableDropdownOptions[] {
4346
return groups
44-
.filter((g) => g.parentId === parentId && g.name !== "ROOT")
47+
.filter((g) => g.parentId === parentId && g.id !== rootGroupId && g.name !== "ROOT")
4548
.flatMap((g) => {
4649
const label = prefix ? `${prefix} / ${g.name}` : g.name;
4750
const children = buildOptions(groups, g.id, label);
4851
return [{ key: g.id, text: label, value: g.id }, ...children];
4952
});
5053
}
5154

52-
return buildOptions(context.state.connectionGroups);
55+
// Start from rootGroupId if available, otherwise undefined
56+
return buildOptions(context.state.connectionGroups, rootGroupId ?? undefined);
5357
}
5458

5559
// Selected group state
@@ -58,7 +62,7 @@ export const ConnectionFormPage = () => {
5862
return (
5963
<div>
6064
{/* Connection Group Dropdown */}
61-
<div style={{ marginBottom: 16 }}>
65+
{/* <div style={{ marginBottom: 16 }}>
6266
<label
6367
htmlFor="connection-group-dropdown"
6468
style={{ fontWeight: 500, marginRight: 8 }}>
@@ -71,7 +75,7 @@ export const ConnectionFormPage = () => {
7175
onSelect={(option: SearchableDropdownOptions) => setSelectedGroup(option.value)}
7276
placeholder="Select a group"
7377
/>
74-
</div>
78+
</div> */}
7579
{/* Existing connection form fields */}
7680
{context.state.connectionComponents.mainOptions.map((inputName, idx) => {
7781
const component =

0 commit comments

Comments
 (0)