-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: edit filter Alerts, Scan Config, Permission
- Loading branch information
1 parent
164d87c
commit 6d797aa
Showing
7 changed files
with
288 additions
and
153 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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import PropTypes from 'web/utils/proptypes'; | ||
|
||
import DefaultFilterDialog from 'web/components/powerfilter/dialog'; | ||
import FilterDialog from 'web/components/powerfilter/filterdialog'; | ||
import useFilterDialog from 'web/components/powerfilter/useFilterDialog'; | ||
import useFilterDialogSave from 'web/components/powerfilter/useFilterDialogSave'; | ||
|
||
import useTranslation from 'web/hooks/useTranslation'; | ||
|
||
const AlertsFilterDialog = ({ | ||
filter, | ||
onCloseClick, | ||
onClose = onCloseClick, | ||
onFilterChanged, | ||
onFilterCreated, | ||
...props | ||
}) => { | ||
const [_] = useTranslation(); | ||
const filterDialogProps = useFilterDialog(filter); | ||
const [handleSave] = useFilterDialogSave( | ||
'alert', | ||
{ | ||
onClose, | ||
onFilterChanged, | ||
onFilterCreated, | ||
}, | ||
filterDialogProps, | ||
); | ||
|
||
const SORT_FIELDS = [ | ||
{ | ||
name: 'name', | ||
displayName: _('Name'), | ||
width: '25%', | ||
}, | ||
{ | ||
name: 'event', | ||
displayName: _('Event'), | ||
width: '21%', | ||
}, | ||
{ | ||
name: 'condition', | ||
displayName: _('Condition'), | ||
width: '21%', | ||
}, | ||
{ | ||
name: 'method', | ||
displayName: _('Method'), | ||
width: '10%', | ||
}, | ||
{ | ||
name: 'filter', | ||
displayName: _('Filter'), | ||
width: '10%', | ||
}, | ||
{ | ||
name: 'active', | ||
displayName: _('Active'), | ||
width: '5%', | ||
}, | ||
]; | ||
return ( | ||
<FilterDialog onClose={onClose} onSave={handleSave}> | ||
<DefaultFilterDialog | ||
{...props} | ||
{...filterDialogProps} | ||
sortFields={SORT_FIELDS} | ||
/> | ||
</FilterDialog> | ||
); | ||
}; | ||
|
||
AlertsFilterDialog.propTypes = { | ||
filter: PropTypes.filter, | ||
onClose: PropTypes.func, | ||
onCloseClick: PropTypes.func, // should be removed in future | ||
onFilterChanged: PropTypes.func, | ||
onFilterCreated: PropTypes.func, | ||
}; | ||
|
||
export default AlertsFilterDialog; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import PropTypes from 'web/utils/proptypes'; | ||
|
||
import DefaultFilterDialog from 'web/components/powerfilter/dialog'; | ||
import FilterDialog from 'web/components/powerfilter/filterdialog'; | ||
import useFilterDialog from 'web/components/powerfilter/useFilterDialog'; | ||
import useFilterDialogSave from 'web/components/powerfilter/useFilterDialogSave'; | ||
|
||
import useTranslation from 'web/hooks/useTranslation'; | ||
|
||
const ScanConfigFilterDialog = ({ | ||
filter, | ||
onCloseClick, | ||
onClose = onCloseClick, | ||
onFilterChanged, | ||
onFilterCreated, | ||
...props | ||
}) => { | ||
const [_] = useTranslation(); | ||
const filterDialogProps = useFilterDialog(filter); | ||
const [handleSave] = useFilterDialogSave( | ||
'config', | ||
{ | ||
onClose, | ||
onFilterChanged, | ||
onFilterCreated, | ||
}, | ||
filterDialogProps, | ||
); | ||
|
||
const SORT_FIELDS = [ | ||
{ | ||
name: 'name', | ||
displayName: _('Name'), | ||
}, | ||
{ | ||
name: 'families_total', | ||
displayName: _('Families: Total'), | ||
}, | ||
{ | ||
name: 'families_trend', | ||
displayName: _('Families: Trend'), | ||
}, | ||
{ | ||
name: 'nvts_total', | ||
displayName: _('NVTs: Total'), | ||
}, | ||
{ | ||
name: 'nvts_trend', | ||
displayName: _('NVTs: Trend'), | ||
}, | ||
]; | ||
|
||
return ( | ||
<FilterDialog onClose={onClose} onSave={handleSave}> | ||
<DefaultFilterDialog | ||
{...props} | ||
{...filterDialogProps} | ||
sortFields={SORT_FIELDS} | ||
/> | ||
</FilterDialog> | ||
); | ||
}; | ||
|
||
ScanConfigFilterDialog.propTypes = { | ||
filter: PropTypes.filter, | ||
onClose: PropTypes.func, | ||
onCloseClick: PropTypes.func, // should be removed in future | ||
onFilterChanged: PropTypes.func, | ||
onFilterCreated: PropTypes.func, | ||
}; | ||
|
||
export default ScanConfigFilterDialog; |
Oops, something went wrong.