Skip to content

Commit cf4ada5

Browse files
feat: synchronize selected index between modeling and tree preparation scopes
1 parent 840eb9d commit cf4ada5

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

src/app/khiops-visualization/components/commons/var-details-tree-preparation/var-details-tree-preparation.component.ts

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ export class VarDetailsTreePreparationComponent implements DoCheck {
6262
this.selectionScope,
6363
);
6464

65+
// When entering from Modeling with a Tree_* variable, reuse modeling chart index.
66+
if (this.selectionScope === 'modeling') {
67+
const modelingIndex = this.graphSelectionSessionService.getSelectedIndex(
68+
'modeling',
69+
);
70+
this.selectedBarIndex = modelingIndex;
71+
this.graphSelectionSessionService.setSelectedIndex(
72+
'treePreparation',
73+
modelingIndex,
74+
);
75+
}
76+
6577
this.onSelectedGraphItemChanged(this.selectedBarIndex);
6678
}
6779

@@ -82,15 +94,27 @@ export class VarDetailsTreePreparationComponent implements DoCheck {
8294
onSelectedGraphItemChanged(index: number) {
8395
// Keep in memory to keep bar charts index on type change
8496
this.selectedBarIndex = index;
85-
this.graphSelectionSessionService.setSelectedIndex(this.selectionScope, index);
97+
this.graphSelectionSessionService.setSelectedIndex(
98+
this.selectionScope,
99+
index,
100+
);
101+
// Keep treePreparation scope aligned with modeling for Tree_* variables.
102+
if (this.selectionScope === 'modeling') {
103+
this.graphSelectionSessionService.setSelectedIndex(
104+
'treePreparation',
105+
index,
106+
);
107+
}
108+
86109
this.currentIntervalDatas =
87110
this.preparationDatasService.getCurrentIntervalDatas(
88111
REPORT.TREE_PREPARATION_REPORT,
89112
this.selectedBarIndex,
90113
);
91-
const nodes = this.currentIntervalDatas?.values?.map((e: any) => e.values);
92-
this.store.selectNodesFromId({
93-
id: nodes,
114+
115+
// Select decision-tree nodes corresponding to selected chart index/modalities.
116+
this.store.selectNodesFromIndex({
117+
index: this.selectedBarIndex,
94118
});
95119
}
96120

0 commit comments

Comments
 (0)