diff --git a/plugins/main/public/components/endpoints-summary/endpoints-summary.tsx b/plugins/main/public/components/endpoints-summary/endpoints-summary.tsx index f28a2cd52f..46851138b5 100644 --- a/plugins/main/public/components/endpoints-summary/endpoints-summary.tsx +++ b/plugins/main/public/components/endpoints-summary/endpoints-summary.tsx @@ -15,10 +15,6 @@ import React, { Component } from 'react'; import { EuiPage, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { AgentsTable } from './table/agents-table'; import WzReduxProvider from '../../redux/wz-redux-provider'; -import { VisFactoryHandler } from '../../react-services/vis-factory-handler'; -import { AppState } from '../../react-services/app-state'; -import { FilterHandler } from '../../utils/filter-handler'; -import { TabVisualizations } from '../../factories/tab-visualizations'; import { WazuhConfig } from '../../react-services/wazuh-config'; import { withReduxProvider, @@ -103,20 +99,6 @@ export const EndpointsSummary = compose( async componentDidMount() { this._isMount = true; this.getOutdatedAgents(); - if (this.wazuhConfig.getConfig()['wazuh.monitoring.enabled']) { - const tabVisualizations = new TabVisualizations(); - tabVisualizations.removeAll(); - tabVisualizations.setTab('general'); - tabVisualizations.assign({ - general: 1, - }); - const filterHandler = new FilterHandler(AppState.getCurrentPattern()); - await VisFactoryHandler.buildOverviewVisualizations( - filterHandler, - 'general', - null, - ); - } } componentWillUnmount() { diff --git a/plugins/main/public/components/endpoints-summary/table/__snapshots__/agents-table.test.tsx.snap b/plugins/main/public/components/endpoints-summary/table/__snapshots__/agents-table.test.tsx.snap index 36bda32149..7964a54a8a 100644 --- a/plugins/main/public/components/endpoints-summary/table/__snapshots__/agents-table.test.tsx.snap +++ b/plugins/main/public/components/endpoints-summary/table/__snapshots__/agents-table.test.tsx.snap @@ -47,65 +47,69 @@ exports[`AgentsTable component Renders correctly to match the snapshot 1`] = `
-
- + + Show only outdated - - - Show only outdated - -
+
+ @@ -381,7 +385,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot 1`] = ` aria-label="Select all rows" class="euiCheckbox__input" disabled="" - id="_selection_column-checkbox_i6bf14741-d0fa-11ee-81c4-29d002524ab5" + id="_selection_column-checkbox_htmlId" type="checkbox" />
@@ -443,7 +447,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot 1`] = `
-
- + + Show only outdated - - - Show only outdated - -
+
+ @@ -1118,7 +1126,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with cust aria-label="Select all rows" class="euiCheckbox__input" disabled="" - id="_selection_column-checkbox_i6bf14741-d0fa-11ee-81c4-29d002524ab5" + id="_selection_column-checkbox_htmlId" type="checkbox" />
@@ -1181,7 +1189,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with cust
-
- + + Show only outdated - - - Show only outdated - -
+
+ @@ -1808,7 +1820,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with no p aria-label="Select all rows" class="euiCheckbox__input" disabled="" - id="_selection_column-checkbox_i6bf14741-d0fa-11ee-81c4-29d002524ab5" + id="_selection_column-checkbox_htmlId" type="checkbox" />
@@ -1871,7 +1883,7 @@ exports[`AgentsTable component Renders correctly to match the snapshot with no p
({ appStateReducers: state => state, })); +jest.mock( + '../../../../../../node_modules/@elastic/eui/lib/services/accessibility/html_id_generator', + () => ({ + htmlIdGenerator: () => () => 'htmlId', + }), +); + const permissionsStore = { appStateReducers: { userAccount: { @@ -343,31 +350,6 @@ describe('AgentsTable component', () => { , ); - // Set table id to avoid snapshot changes - const tableId = '__table_d203a723-1198-11ee-ab9b-75fc624fc672'; - wrapper.find('table')[0]['attribs']['id'] = tableId; - - // Set switch id to avoid snapshot changes - const switchButtonId = - '_show_outdated_switch_button_ic14ef503-e547-11ee-ac6e-71376e7e3fc5'; - wrapper.find('.euiSwitch__button')[0]['attribs']['aria-labelledby'] = - switchButtonId; - wrapper.find('.euiSwitch__button')[0]['attribs']['id'] = switchButtonId; - const switchLabelId = - '_show_outdated_switch_button_ic14ef503-e547-11ee-ac6e-71376e7e3fc5'; - wrapper.find('.euiSwitch__label')[0]['attribs']['id'] = switchLabelId; - - // Set select all checkbox id to avoid snapshot changes - const checkBoxSelectId = - '_selection_column-checkbox_i6bf14741-d0fa-11ee-81c4-29d002524ab5'; - - //Mobile - wrapper.find('.euiCheckbox__input')[0]['attribs']['id'] = checkBoxSelectId; - wrapper.find('.euiCheckbox__label')[0]['attribs']['for'] = checkBoxSelectId; - - //Desktop - wrapper.find('.euiCheckbox__input')[1]['attribs']['id'] = checkBoxSelectId; - expect(wrapper).toMatchSnapshot(); expect( window.localStorage.getItem('wz-agents-overview-table-visible-fields'), @@ -386,31 +368,6 @@ describe('AgentsTable component', () => { , ); - // Set table id to avoid snapshot changes - const tableId = '__table_d203a723-1198-11ee-ab9b-75fc624fc672'; - wrapper.find('table')[0]['attribs']['id'] = tableId; - - // Set switch id to avoid snapshot changes - const switchButtonId = - '_show_outdated_switch_button_ic14ef503-e547-11ee-ac6e-71376e7e3fc5'; - wrapper.find('.euiSwitch__button')[0]['attribs']['aria-labelledby'] = - switchButtonId; - wrapper.find('.euiSwitch__button')[0]['attribs']['id'] = switchButtonId; - const switchLabelId = - '_show_outdated_switch_button_ic14ef503-e547-11ee-ac6e-71376e7e3fc5'; - wrapper.find('.euiSwitch__label')[0]['attribs']['id'] = switchLabelId; - - // Set select all checkbox id to avoid snapshot changes - const checkBoxSelectId = - '_selection_column-checkbox_i6bf14741-d0fa-11ee-81c4-29d002524ab5'; - - //Mobile - wrapper.find('.euiCheckbox__input')[0]['attribs']['id'] = checkBoxSelectId; - wrapper.find('.euiCheckbox__label')[0]['attribs']['for'] = checkBoxSelectId; - - //Desktop - wrapper.find('.euiCheckbox__input')[1]['attribs']['id'] = checkBoxSelectId; - expect(wrapper).toMatchSnapshot(); expect( window.localStorage.getItem('wz-agents-overview-table-visible-fields'), @@ -433,31 +390,6 @@ describe('AgentsTable component', () => { , ); - // Set table id to avoid snapshot changes - const tableId = '__table_d203a723-1198-11ee-ab9b-75fc624fc672'; - wrapper.find('table')[0]['attribs']['id'] = tableId; - - // Set switch id to avoid snapshot changes - const switchButtonId = - '_show_outdated_switch_button_ic14ef503-e547-11ee-ac6e-71376e7e3fc5'; - wrapper.find('.euiSwitch__button')[0]['attribs']['aria-labelledby'] = - switchButtonId; - wrapper.find('.euiSwitch__button')[0]['attribs']['id'] = switchButtonId; - const switchLabelId = - '_show_outdated_switch_button_ic14ef503-e547-11ee-ac6e-71376e7e3fc5'; - wrapper.find('.euiSwitch__label')[0]['attribs']['id'] = switchLabelId; - - // Set select all checkbox id to avoid snapshot changes - const checkBoxSelectId = - '_selection_column-checkbox_i6bf14741-d0fa-11ee-81c4-29d002524ab5'; - - //Mobile - wrapper.find('.euiCheckbox__input')[0]['attribs']['id'] = checkBoxSelectId; - wrapper.find('.euiCheckbox__label')[0]['attribs']['for'] = checkBoxSelectId; - - //Desktop - wrapper.find('.euiCheckbox__input')[1]['attribs']['id'] = checkBoxSelectId; - expect(wrapper).toMatchSnapshot(); expect( window.localStorage.getItem('wz-agents-overview-table-visible-fields'), diff --git a/plugins/main/public/components/endpoints-summary/table/agents-table.tsx b/plugins/main/public/components/endpoints-summary/table/agents-table.tsx index 16c4fa7325..1ccae446ce 100644 --- a/plugins/main/public/components/endpoints-summary/table/agents-table.tsx +++ b/plugins/main/public/components/endpoints-summary/table/agents-table.tsx @@ -19,6 +19,7 @@ import { EuiCallOut, EuiButton, EuiSwitch, + EuiToolTip, } from '@elastic/eui'; import { WzButtonPermissions } from '../../common/permissions/button'; import { withErrorBoundary } from '../../common/hocs'; @@ -211,6 +212,15 @@ export const AgentsTable = compose( ? agentList.totalItems : selectedItems.length; + const switchShowOnlyOutdated = ( + props.setShowOnlyOutdated(!props.showOnlyOutdated)} + /> + ); + const selectedtemsRenderer = ( {selectedItems.length ? ( @@ -241,12 +251,13 @@ export const AgentsTable = compose( ) : null} - props.setShowOnlyOutdated(!props.showOnlyOutdated)} - /> + {props.totalOutdated ? ( + switchShowOnlyOutdated + ) : ( + + {switchShowOnlyOutdated} + + )} ); diff --git a/plugins/main/public/components/endpoints-summary/table/upgrade-task-details-modal.tsx b/plugins/main/public/components/endpoints-summary/table/upgrade-task-details-modal.tsx index 46cab13394..63f16fd205 100644 --- a/plugins/main/public/components/endpoints-summary/table/upgrade-task-details-modal.tsx +++ b/plugins/main/public/components/endpoints-summary/table/upgrade-task-details-modal.tsx @@ -64,7 +64,17 @@ export const AgentUpgradesTaskDetailsModal = ({ }, { field: 'create_time', - name: 'Create', + name: ( + + Create{' '} + + + ), width: '230px', sortable: true, searchable: false, @@ -73,7 +83,17 @@ export const AgentUpgradesTaskDetailsModal = ({ }, { field: 'last_update_time', - name: 'Last update', + name: ( + + Last update{' '} + + + ), width: '230px', sortable: true, searchable: false, diff --git a/plugins/main/public/controllers/overview/components/overview-actions/agents-selection-table.js b/plugins/main/public/controllers/overview/components/overview-actions/agents-selection-table.js index 083782f380..149eae7f1b 100644 --- a/plugins/main/public/controllers/overview/components/overview-actions/agents-selection-table.js +++ b/plugins/main/public/controllers/overview/components/overview-actions/agents-selection-table.js @@ -186,7 +186,7 @@ export class AgentSelectionTable extends Component { {/* agent name (agent id) Unpin button right aligned, require justifyContent="flexEnd" in the EuiFlexGroup */} - +