-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
add button link to ingest #70142
add button link to ingest #70142
Changes from 13 commits
ddc3f39
1c078cf
604316a
460c5f8
36b934f
71c9aac
2113b99
415ae91
ac75c49
55261bc
504f82b
b79f6d7
1844e6b
7c932c6
a65f1a5
a443859
295225e
e119a76
613f90e
e655571
a30978c
50307f8
7609a82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -5,7 +5,7 @@ | |||||||||||
*/ | ||||||||||||
|
||||||||||||
import React, { useState } from 'react'; | ||||||||||||
import { useRouteMatch, Switch, Route } from 'react-router-dom'; | ||||||||||||
import { useRouteMatch, Switch, Route, useLocation, useHistory } from 'react-router-dom'; | ||||||||||||
import { Props as EuiTabProps } from '@elastic/eui/src/components/tabs/tab'; | ||||||||||||
import { i18n } from '@kbn/i18n'; | ||||||||||||
import { PAGE_ROUTING_PATHS } from '../../../../constants'; | ||||||||||||
|
@@ -114,7 +114,11 @@ function InstalledPackages() { | |||||||||||
|
||||||||||||
function AvailablePackages() { | ||||||||||||
useBreadcrumbs('integrations_all'); | ||||||||||||
const [selectedCategory, setSelectedCategory] = useState(''); | ||||||||||||
const history = useHistory(); | ||||||||||||
const queryParams = new URLSearchParams(useLocation().search); | ||||||||||||
const initialCategory = | ||||||||||||
queryParams.get('category') !== null ? (queryParams.get('category') as string) : ''; | ||||||||||||
const [selectedCategory, setSelectedCategory] = useState(initialCategory); | ||||||||||||
const { data: categoryPackagesRes, isLoading: isLoadingPackages } = useGetPackages({ | ||||||||||||
category: selectedCategory, | ||||||||||||
}); | ||||||||||||
|
@@ -141,7 +145,13 @@ function AvailablePackages() { | |||||||||||
isLoading={isLoadingCategories} | ||||||||||||
categories={categories} | ||||||||||||
selectedCategory={selectedCategory} | ||||||||||||
onCategoryChange={({ id }: CategorySummaryItem) => setSelectedCategory(id)} | ||||||||||||
onCategoryChange={({ id }: CategorySummaryItem) => { | ||||||||||||
// clear category query param in the url | ||||||||||||
if (queryParams.get('category') !== null) { | ||||||||||||
history.push({}); | ||||||||||||
} | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @parkiino is
Suggested change
cc @jen-huang and @neptunian for thoughts on dealing with the params/state |
||||||||||||
setSelectedCategory(id); | ||||||||||||
}} | ||||||||||||
/> | ||||||||||||
) : null; | ||||||||||||
|
||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; | ||
|
||
/** | ||
* Returns an object which ingest permissions are allowed | ||
*/ | ||
export const useIngestEnabledCheck = (): { | ||
allEnabled: boolean; | ||
show: boolean; | ||
write: boolean; | ||
read: boolean; | ||
} => { | ||
const { services } = useKibana(); | ||
|
||
// Check if Ingest Manager is present in the configuration | ||
const show = services.application.capabilities.ingestManager?.show ?? false; | ||
const write = services.application.capabilities.ingestManager?.write ?? false; | ||
const read = services.application.capabilities.ingestManager?.read ?? false; | ||
|
||
// Check if all Ingest Manager permissions are enabled | ||
const allEnabled = show && read && write ? true : false; | ||
|
||
return { | ||
allEnabled, | ||
show, | ||
write, | ||
read, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import { FrameworkAdapter, FrameworkRequest } from '../framework'; | |
import { SourceStatusAdapter } from './index'; | ||
import { buildQuery } from './query.dsl'; | ||
import { ApmServiceNameAgg } from './types'; | ||
import { ENDPOINT_METADATA_INDEX } from '../../../common/constants'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should work, but we'll also wanna make sure that the endpoint events and alerts index are added to the defaults. Can be in another PR |
||
|
||
const APM_INDEX_NAME = 'apm-*-transaction*'; | ||
|
||
|
@@ -18,6 +19,8 @@ export class ElasticsearchSourceStatusAdapter implements SourceStatusAdapter { | |
// Intended flow to determine app-empty state is to first check siem indices (as this is a quick shard count), and | ||
// if no shards exist only then perform the heavier APM query. This optimizes for normal use when siem data exists | ||
try { | ||
// Add endpoint metadata index to indices to check | ||
indexNames.push(ENDPOINT_METADATA_INDEX); | ||
// Remove APM index if exists, and only query if length > 0 in case it's the only index provided | ||
const nonApmIndexNames = indexNames.filter((name) => name !== APM_INDEX_NAME); | ||
const indexCheckResponse = await (nonApmIndexNames.length > 0 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
null
significant? If possible, I'd preferI find it more straightforward and we don't lose any safety, afaict.