-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First commit added testlog view and menu with navigation to dev console and testlogs. * Added reducers for tools. * Added PUT request logtest and pretty json. * Clear initial value. * Apply prettier. * Fixed pined menu selected. Change some files js to ts. Added updateSelectedToolsSection redux. * Removed debuggers * Fix error on render elements * Fix render items * Fixed error on tabs * Updated CHANGELOG * Added flyout from ruleset edit and fixed styles. * Added OverlayMask and event to close. * Changed title of Logtest * Fixed styles, PR comments.
- Loading branch information
1 parent
06f75e9
commit 6e57023
Showing
22 changed files
with
622 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10732,4 +10732,4 @@ | |
} | ||
] | ||
} | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Wazuh app - React component for Settings submenu. | ||
* Copyright (C) 2015-2021 Wazuh, Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Find more information about this on the LICENSE file. | ||
*/ | ||
import React, { Component } from 'react'; | ||
import { EuiFlexItem, EuiFlexGroup, EuiSideNav, EuiIcon } from '@elastic/eui'; | ||
import { WzRequest } from '../../react-services/wz-request'; | ||
import { connect } from 'react-redux'; | ||
import { AppNavigate } from '../../react-services/app-navigate'; | ||
|
||
class WzMenuTools extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
// TODO: Fix the selected section | ||
selectedItemName: null | ||
}; | ||
this.wzReq = WzRequest; | ||
} | ||
|
||
UNSAFE_componentWillReceiveProps(nextProps) { | ||
// You don't have to do this check first, but it can help prevent an unneeded render | ||
if (nextProps.section !== this.state.selectedItemName) { | ||
this.setState({ selectedItemName: nextProps.section }); | ||
} | ||
} | ||
|
||
avaibleRenderSettings() { | ||
return [ | ||
this.createItem({ id: 'devTools', text: 'API Console' }), | ||
this.createItem({ id: 'logtest', text: 'Ruleset Test' }), | ||
] | ||
} | ||
|
||
clickMenuItem = async (ev, section) => { | ||
this.props.closePopover(); | ||
AppNavigate.navigateToModule(ev, 'wazuh-dev', { tab: section }); | ||
}; | ||
|
||
createItem = (item, data = {}) => { | ||
// NOTE: Duplicate `name` values will cause `id` collisions. | ||
return { | ||
...data, | ||
id: item.id, | ||
name: item.text, | ||
isSelected: window.location.href.includes('/wazuh-dev') && this.props.state.selected_tools_section === item.id, | ||
onClick: () => { }, | ||
onMouseDown: (ev) => this.clickMenuItem(ev, item.id) | ||
}; | ||
}; | ||
|
||
render() { | ||
const renderSettings = this.avaibleRenderSettings() | ||
const sideNavAdmin = [ | ||
{ | ||
name: 'Tools', | ||
id: 0, | ||
icon: <EuiIcon type="devToolsApp" color="primary" />, | ||
items: renderSettings | ||
} | ||
]; | ||
|
||
return ( | ||
<div className="WzManagementSideMenu" style={{ width: 200 }}> | ||
<EuiFlexGroup responsive={false}> | ||
<EuiFlexItem grow={false}> | ||
<EuiSideNav items={sideNavAdmin} style={{ padding: '4px 12px' }} /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapStateToProps = state => { | ||
return { | ||
state: state.toolsReducers | ||
}; | ||
}; | ||
|
||
export default connect(mapStateToProps, null)(WzMenuTools); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.