Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, () => {
// trigger onChange with query for job id to trigger table filter
const query = EuiSearchBar.Query.parse(selectedId);
this.onChange({ query });
});
}
function getMatchingFilterItems(searchBarQuery, items) {
if (items === undefined) {
return [];
}
if (searchBarQuery === undefined) {
return [...items];
}
// Convert the list of Strings into a list of Objects suitable for running through
// the search bar query.
const allItems = items.map(item => ({ value: item }));
const matchingObjects =
EuiSearchBar.Query.execute(searchBarQuery, allItems, { defaultFields: ['value'] });
return matchingObjects.map(item => item.value);
}
() => {
// trigger onChange with query for job id to trigger table filter
const query = EuiSearchBar.Query.parse(selectedId);
this.onChange({ query });
}
);
selectedIds,
singleSelection,
sortableProperties,
timeseriesOnly
}) {
const [itemIdToSelectedMap, setItemIdToSelectedMap] = useState(getCurrentlySelectedItemIdsMap());
const [currentItems, setCurrentItems] = useState(items);
const [lastSelected, setLastSelected] = useState(selectedIds);
const [sortedColumn, setSortedColumn] = useState('');
const [pager, setPager] = useState();
const [pagerSettings, setPagerSettings] = useState({
itemsPerPage: JOBS_PER_PAGE,
firstItemIndex: 0,
lastItemIndex: 1
});
const [query, setQuery] = useState(EuiSearchBar.Query.MATCH_ALL);
const [error, setError] = useState(null); // eslint-disable-line
useEffect(() => {
setCurrentItems(items);
handleQueryChange({ query: query });
}, [items]); // eslint-disable-line
// When changes to selected ids made via badge removal - update selection in the table accordingly
useEffect(() => {
setItemIdToSelectedMap(getCurrentlySelectedItemIdsMap());
}, [selectedIds]); // eslint-disable-line
useEffect(() => {
const tablePager = new Pager(currentItems.length, JOBS_PER_PAGE);
setPagerSettings({
itemsPerPage: JOBS_PER_PAGE,
(indices, allIds, tableState) => {
let indexArray = allIds.map(indexName => indices[indexName]);
indexArray = filterByToggles(indexArray, tableState.toggleNameToVisibleMap);
const systemFilteredIndexes = tableState.showSystemIndices
? indexArray
: indexArray.filter(index => !(index.name + '').startsWith('.'));
const filter = tableState.filter || EuiSearchBar.Query.MATCH_ALL;
return EuiSearchBar.Query.execute(filter, systemFilteredIndexes, {
defaultFields: defaultFilterFields,
});
}
);
private defaultOnChange = ({ query }: { query: string }) => {
const { searchItems, defaultFields, updateOnChange } = this.props;
const result = EuiSearchBar.Query.execute(query, searchItems, {
defaultFields,
});
this.setState({ currentResult: result });
updateOnChange({ updatedResult: result });
};
public render() {
return (
);
}
}
const onChange = ({ query, error }) => {
if (error) {
return error;
} else {
return EuiSearchBar.Query.execute(query, items, {
defaultFields: ["name"]
});
}
};
(indices, allIds, tableState) => {
let indexArray = allIds.map(indexName => indices[indexName]);
indexArray = filterByToggles(indexArray, tableState.toggleNameToVisibleMap);
const systemFilteredIndexes = tableState.showSystemIndices
? indexArray
: indexArray.filter(index => !(index.name + '').startsWith('.'));
const filter = tableState.filter || EuiSearchBar.Query.MATCH_ALL;
return EuiSearchBar.Query.execute(filter, systemFilteredIndexes, {
defaultFields: defaultFilterFields,
});
}
);
const clickHandler = () => {
filterChanged
&& filterExpression
&& filterChanged(EuiSearchBar.Query.parse(filterExpression));
};
const ariaLabel = i18n.translate(