diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3ae04115..42575a375b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Changed -- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) +- Removed embedded discover [#6120](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6120) [#6235](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6235) [#6254](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6254) [#6285](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6285) [#6288](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6288) [#6290](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6290) [#6289](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6289) [#6286](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6286) [#6275](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6275) [#6287](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6297](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6297) [#6291](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6287) [#6459](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6459) [#6434](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6434) [#6504](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6504) [#6649](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6649) [#6506](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6506) [#6537](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6537) [#6528](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6528) [#6675](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6675) [#6674](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6674) [#6558](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6558) [#6685](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6685) [#6691](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6691) [#6712](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6712) [#6734](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6734) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6746) [#6746](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6752) - Allow editing groups for an agent from Endpoints Summary [#6250](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6250) - Change how the configuration is managed in the backend side [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) [#6519](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6519) [#6573](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6573) - Change the view of API is down and check connection to Server APIs application [#6337](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6337) diff --git a/plugins/main/public/components/common/data-source/pattern/pattern-data-source-repository.ts b/plugins/main/public/components/common/data-source/pattern/pattern-data-source-repository.ts index f1f1270adb..daae65b78a 100644 --- a/plugins/main/public/components/common/data-source/pattern/pattern-data-source-repository.ts +++ b/plugins/main/public/components/common/data-source/pattern/pattern-data-source-repository.ts @@ -1,35 +1,16 @@ -import { tDataSourceRepository } from "../index"; +import { tDataSourceRepository } from '../index'; import { GenericRequest } from '../../../../react-services/generic-request'; import { AppState } from '../../../../react-services'; export type tSavedObjectResponse = { - data: { - attributes: { - fields: string; - title: string; - }; - id: string; - migrationVersion: { - 'index-pattern': string; - }; - namespace: string[]; - references: any[]; - score: number; - type: string; - updated_at: string; - version: string; - } -} - -export type tParsedIndexPattern = { + data: { attributes: { - fields: string; - title: string; + fields: string; + title: string; }; - title: string; id: string; migrationVersion: { - 'index-pattern': string; + 'index-pattern': string; }; namespace: string[]; references: any[]; @@ -37,69 +18,94 @@ export type tParsedIndexPattern = { type: string; updated_at: string; version: string; - _fields: any[]; + }; +}; + +export type tParsedIndexPattern = { + attributes: { + fields: string; + title: string; + }; + title: string; + id: string; + migrationVersion: { + 'index-pattern': string; + }; + namespace: string[]; + references: any[]; + score: number; + type: string; + updated_at: string; + version: string; + _fields: any[]; } & object; -export class PatternDataSourceRepository implements tDataSourceRepository{ - async get(id: string): Promise { - try { - const savedObjectResponse = await GenericRequest.request( - 'GET', - `/api/saved_objects/index-pattern/${id}?fields=title&fields=fields`, - ) as tSavedObjectResponse; +export class PatternDataSourceRepository + implements tDataSourceRepository +{ + async get(id: string): Promise { + try { + const savedObjectResponse = (await GenericRequest.request( + 'GET', + `/api/saved_objects/index-pattern/${id}?fields=title&fields=fields`, + )) as tSavedObjectResponse; - const indexPatternData = (savedObjectResponse || {}).data; - if(!indexPatternData){ - throw new Error(`Index pattern "${id}" not found`); - } - const parsedIndexPatternData = this.parseIndexPattern(indexPatternData); - if (!parsedIndexPatternData.title || !parsedIndexPatternData.id) { - throw new Error(`Invalid index pattern data`); - } - return parsedIndexPatternData; - } catch (error) { - throw new Error(`Error getting index pattern: ${error.message}`); - } + const indexPatternData = (savedObjectResponse || {}).data; + if (!indexPatternData) { + throw new Error(`Index pattern "${id}" not found`); + } + const parsedIndexPatternData = this.parseIndexPattern(indexPatternData); + if (!parsedIndexPatternData.title || !parsedIndexPatternData.id) { + throw new Error(`Invalid index pattern data`); + } + return parsedIndexPatternData; + } catch (error) { + throw new Error(`Error getting index pattern: ${error.message}`); } - async getAll(): Promise { - try { - const savedObjects = await GenericRequest.request( - 'GET', - `/api/saved_objects/_find?type=index-pattern&fields=title&fields=fields&per_page=9999`, - ); - const indexPatterns = ((savedObjects || {}).data || {}).saved_objects || []; - return indexPatterns.map(this.parseIndexPattern); - } catch (error) { - throw new Error(`Error getting index patterns: ${error.message}`); - } + } + async getAll(): Promise { + try { + const savedObjects = await GenericRequest.request( + 'GET', + `/api/saved_objects/_find?type=index-pattern&fields=title&fields=fields&per_page=9999`, + ); + const indexPatterns = + ((savedObjects || {}).data || {}).saved_objects || []; + return indexPatterns.map(this.parseIndexPattern); + } catch (error) { + throw new Error(`Error getting index patterns: ${error.message}`); } + } - parseIndexPattern(indexPatternData): tParsedIndexPattern { - const title = ((indexPatternData || {}).attributes || {}).title; - const id = (indexPatternData || {}).id; - return { - ...indexPatternData, - id: id, - title: title, - _fields: indexPatternData?.attributes?.fields - ? JSON.parse(indexPatternData.attributes.fields) - : [], - }; - } - - setDefault(dataSource: tParsedIndexPattern): void { - if(!dataSource){ - throw new Error('Index pattern is required'); - } - AppState.setCurrentPattern(dataSource.id); - return; + parseIndexPattern(indexPatternData): tParsedIndexPattern { + const title = ((indexPatternData || {}).attributes || {}).title; + const id = (indexPatternData || {}).id; + return { + ...indexPatternData, + id: id, + title: title, + _fields: indexPatternData?.attributes?.fields + ? JSON.parse(indexPatternData.attributes.fields) + : [], + }; + } + + setDefault(dataSource: tParsedIndexPattern): void { + if (!dataSource) { + throw new Error('Index pattern is required'); } - async getDefault(): Promise { - const currentPattern = AppState.getCurrentPattern(); - if(!currentPattern){ - return Promise.resolve(null); - } - return await this.get(currentPattern); + AppState.setCurrentPattern(dataSource.id); + return; + } + async getDefault(): Promise { + const currentPattern = this.getStoreIndexPatternId(); + if (!currentPattern) { + return Promise.resolve(null); } + return await this.get(currentPattern); + } + getStoreIndexPatternId(): string { + return AppState.getCurrentPattern(); + } } diff --git a/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx b/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx index ed26cf2fc6..2b6f1cfedd 100644 --- a/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx +++ b/plugins/main/public/components/common/wazuh-discover/wz-discover.tsx @@ -66,6 +66,8 @@ const WazuhDiscoverComponent = (props: WazuhDiscoverProps) => { const [isExporting, setIsExporting] = useState(false); const sideNavDocked = getWazuhCorePlugin().hooks.useDockedSideNav(); + const AlertsRepository = new AlertsDataSourceRepository(); + const { dataSource, filters, @@ -74,7 +76,7 @@ const WazuhDiscoverComponent = (props: WazuhDiscoverProps) => { fetchData, setFilters, } = useDataSource({ - repository: new AlertsDataSourceRepository(), // this makes only works with alerts index pattern + repository: AlertsRepository, // this makes only works with alerts index pattern DataSource, }); @@ -206,55 +208,58 @@ const WazuhDiscoverComponent = (props: WazuhDiscoverProps) => { {!isDataSourceLoading && results?.hits?.total === 0 ? ( ) : null} - {!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? ( - - - - - - - + 0 + ? '' + : 'wz-no-display' + } + > + + + + + - - - - - - ), - }} - /> - - - - ) : null} + + + + + + + ), + }} + /> + + + {inspectedHit && ( setInspectedHit(undefined)} size='m'> diff --git a/plugins/main/public/components/overview/amazon-web-services/dashboards/dashboard.tsx b/plugins/main/public/components/overview/amazon-web-services/dashboards/dashboard.tsx index e5317210c2..7c1da1eab1 100644 --- a/plugins/main/public/components/overview/amazon-web-services/dashboards/dashboard.tsx +++ b/plugins/main/public/components/overview/amazon-web-services/dashboards/dashboard.tsx @@ -32,6 +32,7 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; const DashboardAWSComponents: React.FC = ({}) => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardAWSComponents: React.FC = ({}) => { setFilters, } = useDataSource({ DataSource: AWSDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -109,38 +110,42 @@ const DashboardAWSComponents: React.FC = ({}) => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 + ? '' + : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/docker/dashboards/dashboard.tsx b/plugins/main/public/components/overview/docker/dashboards/dashboard.tsx index 0ce2503d34..9ff0c2fbe1 100644 --- a/plugins/main/public/components/overview/docker/dashboards/dashboard.tsx +++ b/plugins/main/public/components/overview/docker/dashboards/dashboard.tsx @@ -31,7 +31,8 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; -const DashboardDockerComponent: React.FC = ({ }) => { +const DashboardDockerComponent: React.FC = ({}) => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardDockerComponent: React.FC = ({ }) => { setFilters, } = useDataSource({ DataSource: DockerDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -110,38 +111,40 @@ const DashboardDockerComponent: React.FC = ({ }) => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 ? '' : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/fim/dashboard/dashboard.tsx b/plugins/main/public/components/overview/fim/dashboard/dashboard.tsx index e40b02345c..f0a66334c7 100644 --- a/plugins/main/public/components/overview/fim/dashboard/dashboard.tsx +++ b/plugins/main/public/components/overview/fim/dashboard/dashboard.tsx @@ -31,7 +31,8 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; -const DashboardFIMComponent: React.FC = ({ }) => { +const DashboardFIMComponent: React.FC = ({}) => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardFIMComponent: React.FC = ({ }) => { setFilters, } = useDataSource({ DataSource: FIMDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -110,38 +111,42 @@ const DashboardFIMComponent: React.FC = ({ }) => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 + ? '' + : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/gdpr/dashboards/dashboard.tsx b/plugins/main/public/components/overview/gdpr/dashboards/dashboard.tsx index d97b3d399d..43253060b2 100644 --- a/plugins/main/public/components/overview/gdpr/dashboards/dashboard.tsx +++ b/plugins/main/public/components/overview/gdpr/dashboards/dashboard.tsx @@ -32,6 +32,7 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; const DashboardGDPRComponent: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardGDPRComponent: React.FC = () => { setFilters, } = useDataSource({ DataSource: GDPRDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -111,38 +112,40 @@ const DashboardGDPRComponent: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 ? '' : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/github/dashboards/dashboard.tsx b/plugins/main/public/components/overview/github/dashboards/dashboard.tsx index a95594c9f8..0de79c2886 100644 --- a/plugins/main/public/components/overview/github/dashboards/dashboard.tsx +++ b/plugins/main/public/components/overview/github/dashboards/dashboard.tsx @@ -31,11 +31,8 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; -/* The vulnerabilities dashboard is made up of 3 dashboards because the filters need -a wrapper for visual adjustments, while the Kpi, the Open vs Close visualization and -the rest of the visualizations have different configurations at the dashboard level. */ - const DashboardGitHubComponent: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -45,7 +42,7 @@ const DashboardGitHubComponent: React.FC = () => { setFilters, } = useDataSource({ DataSource: GitHubDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -116,14 +113,18 @@ const DashboardGitHubComponent: React.FC = () => { ) : null} {dataSource && results?.hits?.total > 0 ? ( -
+
0 ? '' : 'wz-no-display' + }`} + > { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -40,7 +41,7 @@ const DashboardGoogleCloudComponent: React.FC = () => { setFilters, } = useDataSource({ DataSource: GoogleCloudDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -110,38 +111,40 @@ const DashboardGoogleCloudComponent: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 ? '' : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/hipaa/dashboards/dashboard.tsx b/plugins/main/public/components/overview/hipaa/dashboards/dashboard.tsx index a328007ec1..df2ed15b53 100644 --- a/plugins/main/public/components/overview/hipaa/dashboards/dashboard.tsx +++ b/plugins/main/public/components/overview/hipaa/dashboards/dashboard.tsx @@ -32,6 +32,7 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; const DashboardHIPAAComponent: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardHIPAAComponent: React.FC = () => { setFilters, } = useDataSource({ DataSource: HIPAADataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -90,7 +91,6 @@ const DashboardHIPAAComponent: React.FC = () => { JSON.stringify(fetchFilters), JSON.stringify(query), JSON.stringify(dateRangeFrom), - , JSON.stringify(dateRangeTo), ]); @@ -112,38 +112,40 @@ const DashboardHIPAAComponent: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 ? '' : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/malware-detection/dashboard/dashboard.tsx b/plugins/main/public/components/overview/malware-detection/dashboard/dashboard.tsx index bf706bc496..8d33b60077 100644 --- a/plugins/main/public/components/overview/malware-detection/dashboard/dashboard.tsx +++ b/plugins/main/public/components/overview/malware-detection/dashboard/dashboard.tsx @@ -31,7 +31,8 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; -const DashboardMalwareDetectionComponent: React.FC = ({ }) => { +const DashboardMalwareDetectionComponent: React.FC = ({}) => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardMalwareDetectionComponent: React.FC = ({ }) => { setFilters, } = useDataSource({ DataSource: MalwareDetectionDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -110,38 +111,42 @@ const DashboardMalwareDetectionComponent: React.FC = ({ }) => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 + ? '' + : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/mitre/dashboard/dashboard.tsx b/plugins/main/public/components/overview/mitre/dashboard/dashboard.tsx index fdef29a13a..5eb82126b6 100644 --- a/plugins/main/public/components/overview/mitre/dashboard/dashboard.tsx +++ b/plugins/main/public/components/overview/mitre/dashboard/dashboard.tsx @@ -29,6 +29,7 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; export const DashboardMITRE: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -38,7 +39,7 @@ export const DashboardMITRE: React.FC = () => { setFilters, } = useDataSource({ DataSource: MitreAttackDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -105,38 +106,40 @@ export const DashboardMITRE: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( -
- -
- 0, - ), - isFullScreenMode: false, - filters: fetchFilters ?? [], - useMargins: true, - id: 'mitre-dashboard-tab-filters', - timeRange: { - from: dateRangeFrom, - to: dateRangeTo, - }, - title: 'MITRE dashboard filters', - description: 'Dashboard of the MITRE filters', - query: query, - refreshConfig: { - pause: false, - value: 15, - }, - hidePanelTitles: false, - }} - /> -
+
0 ? '' : 'wz-no-display' + }`} + > + +
+
- ) : null} +
diff --git a/plugins/main/public/components/overview/nist/dashboards/dashboard.tsx b/plugins/main/public/components/overview/nist/dashboards/dashboard.tsx index cb6915d67d..6101114904 100644 --- a/plugins/main/public/components/overview/nist/dashboards/dashboard.tsx +++ b/plugins/main/public/components/overview/nist/dashboards/dashboard.tsx @@ -32,6 +32,7 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; const DashboardNIST80053Component: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardNIST80053Component: React.FC = () => { setFilters, } = useDataSource({ DataSource: NIST80053DataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -111,38 +112,40 @@ const DashboardNIST80053Component: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 ? '' : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/office/dashboard/dashboard.tsx b/plugins/main/public/components/overview/office/dashboard/dashboard.tsx index de011395ed..f42d7543d1 100644 --- a/plugins/main/public/components/overview/office/dashboard/dashboard.tsx +++ b/plugins/main/public/components/overview/office/dashboard/dashboard.tsx @@ -32,6 +32,7 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; const DashboardOffice365Component: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardOffice365Component: React.FC = () => { setFilters, } = useDataSource({ DataSource: Office365DataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -111,55 +112,60 @@ const DashboardOffice365Component: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( -
- - - -
- ) : null} + +
0 ? '' : 'wz-no-display' + }`} + > + + + +
diff --git a/plugins/main/public/components/overview/pci/dashboards/dashboard.tsx b/plugins/main/public/components/overview/pci/dashboards/dashboard.tsx index 04fff25cf0..0cc4dfc59f 100644 --- a/plugins/main/public/components/overview/pci/dashboards/dashboard.tsx +++ b/plugins/main/public/components/overview/pci/dashboards/dashboard.tsx @@ -32,6 +32,7 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; const DashboardPCIDSSComponent: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardPCIDSSComponent: React.FC = () => { setFilters, } = useDataSource({ DataSource: PCIDSSDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -112,38 +113,40 @@ const DashboardPCIDSSComponent: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 ? '' : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx b/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx index d8a0751b4d..b011319c11 100644 --- a/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx +++ b/plugins/main/public/components/overview/threat-hunting/dashboard/dashboard.tsx @@ -60,6 +60,7 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; const DashboardTH: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -69,7 +70,7 @@ const DashboardTH: React.FC = () => { setFilters, } = useDataSource({ DataSource: ThreatHuntingDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -224,69 +225,77 @@ const DashboardTH: React.FC = () => { {!isDataSourceLoading && dataSource && results?.hits?.total === 0 ? ( ) : null} - {!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? ( -
- -
- - -
- - { }} - tooltip={ - results?.hits?.total && - results?.hits?.total > MAX_ENTRIES_PER_QUERY - ? { +
0 + ? '' + : 'wz-no-display' + }`} + > + +
+ + +
+ + {}} + tooltip={ + results?.hits?.total && + results?.hits?.total > MAX_ENTRIES_PER_QUERY + ? { ariaLabel: 'Warning', content: `The query results has exceeded the limit of 10,000 hits. To provide a better experience the table only shows the first ${formatNumWithCommas( MAX_ENTRIES_PER_QUERY, @@ -294,47 +303,46 @@ const DashboardTH: React.FC = () => { iconType: 'alert', position: 'top', } - : undefined - } - /> - - Export Formated - - - ), - }} - /> -
- {inspectedHit && ( - setInspectedHit(undefined)} size='m'> - - -

Document details

-
-
- - - - - - - -
- )} + : undefined + } + /> + + Export Formated + + + ), + }} + />
+ {inspectedHit && ( + setInspectedHit(undefined)} size='m'> + + +

Document details

+
+
+ + + + + + + +
+ )}
- ) : null} +
); diff --git a/plugins/main/public/components/overview/tsc/dashboards/dashboard.tsx b/plugins/main/public/components/overview/tsc/dashboards/dashboard.tsx index a207191e6c..fd1df1fb67 100644 --- a/plugins/main/public/components/overview/tsc/dashboards/dashboard.tsx +++ b/plugins/main/public/components/overview/tsc/dashboards/dashboard.tsx @@ -32,6 +32,7 @@ const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; const DashboardTSCComponent: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -41,7 +42,7 @@ const DashboardTSCComponent: React.FC = () => { setFilters, } = useDataSource({ DataSource: TSCDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -111,38 +112,40 @@ const DashboardTSCComponent: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( - <> - -
- -
- - ) : null} +
0 ? '' : 'wz-no-display' + } + > + +
+ +
+
diff --git a/plugins/main/public/components/overview/virustotal/dashboard/dashboard.tsx b/plugins/main/public/components/overview/virustotal/dashboard/dashboard.tsx index 50dc0e9935..649c0f17c6 100644 --- a/plugins/main/public/components/overview/virustotal/dashboard/dashboard.tsx +++ b/plugins/main/public/components/overview/virustotal/dashboard/dashboard.tsx @@ -30,7 +30,9 @@ import { WzSearchBar } from '../../../common/search-bar'; const plugins = getPlugins(); const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; + const DashboardVT: React.FC = () => { + const AlertsRepository = new AlertsDataSourceRepository(); const { filters, dataSource, @@ -40,7 +42,7 @@ const DashboardVT: React.FC = () => { setFilters, } = useDataSource({ DataSource: VirusTotalDataSource, - repository: new AlertsDataSourceRepository(), + repository: AlertsRepository, }); const [results, setResults] = useState({} as SearchResponse); @@ -114,57 +116,61 @@ const DashboardVT: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {!isDataSourceLoading && dataSource && results?.hits?.total > 0 ? ( -
- - 0, - ), - isFullScreenMode: false, - filters: fetchFilters ?? [], - useMargins: true, - id: 'virustotal-dashboard-tab', - timeRange: { - from: dateRangeFrom, - to: dateRangeTo, - }, - title: 'Virustotal dashboard', - description: 'Dashboard of the Virustotal', - query: query, - refreshConfig: { - pause: false, - value: 15, - }, - hidePanelTitles: false, - }} - /> -
- ) : null} +
0 + ? '' + : 'wz-no-display' + }`} + > + + +
); diff --git a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx index b1ad586b7c..f6668eafbc 100644 --- a/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx +++ b/plugins/main/public/components/overview/vulnerabilities/common/hocs/validate-vulnerabilities-states-index-pattern.tsx @@ -17,12 +17,7 @@ import { LoadingSpinnerDataSource } from '../../../../common/loading/loading-spi const INDEX_PATTERN_CREATION_NO_INDEX = 'INDEX_PATTERN_CREATION_NO_INDEX'; async function checkExistenceIndexPattern(indexPatternID: string) { - const response = await getSavedObjects().client.get( - 'index-pattern', - indexPatternID, - ); - - return response?.error?.statusCode !== 404; + return await getSavedObjects().client.get('index-pattern', indexPatternID); } async function checkExistenceIndices(indexPatternId: string) { @@ -59,9 +54,10 @@ export async function validateVulnerabilitiesStateDataSources({ try { // Check the existence of related index pattern const existIndexPattern = await checkExistenceIndexPattern(indexPatternID); + let indexPattern = existIndexPattern; // If the idnex pattern does not exist, then check the existence of index - if (!existIndexPattern) { + if (existIndexPattern?.error?.statusCode === 404) { // Check the existence of indices const { exist, fields } = await checkExistenceIndices(indexPatternID); @@ -104,7 +100,7 @@ export async function validateVulnerabilitiesStateDataSources({ } return { ok: false, - data: {}, + data: { indexPattern }, }; } catch (error) { return { diff --git a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard.tsx b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard.tsx index 1dafd6ee5d..81b5dfbca3 100644 --- a/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard.tsx +++ b/plugins/main/public/components/overview/vulnerabilities/dashboards/overview/dashboard.tsx @@ -37,7 +37,13 @@ const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer; a wrapper for visual adjustments, while the Kpi, the Open vs Close visualization and the rest of the visualizations have different configurations at the dashboard level. */ -const DashboardVulsComponent: React.FC = () => { +interface DashboardVulsProps { + indexPattern: IndexPattern; +} + +const DashboardVulsComponent: React.FC = ({ + indexPattern, +}) => { const { filters, dataSource, @@ -96,22 +102,59 @@ const DashboardVulsComponent: React.FC = () => { {dataSource && results?.hits?.total === 0 ? ( ) : null} - {dataSource && results?.hits?.total > 0 ? ( -
+
0 ? '' : 'wz-no-display' + }`} + > + +
{ hidePanelTitles: true, }} /> -
- -
-
- ) : null} + +
diff --git a/plugins/main/public/styles/layout.scss b/plugins/main/public/styles/layout.scss index bcc08f7681..04ebb2d87c 100644 --- a/plugins/main/public/styles/layout.scss +++ b/plugins/main/public/styles/layout.scss @@ -241,7 +241,8 @@ /* Others */ .wz-no-display { - display: none !important; + height: 0; + overflow: hidden; } .wz-display-inline-grid {