Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left menu changes #6086

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions plugins/main/public/components/common/modules/main-agent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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!: {
Expand Down Expand Up @@ -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 },
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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', '');
}
Expand All @@ -60,16 +65,7 @@ class WzCurrentOverviewSection extends Component {
}

render() {
return (
<span>
{/*this.props.currentTab && WAZUH_MODULES[this.props.currentTab] && WAZUH_MODULES[this.props.currentTab].title && (
<EuiTitle size='s'>
<h2>
{WAZUH_MODULES[this.props.currentTab].title}
</h2>
</EuiTitle>)*/}
</span>
);
yenienserrano marked this conversation as resolved.
Show resolved Hide resolved
return <span></span>;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import {
Applications,
configurationAssessment,
fileIntegrityMonitoring,
itHygiene,
mitreAttack,
threatHunting,
vulnerabilityDetection,
Expand All @@ -96,7 +97,7 @@ export const AgentsWelcome = compose(
return [
{ text: '' },
{
text: 'IT Hygiene',
text: itHygiene.title,
},
...(agent?.name
? [
Expand Down
36 changes: 8 additions & 28 deletions plugins/main/public/components/common/welcome/overview-welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 {
Expand All @@ -72,23 +73,6 @@ export const OverviewWelcome = compose(
this.strtools = new StringsTools();
}

buildTabCard(tab, icon) {
return (
<EuiFlexItem>
<EuiCard
size='xs'
layout='horizontal'
icon={<EuiIcon size='xl' type={icon} color='primary' />}
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}
/>
</EuiFlexItem>
);
}

addAgent() {
return (
<>
Expand Down Expand Up @@ -121,7 +105,7 @@ export const OverviewWelcome = compose(
render() {
return (
<Fragment>
<EuiPage className='wz-welcome-page'>
<EuiPage>
<EuiFlexGroup gutterSize='l'>
<EuiFlexItem>
{this.props.agentsCountTotal === 0 && this.addAgent()}
Expand All @@ -145,11 +129,7 @@ export const OverviewWelcome = compose(
size='xs'
layout='horizontal'
icon={
<EuiIcon
size='xl'
type={app.euiIconType}
color='primary'
/>
<EuiIcon size='xl' type={app.euiIconType} />
}
className='homSynopsis__card'
title={app.title}
Expand Down
2 changes: 1 addition & 1 deletion plugins/main/public/components/settings/api/api-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export const ApiTable = compose(
<EuiFlexGroup>
<EuiFlexItem>
<EuiTitle>
<h2>Wazuh API configuration</h2>
<h2>API Configuration</h2>
</EuiTitle>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:*' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EuiPage style={{ background: 'transparent' }}>
<EuiPanel>
{showWarningRestart && (
<>
<EuiSpacer size='s' />
<WzRestartClusterManagerCallout
onRestarted={() => updateRestartManagers(false)}
onRestartedError={() => updateRestartManagers(true)}
/>
<EuiSpacer size='s' />
</>
)}
return (
<EuiPage style={{ background: 'transparent' }}>
<EuiPanel>
{showWarningRestart && (
<>
<EuiSpacer size='s' />
<WzRestartClusterManagerCallout
onRestarted={() => updateRestartManagers(false)}
onRestartedError={() => updateRestartManagers(true)}
/>
<EuiSpacer size='s' />
</>
)}

<EuiFlexGroup>
<EuiFlexItem>
<CDBListsTable
{...props}
updateRestartClusterManager={(showWarningRestart) => updateRestartManagers(showWarningRestart)}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EuiPage>;
<EuiFlexGroup>
<EuiFlexItem>
<CDBListsTable
{...props}
updateRestartClusterManager={showWarningRestart =>
updateRestartManagers(showWarningRestart)
}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EuiPage>
);
}


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);
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@ import {
withReduxProvider,
} from '../../../../../components/common/hocs';
import { compose } from 'redux';
import { itHygiene, settings } from '../../../../../utils/applications';

export default compose(
withErrorBoundary,
withReduxProvider,
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' },
Expand Down
Loading
Loading