From d26801014bb5fee4993904e7ea80f83461b01d59 Mon Sep 17 00:00:00 2001 From: Nikolai Sukhanov Date: Thu, 31 Aug 2023 19:50:44 +0400 Subject: [PATCH] fix(control schemes): make scheme tree initially expanded --- .../control-scheme-view-io-list.component.ts | 6 +----- .../control-scheme-page/control-scheme-view.selectors.ts | 9 +++------ src/app/control-schemes/control-scheme-page/types.ts | 3 --- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/app/control-schemes/control-scheme-page/control-scheme-view-io-list/control-scheme-view-io-list.component.ts b/src/app/control-schemes/control-scheme-page/control-scheme-view-io-list/control-scheme-view-io-list.component.ts index 77fc0d23..e18075b9 100644 --- a/src/app/control-schemes/control-scheme-page/control-scheme-view-io-list/control-scheme-view-io-list.component.ts +++ b/src/app/control-schemes/control-scheme-page/control-scheme-view-io-list/control-scheme-view-io-list.component.ts @@ -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(); } } diff --git a/src/app/control-schemes/control-scheme-page/control-scheme-view.selectors.ts b/src/app/control-schemes/control-scheme-page/control-scheme-view.selectors.ts index 3c913a59..059cca63 100644 --- a/src/app/control-schemes/control-scheme-page/control-scheme-view.selectors.ts +++ b/src/app/control-schemes/control-scheme-page/control-scheme-view.selectors.ts @@ -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; @@ -93,8 +92,7 @@ function createIoTreeNode( decelerationTimeMs: portConfig?.decelerationTimeMs ?? 0, runningTask, lastExecutedTask, - children: [], - initiallyExpanded: false + children: [] }; } @@ -116,8 +114,7 @@ function createBindingTreeNode( binding, schemeName, ioHasNoRequiredCapabilities, - children: [], - initiallyExpanded: false + children: [] }; } diff --git a/src/app/control-schemes/control-scheme-page/types.ts b/src/app/control-schemes/control-scheme-page/types.ts index 5d62f8ea..d5932e2d 100644 --- a/src/app/control-schemes/control-scheme-page/types.ts +++ b/src/app/control-schemes/control-scheme-page/types.ts @@ -15,7 +15,6 @@ export type ControlSchemeViewBindingTreeNodeData = { binding: ControlSchemeBinding; ioHasNoRequiredCapabilities: boolean; children: []; - initiallyExpanded: boolean; }; export type ControlSchemeViewIoTreeNode = { @@ -33,7 +32,6 @@ export type ControlSchemeViewIoTreeNode = { runningTask?: PortCommandTask; lastExecutedTask?: PortCommandTask; children: ControlSchemeViewBindingTreeNodeData[]; - initiallyExpanded: boolean; }; export type ControlSchemeViewHubTreeNode = { @@ -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