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

trigger alert button disabled in report details page when no permission #1574

Merged
merged 5 commits into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[#1507](https://github.com/greenbone/gsa/pull/1507)

### Changed
- trigger alert button disabled in report details page when no permission [#1574](https://github.com/greenbone/gsa/pull/1574)
- Update default filter for report details page [#1552](https://github.com/greenbone/gsa/pull/1552)
- Adjust HelpIcons to use GOS 5 manual [#1549](https://github.com/greenbone/gsa/pull/1549) [#1550](https://github.com/greenbone/gsa/pull/1550)
- Adjust clickable areas for Select and MultiSelect [#1545](https://github.com/greenbone/gsa/pull/1545)
Expand Down
19 changes: 13 additions & 6 deletions gsa/src/web/pages/reports/alertactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {
} from 'web/store/usersettings/actions';

import {getReportComposerDefaults} from 'web/store/usersettings/selectors';
import withCapabilities from 'web/utils/withCapabilities';

const log = logger.getLogger('web.report.alertactions');

Expand Down Expand Up @@ -161,12 +162,14 @@ class AlertActions extends React.Component {
render() {
const {
alerts,
capabilities,
reportComposerDefaults,
filter,
showError,
onInteraction,
} = this.props;
const {alertId, showTriggerAlertDialog, storeAsDefault} = this.state;
const mayAccessAlerts = capabilities.mayOp('get_alerts');
return (
<AlertComponent
onCreated={this.onAlertCreated}
Expand All @@ -175,12 +178,14 @@ class AlertActions extends React.Component {
>
{({create}) => (
<React.Fragment>
<IconDivider>
<StartIcon
title={_('Trigger Alert')}
onClick={this.handleOpenTriggerAlertDialog}
/>
</IconDivider>
{mayAccessAlerts && (
<IconDivider>
<StartIcon
title={_('Trigger Alert')}
onClick={this.handleOpenTriggerAlertDialog}
/>
</IconDivider>
)}
{showTriggerAlertDialog && (
<TriggerAlertDialog
alertId={alertId}
Expand All @@ -205,6 +210,7 @@ class AlertActions extends React.Component {

AlertActions.propTypes = {
alerts: PropTypes.array,
capabilities: PropTypes.array,
saberlynx marked this conversation as resolved.
Show resolved Hide resolved
filter: PropTypes.filter,
gmp: PropTypes.gmp.isRequired,
loadAlerts: PropTypes.func.isRequired,
Expand Down Expand Up @@ -238,6 +244,7 @@ const mapStateToProps = rootState => {

export default compose(
withGmp,
withCapabilities,
connect(
mapStateToProps,
mapDispatchToProps,
Expand Down