-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #746 from swaterkamp/BulkTags
Bulk Tags
- Loading branch information
Showing
7 changed files
with
411 additions
and
34 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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
* | ||
* Authors: | ||
* Björn Ricks <[email protected]> | ||
* Steffen Waterkamp <[email protected]> | ||
* | ||
* Copyright: | ||
* Copyright (C) 2017 - 2018 Greenbone Networks GmbH | ||
|
@@ -66,7 +67,9 @@ class TagCommand extends EntityCommand { | |
name, | ||
comment = '', | ||
active, | ||
filter, | ||
resource_id = '', | ||
resource_ids = [resource_id], | ||
resource_type, | ||
value = '', | ||
}) { | ||
|
@@ -77,7 +80,8 @@ class TagCommand extends EntityCommand { | |
tag_value: value, | ||
comment, | ||
active, | ||
resource_id, | ||
filter, | ||
'resource_ids:': resource_ids.length > 0 ? resource_ids : undefined, | ||
resource_type, | ||
}; | ||
log.debug('Saving tag', data); | ||
|
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,69 @@ | ||
/* Greenbone Security Assistant | ||
* | ||
* Authors: | ||
* Steffen Waterkamp <[email protected]> | ||
* | ||
* Copyright: | ||
* Copyright (C) 2018 Greenbone Networks GmbH | ||
* | ||
* 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. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import _ from 'gmp/locale.js'; | ||
import {is_defined} from 'gmp/utils'; | ||
|
||
import PropTypes from '../../utils/proptypes.js'; | ||
|
||
import SelectionType from '../../utils/selectiontype.js'; | ||
|
||
import Icon from './icon.js'; | ||
|
||
const TagsIcon = ({ | ||
active = true, | ||
selectionType, | ||
title, | ||
...other | ||
}) => { | ||
if (!is_defined(title)) { | ||
if (selectionType === SelectionType.SELECTION_PAGE_CONTENTS) { | ||
title = _('Add tag to page contents'); | ||
} | ||
else if (selectionType === SelectionType.SELECTION_USER) { | ||
title = _('Add tag to selection'); | ||
} | ||
else if (selectionType === SelectionType.SELECTION_FILTER) { | ||
title = _('Add tag to filtered'); | ||
} | ||
} | ||
return ( | ||
<Icon | ||
{...other} | ||
img={'tag.svg'} | ||
title={title}/> | ||
); | ||
}; | ||
|
||
TagsIcon.propTypes = { | ||
active: PropTypes.bool, | ||
selectionType: PropTypes.string, | ||
title: PropTypes.string, | ||
onClick: PropTypes.func, | ||
}; | ||
|
||
export default TagsIcon; | ||
|
||
// vim: set ts=2 sw=2 tw=80: |
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 |
---|---|---|
|
@@ -2,9 +2,10 @@ | |
* | ||
* Authors: | ||
* Björn Ricks <[email protected]> | ||
* Steffen Waterkamp <[email protected]> | ||
* | ||
* Copyright: | ||
* Copyright (C) 2016 - 2017 Greenbone Networks GmbH | ||
* Copyright (C) 2016 - 2018 Greenbone Networks GmbH | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
|
@@ -34,6 +35,7 @@ import SelectionType from '../utils/selectiontype.js'; | |
|
||
import DeleteIcon from '../components/icon/deleteicon.js'; | ||
import ExportIcon from '../components/icon/exporticon.js'; | ||
import TagsIcon from '../components/icon/tagsicon.js'; | ||
import TrashIcon from '../components/icon/trashicon.js'; | ||
|
||
import Select from '../components/form/select.js'; | ||
|
@@ -48,10 +50,12 @@ export const EntitiesFooter = ({ | |
selection = true, | ||
selectionType, | ||
span, | ||
tags = true, | ||
trash, | ||
onDeleteClick, | ||
onDownloadClick, | ||
onSelectionTypeChange, | ||
onTagsClick, | ||
onTrashClick, | ||
...props | ||
}) => { | ||
|
@@ -79,6 +83,12 @@ export const EntitiesFooter = ({ | |
</Select> | ||
} | ||
<IconDivider> | ||
{tags && | ||
<TagsIcon | ||
onClick={onTagsClick} | ||
selectionType={selectionType} | ||
/> | ||
} | ||
{trash && | ||
<TrashIcon | ||
onClick={onTrashClick} | ||
|
@@ -113,22 +123,30 @@ EntitiesFooter.propTypes = { | |
selection: PropTypes.bool, | ||
selectionType: PropTypes.string, | ||
span: PropTypes.number.isRequired, | ||
tags: PropTypes.bool, | ||
trash: PropTypes.bool, | ||
onDeleteClick: PropTypes.func, | ||
onDownloadClick: PropTypes.func, | ||
onSelectionTypeChange: PropTypes.func, | ||
onTagsClick: PropTypes.func, | ||
onTrashClick: PropTypes.func, | ||
}; | ||
|
||
export const withEntitiesFooter = (options = {}) => Component => { | ||
|
||
const EntitiesFooterWrapper = ({onDownloadBulk, onDeleteBulk, ...props}) => { | ||
const EntitiesFooterWrapper = ({ | ||
onDownloadBulk, | ||
onDeleteBulk, | ||
onTagsBulk, | ||
...props | ||
}) => { | ||
return ( | ||
<Component | ||
{...options} | ||
{...props} | ||
onDownloadClick={onDownloadBulk} | ||
onDeleteClick={onDeleteBulk} | ||
onTagsClick={onTagsBulk} | ||
onTrashClick={onDeleteBulk} | ||
/> | ||
); | ||
|
@@ -137,6 +155,7 @@ export const withEntitiesFooter = (options = {}) => Component => { | |
EntitiesFooterWrapper.propTypes = { | ||
onDeleteBulk: PropTypes.func, | ||
onDownloadBulk: PropTypes.func, | ||
onTagsBulk: PropTypes.func, | ||
}; | ||
|
||
return EntitiesFooterWrapper; | ||
|
Oops, something went wrong.