mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
use locator in osquery plugin (#125698)
This commit is contained in:
parent
7d186f945b
commit
f0e5e2db05
2 changed files with 8 additions and 8 deletions
|
@ -18,14 +18,14 @@ export const useDiscoverLink = ({ filters }: UseDiscoverLink) => {
|
|||
const {
|
||||
application: { navigateToUrl },
|
||||
} = useKibana().services;
|
||||
const urlGenerator = useKibana().services.discover?.urlGenerator;
|
||||
const locator = useKibana().services.discover?.locator;
|
||||
const [discoverUrl, setDiscoverUrl] = useState<string>('');
|
||||
|
||||
useEffect(() => {
|
||||
const getDiscoverUrl = async () => {
|
||||
if (!urlGenerator?.createUrl) return;
|
||||
if (!locator) return;
|
||||
|
||||
const newUrl = await urlGenerator.createUrl({
|
||||
const newUrl = await locator.getUrl({
|
||||
indexPatternId: 'logs-*',
|
||||
filters: filters.map((filter) => ({
|
||||
meta: {
|
||||
|
@ -44,7 +44,7 @@ export const useDiscoverLink = ({ filters }: UseDiscoverLink) => {
|
|||
setDiscoverUrl(newUrl);
|
||||
};
|
||||
getDiscoverUrl();
|
||||
}, [filters, urlGenerator]);
|
||||
}, [filters, locator]);
|
||||
|
||||
const onClick = useCallback(
|
||||
(event: React.MouseEvent) => {
|
||||
|
|
|
@ -264,12 +264,12 @@ const ViewResultsInDiscoverActionComponent: React.FC<ViewResultsInDiscoverAction
|
|||
endDate,
|
||||
startDate,
|
||||
}) => {
|
||||
const urlGenerator = useKibana().services.discover?.urlGenerator;
|
||||
const locator = useKibana().services.discover?.locator;
|
||||
const [discoverUrl, setDiscoverUrl] = useState<string>('');
|
||||
|
||||
useEffect(() => {
|
||||
const getDiscoverUrl = async () => {
|
||||
if (!urlGenerator?.createUrl) return;
|
||||
if (!locator) return;
|
||||
|
||||
const agentIdsQuery = agentIds?.length
|
||||
? {
|
||||
|
@ -280,7 +280,7 @@ const ViewResultsInDiscoverActionComponent: React.FC<ViewResultsInDiscoverAction
|
|||
}
|
||||
: null;
|
||||
|
||||
const newUrl = await urlGenerator.createUrl({
|
||||
const newUrl = await locator.getUrl({
|
||||
indexPatternId: 'logs-*',
|
||||
filters: [
|
||||
{
|
||||
|
@ -334,7 +334,7 @@ const ViewResultsInDiscoverActionComponent: React.FC<ViewResultsInDiscoverAction
|
|||
setDiscoverUrl(newUrl);
|
||||
};
|
||||
getDiscoverUrl();
|
||||
}, [actionId, agentIds, endDate, startDate, urlGenerator]);
|
||||
}, [actionId, agentIds, endDate, startDate, locator]);
|
||||
|
||||
if (buttonType === ViewResultsActionButtonType.button) {
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue