Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(control schemes): make scheme tree initially expanded #241

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ export class ControlSchemeViewIoListComponent {
this.treeControl.dataNodes = this.dataSource.data;
if (!this.initialExpansionDone) {
this.initialExpansionDone = true;
this.treeControl.dataNodes
.filter((node) => node.initiallyExpanded)
.forEach((node) => {
this.treeControl.expand(node);
});
this.treeControl.expandAll();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ function createHubTreeNode(
hasCommunication: hubStats?.hasCommunication ?? false,
nodeType: ControlSchemeNodeTypes.Hub,
isConnected: !!hubStats,
children: [],
initiallyExpanded: true
children: []
};
if (hubConfig.name !== undefined) {
result.name = hubConfig.name;
Expand Down Expand Up @@ -93,8 +92,7 @@ function createIoTreeNode(
decelerationTimeMs: portConfig?.decelerationTimeMs ?? 0,
runningTask,
lastExecutedTask,
children: [],
initiallyExpanded: false
children: []
};
}

Expand All @@ -116,8 +114,7 @@ function createBindingTreeNode(
binding,
schemeName,
ioHasNoRequiredCapabilities,
children: [],
initiallyExpanded: false
children: []
};
}

Expand Down
3 changes: 0 additions & 3 deletions src/app/control-schemes/control-scheme-page/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export type ControlSchemeViewBindingTreeNodeData = {
binding: ControlSchemeBinding;
ioHasNoRequiredCapabilities: boolean;
children: [];
initiallyExpanded: boolean;
};

export type ControlSchemeViewIoTreeNode = {
Expand All @@ -33,7 +32,6 @@ export type ControlSchemeViewIoTreeNode = {
runningTask?: PortCommandTask;
lastExecutedTask?: PortCommandTask;
children: ControlSchemeViewBindingTreeNodeData[];
initiallyExpanded: boolean;
};

export type ControlSchemeViewHubTreeNode = {
Expand All @@ -48,7 +46,6 @@ export type ControlSchemeViewHubTreeNode = {
hasCommunication: boolean; // TODO: remove, may impact performance, Use ad-hoc selector instead
isConnected: boolean;
children: ControlSchemeViewIoTreeNode[];
initiallyExpanded: boolean;
};

export type ControlSchemeViewTreeNode = ControlSchemeViewHubTreeNode
Expand Down
Loading