Skip to content

Commit

Permalink
Adjustments to SmartNodeSelector
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Oct 22, 2024
1 parent 0133502 commit 72e0b64
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ export const ByParameterValueFilter: React.FC<ByParameterValueFilterProps> = (pr
return;
}

console.debug(selection.selectedIds);
console.debug(selection.selectedNodes);
console.debug(selection.selectedTags);

// Find new parameter ident strings that are not in the current map
const newMap = new Map(props.selectedParameterIdentStringToValueSelectionReadonlyMap);
Expand Down Expand Up @@ -105,7 +104,7 @@ export const ByParameterValueFilter: React.FC<ByParameterValueFilterProps> = (pr
// Trigger filter change
onFilterChange({
parameterIdentStringToValueSelectionMap: nonEmptyMap,
smartNodeSelectorTags: selection.selectedTags,
smartNodeSelectorTags: selection.selectedTags.map((tag) => tag.text),
});
},
[onFilterChange, props.ensembleParameters, props.selectedParameterIdentStringToValueSelectionReadonlyMap]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ export enum KeyEventType {
KeyDown,
}

export type SmartNodeSelectorTag = {
text: string;
isValid: boolean;
};

export type SmartNodeSelectorSelection = {
selectedTags: string[];
selectedTags: SmartNodeSelectorTag[];
selectedNodes: string[];
selectedIds: string[];
};
Expand Down Expand Up @@ -236,7 +241,6 @@ export class SmartNodeSelectorComponent extends React.Component<SmartNodeSelecto
}

componentDidUpdate(prevProps: SmartNodeSelectorProps): void {
console.debug(this.props.selectedTags);
if (
(this.props.data && JSON.stringify(this.props.data) !== JSON.stringify(prevProps.data)) ||
(this.props.delimiter && this.props.delimiter !== prevProps.delimiter)
Expand Down Expand Up @@ -955,13 +959,16 @@ export class SmartNodeSelectorComponent extends React.Component<SmartNodeSelecto

protected updateSelectedTagsAndNodes(initialUpdate = false): void {
const { onChange, maxNumSelectedNodes } = this.props;
const selectedTags: string[] = [];
const selectedTags: SmartNodeSelectorTag[] = [];
const selectedNodes: string[] = [];
const selectedIds: string[] = [];
loop1: for (let i = 0; i < this.countTags(); i++) {
const nodeSelection = this.nodeSelection(i);
if (nodeSelection.getCompleteNodePathAsString() !== "") {
selectedTags.push(nodeSelection.getCompleteNodePathAsString());
selectedTags.push({
text: nodeSelection.getCompleteNodePathAsString(),
isValid: nodeSelection.isValid(),
});
}
if (nodeSelection.isValid() && !this.checkIfSelectionIsDuplicate(nodeSelection, i)) {
const matchedNodePaths = nodeSelection.exactlyMatchedNodePaths();
Expand Down

0 comments on commit 72e0b64

Please sign in to comment.