-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4.9.0' into feat/6549-remove-angularjs-controller-manag…
…ement
- Loading branch information
Showing
17 changed files
with
2,958 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
.../public/components/common/data-source/pattern/alerts/alerts-aws/alerts-aws-data-source.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { tFilter } from '../../../index'; | ||
import { DATA_SOURCE_FILTER_CONTROLLED_AWS_RULE_GROUP } from '../../../../../../../common/constants'; | ||
import { AlertsDataSource } from '../alerts-data-source'; | ||
|
||
const AWS_GROUP_KEY = 'rule.groups'; | ||
const AWS_GROUP_VALUE = 'amazon'; | ||
|
||
export class AlertsAWSDataSource extends AlertsDataSource { | ||
constructor(id: string, title: string) { | ||
super(id, title); | ||
} | ||
|
||
getRuleGroupsFilter() { | ||
return super.getRuleGroupsFilter( | ||
AWS_GROUP_KEY, | ||
AWS_GROUP_VALUE, | ||
DATA_SOURCE_FILTER_CONTROLLED_AWS_RULE_GROUP, | ||
); | ||
} | ||
|
||
getFixedFilters(): tFilter[] { | ||
return [...this.getRuleGroupsFilter(), ...super.getFixedFilters()]; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
plugins/main/public/components/common/data-source/pattern/alerts/alerts-aws/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './alerts-aws-data-source'; |
24 changes: 24 additions & 0 deletions
24
.../public/components/common/data-source/pattern/alerts/alerts-fim/alerts-fim-data-source.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { tFilter } from '../../../index'; | ||
import { DATA_SOURCE_FILTER_CONTROLLED_FIM_RULE_GROUP } from '../../../../../../../common/constants'; | ||
import { AlertsDataSource } from '../alerts-data-source'; | ||
|
||
const FIM_GROUP_KEY = 'rule.groups'; | ||
const FIM_GROUP_VALUE = 'syscheck'; | ||
|
||
export class AlertsFIMDataSource extends AlertsDataSource { | ||
constructor(id: string, title: string) { | ||
super(id, title); | ||
} | ||
|
||
getRuleGroupsFilter() { | ||
return super.getRuleGroupsFilter( | ||
FIM_GROUP_KEY, | ||
FIM_GROUP_VALUE, | ||
DATA_SOURCE_FILTER_CONTROLLED_FIM_RULE_GROUP, | ||
); | ||
} | ||
|
||
getFixedFilters(): tFilter[] { | ||
return [...this.getRuleGroupsFilter(), ...super.getFixedFilters()]; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
plugins/main/public/components/common/data-source/pattern/alerts/alerts-fim/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './alerts-fim-data-source'; |
2 changes: 2 additions & 0 deletions
2
plugins/main/public/components/common/data-source/pattern/alerts/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export * from './alerts-fim'; | ||
export * from './alerts-data-source-repository'; | ||
export * from './alerts-data-source'; | ||
export * from './alerts-aws'; | ||
export * from './vulnerabilities'; | ||
export * from './mitre-attack'; | ||
export * from './virustotal'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
plugins/main/public/components/overview/amazon-web-services/dashboards/dashboard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import useSearchBar from '../../../common/search-bar/use-search-bar'; | ||
import { compose } from 'redux'; | ||
import { getPlugins } from '../../../../kibana-services'; | ||
import { ViewMode } from '../../../../../../../src/plugins/embeddable/public'; | ||
import { getDashboardPanels } from './dashboard_panels'; | ||
import { I18nProvider } from '@osd/i18n/react'; | ||
import { SearchResponse } from '../../../../../../../src/core/server'; | ||
import './styles.scss'; | ||
import { withErrorBoundary } from '../../../common/hocs'; | ||
import { IndexPattern } from '../../../../../../../src/plugins/data/common'; | ||
import { SampleDataWarning } from '../../../visualize/components'; | ||
import { | ||
ErrorFactory, | ||
ErrorHandler, | ||
HttpError, | ||
} from '../../../../react-services/error-management'; | ||
import { | ||
AlertsDataSourceRepository, | ||
PatternDataSource, | ||
tParsedIndexPattern, | ||
useDataSource, | ||
AlertsAWSDataSource, | ||
} from '../../../common/data-source'; | ||
import { DiscoverNoResults } from '../../../common/no-results/no-results'; | ||
import { LoadingSpinner } from '../../../common/loading-spinner/loading-spinner'; | ||
|
||
const plugins = getPlugins(); | ||
|
||
const SearchBar = getPlugins().data.ui.SearchBar; | ||
|
||
const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; | ||
|
||
const DashboardAWSComponents: React.FC = ({}) => { | ||
const { | ||
filters, | ||
dataSource, | ||
fetchFilters, | ||
isLoading: isDataSourceLoading, | ||
fetchData, | ||
setFilters, | ||
} = useDataSource<tParsedIndexPattern, PatternDataSource>({ | ||
DataSource: AlertsAWSDataSource, | ||
repository: new AlertsDataSourceRepository(), | ||
}); | ||
|
||
const [results, setResults] = useState<SearchResponse>({} as SearchResponse); | ||
|
||
const { searchBarProps } = useSearchBar({ | ||
indexPattern: dataSource?.indexPattern as IndexPattern, | ||
filters, | ||
setFilters, | ||
}); | ||
|
||
const { query, dateRangeFrom, dateRangeTo } = searchBarProps; | ||
|
||
useEffect(() => { | ||
if (isDataSourceLoading) { | ||
return; | ||
} | ||
fetchData({ | ||
query, | ||
dateRange: { | ||
from: dateRangeFrom, | ||
to: dateRangeTo, | ||
}, | ||
}) | ||
.then(results => setResults(results)) | ||
.catch(error => { | ||
const searchError = ErrorFactory.create(HttpError, { | ||
error, | ||
message: 'Error fetching data', | ||
}); | ||
ErrorHandler.handleError(searchError); | ||
}); | ||
}, [ | ||
JSON.stringify(fetchFilters), | ||
JSON.stringify(query), | ||
JSON.stringify(dateRangeFrom), | ||
JSON.stringify(dateRangeTo), | ||
]); | ||
return ( | ||
<> | ||
<I18nProvider> | ||
<> | ||
{isDataSourceLoading && !dataSource ? ( | ||
<LoadingSpinner /> | ||
) : ( | ||
<div className='wz-search-bar hide-filter-control'> | ||
<SearchBar | ||
appName='aws-searchbar' | ||
{...searchBarProps} | ||
showDatePicker={true} | ||
showQueryInput={true} | ||
showQueryBar={true} | ||
/> | ||
</div> | ||
)} | ||
{dataSource && results?.hits?.total === 0 ? ( | ||
<DiscoverNoResults /> | ||
) : null} | ||
{!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? ( | ||
<> | ||
<SampleDataWarning /> | ||
<div className='aws-dashboard-responsive'> | ||
<DashboardByRenderer | ||
input={{ | ||
viewMode: ViewMode.VIEW, | ||
panels: getDashboardPanels( | ||
dataSource?.id, | ||
Boolean(dataSource?.getPinnedAgentFilter()?.length), | ||
), | ||
isFullScreenMode: false, | ||
filters: fetchFilters || [], | ||
useMargins: true, | ||
id: 'aws-dashboard-tab', | ||
timeRange: { | ||
from: dateRangeFrom, | ||
to: dateRangeTo, | ||
}, | ||
title: 'AWS dashboard', | ||
description: 'Dashboard of the AWS', | ||
query: query, | ||
refreshConfig: { | ||
pause: false, | ||
value: 15, | ||
}, | ||
hidePanelTitles: false, | ||
}} | ||
/> | ||
</div> | ||
</> | ||
) : null} | ||
</> | ||
</I18nProvider> | ||
</> | ||
); | ||
}; | ||
|
||
export const DashboardAWS = compose(withErrorBoundary)(DashboardAWSComponents); |
Oops, something went wrong.