Skip to content

Commit

Permalink
Use withCapabilities in alert method parts
Browse files Browse the repository at this point in the history
Instead of passing the capabilities as a prop, use withCapabilities in
the dialog part components for the alert methods SCP, Send, SMB and
Verinice.
  • Loading branch information
timopollmeier committed Jul 22, 2024
1 parent b776c4b commit 23586b1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/web/pages/alerts/dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,6 @@ class AlertDialog extends React.Component {
{values.method === METHOD_TYPE_SCP && (
<ScpMethodPart
prefix="method_data"
capabilities={capabilities}
credentials={credentials}
reportConfigs={report_configs}
reportFormats={report_formats}
Expand All @@ -737,7 +736,6 @@ class AlertDialog extends React.Component {
{values.method === METHOD_TYPE_SEND && (
<SendMethodPart
prefix="method_data"
capabilities={capabilities}
sendHost={values.method_data_send_host}
sendPort={values.method_data_send_port}
sendReportConfig={values.method_data_send_report_config}
Expand All @@ -760,7 +758,6 @@ class AlertDialog extends React.Component {
{values.method === METHOD_TYPE_SMB && (
<SmbMethodPart
prefix="method_data"
capabilities={capabilities}
credentials={credentials}
reportConfigs={report_configs}
reportFormats={report_formats}
Expand Down Expand Up @@ -804,7 +801,6 @@ class AlertDialog extends React.Component {
{values.method === METHOD_TYPE_VERINICE && (
<VeriniceMethodPart
prefix="method_data"
capabilities={capabilities}
credentials={credentials}
reportConfigs={report_configs}
reportFormats={report_formats}
Expand Down
4 changes: 3 additions & 1 deletion src/web/pages/alerts/scpmethodpart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import Layout from 'web/components/layout/layout';
import PropTypes from 'web/utils/proptypes';

import {renderSelectItems, UNSET_VALUE} from '../../utils/render';
import compose from "web/utils/compose";
import withCapabilities from "web/utils/withCapabilities";
import withPrefix from 'web/utils/withPrefix';

import Select from 'web/components/form/select';
Expand Down Expand Up @@ -173,6 +175,6 @@ ScpMethodPart.propTypes = {
onNewCredentialClick: PropTypes.func.isRequired,
};

export default withPrefix(ScpMethodPart);
export default compose(withCapabilities, withPrefix)(ScpMethodPart);

// vim: set ts=2 sw=2 tw=80:
4 changes: 3 additions & 1 deletion src/web/pages/alerts/sendmethodpart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import Divider from 'web/components/layout/divider';
import Layout from 'web/components/layout/layout';

import PropTypes from 'web/utils/proptypes';
import compose from "web/utils/compose";
import withCapabilities from "web/utils/withCapabilities";
import withPrefix from 'web/utils/withPrefix';

import Select from 'web/components/form/select';
Expand Down Expand Up @@ -110,6 +112,6 @@ SendMethodPart.propTypes = {
onChange: PropTypes.func,
};

export default withPrefix(SendMethodPart);
export default compose(withCapabilities, withPrefix)(SendMethodPart);

// vim: set ts=2 sw=2 tw=80:
4 changes: 3 additions & 1 deletion src/web/pages/alerts/smbmethodpart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import Layout from 'web/components/layout/layout';
import PropTypes from 'web/utils/proptypes';

import {renderSelectItems, UNSET_VALUE} from 'web/utils/render';
import compose from "web/utils/compose";
import withCapabilities from "web/utils/withCapabilities";
import withPrefix from 'web/utils/withPrefix';

import Select from 'web/components/form/select';
Expand Down Expand Up @@ -174,6 +176,6 @@ SmbMethodPart.propTypes = {
onNewCredentialClick: PropTypes.func.isRequired,
};

export default withPrefix(SmbMethodPart);
export default compose(withCapabilities, withPrefix)(SmbMethodPart);

// vim: set ts=2 sw=2 tw=80:
4 changes: 3 additions & 1 deletion src/web/pages/alerts/verinicemethodpart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import Layout from 'web/components/layout/layout';

import PropTypes from 'web/utils/proptypes';
import {renderSelectItems, UNSET_VALUE} from '../../utils/render';
import compose from "web/utils/compose";
import withCapabilities from "web/utils/withCapabilities";
import withPrefix from 'web/utils/withPrefix';

import Select from 'web/components/form/select';
Expand Down Expand Up @@ -136,6 +138,6 @@ VeriniceMethodPart.propTypes = {
onNewCredentialClick: PropTypes.func.isRequired,
};

export default withPrefix(VeriniceMethodPart);
export default compose(withCapabilities, withPrefix)(VeriniceMethodPart);

// vim: set ts=2 sw=2 tw=80:

0 comments on commit 23586b1

Please sign in to comment.