From 2fdc49a1e5e7a78015092bab6da259eb61826b57 Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Wed, 1 Nov 2023 12:48:39 +0100 Subject: [PATCH 1/9] Change names of the applications in the menu --- plugins/main/public/utils/applications.ts | 50 +++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/plugins/main/public/utils/applications.ts b/plugins/main/public/utils/applications.ts index 58ffbfdf5c..b19f69b314 100644 --- a/plugins/main/public/utils/applications.ts +++ b/plugins/main/public/utils/applications.ts @@ -29,7 +29,7 @@ Server management: 600 Dashboard/indexer management (added to Wazuh dashboard default categories): 9000 */ -const overview = { +export const overview = { category: 'wz-category-home', id: 'wz-home', title: i18n.translate('wz-app-home', { @@ -50,7 +50,7 @@ export const fileIntegrityMonitoring = { category: 'wz-category-endpoint-security', id: 'file-integrity-monitoring', title: i18n.translate('wz-app-file-integrity-monitoring', { - defaultMessage: 'File integrity monitoring', + defaultMessage: 'File Integrity Monitoring', }), description: i18n.translate('file-integrity-monitoring-description', { defaultMessage: @@ -68,11 +68,11 @@ export const fileIntegrityMonitoring = { }`, }; -const endpointSumary = { +export const endpointSumary = { category: 'wz-category-server-management', id: 'endpoints-summary', title: i18n.translate('wz-app-endpoints-summary', { - defaultMessage: 'Endpoints summary', + defaultMessage: 'Endpoints Summary', }), description: i18n.translate('endpoints-summary-description', { defaultMessage: 'Summary of agents and their status.', @@ -88,7 +88,7 @@ const malwareDetection = { category: 'wz-category-endpoint-security', id: 'malware-detection', title: i18n.translate('wz-app-malware-detection', { - defaultMessage: 'Malware detection', + defaultMessage: 'Malware Detection', }), description: i18n.translate('malware-detection-description', { defaultMessage: @@ -110,7 +110,7 @@ export const configurationAssessment = { category: 'wz-category-endpoint-security', id: 'configuration-assessment', title: i18n.translate('wz-app-configuration-assessment', { - defaultMessage: 'Configuration assessment', + defaultMessage: 'Configuration Assessment', }), description: i18n.translate('configuration-assessment-description', { defaultMessage: @@ -132,7 +132,7 @@ export const threatHunting = { category: 'wz-category-threat-intelligence', id: 'threat-hunting', title: i18n.translate('wz-app-threat-hunting', { - defaultMessage: 'Threat hunting', + defaultMessage: 'Threat Hunting', }), description: i18n.translate('threat-hunting-description', { defaultMessage: @@ -154,7 +154,7 @@ export const vulnerabilityDetection = { category: 'wz-category-threat-intelligence', id: 'vulnerability-detection', title: i18n.translate('wz-app-vulnerability-detection', { - defaultMessage: 'Vulnerability detection', + defaultMessage: 'Vulnerability Detection', }), description: i18n.translate('vulnerability-detection-description', { defaultMessage: @@ -326,7 +326,7 @@ const tsc = { }`, }; -const itHygiene = { +export const itHygiene = { category: 'wz-category-security-operations', id: 'it-hygiene', title: i18n.translate('wz-app-it-hygiene', { @@ -457,7 +457,7 @@ const docker = { }`, }; -const rules = { +export const rules = { category: 'wz-category-server-management', id: 'rules', title: i18n.translate('wz-app-rules', { @@ -473,7 +473,7 @@ const rules = { redirectTo: () => '/manager/?tab=ruleset', }; -const decoders = { +export const decoders = { category: 'wz-category-server-management', id: 'decoders', title: i18n.translate('wz-app-decoders', { @@ -489,7 +489,7 @@ const decoders = { redirectTo: () => '/manager/?tab=decoders', }; -const cdbLists = { +export const cdbLists = { category: 'wz-category-server-management', id: 'cdb-lists', title: i18n.translate('wz-app-lists', { @@ -509,7 +509,7 @@ export const endpointGroups = { category: 'wz-category-server-management', id: 'endpoint-groups', title: i18n.translate('wz-app-endpoint-groups', { - defaultMessage: 'Endpoint groups', + defaultMessage: 'Endpoint Groups', }), description: i18n.translate('endpoint-groups-description', { defaultMessage: 'Manage your agent groups.', @@ -521,7 +521,7 @@ export const endpointGroups = { redirectTo: () => '/manager/?tab=groups', }; -const serverStatus = { +export const serverStatus = { category: 'wz-category-server-management', id: 'server-status', title: i18n.translate('wz-app-status', { @@ -553,7 +553,7 @@ const cluster = { redirectTo: () => '/manager/?tab=monitoring', }; -const statistics = { +export const statistics = { category: 'wz-category-server-management', id: 'statistics', title: i18n.translate('wz-app-statistics', { @@ -569,7 +569,7 @@ const statistics = { redirectTo: () => '/manager/?tab=statistics', }; -const logs = { +export const logs = { category: 'wz-category-server-management', id: 'logs', title: i18n.translate('wz-app-logs', { @@ -585,7 +585,7 @@ const logs = { redirectTo: () => '/manager/?tab=logs', }; -const reporting = { +export const reporting = { category: 'management', id: 'reporting', title: i18n.translate('wz-app-reporting', { @@ -601,7 +601,7 @@ const reporting = { redirectTo: () => '/manager/?tab=reporting', }; -const settings = { +export const settings = { category: 'wz-category-server-management', id: 'settings', title: i18n.translate('wz-app-settings', { @@ -637,7 +637,7 @@ const rulesetTest = { category: 'wz-category-server-management', id: 'ruleset-test', title: i18n.translate('wz-app-ruleset-test', { - defaultMessage: 'Ruleset test', + defaultMessage: 'Ruleset Test', }), description: i18n.translate('ruleset-test-description', { defaultMessage: 'Check your ruleset testing logs.', @@ -670,7 +670,7 @@ export const serverApi = { category: 'management', id: 'server-api', title: i18n.translate('wz-app-server-api', { - defaultMessage: 'Server API', + defaultMessage: 'Server APIs', }), description: i18n.translate('server-api-description', { defaultMessage: 'Manage and configure the API entries.', @@ -686,7 +686,7 @@ const serverData = { category: 'management', id: 'server-data', title: i18n.translate('wz-app-server-data', { - defaultMessage: 'Server data', + defaultMessage: 'Sample Data', }), description: i18n.translate('server-data-description', { defaultMessage: 'Add sample data with events to the modules.', @@ -702,7 +702,7 @@ export const wazuhPluginSettings = { category: 'management', id: 'wazuh-plugin-settings', title: i18n.translate('wz-app-wazuh-plugin-settings', { - defaultMessage: 'Wazuh plugin settings', + defaultMessage: 'App Settings', }), description: i18n.translate('wazuh-plugin-settings-description', { defaultMessage: 'Manage your Wazuh cluster configuration.', @@ -718,7 +718,7 @@ const wazuhPluginLogs = { category: 'management', id: 'wazuh-plugin-logs', title: i18n.translate('wz-app-wazuh-plugin-logs', { - defaultMessage: 'Wazuh plugin logs', + defaultMessage: 'App Logs', }), description: i18n.translate('wazuh-plugin-logs-description', { defaultMessage: 'Explore the logs related to the applications.', @@ -734,7 +734,7 @@ const wazuhPluginAbout = { category: 'management', id: 'wazuh-plugin-about', title: i18n.translate('wz-app-wazuh-plugin-about', { - defaultMessage: 'Wazuh plugin about', + defaultMessage: 'About', }), description: i18n.translate('wazuh-plugin-about-description', { defaultMessage: 'Show information about App Versions and community links.', @@ -848,7 +848,7 @@ export const Categories = [ }, { id: 'management', - label: 'Indexer/dashboard Management', + label: 'Indexer/dashboard management', order: 5e3, euiIconType: 'managementApp', }, From 41a6bdaf428f33536cec956557a301d41c860417 Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Wed, 1 Nov 2023 14:25:24 +0100 Subject: [PATCH 2/9] Change breadcrumbs --- .../components/common/modules/main-agent.tsx | 12 +- .../modules/overview-current-section.tsx | 24 ++- .../common/welcome/agents-welcome.js | 3 +- .../common/welcome/overview-welcome.js | 28 +-- .../agent/components/agents-preview.js | 3 +- .../cdblists/views/cdblists-overview.tsx | 79 +++++---- .../components/management/common/constants.ts | 3 - .../configuration/configuration-main.js | 5 +- .../decoders/views/decoders-overview.tsx | 81 ++++----- .../components/management/mg-logs/logs.js | 161 +++++++++++------- .../management/reporting/reporting-main.js | 16 +- .../ruleset/views/ruleset-overview.tsx | 78 +++++---- .../statistics/statistics-overview.js | 3 +- .../management/status/status-overview.js | 88 ++++++---- 14 files changed, 319 insertions(+), 265 deletions(-) diff --git a/plugins/main/public/components/common/modules/main-agent.tsx b/plugins/main/public/components/common/modules/main-agent.tsx index b84017169a..5e9c7d3a2f 100644 --- a/plugins/main/public/components/common/modules/main-agent.tsx +++ b/plugins/main/public/components/common/modules/main-agent.tsx @@ -28,6 +28,7 @@ import { AgentInfo } from '../../common/welcome/agents-info'; import { getAngularModule } from '../../../kibana-services'; import { compose } from 'redux'; import { withGlobalBreadcrumb } from '../hocs'; +import { itHygiene } from '../../../utils/applications'; export class MainModuleAgent extends Component { props!: { @@ -222,22 +223,17 @@ export class MainModuleAgent extends Component { } } - export default compose( - withGlobalBreadcrumb(({agent, section}) => { + withGlobalBreadcrumb(({ agent, section }) => { if (section === 'welcome') { - return [ - { text: '' }, - { text: 'IT Hygiene' }, - { text: agent.id }, - ]; + return [{ text: '' }, { text: itHygiene.title }, { text: agent.id }]; } else { return [ { text: '', }, { - text: 'IT Hygiene', + text: itHygiene.title, }, { agent: agent }, { diff --git a/plugins/main/public/components/common/modules/overview-current-section.tsx b/plugins/main/public/components/common/modules/overview-current-section.tsx index a7fb92d54b..05384ab742 100644 --- a/plugins/main/public/components/common/modules/overview-current-section.tsx +++ b/plugins/main/public/components/common/modules/overview-current-section.tsx @@ -15,7 +15,8 @@ import { updateGlobalBreadcrumb } from '../../../redux/actions/globalBreadcrumbA import { updateCurrentTab } from '../../../redux/actions/appStateActions'; import store from '../../../redux/store'; import { connect } from 'react-redux'; -import { WAZUH_MODULES } from '../../../../common/wazuh-modules'; +import { getWzCurrentAppID } from '../../../kibana-services'; +import { Applications } from '../../../utils/applications'; class WzCurrentOverviewSection extends Component { constructor(props) { @@ -26,16 +27,20 @@ class WzCurrentOverviewSection extends Component { setGlobalBreadcrumb() { const currentAgent = store.getState().appStateReducers.currentAgentData; - if (WAZUH_MODULES[this.props.currentTab]) { + const section = Applications.find( + ({ id }) => getWzCurrentAppID() === id, + )?.title; + + if (section) { const breadcrumb = currentAgent.id ? [ { text: '' }, { - text: WAZUH_MODULES[this.props.currentTab].title, + text: section, }, { agent: currentAgent }, ] - : [{ text: '' }, { text: WAZUH_MODULES[this.props.currentTab].title }]; + : [{ text: '' }, { text: section }]; store.dispatch(updateGlobalBreadcrumb(breadcrumb)); $('#breadcrumbNoTitle').attr('title', ''); } @@ -60,16 +65,7 @@ class WzCurrentOverviewSection extends Component { } render() { - return ( - - {/*this.props.currentTab && WAZUH_MODULES[this.props.currentTab] && WAZUH_MODULES[this.props.currentTab].title && ( - -

- {WAZUH_MODULES[this.props.currentTab].title} -

-
)*/} -
- ); + return ; } } diff --git a/plugins/main/public/components/common/welcome/agents-welcome.js b/plugins/main/public/components/common/welcome/agents-welcome.js index e3112d7d7c..c09aeafcfb 100644 --- a/plugins/main/public/components/common/welcome/agents-welcome.js +++ b/plugins/main/public/components/common/welcome/agents-welcome.js @@ -73,6 +73,7 @@ import { Applications, configurationAssessment, fileIntegrityMonitoring, + itHygiene, mitreAttack, threatHunting, vulnerabilityDetection, @@ -96,7 +97,7 @@ export const AgentsWelcome = compose( return [ { text: '' }, { - text: 'IT Hygiene', + text: itHygiene.title, }, ...(agent?.name ? [ diff --git a/plugins/main/public/components/common/welcome/overview-welcome.js b/plugins/main/public/components/common/welcome/overview-welcome.js index bdc459ca30..b4d4898977 100644 --- a/plugins/main/public/components/common/welcome/overview-welcome.js +++ b/plugins/main/public/components/common/welcome/overview-welcome.js @@ -24,17 +24,18 @@ import { EuiPage, EuiButtonEmpty, } from '@elastic/eui'; -import { updateCurrentTab } from '../../../redux/actions/appStateActions'; -import store from '../../../redux/store'; import './welcome.scss'; -import { WAZUH_MODULES } from '../../../../common/wazuh-modules'; import { withErrorBoundary, withGlobalBreadcrumb, withReduxProvider, } from '../hocs'; import { compose } from 'redux'; -import { Applications, Categories } from '../../../utils/applications'; +import { + Applications, + Categories, + overview, +} from '../../../utils/applications'; import { getCore } from '../../../kibana-services'; const appCategories = Applications.reduce((categories, app) => { @@ -63,7 +64,7 @@ export const OverviewWelcome = compose( withReduxProvider, withErrorBoundary, withGlobalBreadcrumb(props => { - return [{ text: '' }, { text: 'Overview' }]; + return [{ text: '' }, { text: overview.title }]; }), )( class OverviewWelcome extends Component { @@ -72,23 +73,6 @@ export const OverviewWelcome = compose( this.strtools = new StringsTools(); } - buildTabCard(tab, icon) { - return ( - - } - className='homSynopsis__card' - title={WAZUH_MODULES[tab].title} - onClick={() => store.dispatch(updateCurrentTab(tab))} - data-test-subj={`overviewWelcome${this.strtools.capitalize(tab)}`} - description={WAZUH_MODULES[tab].description} - /> - - ); - } - addAgent() { return ( <> diff --git a/plugins/main/public/controllers/agent/components/agents-preview.js b/plugins/main/public/controllers/agent/components/agents-preview.js index 9726fbb80e..c8f3e21983 100644 --- a/plugins/main/public/controllers/agent/components/agents-preview.js +++ b/plugins/main/public/controllers/agent/components/agents-preview.js @@ -53,11 +53,12 @@ import { agentStatusColorByAgentStatus, agentStatusLabelByAgentStatus, } from '../../../../common/services/wz_agent_status'; +import { endpointSumary } from '../../../utils/applications'; export const AgentsPreview = compose( withErrorBoundary, withReduxProvider, - withGlobalBreadcrumb([{ text: '' }, { text: 'Endpoints summary' }]), + withGlobalBreadcrumb([{ text: '' }, { text: endpointSumary.title }]), withUserAuthorizationPrompt([ [ { action: 'agent:read', resource: 'agent:id:*' }, diff --git a/plugins/main/public/controllers/management/components/management/cdblists/views/cdblists-overview.tsx b/plugins/main/public/controllers/management/components/management/cdblists/views/cdblists-overview.tsx index 10e75dd501..f3a2ad6fb8 100644 --- a/plugins/main/public/controllers/management/components/management/cdblists/views/cdblists-overview.tsx +++ b/plugins/main/public/controllers/management/components/management/cdblists/views/cdblists-overview.tsx @@ -6,61 +6,66 @@ import { EuiFlexItem, EuiPanel, EuiPage, - EuiSpacer + EuiSpacer, } from '@elastic/eui'; // Wazuh components -import { withUserAuthorizationPrompt, withGlobalBreadcrumb } from '../../../../../../components/common/hocs'; +import { + withUserAuthorizationPrompt, + withGlobalBreadcrumb, +} from '../../../../../../components/common/hocs'; import { compose } from 'redux'; import { resourceDictionary } from '../../common/resources-handler'; -import { SECTION_CDBLIST_NAME, SECTION_CDBLIST_KEY } from '../../common/constants'; +import { SECTION_CDBLIST_KEY } from '../../common/constants'; import CDBListsTable from '../components/cdblists-table'; import '../../common/layout-overview.scss'; import WzRestartClusterManagerCallout from '../../../../../../components/common/restart-cluster-manager-callout'; - +import { cdbLists } from '../../../../../../utils/applications'; function WzCDBListsOverview(props) { - const [showWarningRestart, setShowWarningRestart] = useState(false); - const updateRestartManagers = (showWarningRestart) => { + const updateRestartManagers = showWarningRestart => { setShowWarningRestart(showWarningRestart); - } + }; - return - - {showWarningRestart && ( - <> - - updateRestartManagers(false)} - onRestartedError={() => updateRestartManagers(true)} - /> - - - )} + return ( + + + {showWarningRestart && ( + <> + + updateRestartManagers(false)} + onRestartedError={() => updateRestartManagers(true)} + /> + + + )} - - - updateRestartManagers(showWarningRestart)} - /> - - - - ; + + + + updateRestartManagers(showWarningRestart) + } + /> + + + + + ); } - export default compose( withGlobalBreadcrumb(props => { - return [ - { text: '' }, - { text: SECTION_CDBLIST_NAME} - ]; + return [{ text: '' }, { text: cdbLists.title }]; }), - withUserAuthorizationPrompt((props) => [ - { action: `${SECTION_CDBLIST_KEY}:read`, resource: resourceDictionary[SECTION_CDBLIST_KEY].permissionResource('*') } - ]) + withUserAuthorizationPrompt(props => [ + { + action: `${SECTION_CDBLIST_KEY}:read`, + resource: resourceDictionary[SECTION_CDBLIST_KEY].permissionResource('*'), + }, + ]), )(WzCDBListsOverview); diff --git a/plugins/main/public/controllers/management/components/management/common/constants.ts b/plugins/main/public/controllers/management/components/management/common/constants.ts index 4ad8214e6f..80f8a3365b 100644 --- a/plugins/main/public/controllers/management/components/management/common/constants.ts +++ b/plugins/main/public/controllers/management/components/management/common/constants.ts @@ -1,11 +1,8 @@ -export const SECTION_RULES_NAME = 'Rules'; export const SECTION_RULES_KEY = 'rules'; export const SECTION_RULES_SECTION = 'rules'; -export const SECTION_DECODERS_NAME = 'Decoders'; export const SECTION_DECODERS_KEY = 'decoders'; export const SECTION_DECODERS_SECTION = 'decoders'; -export const SECTION_CDBLIST_NAME = 'CDB lists'; export const SECTION_CDBLIST_KEY = 'lists'; export const SECTION_CDBLIST_SECTION = 'lists'; diff --git a/plugins/main/public/controllers/management/components/management/configuration/configuration-main.js b/plugins/main/public/controllers/management/components/management/configuration/configuration-main.js index a8e938b1ef..a32336d8f7 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/configuration-main.js +++ b/plugins/main/public/controllers/management/components/management/configuration/configuration-main.js @@ -17,6 +17,7 @@ import { withReduxProvider, } from '../../../../../components/common/hocs'; import { compose } from 'redux'; +import { itHygiene, settings } from '../../../../../utils/applications'; export default compose( withErrorBoundary, @@ -24,12 +25,12 @@ export default compose( withGlobalBreadcrumb(props => { let breadcrumb = false; if (props.agent.id === '000') { - breadcrumb = [{ text: '' }, { text: 'Settings' }]; + breadcrumb = [{ text: '' }, { text: settings.title }]; } else { breadcrumb = [ { text: '' }, { - text: 'IT Hygiene', + text: itHygiene.title, }, { agent: props.agent }, { text: 'Configuration' }, diff --git a/plugins/main/public/controllers/management/components/management/decoders/views/decoders-overview.tsx b/plugins/main/public/controllers/management/components/management/decoders/views/decoders-overview.tsx index 31762d2e69..79e977ffee 100644 --- a/plugins/main/public/controllers/management/components/management/decoders/views/decoders-overview.tsx +++ b/plugins/main/public/controllers/management/components/management/decoders/views/decoders-overview.tsx @@ -7,62 +7,67 @@ import { EuiFlexItem, EuiPanel, EuiPage, - EuiSpacer + EuiSpacer, } from '@elastic/eui'; // Wazuh components -import { withUserAuthorizationPrompt, withGlobalBreadcrumb } from '../../../../../../components/common/hocs'; +import { + withUserAuthorizationPrompt, + withGlobalBreadcrumb, +} from '../../../../../../components/common/hocs'; import { compose } from 'redux'; import { resourceDictionary } from '../../common/resources-handler'; -import { SECTION_DECODERS_NAME, SECTION_DECODERS_KEY } from '../../common/constants'; +import { SECTION_DECODERS_KEY } from '../../common/constants'; import '../../common/layout-overview.scss'; import DecodersTable from '../components/decoders-table'; import WzRestartClusterManagerCallout from '../../../../../../components/common/restart-cluster-manager-callout'; - +import { decoders } from '../../../../../../utils/applications'; function WzDecodersOverview(props) { - const [showWarningRestart, setShowWarningRestart] = useState(false); - const updateRestartManagers = (showWarningRestart) => { + const updateRestartManagers = showWarningRestart => { setShowWarningRestart(showWarningRestart); - } - - - return - - {showWarningRestart && ( - <> - - updateRestartManagers(false)} - onRestartedError={() => updateRestartManagers(true)} - /> - - - )} + }; - - - updateRestartManagers(showWarningRestart)} - /> - - - -; + return ( + + + {showWarningRestart && ( + <> + + updateRestartManagers(false)} + onRestartedError={() => updateRestartManagers(true)} + /> + + + )} + + + + updateRestartManagers(showWarningRestart) + } + /> + + + + + ); } export default compose( withGlobalBreadcrumb(props => { - return [ - { text: '' }, - { text: SECTION_DECODERS_NAME} - ]; + return [{ text: '' }, { text: decoders.title }]; }), - withUserAuthorizationPrompt((props) => [ - { action: `${SECTION_DECODERS_KEY}:read`, resource: resourceDictionary[SECTION_DECODERS_KEY].permissionResource('*') } - ]) + withUserAuthorizationPrompt(props => [ + { + action: `${SECTION_DECODERS_KEY}:read`, + resource: + resourceDictionary[SECTION_DECODERS_KEY].permissionResource('*'), + }, + ]), )(WzDecodersOverview); diff --git a/plugins/main/public/controllers/management/components/management/mg-logs/logs.js b/plugins/main/public/controllers/management/components/management/mg-logs/logs.js index 1c43201a1c..3cee454e95 100644 --- a/plugins/main/public/controllers/management/components/management/mg-logs/logs.js +++ b/plugins/main/public/controllers/management/components/management/mg-logs/logs.js @@ -41,13 +41,14 @@ import { UI_LOGGER_LEVELS } from '../../../../../../common/constants'; import { UI_ERROR_SEVERITIES } from '../../../../../react-services/error-orchestrator/types'; import { getErrorOrchestrator } from '../../../../../react-services/common-services'; import { WzFieldSearchDelay } from '../../../../../components/common/search'; +import { logs } from '../../../../../utils/applications'; export default compose( - withGlobalBreadcrumb([{ text: '' }, { text: 'Logs' }]), + withGlobalBreadcrumb([{ text: '' }, { text: logs.title }]), withUserAuthorizationPrompt([ { action: 'cluster:status', resource: '*:*:*' }, { action: 'cluster:read', resource: 'node:id:*' }, - ]) + ]), )( class WzLogs extends Component { constructor(props) { @@ -100,7 +101,7 @@ export default compose( this.setState({ isLoading: false, }); - } + }, ); } catch (error) { this.setState({ @@ -131,7 +132,12 @@ export default compose( try { const path = logsPath + '/summary'; const responseLogsSummary = await WzRequest.apiReq('GET', path, {}); - const daemonsList = ['all', ...responseLogsSummary?.data?.data?.affected_items.map(logSummary => Object.keys(logSummary)[0]).sort()]; + const daemonsList = [ + 'all', + ...responseLogsSummary?.data?.data?.affected_items + .map(logSummary => Object.keys(logSummary)[0]) + .sort(), + ]; this.setState({ daemonsList }); } catch (error) { throw new Error('Error fetching daemons list: ' + error); @@ -140,7 +146,7 @@ export default compose( parseLogsToText(logs) { let result = ''; - logs.forEach((item) => { + logs.forEach(item => { result += formatUIDate(item.timestamp) + ' ' + @@ -159,8 +165,10 @@ export default compose( if (customOffset) { result['offset'] = customOffset; } - if (this.state.logLevelSelect !== 'all') result['level'] = this.state.logLevelSelect; - if (this.state.selectedDaemon !== 'all') result['tag'] = this.state.selectedDaemon; + if (this.state.logLevelSelect !== 'all') + result['level'] = this.state.logLevelSelect; + if (this.state.selectedDaemon !== 'all') + result['tag'] = this.state.selectedDaemon; if (this.state.appliedSearch) result['search'] = this.state.appliedSearch; result['sort'] = `${this.state.descendingSort ? '-' : '+'}timestamp`; @@ -219,7 +227,11 @@ export default compose( */ async getLogsPath() { try { - const clusterStatus = await WzRequest.apiReq('GET', '/cluster/status', {}); + const clusterStatus = await WzRequest.apiReq( + 'GET', + '/cluster/status', + {}, + ); const clusterEnabled = clusterStatus?.data?.data?.running === 'yes' && clusterStatus?.data?.data?.enabled === 'yes'; @@ -227,11 +239,15 @@ export default compose( if (clusterEnabled) { let nodeList = ''; let selectedNode = ''; - const nodeListTmp = await WzRequest.apiReq('GET', '/cluster/nodes', {}); + const nodeListTmp = await WzRequest.apiReq( + 'GET', + '/cluster/nodes', + {}, + ); if (Array.isArray(nodeListTmp?.data?.data?.affected_items)) { nodeList = nodeListTmp.data.data.affected_items; selectedNode = nodeListTmp.data.data.affected_items.filter( - (item) => item.type === 'master' + item => item.type === 'master', )[0].name; } return { @@ -249,7 +265,7 @@ export default compose( getDaemonsOptions() { return this.state.daemonsList.length > 0 - ? this.state.daemonsList.map((item) => { + ? this.state.daemonsList.map(item => { return { value: item, text: item === 'all' ? 'All daemons' : item }; }) : [{ value: 'all', text: 'All daemons' }]; @@ -270,7 +286,7 @@ export default compose( getNodeList() { try { if (this.state.nodeList && Array.isArray(this.state.nodeList)) { - return this.state.nodeList.map((item) => { + return this.state.nodeList.map(item => { return { value: item.name, text: `${item.name} (${item.type})` }; }); } else { @@ -293,69 +309,76 @@ export default compose( } } - onDaemonChange = (e) => { + onDaemonChange = e => { this.setState( { selectedDaemon: e.target.value, }, - this.setFullLogs + this.setFullLogs, ); }; - onLogLevelChange = (e) => { + onLogLevelChange = e => { this.setState( { logLevelSelect: e.target.value, }, - this.setFullLogs + this.setFullLogs, ); }; - onSortSwitchChange = (e) => { + onSortSwitchChange = e => { this.setState( { descendingSort: e.target.checked, }, - this.setFullLogs + this.setFullLogs, ); }; - onSelectNode = (e) => { + onSelectNode = e => { this.setState( { selectedNode: e.target.value, logsPath: `/cluster/${e.target.value}/logs`, }, - this.setFullLogs + this.setFullLogs, ); }; - onSearchBarChange = (e) => { + onSearchBarChange = e => { this.setState({ searchBarValue: e, }); }; - onSearchBarSearch = (e) => { + onSearchBarSearch = e => { this.setState( { appliedSearch: e, }, - this.setFullLogs + this.setFullLogs, ); }; makeSearch() { - this.setState({ appliedSearch: this.state.searchBarValue }, this.setFullLogs); + this.setState( + { appliedSearch: this.state.searchBarValue }, + this.setFullLogs, + ); } setRealTimeInterval() { - if (this.state.realTime) this.realTimeInterval = setInterval(() => this.setFullLogs(), 5000); + if (this.state.realTime) + this.realTimeInterval = setInterval(() => this.setFullLogs(), 5000); else clearInterval(this.realTimeInterval); } switchRealTime() { - this.setState({ realTime: !this.state.realTime }, this.setRealTimeInterval); + this.setState( + { realTime: !this.state.realTime }, + this.setRealTimeInterval, + ); } showToast = (color, title, time) => { @@ -369,12 +392,23 @@ export default compose( exportFormatted = async () => { try { this.setState({ generatingCsv: true }); - this.showToast('success', 'Your download should begin automatically...', 3000); + this.showToast( + 'success', + 'Your download should begin automatically...', + 3000, + ); const filters = this.buildFilters(); await exportCsv( - this.state.selectedNode ? `/cluster/${this.state.selectedNode}/logs` : '/manager/logs', - Object.keys(filters).map((filter) => ({ name: filter, value: filters[filter] })), - `wazuh-${this.state.selectedNode ? `${this.state.selectedNode}-` : ''}ossec-log` + this.state.selectedNode + ? `/cluster/${this.state.selectedNode}/logs` + : '/manager/logs', + Object.keys(filters).map(filter => ({ + name: filter, + value: filters[filter], + })), + `wazuh-${ + this.state.selectedNode ? `${this.state.selectedNode}-` : '' + }ossec-log`, ); } catch (error) { const options = { @@ -410,7 +444,7 @@ export default compose( - +

List and filter Wazuh logs.

@@ -433,43 +467,43 @@ export default compose( {this.state.selectedNode && ( )} this.switchRealTime()} /> @@ -484,8 +518,8 @@ export default compose( delay={500} onChange={this.onSearchBarChange} onSearch={this.onSearchBarSearch} - placeholder="Filter logs" - aria-label="Filter logs" + placeholder='Filter logs' + aria-label='Filter logs' fullWidth /> @@ -510,25 +544,34 @@ export default compose(
{(this.state.logsList && ( -
+
{this.state.logsList}
- + {this.state.offset + 100 < this.state.totalItems && ( - - + + this.loadExtraLogs() : undefined} + onClick={ + !this.state.loadingLogs + ? () => this.loadExtraLogs() + : undefined + } > Load more logs @@ -538,9 +581,9 @@ export default compose( )) || ( )}
@@ -551,14 +594,14 @@ export default compose( return ( - + {this.header()} {(!this.state.isLoading && this.logsTable()) || ( - + - + )} @@ -567,5 +610,5 @@ export default compose( ); } - } + }, ); diff --git a/plugins/main/public/controllers/management/components/management/reporting/reporting-main.js b/plugins/main/public/controllers/management/components/management/reporting/reporting-main.js index 1b69de3f0b..bd96f3cf21 100644 --- a/plugins/main/public/controllers/management/components/management/reporting/reporting-main.js +++ b/plugins/main/public/controllers/management/components/management/reporting/reporting-main.js @@ -15,7 +15,11 @@ import WzReduxProvider from '../../../../../redux/wz-redux-provider'; //Wazuh groups overview import WzReportingOverview from './reporting-overview'; import { compose } from 'redux'; -import { withGlobalBreadcrumb, withReduxProvider } from '../../../../../components/common/hocs'; +import { + withGlobalBreadcrumb, + withReduxProvider, +} from '../../../../../components/common/hocs'; +import { reporting } from '../../../../../utils/applications'; class WzReporting extends Component { constructor(props) { @@ -34,9 +38,7 @@ class WzReporting extends Component { export default compose( withReduxProvider, - withGlobalBreadcrumb( props => { - return [ - { text: '' }, - { text: 'Reporting' } - ]; -}))(WzReporting); + withGlobalBreadcrumb(props => { + return [{ text: '' }, { text: reporting.title }]; + }), +)(WzReporting); diff --git a/plugins/main/public/controllers/management/components/management/ruleset/views/ruleset-overview.tsx b/plugins/main/public/controllers/management/components/management/ruleset/views/ruleset-overview.tsx index 11c1dd9698..0113f4e86c 100644 --- a/plugins/main/public/controllers/management/components/management/ruleset/views/ruleset-overview.tsx +++ b/plugins/main/public/controllers/management/components/management/ruleset/views/ruleset-overview.tsx @@ -6,60 +6,66 @@ import { EuiFlexItem, EuiPanel, EuiPage, - EuiSpacer + EuiSpacer, } from '@elastic/eui'; // Wazuh components -import { withUserAuthorizationPrompt, withGlobalBreadcrumb } from '../../../../../../components/common/hocs'; +import { + withUserAuthorizationPrompt, + withGlobalBreadcrumb, +} from '../../../../../../components/common/hocs'; import { compose } from 'redux'; import { resourceDictionary } from '../../common/resources-handler'; -import { SECTION_RULES_NAME, SECTION_RULES_KEY } from '../../common/constants'; +import { SECTION_RULES_KEY } from '../../common/constants'; import RulesetTable from '../components/ruleset-table'; import '../../common/layout-overview.scss'; import WzRestartClusterManagerCallout from '../../../../../../components/common/restart-cluster-manager-callout'; - +import { rules } from '../../../../../../utils/applications'; function WzRulesetOverview(props) { - const [showWarningRestart, setShowWarningRestart] = useState(false); - const updateRestartManagers = (showWarningRestart) => { + const updateRestartManagers = showWarningRestart => { setShowWarningRestart(showWarningRestart); - } + }; - return - - {showWarningRestart && ( - <> - - updateRestartManagers(false)} - onRestartedError={() => updateRestartManagers(true)} - /> - - - )} + return ( + + + {showWarningRestart && ( + <> + + updateRestartManagers(false)} + onRestartedError={() => updateRestartManagers(true)} + /> + + + )} - - - updateRestartManagers(showWarningRestart)} - /> - - - - ; + + + + updateRestartManagers(showWarningRestart) + } + /> + + + + + ); } export default compose( withGlobalBreadcrumb(props => { - return [ - { text: '' }, - { text: SECTION_RULES_NAME} - ]; + return [{ text: '' }, { text: rules.title }]; }), - withUserAuthorizationPrompt((props) => [ - { action: `${SECTION_RULES_KEY}:read`, resource: resourceDictionary[SECTION_RULES_KEY].permissionResource('*') } - ]) + withUserAuthorizationPrompt(props => [ + { + action: `${SECTION_RULES_KEY}:read`, + resource: resourceDictionary[SECTION_RULES_KEY].permissionResource('*'), + }, + ]), )(WzRulesetOverview); diff --git a/plugins/main/public/controllers/management/components/management/statistics/statistics-overview.js b/plugins/main/public/controllers/management/components/management/statistics/statistics-overview.js index 5226342b41..5f5cb596cf 100644 --- a/plugins/main/public/controllers/management/components/management/statistics/statistics-overview.js +++ b/plugins/main/public/controllers/management/components/management/statistics/statistics-overview.js @@ -45,6 +45,7 @@ import { UI_ERROR_SEVERITIES } from '../../../../../react-services/error-orchest import { UI_LOGGER_LEVELS } from '../../../../../../common/constants'; import { getErrorOrchestrator } from '../../../../../react-services/common-services'; import { getCore } from '../../../../../kibana-services'; +import { statistics } from '../../../../../utils/applications'; const wzConfig = new WazuhConfig(); export class WzStatisticsOverview extends Component { @@ -264,7 +265,7 @@ export class WzStatisticsOverview extends Component { } export default compose( - withGlobalBreadcrumb([{ text: '' }, { text: 'Statistics' }]), + withGlobalBreadcrumb([{ text: '' }, { text: statistics.title }]), withGuard(props => { return !(wzConfig.getConfig() || {})['cron.statistics.status']; // if 'cron.statistics.status' is false, then it renders PromptStatisticsDisabled component }, PromptStatisticsDisabled), diff --git a/plugins/main/public/controllers/management/components/management/status/status-overview.js b/plugins/main/public/controllers/management/components/management/status/status-overview.js index e05d12d374..cf6ce67c10 100644 --- a/plugins/main/public/controllers/management/components/management/status/status-overview.js +++ b/plugins/main/public/controllers/management/components/management/status/status-overview.js @@ -54,6 +54,7 @@ import { compose } from 'redux'; import { UI_ERROR_SEVERITIES } from '../../../../../react-services/error-orchestrator/types'; import { UI_LOGGER_LEVELS } from '../../../../../../common/constants'; import { getErrorOrchestrator } from '../../../../../react-services/common-services'; +import { serverStatus } from '../../../../../utils/applications'; export class WzStatusOverview extends Component { _isMounted = false; @@ -92,15 +93,14 @@ export class WzStatusOverview extends Component { try { this.props.updateLoadingStatus(true); - - const [ - clusterStatus, - agentsCountByManagerNodes - ] = (await Promise.all([ - this.statusHandler.clusterStatus(), - this.statusHandler.clusterAgentsCount() - ])).map(response => response?.data?.data); - const { connection: agentsCount, configuration } = agentsCountByManagerNodes?.agent_status; + const [clusterStatus, agentsCountByManagerNodes] = ( + await Promise.all([ + this.statusHandler.clusterStatus(), + this.statusHandler.clusterAgentsCount(), + ]) + ).map(response => response?.data?.data); + const { connection: agentsCount, configuration } = + agentsCountByManagerNodes?.agent_status; const agentsActiveCoverage = ( (agentsCount.active / agentsCount.total) * @@ -118,32 +118,48 @@ export class WzStatusOverview extends Component { agentsCoverage: isNaN(agentsActiveCoverage) ? 0 : agentsActiveCoverage, }); - this.props.updateClusterEnabled(clusterStatus && clusterStatus.enabled === 'yes'); + this.props.updateClusterEnabled( + clusterStatus && clusterStatus.enabled === 'yes', + ); - if (clusterStatus && clusterStatus.enabled === 'yes' && clusterStatus.running === 'yes') { + if ( + clusterStatus && + clusterStatus.enabled === 'yes' && + clusterStatus.running === 'yes' + ) { const nodes = await this.statusHandler.clusterNodes(); const listNodes = nodes.data.data.affected_items; this.props.updateListNodes(listNodes); const masterNode = nodes.data.data.affected_items.filter( - (item) => item.type === 'master' + item => item.type === 'master', )[0]; this.props.updateSelectedNode(masterNode.name); - const daemons = await this.statusHandler.clusterNodeStatus(masterNode.name); + const daemons = await this.statusHandler.clusterNodeStatus( + masterNode.name, + ); const listDaemons = this.objToArr(daemons.data.data.affected_items[0]); this.props.updateListDaemons(listDaemons); - const nodeInfo = await this.statusHandler.clusterNodeInfo(masterNode.name); + const nodeInfo = await this.statusHandler.clusterNodeInfo( + masterNode.name, + ); this.props.updateNodeInfo(nodeInfo.data.data.affected_items[0]); } else { - if (clusterStatus && clusterStatus.enabled === 'yes' && clusterStatus.running === 'no') { + if ( + clusterStatus && + clusterStatus.enabled === 'yes' && + clusterStatus.running === 'no' + ) { this.showToast( 'danger', `Cluster is enabled but it's not running, please check your cluster health.`, - 3000 + 3000, ); } else { const managerInfo = await this.statusHandler.managerInfo(); const daemons = await this.statusHandler.managerStatus(); - const listDaemons = this.objToArr(daemons?.data?.data?.affected_items?.[0]); + const listDaemons = this.objToArr( + daemons?.data?.data?.affected_items?.[0], + ); const managerInfoData = managerInfo?.data?.data?.affected_items?.[0]; this.props.updateListDaemons(listDaemons); this.props.updateSelectedNode(false); @@ -178,7 +194,8 @@ export class WzStatusOverview extends Component { }; render() { - const { isLoading, listDaemons, stats, nodeInfo, agentInfo } = this.props.state; + const { isLoading, listDaemons, stats, nodeInfo, agentInfo } = + this.props.state; return ( @@ -197,11 +214,11 @@ export class WzStatusOverview extends Component { - {isLoading && } + {isLoading && } {!isLoading && listDaemons && } - + {!isLoading && stats && } - + {!isLoading && ( {nodeInfo && ( @@ -224,31 +241,30 @@ export class WzStatusOverview extends Component { } } -const mapStateToProps = (state) => { +const mapStateToProps = state => { return { state: state.statusReducers, }; }; -const mapDispatchToProps = (dispatch) => { +const mapDispatchToProps = dispatch => { return { - updateLoadingStatus: (status) => dispatch(updateLoadingStatus(status)), - updateListNodes: (listNodes) => dispatch(updateListNodes(listNodes)), - updateSelectedNode: (selectedNode) => dispatch(updateSelectedNode(selectedNode)), - updateListDaemons: (listDaemons) => dispatch(updateListDaemons(listDaemons)), - updateStats: (stats) => dispatch(updateStats(stats)), - updateNodeInfo: (nodeInfo) => dispatch(updateNodeInfo(nodeInfo)), - updateAgentInfo: (agentInfo) => dispatch(updateAgentInfo(agentInfo)), - updateClusterEnabled: (clusterEnabled) => dispatch(updateClusterEnabled(clusterEnabled)), + updateLoadingStatus: status => dispatch(updateLoadingStatus(status)), + updateListNodes: listNodes => dispatch(updateListNodes(listNodes)), + updateSelectedNode: selectedNode => + dispatch(updateSelectedNode(selectedNode)), + updateListDaemons: listDaemons => dispatch(updateListDaemons(listDaemons)), + updateStats: stats => dispatch(updateStats(stats)), + updateNodeInfo: nodeInfo => dispatch(updateNodeInfo(nodeInfo)), + updateAgentInfo: agentInfo => dispatch(updateAgentInfo(agentInfo)), + updateClusterEnabled: clusterEnabled => + dispatch(updateClusterEnabled(clusterEnabled)), cleanInfo: () => dispatch(cleanInfo()), }; }; export default compose( - withGlobalBreadcrumb([ - { text: '' }, - { text: 'Status' }, - ]), + withGlobalBreadcrumb([{ text: '' }, { text: serverStatus.title }]), withUserAuthorizationPrompt([ [ { action: 'agent:read', resource: 'agent:id:*' }, @@ -257,5 +273,5 @@ export default compose( { action: 'manager:read', resource: '*:*:*' }, { action: 'cluster:read', resource: 'node:id:*' }, ]), - connect(mapStateToProps, mapDispatchToProps) + connect(mapStateToProps, mapDispatchToProps), )(WzStatusOverview); From 2188627ce0c26241f3d089eb6979d5c1c2f2969a Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Wed, 1 Nov 2023 14:26:32 +0100 Subject: [PATCH 3/9] Change Wazuh API configuration to API Configuration --- plugins/main/public/components/settings/api/api-table.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/main/public/components/settings/api/api-table.js b/plugins/main/public/components/settings/api/api-table.js index c9b333606c..14a8a07099 100644 --- a/plugins/main/public/components/settings/api/api-table.js +++ b/plugins/main/public/components/settings/api/api-table.js @@ -331,7 +331,7 @@ export const ApiTable = compose( -

Wazuh API configuration

+

API Configuration

From 31605bf1f83e0432568f6ac051a9fd3b8cc16131 Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Wed, 1 Nov 2023 15:06:14 +0100 Subject: [PATCH 4/9] Change the style of Home icons --- .../components/common/welcome/overview-welcome.js | 8 ++------ plugins/main/public/styles/index.ts | 2 -- plugins/main/public/styles/mixins.scss | 15 --------------- .../main/public/styles/theme/dark/index.dark.scss | 5 ----- .../main/public/styles/theme/dark/variables.scss | 2 -- .../public/styles/theme/light/index.light.scss | 4 ---- .../main/public/styles/theme/light/variables.scss | 2 -- 7 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 plugins/main/public/styles/mixins.scss delete mode 100644 plugins/main/public/styles/theme/dark/variables.scss delete mode 100644 plugins/main/public/styles/theme/light/index.light.scss delete mode 100644 plugins/main/public/styles/theme/light/variables.scss diff --git a/plugins/main/public/components/common/welcome/overview-welcome.js b/plugins/main/public/components/common/welcome/overview-welcome.js index b4d4898977..2691bc41ca 100644 --- a/plugins/main/public/components/common/welcome/overview-welcome.js +++ b/plugins/main/public/components/common/welcome/overview-welcome.js @@ -105,7 +105,7 @@ export const OverviewWelcome = compose( render() { return ( - + {this.props.agentsCountTotal === 0 && this.addAgent()} @@ -129,11 +129,7 @@ export const OverviewWelcome = compose( size='xs' layout='horizontal' icon={ - + } className='homSynopsis__card' title={app.title} diff --git a/plugins/main/public/styles/index.ts b/plugins/main/public/styles/index.ts index a06d502a87..8c1e781275 100644 --- a/plugins/main/public/styles/index.ts +++ b/plugins/main/public/styles/index.ts @@ -27,7 +27,5 @@ const IS_DARK_THEME = getUiSettings().get('theme:darkMode'); /* tslint-disable no-undef */ if (IS_DARK_THEME) { import('./theme/dark/index.dark.scss').then(); -}else{ - import('./theme/light/index.light.scss').then(); } /* tslint-enable no-undef */ diff --git a/plugins/main/public/styles/mixins.scss b/plugins/main/public/styles/mixins.scss deleted file mode 100644 index c9b1846847..0000000000 --- a/plugins/main/public/styles/mixins.scss +++ /dev/null @@ -1,15 +0,0 @@ -@mixin _icon_fill($primary, $secondary){ - .euiIcon{ - fill: $primary; - - .euiIcon__fillSecondary{ - fill: $secondary; - } - } -} - -@mixin apply_brand_color($primary_color, $secondary_color){ - .wz-welcome-page .euiCard{ - @include _icon_fill($primary_color, $secondary_color); - } -} diff --git a/plugins/main/public/styles/theme/dark/index.dark.scss b/plugins/main/public/styles/theme/dark/index.dark.scss index 1f158f8500..47120ca3a7 100644 --- a/plugins/main/public/styles/theme/dark/index.dark.scss +++ b/plugins/main/public/styles/theme/dark/index.dark.scss @@ -1,6 +1,3 @@ -@import 'variables'; -@import '../../mixins'; - body.md-default-theme, body, html.md-default-theme, @@ -467,5 +464,3 @@ svg .legend text { .copy-codeblock-wrapper .euiToolTipAnchor { background-color: rgba(0, 0, 0, 0.7); } - -@include apply_brand_color($brand_primary_color, $brand_secondary_color); diff --git a/plugins/main/public/styles/theme/dark/variables.scss b/plugins/main/public/styles/theme/dark/variables.scss deleted file mode 100644 index a172e14390..0000000000 --- a/plugins/main/public/styles/theme/dark/variables.scss +++ /dev/null @@ -1,2 +0,0 @@ -$brand_primary_color: #499CFE; -$brand_secondary_color: white; diff --git a/plugins/main/public/styles/theme/light/index.light.scss b/plugins/main/public/styles/theme/light/index.light.scss deleted file mode 100644 index 053125dc3b..0000000000 --- a/plugins/main/public/styles/theme/light/index.light.scss +++ /dev/null @@ -1,4 +0,0 @@ -@import 'variables'; -@import '../../mixins'; - -@include apply_brand_color($brand_primary_color, $brand_secondary_color); diff --git a/plugins/main/public/styles/theme/light/variables.scss b/plugins/main/public/styles/theme/light/variables.scss deleted file mode 100644 index 2d3ac4a41c..0000000000 --- a/plugins/main/public/styles/theme/light/variables.scss +++ /dev/null @@ -1,2 +0,0 @@ -$brand_primary_color: #256BD1; -$brand_secondary_color: black; From fe9e02314d9635ff999e1131e7f43d4be3ed9fb7 Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Wed, 1 Nov 2023 17:54:54 +0100 Subject: [PATCH 5/9] Change applications order --- plugins/main/public/utils/applications.ts | 50 +++++++++++------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/plugins/main/public/utils/applications.ts b/plugins/main/public/utils/applications.ts index b19f69b314..ba73beaede 100644 --- a/plugins/main/public/utils/applications.ts +++ b/plugins/main/public/utils/applications.ts @@ -20,10 +20,10 @@ Application order: one of 100-199 range: 100, 101, 102, etc... /* Categories ID Wazuh: Home: 0 -Endpoint security: 100 -Threat intelligence: 200 -Security operations: 300 -Cloud security: 400 +Endpoint security: 200 +Threat intelligence: 300 +Security operations: 400 +Cloud security: 500 Explore (added to Wazuh dashboard default categories): 500 Server management: 600 Dashboard/indexer management (added to Wazuh dashboard default categories): 9000 @@ -59,7 +59,7 @@ export const fileIntegrityMonitoring = { euiIconType: 'indexRollupApp', showInOverviewApp: true, showInAgentMenu: true, - order: 102, + order: 202, redirectTo: () => `/overview/?tab=fim&tabView=panels${ store.getState()?.appStateReducers?.currentAgentData?.id @@ -95,7 +95,7 @@ const malwareDetection = { 'Verify that your systems are configured according to your security policies baseline.', }), euiIconType: 'indexRollupApp', - order: 101, + order: 201, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -116,7 +116,7 @@ export const configurationAssessment = { defaultMessage: 'Scan your assets as part of a configuration assessment audit.', }), - order: 100, + order: 200, euiIconType: 'managementApp', showInOverviewApp: true, showInAgentMenu: true, @@ -139,7 +139,7 @@ export const threatHunting = { 'Browse through your security alerts, identifying issues and threats in your environment.', }), euiIconType: 'securityAnalyticsApp', - order: 200, + order: 300, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -161,7 +161,7 @@ export const vulnerabilityDetection = { 'Discover what applications in your environment are affected by well-known vulnerabilities.', }), euiIconType: 'heartbeatApp', - order: 201, + order: 301, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -183,7 +183,7 @@ export const mitreAttack = { 'Security events from the knowledge base of adversary tactics and techniques based on real-world observations.', }), euiIconType: 'grokApp', - order: 202, + order: 302, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -205,7 +205,7 @@ const virustotal = { 'Alerts resulting from VirusTotal analysis of suspicious files via an integration with their API.', }), euiIconType: 'monitoringApp', - order: 203, + order: 303, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -227,7 +227,7 @@ const pciDss = { 'Global security standard for entities that process, store, or transmit payment cardholder data.', }), euiIconType: 'sqlApp', - order: 300, + order: 400, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -249,7 +249,7 @@ const hipaa = { 'Health Insurance Portability and Accountability Act of 1996 (HIPAA) provides data privacy and security provisions for safeguarding medical information.', }), euiIconType: 'monitoringApp', - order: 302, + order: 402, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -271,7 +271,7 @@ const gdpr = { 'General Data Protection Regulation (GDPR) sets guidelines for processing of personal data.', }), euiIconType: 'sqlApp', - order: 301, + order: 401, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -295,7 +295,7 @@ const nist80053 = { euiIconType: 'notebookApp', showInOverviewApp: true, showInAgentMenu: true, - order: 303, + order: 403, redirectTo: () => `/overview/?tab=nist&tabView=panels${ store.getState()?.appStateReducers?.currentAgentData?.id @@ -315,7 +315,7 @@ const tsc = { 'Trust Services Criteria for Security, Availability, Processing Integrity, Confidentiality, and Privacy.', }), euiIconType: 'packetbeatApp', - order: 304, + order: 404, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -337,7 +337,7 @@ export const itHygiene = { 'Applications, network configuration, open ports, and processes running on your monitored systems.', }), euiIconType: 'visualizeApp', - order: 305, + order: 405, showInOverviewApp: true, showInAgentMenu: false, redirectTo: () => @@ -359,7 +359,7 @@ const amazonWebServices = { 'Security events related to your Amazon AWS services, collected directly via AWS API.', }), euiIconType: 'logoAWSMono', - order: 400, + order: 500, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -381,7 +381,7 @@ const googleCloud = { 'Security events related to your Google Cloud Platform services, collected directly via GCP API.', }), euiIconType: LogoGoogleCloud, - order: 401, + order: 501, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -403,7 +403,7 @@ const github = { 'Monitoring events from audit logs of your GitHub organizations.', }), euiIconType: LogoGitHub, - order: 402, + order: 502, showInOverviewApp: true, showInAgentMenu: true, redirectTo: () => @@ -424,7 +424,7 @@ const office365 = { defaultMessage: 'Security events related to your Office 365 services.', }), euiIconType: LogoOffice365, - order: 403, + order: 503, showInOverviewApp: true, showInAgentMenu: false, redirectTo: () => @@ -811,7 +811,7 @@ export const Categories = [ label: i18n.translate('wz-app-category-endpoint-security', { defaultMessage: 'Endpoint security', }), - order: 100, + order: 200, euiIconType: 'monitoringApp', }, { @@ -819,7 +819,7 @@ export const Categories = [ label: i18n.translate('wz-app-category-threat-intelligence', { defaultMessage: 'Threat intelligence', }), - order: 200, + order: 300, euiIconType: 'lensApp', }, { @@ -827,7 +827,7 @@ export const Categories = [ label: i18n.translate('wz-app-category-security-operations', { defaultMessage: 'Security operations', }), - order: 300, + order: 400, euiIconType: 'securityApp', }, { @@ -835,7 +835,7 @@ export const Categories = [ label: i18n.translate('wz-app-category-cloud-security', { defaultMessage: 'Cloud security', }), - order: 400, + order: 500, euiIconType: 'watchesApp', }, { From f766fd39fe3fa82a0822e97a4671390d740bdb8b Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Wed, 1 Nov 2023 19:14:09 +0100 Subject: [PATCH 6/9] Change comment categories ID --- plugins/main/public/utils/applications.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/main/public/utils/applications.ts b/plugins/main/public/utils/applications.ts index ba73beaede..29a168525f 100644 --- a/plugins/main/public/utils/applications.ts +++ b/plugins/main/public/utils/applications.ts @@ -20,11 +20,11 @@ Application order: one of 100-199 range: 100, 101, 102, etc... /* Categories ID Wazuh: Home: 0 +Explore (added to Wazuh dashboard default categories): 100 Endpoint security: 200 Threat intelligence: 300 Security operations: 400 Cloud security: 500 -Explore (added to Wazuh dashboard default categories): 500 Server management: 600 Dashboard/indexer management (added to Wazuh dashboard default categories): 9000 */ From b1a483869e88f2ab865dfddf90829d9628153202 Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Thu, 2 Nov 2023 10:13:04 +0100 Subject: [PATCH 7/9] Change id to new names in applications --- .../public/controllers/settings/settings.js | 10 +- plugins/main/public/utils/applications.ts | 183 +++++++++--------- 2 files changed, 95 insertions(+), 98 deletions(-) diff --git a/plugins/main/public/controllers/settings/settings.js b/plugins/main/public/controllers/settings/settings.js index d909a96656..8a2d28d2a7 100644 --- a/plugins/main/public/controllers/settings/settings.js +++ b/plugins/main/public/controllers/settings/settings.js @@ -28,8 +28,8 @@ import { getAssetURL } from '../../utils/assets'; import { getHttp, getWzCurrentAppID } from '../../kibana-services'; import { Applications, - serverApi, - wazuhPluginSettings, + serverApis, + appSettings, } from '../../utils/applications'; export class SettingsController { @@ -87,7 +87,7 @@ export class SettingsController { const breadcrumb = [{ text: '' }, { text: tabActiveName }]; store.dispatch(updateGlobalBreadcrumb(breadcrumb)); } else { - const breadcrumb = [{ text: '' }, { text: serverApi.title }]; + const breadcrumb = [{ text: '' }, { text: serverApis.title }]; store.dispatch(updateGlobalBreadcrumb(breadcrumb)); } @@ -163,9 +163,7 @@ export class SettingsController { selectedTab: this.tab || 'api', // Define tabs for Wazuh plugin settings application tabs: - getWzCurrentAppID() === wazuhPluginSettings.id - ? this.tabsConfiguration - : null, + getWzCurrentAppID() === appSettings.id ? this.tabsConfiguration : null, wazuhConfig: this.wazuhConfig, }; diff --git a/plugins/main/public/utils/applications.ts b/plugins/main/public/utils/applications.ts index 29a168525f..dd61f90771 100644 --- a/plugins/main/public/utils/applications.ts +++ b/plugins/main/public/utils/applications.ts @@ -6,7 +6,6 @@ import { LogoGoogleCloud, LogoOffice365, } from '../components/common/logos'; -import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public'; /* Applications Convention: the order of each application must according to the order of the category @@ -32,10 +31,10 @@ Dashboard/indexer management (added to Wazuh dashboard default categories): 9000 export const overview = { category: 'wz-category-home', id: 'wz-home', - title: i18n.translate('wz-app-home', { + title: i18n.translate('wz-app-home-title', { defaultMessage: 'Overview', }), - description: i18n.translate('overview-description', { + description: i18n.translate('wz-app-overview-description', { defaultMessage: 'This application provides you with an overview of Wazuh applications.', }), @@ -49,10 +48,10 @@ export const overview = { export const fileIntegrityMonitoring = { category: 'wz-category-endpoint-security', id: 'file-integrity-monitoring', - title: i18n.translate('wz-app-file-integrity-monitoring', { + title: i18n.translate('wz-app-file-integrity-monitoring-title', { defaultMessage: 'File Integrity Monitoring', }), - description: i18n.translate('file-integrity-monitoring-description', { + description: i18n.translate('wz-app-file-integrity-monitoring-description', { defaultMessage: 'Alerts related to file changes, including permissions, content, ownership, and attributes.', }), @@ -71,10 +70,10 @@ export const fileIntegrityMonitoring = { export const endpointSumary = { category: 'wz-category-server-management', id: 'endpoints-summary', - title: i18n.translate('wz-app-endpoints-summary', { + title: i18n.translate('wz-app-endpoints-summary-title', { defaultMessage: 'Endpoints Summary', }), - description: i18n.translate('endpoints-summary-description', { + description: i18n.translate('wz-app-endpoints-summary-description', { defaultMessage: 'Summary of agents and their status.', }), euiIconType: 'usersRolesApp', @@ -87,10 +86,10 @@ export const endpointSumary = { const malwareDetection = { category: 'wz-category-endpoint-security', id: 'malware-detection', - title: i18n.translate('wz-app-malware-detection', { + title: i18n.translate('wz-app-malware-detection-title', { defaultMessage: 'Malware Detection', }), - description: i18n.translate('malware-detection-description', { + description: i18n.translate('wz-app-malware-detection-description', { defaultMessage: 'Verify that your systems are configured according to your security policies baseline.', }), @@ -109,10 +108,10 @@ const malwareDetection = { export const configurationAssessment = { category: 'wz-category-endpoint-security', id: 'configuration-assessment', - title: i18n.translate('wz-app-configuration-assessment', { + title: i18n.translate('wz-app-configuration-assessment-title', { defaultMessage: 'Configuration Assessment', }), - description: i18n.translate('configuration-assessment-description', { + description: i18n.translate('wz-app-configuration-assessment-description', { defaultMessage: 'Scan your assets as part of a configuration assessment audit.', }), @@ -131,10 +130,10 @@ export const configurationAssessment = { export const threatHunting = { category: 'wz-category-threat-intelligence', id: 'threat-hunting', - title: i18n.translate('wz-app-threat-hunting', { + title: i18n.translate('wz-app-threat-hunting-title', { defaultMessage: 'Threat Hunting', }), - description: i18n.translate('threat-hunting-description', { + description: i18n.translate('wz-app-threat-hunting-description', { defaultMessage: 'Browse through your security alerts, identifying issues and threats in your environment.', }), @@ -153,10 +152,10 @@ export const threatHunting = { export const vulnerabilityDetection = { category: 'wz-category-threat-intelligence', id: 'vulnerability-detection', - title: i18n.translate('wz-app-vulnerability-detection', { + title: i18n.translate('wz-app-vulnerability-detection-title', { defaultMessage: 'Vulnerability Detection', }), - description: i18n.translate('vulnerability-detection-description', { + description: i18n.translate('wz-app-vulnerability-detection-description', { defaultMessage: 'Discover what applications in your environment are affected by well-known vulnerabilities.', }), @@ -175,10 +174,10 @@ export const vulnerabilityDetection = { export const mitreAttack = { category: 'wz-category-threat-intelligence', id: 'mitre-attack', - title: i18n.translate('wz-app-mitre-attack', { + title: i18n.translate('wz-app-mitre-attack-title', { defaultMessage: 'MITRE ATT&CK', }), - description: i18n.translate('mitre-attack-description', { + description: i18n.translate('wz-app-mitre-attack-description', { defaultMessage: 'Security events from the knowledge base of adversary tactics and techniques based on real-world observations.', }), @@ -197,10 +196,10 @@ export const mitreAttack = { const virustotal = { category: 'wz-category-threat-intelligence', id: 'virustotal', - title: i18n.translate('wz-app-virustotal', { + title: i18n.translate('wz-app-virustotal-title', { defaultMessage: 'Virustotal', }), - description: i18n.translate('virustotal-description', { + description: i18n.translate('wz-app-virustotal-description', { defaultMessage: 'Alerts resulting from VirusTotal analysis of suspicious files via an integration with their API.', }), @@ -219,10 +218,10 @@ const virustotal = { const pciDss = { category: 'wz-category-security-operations', id: 'pci-dss', - title: i18n.translate('wz-app-pci-dss', { + title: i18n.translate('wz-app-pci-dss-title', { defaultMessage: 'PCI DSS', }), - description: i18n.translate('pci-dss-description', { + description: i18n.translate('wz-app-pci-dss-description', { defaultMessage: 'Global security standard for entities that process, store, or transmit payment cardholder data.', }), @@ -241,10 +240,10 @@ const pciDss = { const hipaa = { category: 'wz-category-security-operations', id: 'hipaa', - title: i18n.translate('wz-app-hipaa', { + title: i18n.translate('wz-app-hipaa-title', { defaultMessage: 'HIPAA', }), - description: i18n.translate('hipaa-description', { + description: i18n.translate('wz-app-hipaa-description', { defaultMessage: 'Health Insurance Portability and Accountability Act of 1996 (HIPAA) provides data privacy and security provisions for safeguarding medical information.', }), @@ -263,10 +262,10 @@ const hipaa = { const gdpr = { category: 'wz-category-security-operations', id: 'gdpr', - title: i18n.translate('wz-app-gdpr', { + title: i18n.translate('wz-app-gdpr-title', { defaultMessage: 'GDPR', }), - description: i18n.translate('gdpr-description', { + description: i18n.translate('wz-app-gdpr-description', { defaultMessage: 'General Data Protection Regulation (GDPR) sets guidelines for processing of personal data.', }), @@ -285,10 +284,10 @@ const gdpr = { const nist80053 = { category: 'wz-category-security-operations', id: 'nist-800-53', - title: i18n.translate('wz-app-nist-800-53', { + title: i18n.translate('wz-app-nist-800-53-title', { defaultMessage: 'NIST 800-53', }), - description: i18n.translate('nist-800-53-description', { + description: i18n.translate('wz-app-nist-800-53-description', { defaultMessage: 'National Institute of Standards and Technology Special Publication 800-53 (NIST 800-53) sets guidelines for federal information systems.', }), @@ -307,10 +306,10 @@ const nist80053 = { const tsc = { category: 'wz-category-security-operations', id: 'tsc', - title: i18n.translate('wz-app-tsc', { + title: i18n.translate('wz-app-tsc-title', { defaultMessage: 'TSC', }), - description: i18n.translate('tsc-description', { + description: i18n.translate('wz-app-tsc-description', { defaultMessage: 'Trust Services Criteria for Security, Availability, Processing Integrity, Confidentiality, and Privacy.', }), @@ -329,10 +328,10 @@ const tsc = { export const itHygiene = { category: 'wz-category-security-operations', id: 'it-hygiene', - title: i18n.translate('wz-app-it-hygiene', { + title: i18n.translate('wz-app-it-hygiene-title', { defaultMessage: 'IT Hygiene', }), - description: i18n.translate('it-hygiene-description', { + description: i18n.translate('wz-app-it-hygiene-description', { defaultMessage: 'Applications, network configuration, open ports, and processes running on your monitored systems.', }), @@ -351,10 +350,10 @@ export const itHygiene = { const amazonWebServices = { category: 'wz-category-cloud-security', id: 'amazon-web-services', - title: i18n.translate('wz-app-amazon-web-services', { + title: i18n.translate('wz-app-amazon-web-services-title', { defaultMessage: 'Amazon Web Services', }), - description: i18n.translate('amazon-web-services-description', { + description: i18n.translate('wz-app-amazon-web-services-description', { defaultMessage: 'Security events related to your Amazon AWS services, collected directly via AWS API.', }), @@ -373,10 +372,10 @@ const amazonWebServices = { const googleCloud = { category: 'wz-category-cloud-security', id: 'google-cloud', - title: i18n.translate('wz-app-google-cloud', { + title: i18n.translate('wz-app-google-cloud-title', { defaultMessage: 'Google Cloud', }), - description: i18n.translate('google-cloud-description', { + description: i18n.translate('wz-app-google-cloud-description', { defaultMessage: 'Security events related to your Google Cloud Platform services, collected directly via GCP API.', }), @@ -395,10 +394,10 @@ const googleCloud = { const github = { category: 'wz-category-cloud-security', id: 'github', - title: i18n.translate('wz-app-github', { + title: i18n.translate('wz-app-github-title', { defaultMessage: 'GitHub', }), - description: i18n.translate('github-description', { + description: i18n.translate('wz-app-github-description', { defaultMessage: 'Monitoring events from audit logs of your GitHub organizations.', }), @@ -417,10 +416,10 @@ const github = { const office365 = { category: 'wz-category-cloud-security', id: 'office365', - title: i18n.translate('wz-app-office365', { + title: i18n.translate('wz-app-office365-title', { defaultMessage: 'Office 365', }), - description: i18n.translate('office365-description', { + description: i18n.translate('wz-app-office365-description', { defaultMessage: 'Security events related to your Office 365 services.', }), euiIconType: LogoOffice365, @@ -438,10 +437,10 @@ const office365 = { const docker = { category: 'wz-category-cloud-security', id: 'docker', - title: i18n.translate('wz-app-docker', { + title: i18n.translate('wz-app-docker-title', { defaultMessage: 'Docker', }), - description: i18n.translate('docker-description', { + description: i18n.translate('wz-app-docker-description', { defaultMessage: 'Monitor and collect the activity from Docker containers such as creation, running, starting, stopping or pausing events.', }), @@ -460,10 +459,10 @@ const docker = { export const rules = { category: 'wz-category-server-management', id: 'rules', - title: i18n.translate('wz-app-rules', { + title: i18n.translate('wz-app-rules-title', { defaultMessage: 'Rules', }), - description: i18n.translate('rules-description', { + description: i18n.translate('wz-app-rules-description', { defaultMessage: 'Manage your Wazuh cluster rules.', }), euiIconType: 'indexRollupApp', @@ -476,10 +475,10 @@ export const rules = { export const decoders = { category: 'wz-category-server-management', id: 'decoders', - title: i18n.translate('wz-app-decoders', { + title: i18n.translate('wz-app-decoders-title', { defaultMessage: 'Decoders', }), - description: i18n.translate('decoders-description', { + description: i18n.translate('wz-app-decoders-description', { defaultMessage: 'Manage your Wazuh cluster decoders.', }), euiIconType: 'indexRollupApp', @@ -492,10 +491,10 @@ export const decoders = { export const cdbLists = { category: 'wz-category-server-management', id: 'cdb-lists', - title: i18n.translate('wz-app-lists', { + title: i18n.translate('wz-app-lists-title', { defaultMessage: 'CDB Lists', }), - description: i18n.translate('cdb-lists-description', { + description: i18n.translate('wz-app-cdb-lists-description', { defaultMessage: 'Manage your Wazuh cluster CDB list.', }), euiIconType: 'indexRollupApp', @@ -508,10 +507,10 @@ export const cdbLists = { export const endpointGroups = { category: 'wz-category-server-management', id: 'endpoint-groups', - title: i18n.translate('wz-app-endpoint-groups', { + title: i18n.translate('wz-app-endpoint-groups-title', { defaultMessage: 'Endpoint Groups', }), - description: i18n.translate('endpoint-groups-description', { + description: i18n.translate('wz-app-endpoint-groups-description', { defaultMessage: 'Manage your agent groups.', }), euiIconType: 'usersRolesApp', @@ -524,10 +523,10 @@ export const endpointGroups = { export const serverStatus = { category: 'wz-category-server-management', id: 'server-status', - title: i18n.translate('wz-app-status', { + title: i18n.translate('wz-app-status-title', { defaultMessage: 'Status', }), - description: i18n.translate('server-status-description', { + description: i18n.translate('wz-app-server-status-description', { defaultMessage: 'Manage your Wazuh cluster status.', }), euiIconType: 'indexRollupApp', @@ -540,10 +539,10 @@ export const serverStatus = { const cluster = { category: 'wz-category-server-management', id: 'cluster', - title: i18n.translate('wz-app-cluster', { + title: i18n.translate('wz-app-cluster-title', { defaultMessage: 'Cluster', }), - description: i18n.translate('cluster-description', { + description: i18n.translate('wz-app-cluster-description', { defaultMessage: 'Manage your Wazuh cluster.', }), euiIconType: 'indexRollupApp', @@ -556,10 +555,10 @@ const cluster = { export const statistics = { category: 'wz-category-server-management', id: 'statistics', - title: i18n.translate('wz-app-statistics', { + title: i18n.translate('wz-app-statistics-title', { defaultMessage: 'Statistics', }), - description: i18n.translate('statistics-description', { + description: i18n.translate('wz-app-statistics-description', { defaultMessage: 'Information about the Wazuh enviroment.', }), euiIconType: 'indexRollupApp', @@ -572,10 +571,10 @@ export const statistics = { export const logs = { category: 'wz-category-server-management', id: 'logs', - title: i18n.translate('wz-app-logs', { + title: i18n.translate('wz-app-logs-title', { defaultMessage: 'Logs', }), - description: i18n.translate('logs-description', { + description: i18n.translate('wz-app-logs-description', { defaultMessage: 'Logs from your Wazuh cluster.', }), euiIconType: 'indexRollupApp', @@ -588,10 +587,10 @@ export const logs = { export const reporting = { category: 'management', id: 'reporting', - title: i18n.translate('wz-app-reporting', { + title: i18n.translate('wz-app-reporting-title', { defaultMessage: 'Reporting', }), - description: i18n.translate('reporting-description', { + description: i18n.translate('wz-app-reporting-description', { defaultMessage: 'Check your stored Wazuh reports.', }), euiIconType: 'indexRollupApp', @@ -604,10 +603,10 @@ export const reporting = { export const settings = { category: 'wz-category-server-management', id: 'settings', - title: i18n.translate('wz-app-settings', { + title: i18n.translate('wz-app-settings-title', { defaultMessage: 'Settings', }), - description: i18n.translate('settings-description', { + description: i18n.translate('wz-app-settings-description', { defaultMessage: 'Manage your Wazuh cluster configuration.', }), euiIconType: 'indexRollupApp', @@ -620,10 +619,10 @@ export const settings = { const devTools = { category: 'wz-category-server-management', id: 'dev-tools', - title: i18n.translate('wz-app-dev-tools', { + title: i18n.translate('wz-app-dev-tools-title', { defaultMessage: 'Dev Tools', }), - description: i18n.translate('dev-tools-description', { + description: i18n.translate('wz-app-dev-tools-description', { defaultMessage: 'Test the Wazuh API endpoints.', }), euiIconType: 'devToolsApp', @@ -636,10 +635,10 @@ const devTools = { const rulesetTest = { category: 'wz-category-server-management', id: 'ruleset-test', - title: i18n.translate('wz-app-ruleset-test', { + title: i18n.translate('wz-app-ruleset-test-title', { defaultMessage: 'Ruleset Test', }), - description: i18n.translate('ruleset-test-description', { + description: i18n.translate('wz-app-ruleset-test-description', { defaultMessage: 'Check your ruleset testing logs.', }), euiIconType: 'visualizeApp', @@ -652,10 +651,10 @@ const rulesetTest = { export const security = { category: 'wz-category-server-management', id: 'security', - title: i18n.translate('wz-app-security', { + title: i18n.translate('wz-app-security-title', { defaultMessage: 'Security', }), - description: i18n.translate('security-description', { + description: i18n.translate('wz-app-security-description', { defaultMessage: 'Manage permissions to system resources based on the roles and policies.', }), @@ -666,13 +665,13 @@ export const security = { redirectTo: () => '/security?tab=users', }; -export const serverApi = { +export const serverApis = { category: 'management', - id: 'server-api', - title: i18n.translate('wz-app-server-api', { + id: 'server-apis', + title: i18n.translate('wz-app-server-apis-title', { defaultMessage: 'Server APIs', }), - description: i18n.translate('server-api-description', { + description: i18n.translate('wz-app-server-apis-description', { defaultMessage: 'Manage and configure the API entries.', }), euiIconType: 'indexRollupApp', @@ -682,13 +681,13 @@ export const serverApi = { redirectTo: () => '/settings?tab=api', }; -const serverData = { +const sampleData = { category: 'management', - id: 'server-data', - title: i18n.translate('wz-app-server-data', { + id: 'sample-data', + title: i18n.translate('wz-app-sample-data-title', { defaultMessage: 'Sample Data', }), - description: i18n.translate('server-data-description', { + description: i18n.translate('wz-app-sample-data-description', { defaultMessage: 'Add sample data with events to the modules.', }), euiIconType: 'indexRollupApp', @@ -698,13 +697,13 @@ const serverData = { redirectTo: () => '/settings?tab=sample_data', }; -export const wazuhPluginSettings = { +export const appSettings = { category: 'management', - id: 'wazuh-plugin-settings', - title: i18n.translate('wz-app-wazuh-plugin-settings', { + id: 'app-settings', + title: i18n.translate('wz-app-settings-title', { defaultMessage: 'App Settings', }), - description: i18n.translate('wazuh-plugin-settings-description', { + description: i18n.translate('wz-app-settings-description', { defaultMessage: 'Manage your Wazuh cluster configuration.', }), euiIconType: 'indexRollupApp', @@ -714,13 +713,13 @@ export const wazuhPluginSettings = { redirectTo: () => '/settings?tab=configuration', }; -const wazuhPluginLogs = { +const appLogs = { category: 'management', - id: 'wazuh-plugin-logs', - title: i18n.translate('wz-app-wazuh-plugin-logs', { + id: 'app-logs', + title: i18n.translate('wz-app-app-logs-title', { defaultMessage: 'App Logs', }), - description: i18n.translate('wazuh-plugin-logs-description', { + description: i18n.translate('wz-app-app-logs-description', { defaultMessage: 'Explore the logs related to the applications.', }), euiIconType: 'indexRollupApp', @@ -730,13 +729,13 @@ const wazuhPluginLogs = { redirectTo: () => '/settings?tab=logs', }; -const wazuhPluginAbout = { +const about = { category: 'management', - id: 'wazuh-plugin-about', - title: i18n.translate('wz-app-wazuh-plugin-about', { + id: 'about', + title: i18n.translate('wz-app-about-title', { defaultMessage: 'About', }), - description: i18n.translate('wazuh-plugin-about-description', { + description: i18n.translate('wz-app-about-description', { defaultMessage: 'Show information about App Versions and community links.', }), euiIconType: 'indexRollupApp', @@ -780,11 +779,11 @@ export const Applications = [ logs, settings, reporting, - serverApi, - serverData, - wazuhPluginSettings, - wazuhPluginLogs, - wazuhPluginAbout, + serverApis, + sampleData, + appSettings, + appLogs, + about, ].sort((a, b) => { // Sort applications by order if (a.order < b.order) { From b2efab68157efd194dc1575d4714bfe08a1e0902 Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Thu, 2 Nov 2023 13:44:18 +0100 Subject: [PATCH 8/9] Change redirections without refresh page --- .../globalBreadcrumb/globalBreadcrumb.tsx | 3 +- .../agent-group-truncate/group-truncate.tsx | 3 +- .../common/welcome/agents-welcome.js | 58 +++++----- .../fim_events_table/fim_events_table.tsx | 24 ++-- .../common/welcome/components/menu-agent.js | 12 +- .../welcome/components/sca_scan/sca_scan.tsx | 103 ++++++++++-------- .../common/welcome/overview-welcome.js | 77 +++++++------ .../container/health-check.container.tsx | 18 +-- .../components/sample-data-warning.js | 24 ++-- .../agent/components/agents-table.js | 57 +++++----- .../configuration/configuration-switch.js | 29 ++--- .../management/groups/group-agents-table.js | 3 +- .../management/ruleset/views/rule-info.tsx | 3 +- .../statistics/statistics-overview.js | 24 ++-- .../controllers/management/monitoring.js | 3 +- .../controllers/overview/components/stats.js | 3 +- plugins/main/public/utils/applications.ts | 2 +- 17 files changed, 248 insertions(+), 198 deletions(-) diff --git a/plugins/main/public/components/common/globalBreadcrumb/globalBreadcrumb.tsx b/plugins/main/public/components/common/globalBreadcrumb/globalBreadcrumb.tsx index 1543408e25..581fbabc5f 100644 --- a/plugins/main/public/components/common/globalBreadcrumb/globalBreadcrumb.tsx +++ b/plugins/main/public/components/common/globalBreadcrumb/globalBreadcrumb.tsx @@ -2,6 +2,7 @@ import React, { Component } from 'react'; import { EuiBreadcrumbs } from '@elastic/eui'; import { connect } from 'react-redux'; import { getAngularModule, getCore } from '../../../kibana-services'; +import { itHygiene } from '../../../utils/applications'; class WzGlobalBreadcrumb extends Component { props: { state: { breadcrumb: [{ agent; text }] } }; @@ -23,7 +24,7 @@ class WzGlobalBreadcrumb extends Component { 'euiLink euiLink--subdued osdBreadcrumbs wz-vertical-align-middle', onClick: ev => { ev.stopPropagation(); - getCore().application.navigateToApp('it-hygiene', { + getCore().application.navigateToApp(itHygiene.id, { path: `#/agents?tab=welcome&agent=${breadcrumb.agent.id}`, }); this.router.reload(); diff --git a/plugins/main/public/components/common/util/agent-group-truncate/group-truncate.tsx b/plugins/main/public/components/common/util/agent-group-truncate/group-truncate.tsx index d225eefa58..c910eebee8 100644 --- a/plugins/main/public/components/common/util/agent-group-truncate/group-truncate.tsx +++ b/plugins/main/public/components/common/util/agent-group-truncate/group-truncate.tsx @@ -21,6 +21,7 @@ import { EuiPopover, } from '@elastic/eui'; import { getCore } from '../../../../kibana-services'; +import { endpointGroups } from '../../../../utils/applications'; export class GroupTruncate extends React.Component { _isMount = false; @@ -51,7 +52,7 @@ export class GroupTruncate extends React.Component { action(index, group) { switch (this.props.action) { case 'redirect': - return getCore().application.navigateToApp('endpoint-groups', { + return getCore().application.navigateToApp(endpointGroups.id, { path: `#/manager/?tab=groups&group=${group}`, }); case 'filter': diff --git a/plugins/main/public/components/common/welcome/agents-welcome.js b/plugins/main/public/components/common/welcome/agents-welcome.js index c09aeafcfb..b0183ac728 100644 --- a/plugins/main/public/components/common/welcome/agents-welcome.js +++ b/plugins/main/public/components/common/welcome/agents-welcome.js @@ -78,6 +78,7 @@ import { threatHunting, vulnerabilityDetection, } from '../../../utils/applications'; +import { RedirectAppLinks } from '../../../../../../src/plugins/opensearch_dashboards_react/public'; const mapStateToProps = state => ({ agent: state.appStateReducers.currentAgentData, @@ -279,21 +280,20 @@ export const AgentsWelcome = compose( grow={false} style={{ marginLeft: 0, marginTop: 7 }} > - { - getCore().application.navigateToApp(applicationId); - this.router.reload(); - }} - style={{ cursor: 'pointer' }} - > - - { - Applications.find(({ id }) => id === applicationId) - .title - } -   - - + + + + { + Applications.find(({ id }) => id === applicationId) + .title + } +   + + + ); } @@ -499,14 +499,16 @@ export const AgentsWelcome = compose(
- { - getCore().application.navigateToApp('mitre-attack'); - }} - aria-label='Open MITRE ATT&CK' - /> + + +
@@ -636,10 +638,7 @@ export const AgentsWelcome = compose( - + @@ -669,10 +668,7 @@ export const AgentsWelcome = compose( {this.renderCompliancePanel()} - + diff --git a/plugins/main/public/components/common/welcome/components/fim_events_table/fim_events_table.tsx b/plugins/main/public/components/common/welcome/components/fim_events_table/fim_events_table.tsx index 99c7a48635..704447e0c6 100644 --- a/plugins/main/public/components/common/welcome/components/fim_events_table/fim_events_table.tsx +++ b/plugins/main/public/components/common/welcome/components/fim_events_table/fim_events_table.tsx @@ -33,8 +33,10 @@ import { formatUIDate } from '../../../../../react-services/time-service'; import { FlyoutDetail } from '../../../../agents/fim/inventory/flyout'; import { EuiLink } from '@elastic/eui'; import { getCore, getDataPlugin } from '../../../../../kibana-services'; +import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; +import { fileIntegrityMonitoring } from '../../../../../utils/applications'; -export function FimEventsTable({ agent, router }) { +export function FimEventsTable({ agent }) { return ( @@ -47,12 +49,17 @@ export function FimEventsTable({ agent, router }) { - navigateToFim(agent, router)} - aria-label='Open FIM' - /> + + navigateToFim(agent)} + href={getCore().application.getUrlForApp( + fileIntegrityMonitoring.id, + )} + aria-label='Open FIM' + /> + @@ -114,9 +121,8 @@ function FimTable({ agent }) { ); } -function navigateToFim(agent, router) { +function navigateToFim(agent) { store.dispatch(updateCurrentAgentData(agent)); - getCore().application.navigateToApp('file-integrity-monitoring'); } const columns = (setFile, setIsOpen) => [ diff --git a/plugins/main/public/components/common/welcome/components/menu-agent.js b/plugins/main/public/components/common/welcome/components/menu-agent.js index fc2b5186a9..f11013ad54 100644 --- a/plugins/main/public/components/common/welcome/components/menu-agent.js +++ b/plugins/main/public/components/common/welcome/components/menu-agent.js @@ -16,6 +16,7 @@ import { EuiFlexItem, EuiIcon, EuiSideNav, + EuiLink, } from '@elastic/eui'; import { connect } from 'react-redux'; import { hasAgentSupportModule } from '../../../../react-services/wz-agents'; @@ -26,6 +27,7 @@ import { } from '../../../../kibana-services'; import { updateCurrentAgentData } from '../../../../redux/actions/appStateActions'; import { Applications, Categories } from '../../../../utils/applications'; +import { RedirectAppLinks } from '../../../../../../../src/plugins/opensearch_dashboards_react/public'; class WzMenuAgent extends Component { constructor(props) { @@ -71,7 +73,6 @@ class WzMenuAgent extends Component { clickMenuItem = appId => { this.props.closePopover(); // do not redirect if we already are in that tab - getCore().application.navigateToApp(appId); this.props.updateCurrentAgentData(this.props.isAgent); this.router.reload(); }; @@ -107,7 +108,14 @@ class WzMenuAgent extends Component { onClick={() => (!item.isTitle ? this.clickMenuItem(item.id) : null)} style={{ cursor: !item.isTitle ? 'pointer' : 'normal' }} > - {item.title} + + + {item.title} + + {this.state.hoverAddFilter === item.id && !item.isTitle && diff --git a/plugins/main/public/components/common/welcome/components/sca_scan/sca_scan.tsx b/plugins/main/public/components/common/welcome/components/sca_scan/sca_scan.tsx index d58df9b370..68f4b20f95 100644 --- a/plugins/main/public/components/common/welcome/components/sca_scan/sca_scan.tsx +++ b/plugins/main/public/components/common/welcome/components/sca_scan/sca_scan.tsx @@ -36,6 +36,8 @@ import { withReduxProvider, withUserAuthorizationPrompt } from '../../../hocs'; import { compose } from 'redux'; import SCAPoliciesTable from '../../../../agents/sca/inventory/agent-policies-table'; import { MODULE_SCA_CHECK_RESULT_LABEL } from '../../../../../../common/constants'; +import { configurationAssessment } from '../../../../../utils/applications'; +import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; type Props = { agent: { [key in string]: any }; @@ -188,18 +190,25 @@ export const ScaScan = compose( - - { - window.location.href = `#/overview?tab=sca&redirectPolicyTable=${lastScan.policy_id}`; - store.dispatch(updateCurrentAgentData(this.props.agent)); - this.router.reload(); - }} - > -

{lastScan.name}

- -
-
+ + + { + store.dispatch(updateCurrentAgentData(this.props.agent)); + this.router.reload(); + }} + href={getCore().application.getUrlForApp( + configurationAssessment.id, + { + path: `#/overview?tab=sca&redirectPolicy=${lastScan.policy_id}`, + }, + )} + > +

{lastScan.name}

+ +
+
+
{lastScan.policy_id} @@ -246,44 +255,48 @@ export const ScaScan = compose( - - { - store.dispatch( - updateCurrentAgentData(this.props.agent), - ); - getCore().application.navigateToApp( - 'configuration-assessment', + + + { + store.dispatch( + updateCurrentAgentData(this.props.agent), + ); + this.router.reload(); + }} + href={getCore().application.getUrlForApp( + configurationAssessment.id, { path: `#/overview?tab=sca&redirectPolicy=${lastScan.policy_id}`, }, - ); - this.router.reload(); - }} - > -

SCA: Lastest scans

-
-
+ )} + > +

SCA: Lastest scans

+
+
+
- - { - store.dispatch( - updateCurrentAgentData(this.props.agent), - ); - getCore().application.navigateToApp( - 'configuration-assessment', - ); - this.router.reload(); - }} - aria-label='Open SCA Scans' - /> - + + + { + store.dispatch( + updateCurrentAgentData(this.props.agent), + ); + this.router.reload(); + }} + href={getCore().application.getUrlForApp( + configurationAssessment.id, + )} + aria-label='Open SCA Scans' + /> + +
diff --git a/plugins/main/public/components/common/welcome/overview-welcome.js b/plugins/main/public/components/common/welcome/overview-welcome.js index 2691bc41ca..3be9012a1f 100644 --- a/plugins/main/public/components/common/welcome/overview-welcome.js +++ b/plugins/main/public/components/common/welcome/overview-welcome.js @@ -34,9 +34,11 @@ import { compose } from 'redux'; import { Applications, Categories, + endpointSumary, overview, } from '../../../utils/applications'; import { getCore } from '../../../kibana-services'; +import { RedirectAppLinks } from '../../../../../../src/plugins/opensearch_dashboards_react/public'; const appCategories = Applications.reduce((categories, app) => { const existingCategory = categories.find( @@ -78,23 +80,25 @@ export const OverviewWelcome = compose( <> - - No agents were added to this manager.{' '} - - Add agent - - - } - color='warning' - iconType='alert' - > + + + No agents were added to this manager.{' '} + + Add agent + + + } + color='warning' + iconType='alert' + > + @@ -125,22 +129,29 @@ export const OverviewWelcome = compose( {apps.map(app => ( - - } - className='homSynopsis__card' - title={app.title} - onClick={() => - getCore().application.navigateToApp(app.id) - } - data-test-subj={`overviewWelcome${this.strtools.capitalize( - app.id, - )}`} - description={app.description} - /> + + + } + className='homSynopsis__card' + title={app.title} + href={getCore().application.getUrlForApp( + app.id, + )} + data-test-subj={`overviewWelcome${this.strtools.capitalize( + app.id, + )}`} + description={app.description} + /> + ))} diff --git a/plugins/main/public/components/health-check/container/health-check.container.tsx b/plugins/main/public/components/health-check/container/health-check.container.tsx index a3cd801b54..885408f292 100644 --- a/plugins/main/public/components/health-check/container/health-check.container.tsx +++ b/plugins/main/public/components/health-check/container/health-check.container.tsx @@ -39,6 +39,8 @@ import { import { compose } from 'redux'; import { getThemeAssetURL, getAssetURL } from '../../../utils/assets'; +import { serverApis } from '../../../utils/applications'; +import { RedirectAppLinks } from '../../../../../../src/plugins/opensearch_dashboards_react/public'; const checks = { api: { @@ -272,14 +274,14 @@ function HealthCheckComponent() { {thereAreErrors && ( - - Go to Settings - + + + Go to Settings + + )} {isDebugMode && diff --git a/plugins/main/public/components/visualize/components/sample-data-warning.js b/plugins/main/public/components/visualize/components/sample-data-warning.js index e59adb5b6c..7b5b115cbb 100644 --- a/plugins/main/public/components/visualize/components/sample-data-warning.js +++ b/plugins/main/public/components/visualize/components/sample-data-warning.js @@ -16,6 +16,8 @@ import React, { useState, useEffect } from 'react'; import { WzRequest } from '../../../react-services'; import { getErrorOrchestrator } from '../../../react-services/common-services'; import { getCore } from '../../../kibana-services'; +import { sampleData } from '../../../utils/applications'; +import { RedirectAppLinks } from '../../../../../../src/plugins/opensearch_dashboards_react/public'; export const SampleDataWarning = ({ ...props }) => { const [isSampleData, setIsSampleData] = useState(false); @@ -59,16 +61,18 @@ export const SampleDataWarning = ({ ...props }) => { data-test-subject='sample-data-callout' {...props} > -

- {'The data displayed may contain sample alerts. Go '} - - {'here '} - - {'to configure the sample data.'} -

+ +

+ {'The data displayed may contain sample alerts. Go '} + + {'here '} + + {'to configure the sample data.'} +

+
); } else { diff --git a/plugins/main/public/controllers/agent/components/agents-table.js b/plugins/main/public/controllers/agent/components/agents-table.js index 5a6d21d3ce..991168ebda 100644 --- a/plugins/main/public/controllers/agent/components/agents-table.js +++ b/plugins/main/public/controllers/agent/components/agents-table.js @@ -39,6 +39,8 @@ import { TableWzAPI } from '../../../components/common/tables'; import { WzRequest } from '../../../react-services/wz-request'; import { get as getLodash } from 'lodash'; import { getCore } from '../../../kibana-services'; +import { itHygiene } from '../../../utils/applications'; +import { RedirectAppLinks } from '../../../../../../src/plugins/opensearch_dashboards_react/public'; const searchBarWQLOptions = { implicitQuery: { @@ -93,41 +95,38 @@ export const AgentsTable = withErrorBoundary( actionButtonsRender(agent) { return (
- - { - ev.stopPropagation(); - getCore().application.navigateToApp('it-hygiene', { - path: `#/agents?tab=welcome&agent=${agent.id}`, - }); - }} - iconType='eye' - color={'primary'} - aria-label='Open summary panel for this agent' - /> - -   - {agent.status !== API_NAME_AGENT_STATUS.NEVER_CONNECTED && ( + { - ev.stopPropagation(); - AppNavigate.navigateToModule(ev, 'agents', { - tab: 'configuration', - agent: agent.id, - }); - }} + href={getCore().application.getUrlForApp(itHygiene.id, { + path: `#/agents?tab=welcome&agent=${agent.id}`, + })} + iconType='eye' color={'primary'} - iconType='wrench' - aria-label='Open configuration for this agent' + aria-label='Open summary panel for this agent' /> + +   + {agent.status !== API_NAME_AGENT_STATUS.NEVER_CONNECTED && ( + + + + + )}
); @@ -293,7 +292,7 @@ export const AgentsTable = withErrorBoundary( } return { onClick: ev => { - getCore().application.navigateToApp('it-hygiene', { + getCore().application.navigateToApp(itHygiene.id, { path: `#/agents?tab=welcome&agent=${item.id}`, }); }, diff --git a/plugins/main/public/controllers/management/components/management/configuration/configuration-switch.js b/plugins/main/public/controllers/management/components/management/configuration/configuration-switch.js index fbccffc50a..9a59dfa8d4 100644 --- a/plugins/main/public/controllers/management/components/management/configuration/configuration-switch.js +++ b/plugins/main/public/controllers/management/components/management/configuration/configuration-switch.js @@ -83,6 +83,8 @@ import { getErrorOrchestrator } from '../../../../../react-services/common-servi import { WzConfigurationOffice365 } from './office365/office365'; import { getCore } from '../../../../../kibana-services'; import { PromptAgentNeverConnected } from '../../../../../components/agents/prompts'; +import { RedirectAppLinks } from '../../../../../../../../src/plugins/opensearch_dashboards_react/public'; +import { endpointGroups } from '../../../../../utils/applications'; class WzConfigurationSwitch extends Component { constructor(props) { @@ -206,19 +208,20 @@ class WzConfigurationSwitch extends Component { {agent.id !== '000' && agent.group && agent.group.length ? ( Groups: - {agent.group.map((group, key) => ( - { - getCore().application.navigateToApp('endpoint-groups', { - path: `#/manager/?tab=groups&group=${group}`, - }); - }} - > - {group} - - ))} - + + {agent.group.map((group, key) => ( + + {group} + + ))} + + ) : null} {view !== '' && view !== 'edit-configuration' && ( diff --git a/plugins/main/public/controllers/management/components/management/groups/group-agents-table.js b/plugins/main/public/controllers/management/components/management/groups/group-agents-table.js index 8fe1efb920..2b65c18c9d 100644 --- a/plugins/main/public/controllers/management/components/management/groups/group-agents-table.js +++ b/plugins/main/public/controllers/management/components/management/groups/group-agents-table.js @@ -39,6 +39,7 @@ import { UI_ERROR_SEVERITIES } from '../../../../../react-services/error-orchest import { getErrorOrchestrator } from '../../../../../react-services/common-services'; import { AgentStatus } from '../../../../../components/agents/agent-status'; import { WzRequest } from '../../../../../react-services'; +import { itHygiene } from '../../../../../utils/applications'; class WzGroupAgentsTable extends Component { _isMounted = false; @@ -118,7 +119,7 @@ class WzGroupAgentsTable extends Component { aria-label='Go to the agent' iconType='eye' onClick={async () => { - getCore().application.navigateToApp('it-hygiene', { + getCore().application.navigateToApp(itHygiene.id, { path: `#/agents?agent=${item.id}`, }); }} diff --git a/plugins/main/public/controllers/management/components/management/ruleset/views/rule-info.tsx b/plugins/main/public/controllers/management/components/management/ruleset/views/rule-info.tsx index 8e704ca4db..cc7dcb44bd 100644 --- a/plugins/main/public/controllers/management/components/management/ruleset/views/rule-info.tsx +++ b/plugins/main/public/controllers/management/components/management/ruleset/views/rule-info.tsx @@ -28,6 +28,7 @@ import { UI_LOGGER_LEVELS } from '../../../../../../../common/constants'; import { TableWzAPI } from '../../../../../../components/common/tables'; import { getErrorOrchestrator } from '../../../../../../react-services/common-services'; import { getCore } from '../../../../../../kibana-services'; +import { threatHunting } from '../../../../../../utils/applications'; export default class WzRuleInfo extends Component { constructor(props) { @@ -750,7 +751,7 @@ export default class WzRuleInfo extends Component { {}} />
- - getCore().application.navigateToApp('wazuh-plugin-settings', { + + - Settings - + })} + iconType='gear' + iconSide='left' + > + Settings + +
diff --git a/plugins/main/public/controllers/management/monitoring.js b/plugins/main/public/controllers/management/monitoring.js index ab80702171..389c3ed58b 100644 --- a/plugins/main/public/controllers/management/monitoring.js +++ b/plugins/main/public/controllers/management/monitoring.js @@ -20,6 +20,7 @@ import { updateGlobalBreadcrumb } from '../../redux/actions/globalBreadcrumbActi import { ModulesHelper } from '../../components/common/modules/modules-helper'; import { WAZUH_ROLE_ADMINISTRATOR_NAME } from '../../../common/constants'; import { getCore, getDataPlugin } from '../../kibana-services'; +import { endpointSumary } from '../../utils/applications'; export function ClusterController( $scope, @@ -80,7 +81,7 @@ export function ClusterController( * This navigates to agents preview */ $scope.goAgents = () => { - getCore().application.navigateToApp('endpoints-summary', { + getCore().application.navigateToApp(endpointSumary.id, { path: '#/agents-preview', }); }; diff --git a/plugins/main/public/controllers/overview/components/stats.js b/plugins/main/public/controllers/overview/components/stats.js index 0b3ba5ac15..e98c252409 100644 --- a/plugins/main/public/controllers/overview/components/stats.js +++ b/plugins/main/public/controllers/overview/components/stats.js @@ -26,6 +26,7 @@ import { agentStatusColorByAgentStatus, } from '../../../../common/services/wz_agent_status'; import { getCore } from '../../../kibana-services'; +import { endpointSumary } from '../../../utils/applications'; export const Stats = withErrorBoundary( class Stats extends Component { @@ -54,7 +55,7 @@ export const Stats = withErrorBoundary( } else if (sessionStorage.getItem('wz-agents-overview-table-filter')) { sessionStorage.removeItem('wz-agents-overview-table-filter'); } - getCore().application.navigateToApp('endpoints-summary', { + getCore().application.navigateToApp(endpointSumary.id, { path: '#/agents-preview', }); } diff --git a/plugins/main/public/utils/applications.ts b/plugins/main/public/utils/applications.ts index dd61f90771..4e04c3f1a6 100644 --- a/plugins/main/public/utils/applications.ts +++ b/plugins/main/public/utils/applications.ts @@ -681,7 +681,7 @@ export const serverApis = { redirectTo: () => '/settings?tab=api', }; -const sampleData = { +export const sampleData = { category: 'management', id: 'sample-data', title: i18n.translate('wz-app-sample-data-title', { From 628a1462b66e431f6f23656cc6a7cae0afbf3a0a Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Thu, 2 Nov 2023 16:07:14 +0100 Subject: [PATCH 9/9] Fix test --- .../health-check/container/health-check.container.test.tsx | 5 ++++- .../visualize/components/sample-data-warning.test.js | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/main/public/components/health-check/container/health-check.container.test.tsx b/plugins/main/public/components/health-check/container/health-check.container.test.tsx index 3a01a3c115..8b198b157d 100644 --- a/plugins/main/public/components/health-check/container/health-check.container.test.tsx +++ b/plugins/main/public/components/health-check/container/health-check.container.test.tsx @@ -47,7 +47,7 @@ jest.mock('../services', () => ({ })); jest.mock('../components/check-result', () => ({ - CheckResult: () => () => <>, + CheckResult: () => <>, })); jest.mock('../../../react-services', () => ({ @@ -59,10 +59,13 @@ jest.mock('../../../react-services', () => ({ }, })); +jest.mock('react-use/lib/useObservable', () => () => {}); + jest.mock('../../../kibana-services', () => ({ getCore: () => ({ application: { getUrlForApp: (appId: string) => appId, + navigateToUrl: (appId: string) => appId, }, }), getHttp: () => ({ diff --git a/plugins/main/public/components/visualize/components/sample-data-warning.test.js b/plugins/main/public/components/visualize/components/sample-data-warning.test.js index 738ef265b4..7158bb2c18 100644 --- a/plugins/main/public/components/visualize/components/sample-data-warning.test.js +++ b/plugins/main/public/components/visualize/components/sample-data-warning.test.js @@ -29,9 +29,12 @@ jest.mock('../../../react-services'); jest.mock('../../../react-services/common-services'); jest.mock('../../../kibana-services'); +jest.mock('react-use/lib/useObservable', () => () => {}); + getCore.mockImplementation(() => ({ application: { getUrlForApp: (appId, options) => `/app/${appId}`, + navigateToUrl: appId => appId, }, }));