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

Deactivated wild cards in single node selection mode #308

Merged
merged 2 commits into from
Sep 14, 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 @@ -12,21 +12,25 @@ export class TreeData {
private _stringifiedData: string;
private _nodeData: TreeDataNodeMetaData[];
private _allowOrOperator: boolean;
private _allowWildcards: boolean;

constructor({
treeData,
delimiter,
allowOrOperator,
allowWildcards,
}: {
treeData: TreeDataNode[];
delimiter: string;
allowOrOperator: boolean;
allowWildcards: boolean;
}) {
this._treeData = treeData;
this._delimiter = delimiter;
this._nodeData = [];
this._stringifiedData = "";
this._allowOrOperator = allowOrOperator;
this._allowWildcards = allowWildcards;

this.populateNodes();
}
Expand Down Expand Up @@ -125,6 +129,13 @@ export class TreeData {
}

private adjustNodeName(nodeName: string): string {
if (!this._allowWildcards) {
return this.replaceAll(
this.replaceAll(this.replaceAll(this.escapeRegExp(nodeName), ":", ""), "*", "\\*"),
"?",
"\\."
);
}
return this.activateOrStatements(
this.replaceAll(
this.replaceAll(this.replaceAll(this.escapeRegExp(nodeName), ":", ""), "*", '[^:"]*'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export class SmartNodeSelectorComponent extends React.Component<SmartNodeSelecto
treeData: props.data,
delimiter: props.delimiter,
allowOrOperator: props.useBetaFeatures || false,
allowWildcards: props.maxNumSelectedNodes !== 1,
});
} catch (e) {
this.treeData = null;
Expand Down Expand Up @@ -250,6 +251,7 @@ export class SmartNodeSelectorComponent extends React.Component<SmartNodeSelecto
treeData: this.props.data,
delimiter: this.props.delimiter,
allowOrOperator: this.props.useBetaFeatures || false,
allowWildcards: this.props.maxNumSelectedNodes !== 1,
});
} catch (e) {
this.treeData = null;
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/components/VectorSelector/vectorSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class VectorSelectorComponent extends SmartNodeSelectorComponent {
treeData: this.modifyTreeData(props.data, props.numMetaNodes, this.vectorDefinitions),
delimiter: props.delimiter,
allowOrOperator: props.useBetaFeatures || false,
allowWildcards: this.props.maxNumSelectedNodes !== 1,
});
} catch (e) {
this.treeData = null;
Expand Down Expand Up @@ -116,6 +117,7 @@ export class VectorSelectorComponent extends SmartNodeSelectorComponent {
treeData: this.modifyTreeData(this.props.data, this.props.numMetaNodes, this.vectorDefinitions),
delimiter: this.props.delimiter,
allowOrOperator: this.props.useBetaFeatures || false,
allowWildcards: this.props.maxNumSelectedNodes !== 1,
});
} catch (e) {
this.treeData = null;
Expand Down