Skip to content

Commit

Permalink
Save selected alert to report content composer defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
swaterkamp committed Dec 11, 2018
1 parent 1af48c9 commit 8e8a002
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gsa/src/web/pages/reports/alertactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class AlertActions extends React.Component {
if (storeAsDefault) {
this.props.saveReportComposerDefaults({
applyOverrides,
defaultAlertId: alertId,
includeNotes,
includeOverrides,
});
Expand Down Expand Up @@ -164,6 +165,7 @@ class AlertActions extends React.Component {
const {
alertId,
applyOverrides,
defaultAlertId,
includeNotes,
includeOverrides,
showTriggerAlertDialog,
Expand All @@ -189,6 +191,7 @@ class AlertActions extends React.Component {
alertId={alertId}
alerts={alerts}
applyOverrides={applyOverrides}
defaultAlertId={defaultAlertId}
filter={filter}
includeNotes={includeNotes}
includeOverrides={includeOverrides}
Expand Down
6 changes: 6 additions & 0 deletions gsa/src/web/pages/reports/triggeralertdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import _ from 'gmp/locale';
import {NO_VALUE, YES_VALUE} from 'gmp/parser';

import {first} from 'gmp/utils/array';
import {selectSaveId} from 'gmp/utils/id';
import {isDefined, isString} from 'gmp/utils/identity';
import PropTypes from 'web/utils/proptypes';
import {renderSelectItems} from 'web/utils/render';
Expand All @@ -50,6 +51,7 @@ const TriggerAlertDialog = ({
alertId,
alerts = [],
applyOverrides = COMPOSER_CONTENT_DEFAULTS.applyOverrides,
defaultAlertId,
filter = {},
includeNotes = COMPOSER_CONTENT_DEFAULTS.includeNotes,
includeOverrides = COMPOSER_CONTENT_DEFAULTS.includeOverrides,
Expand All @@ -64,6 +66,10 @@ const TriggerAlertDialog = ({
const filterString = isString(filter) ?
filter : filter.toFilterCriteriaString();

if (isDefined(defaultAlertId)) {
alertId = selectSaveId(alerts, defaultAlertId);
};

const unControlledValues = {
applyOverrides,
includeNotes,
Expand Down

0 comments on commit 8e8a002

Please sign in to comment.