MCPcopy Index your code
hub / github.com/microsoft/SandDance / toggleableSearch

Method toggleableSearch

docs/app/js/sanddance-app.js:14474–14506  ·  view source on GitHub ↗
(e, search)

Source from the content-addressed store, hash-verified

14472 };
14473 }
14474 toggleableSearch(e, search) {
14475 if (e.ctrlKey) {
14476 this.setState({
14477 search: createInputSearch(search)
14478 });
14479 this.setSideTabId((0, _interfaces.SideTabId).Search);
14480 } else {
14481 var oldSelection = this.viewer.getSelection();
14482 if (oldSelection.search) {
14483 //look for matching groups and toggle them
14484 const result = (0, _toggleSearch.toggleSearch)((0, _sanddanceReact.SandDance).searchExpression.ensureSearchExpressionGroupArray(oldSelection.search), search);
14485 if (result.found) {
14486 //removing a group
14487 if (result.groups.length === 0) this.doDeselect();
14488 else //select with new search removed
14489 this.doSelect(result.groups);
14490 } else //adding a new group
14491 if (e.altKey || e.shiftKey) {
14492 let group = true;
14493 if (e.altKey) search.clause = "&&";
14494 else if (e.shiftKey) {
14495 if (this.props.searchORDisabled) group = false;
14496 else search.clause = "||";
14497 }
14498 if (group) {
14499 result.groups.push(search);
14500 this.doSelect(result.groups);
14501 } else this.doSelect(search);
14502 } else //replace
14503 this.doSelect(search);
14504 } else this.doSelect(search);
14505 }
14506 }
14507 doFilter(search, historicFilterChange) {
14508 this.historicFilterChange = historicFilterChange;
14509 this.viewer.filter(search);

Callers 1

updateViewerOptionsMethod · 0.95

Calls 5

setSideTabIdMethod · 0.95
doDeselectMethod · 0.95
doSelectMethod · 0.95
createInputSearchFunction · 0.70
getSelectionMethod · 0.45

Tested by

no test coverage detected