Skip to content

Commit

Permalink
Migrated visualization to embeddables
Browse files Browse the repository at this point in the history
  • Loading branch information
yenienserrano committed Mar 8, 2024
1 parent 9a0a9a5 commit f67de9b
Show file tree
Hide file tree
Showing 4 changed files with 746 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
import { Dashboard } from './dashboard';
import { MainSca } from '../../agents/sca';
import { DashboardAWS } from '../../overview/amazon-web-services/dashboards';
import { MainMitre } from './main-mitre';
import { ModuleMitreAttackIntelligence } from '../../overview/mitre_attack_intelligence';
import { ComplianceTable } from '../../overview/compliance-table';
Expand Down Expand Up @@ -106,7 +107,12 @@ export const ModulesDefaults = {
aws: {
init: 'dashboard',
tabs: [
DashboardTab,
{
id: 'dashboard',
name: 'Dashboard',
buttons: [ButtonModuleExploreAgent, ButtonModuleGenerateReport],
component: DashboardAWS,
},
renderDiscoverTab(DEFAULT_INDEX_PATTERN, amazonWebServicesColumns),
],
availableFor: ['manager', 'agent'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from 'react';
import { getPlugins } from '../../../../kibana-services';
import { ViewMode } from '../../../../../../../src/plugins/embeddable/public';
import { getDashboardPanels } from './dashboard_panels';
import { I18nProvider } from '@osd/i18n/react';
import useSearchBar from '../../../common/search-bar/use-search-bar';
import { WAZUH_ALERTS_PATTERN } from '../../../../../common/constants';

const plugins = getPlugins();

const SearchBar = getPlugins().data.ui.SearchBar;

const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer;

export const DashboardAWS: React.FC = () => {
const INDEX_PATTERN_ID = WAZUH_ALERTS_PATTERN;

const { searchBarProps } = useSearchBar({
defaultIndexPatternID: INDEX_PATTERN_ID,
filters: [],
});

return (
<>
<I18nProvider>
<SearchBar
appName='aws-searchbar'
{...searchBarProps}
showDatePicker={false}
showQueryInput={true}
showQueryBar={true}
/>
</I18nProvider>
<DashboardByRenderer
input={{
viewMode: ViewMode.VIEW,
panels: getDashboardPanels(INDEX_PATTERN_ID),
isFullScreenMode: false,
filters: searchBarProps.filters ?? [],
useMargins: true,
id: 'aws-dashboard-tab',
timeRange: {
from: searchBarProps.dateRangeFrom,
to: searchBarProps.dateRangeTo,
},
title: 'AWS dashboard',
description: 'Dashboard of the AWS',
query: searchBarProps.query,
refreshConfig: {
pause: false,
value: 15,
},
hidePanelTitles: false,
}}
/>
</>
);
};
Loading

0 comments on commit f67de9b

Please sign in to comment.