Skip to content

Commit

Permalink
Merge pull request #1650 from swaterkamp/RemoveCloneVerifyForRF
Browse files Browse the repository at this point in the history
Remove clone and verify functionalities for ReportFormats
  • Loading branch information
bjoernricks authored Oct 1, 2019
2 parents 841c623 + a7f4953 commit f6cd414
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 211 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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
- Removed Clone and Verify functionalities for report formats [#1650](https://github.com/greenbone/gsa/pull/1650)
- Use new [React context API](https://reactjs.org/docs/context.html#api) [#1637](https://github.com/greenbone/gsa/pull/1637)
- Update response data parsing in Model classes [#1633](https://github.com/greenbone/gsa/pull/1633)
- Fix statusbar content can be more than 100% and add progressbar colors to theme [1621](https://github.com/greenbone/gsa/pull/1621)
Expand Down
23 changes: 0 additions & 23 deletions gsa/src/gmp/commands/reportformats.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
import logger from '../log';

import {isDefined} from '../utils/identity';

import registerCommand from '../command';

import ReportFormat from '../models/reportformat';
Expand Down Expand Up @@ -71,27 +69,6 @@ class ReportFormatCommand extends EntityCommand {
return this.action(data);
}

verify({id}) {
log.debug('Verifying report format', id);
return this.httpPost({
cmd: 'verify_report_format',
id,
}).then(this.transformRequest, rej => {
const {root} = rej;

if (
isDefined(root) &&
isDefined(root.get_report_formats) &&
isDefined(root.get_report_formats.verify_report_format_response)
) {
const response = root.get_report_formats.verify_report_format_response;
rej.setMessage(response._status_text);
}

return Promise.reject(rej);
});
}

getElementFromRoot(root) {
return root.get_report_format.get_report_formats_response.report_format;
}
Expand Down
18 changes: 0 additions & 18 deletions gsa/src/web/pages/reportformats/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,10 @@ class ReportFormatComponent extends React.Component {
this.handleCloseReportFormatDialog = this.handleCloseReportFormatDialog.bind(
this,
);
this.handleVerify = this.handleVerify.bind(this);
this.handleSave = this.handleSave.bind(this);
this.openReportFormatDialog = this.openReportFormatDialog.bind(this);
}

handleVerify(format) {
const {gmp, onVerified, onVerifyError} = this.props;

this.handleInteraction();

gmp.reportformat.verify(format).then(onVerified, onVerifyError);
}

openReportFormatDialog(reportformat) {
this.handleInteraction();

Expand Down Expand Up @@ -138,8 +129,6 @@ class ReportFormatComponent extends React.Component {
render() {
const {
children,
onCloned,
onCloneError,
onDeleted,
onDeleteError,
onDownloaded,
Expand All @@ -152,8 +141,6 @@ class ReportFormatComponent extends React.Component {
return (
<EntityComponent
name="reportformat"
onCloned={onCloned}
onCloneError={onCloneError}
onDeleted={onDeleted}
onDeleteError={onDeleteError}
onDownloaded={onDownloaded}
Expand All @@ -166,7 +153,6 @@ class ReportFormatComponent extends React.Component {
...other,
import: this.openReportFormatDialog,
edit: this.openReportFormatDialog,
verify: this.handleVerify,
})}
{dialogVisible && (
<ReportFormatDialog
Expand All @@ -186,8 +172,6 @@ class ReportFormatComponent extends React.Component {
ReportFormatComponent.propTypes = {
children: PropTypes.func.isRequired,
gmp: PropTypes.gmp.isRequired,
onCloneError: PropTypes.func,
onCloned: PropTypes.func,
onDeleteError: PropTypes.func,
onDeleted: PropTypes.func,
onDownloadError: PropTypes.func,
Expand All @@ -197,8 +181,6 @@ ReportFormatComponent.propTypes = {
onInteraction: PropTypes.func.isRequired,
onSaveError: PropTypes.func,
onSaved: PropTypes.func,
onVerified: PropTypes.func,
onVerifyError: PropTypes.func,
};

export default withGmp(ReportFormatComponent);
Expand Down
52 changes: 8 additions & 44 deletions gsa/src/web/pages/reportformats/detailspage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ import React from 'react';

import _ from 'gmp/locale';

import ManualIcon from 'web/components/icon/manualicon';
import ListIcon from 'web/components/icon/listicon';
import ReportFormatIcon from 'web/components/icon/reportformaticon';
import VerifyIcon from 'web/components/icon/verifyicon';

import CreateIcon from 'web/entity/icon/createicon';
import DeleteIcon from 'web/entity/icon/deleteicon';
import Divider from 'web/components/layout/divider';
import EditIcon from 'web/entity/icon/editicon';
import ExportIcon from 'web/components/icon/exporticon';
import IconDivider from 'web/components/layout/icondivider';
import Layout from 'web/components/layout/layout';
import ListIcon from 'web/components/icon/listicon';
import ManualIcon from 'web/components/icon/manualicon';
import ReportFormatIcon from 'web/components/icon/reportformaticon';

import Tab from 'web/components/tab/tab';
import TabLayout from 'web/components/tab/tablayout';
Expand All @@ -52,12 +54,6 @@ import withEntityContainer, {
permissionsResourceFilter,
} from 'web/entity/withEntityContainer';

import ExportIcon from 'web/components/icon/exporticon';
import CloneIcon from 'web/entity/icon/cloneicon';
import CreateIcon from 'web/entity/icon/createicon';
import EditIcon from 'web/entity/icon/editicon';
import DeleteIcon from 'web/entity/icon/deleteicon';

import {selector, loadEntity} from 'web/store/entities/reportformats';

import {
Expand All @@ -75,12 +71,10 @@ const ToolBarIcons = withCapabilities(
({
capabilities,
entity,
onReportFormatCloneClick,
onReportFormatImportClick,
onReportFormatDeleteClick,
onReportFormatDownloadClick,
onReportFormatEditClick,
onReportFormatVerifyClick,
}) => (
<Divider margin="10px">
<IconDivider>
Expand All @@ -97,11 +91,6 @@ const ToolBarIcons = withCapabilities(
entity={entity}
onClick={onReportFormatImportClick}
/>
<CloneIcon
displayName={_('Report Format')}
entity={entity}
onClick={onReportFormatCloneClick}
/>
<EditIcon
displayName={_('Report Format')}
entity={entity}
Expand All @@ -117,24 +106,13 @@ const ToolBarIcons = withCapabilities(
title={_('Export Report Format as XML')}
onClick={onReportFormatDownloadClick}
/>
<VerifyIcon
disabled={!capabilities.mayOp('verify_report_format')}
value={entity}
title={
capabilities.mayOp('verify_report_format')
? _('Verify Report Format')
: _('Permission to verify Report Format denied')
}
onClick={onReportFormatVerifyClick}
/>
</IconDivider>
</Divider>
),
);

ToolBarIcons.propTypes = {
entity: PropTypes.model.isRequired,
onReportFormatCloneClick: PropTypes.func.isRequired,
onReportFormatDeleteClick: PropTypes.func.isRequired,
onReportFormatDownloadClick: PropTypes.func.isRequired,
onReportFormatEditClick: PropTypes.func.isRequired,
Expand Down Expand Up @@ -197,41 +175,27 @@ const Page = ({
...props
}) => (
<ReportFormatComponent
onCloned={goto_details('reportformat', props)}
onCloneError={onError}
onDeleted={goto_list('reportformats', props)}
onDeleteError={onError}
onDownloaded={onDownloaded}
onDownloadError={onError}
onImported={goto_details('reportformat', props)}
onInteraction={onInteraction}
onSaved={onChanged}
onVerify={onChanged}
onVerifyError={onError}
>
{({
clone,
delete: delete_func,
download,
edit,
import: import_func,
save,
verify,
}) => (
{({delete: delete_func, download, edit, import: import_func, save}) => (
<EntityPage
{...props}
entity={entity}
sectionIcon={<ReportFormatIcon size="large" />}
title={_('Report Format')}
toolBarIcons={ToolBarIcons}
onInteraction={onInteraction}
onReportFormatCloneClick={clone}
onReportFormatImportClick={import_func}
onReportFormatDeleteClick={delete_func}
onReportFormatDownloadClick={download}
onReportFormatEditClick={edit}
onReportFormatSaveClick={save}
onReportFormatVerifyClick={verify}
>
{({activeTab = 0, onActivateTab}) => {
return (
Expand Down
19 changes: 1 addition & 18 deletions gsa/src/web/pages/reportformats/listpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,14 @@ const ReportFormatsPage = ({
}) => (
<ReportFormatComponent
onSaved={onChanged}
onCloned={onChanged}
onCloneError={onError}
onDeleted={onChanged}
onDeleteError={onError}
onDownloaded={onDownloaded}
onDownloadError={onError}
onImported={onChanged}
onInteraction={onInteraction}
onVerified={() => {
onChanged();
showSuccess(_('Report Format has been verified.'));
}}
onVerifyError={onError}
>
{({
clone,
delete: delete_func,
download,
edit,
import: import_func,
save,
verify,
}) => (
{({delete: delete_func, download, edit, import: import_func, save}) => (
<EntitiesPage
{...props}
filterEditDialog={ReportFormatsFilterDialog}
Expand All @@ -115,12 +100,10 @@ const ReportFormatsPage = ({
onDownloaded={onDownloaded}
onError={onError}
onInteraction={onInteraction}
onReportFormatCloneClick={clone}
onReportFormatImportClick={import_func}
onReportFormatDeleteClick={delete_func}
onReportFormatDownloadClick={download}
onReportFormatEditClick={edit}
onReportFormatVerifyClick={verify}
/>
)}
</ReportFormatComponent>
Expand Down
24 changes: 1 addition & 23 deletions gsa/src/web/pages/reportformats/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ import EntityNameTableData from 'web/entities/entitynametabledata';

import Comment from 'web/components/comment/comment';

import CloneIcon from 'web/entity/icon/cloneicon';
import EditIcon from 'web/entity/icon/editicon';
import TrashIcon from 'web/entity/icon/trashicon';
import VerifyIcon from 'web/entity/icon/verifyicon';

import ExportIcon from 'web/components/icon/exporticon';
import TrashIcon from 'web/entity/icon/trashicon';

import IconDivider from 'web/components/layout/icondivider';

Expand All @@ -51,11 +48,9 @@ const Actions = compose(
({
capabilities,
entity,
onReportFormatCloneClick,
onReportFormatDeleteClick,
onReportFormatDownloadClick,
onReportFormatEditClick,
onReportFormatVerifyClick,
}) => (
<IconDivider align={['center', 'center']} grow>
<TrashIcon
Expand All @@ -70,37 +65,20 @@ const Actions = compose(
entity={entity}
onClick={onReportFormatEditClick}
/>
<CloneIcon
displayName={_('Report Format')}
name="report_format"
entity={entity}
title={_('Clone Report Format')}
value={entity}
onClick={onReportFormatCloneClick}
/>
<ExportIcon
value={entity}
title={_('Export Report Format')}
onClick={onReportFormatDownloadClick}
/>
<VerifyIcon
displayName={_('Report Format')}
name="report_format"
entity={entity}
value={entity}
onClick={onReportFormatVerifyClick}
/>
</IconDivider>
),
);

Actions.propTypes = {
entity: PropTypes.model.isRequired,
onReportFormatCloneClick: PropTypes.func.isRequired,
onReportFormatDeleteClick: PropTypes.func.isRequired,
onReportFormatDownloadClick: PropTypes.func.isRequired,
onReportFormatEditClick: PropTypes.func.isRequired,
onReportFormatVerifyClick: PropTypes.func.isRequired,
};

const Row = ({
Expand Down
2 changes: 0 additions & 2 deletions gsad/src/gsad.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ init_validator ()
"|(sync_config)"
"|(toggle_tag)"
"|(verify_agent)"
"|(verify_report_format)"
"|(verify_scanner)"
"|(wizard)"
"|(wizard_get))$");
Expand Down Expand Up @@ -1550,7 +1549,6 @@ exec_gmp_post (http_connection_t *con, gsad_connection_info_t *con_info,
ELSE (test_alert)
ELSE (toggle_tag)
ELSE (verify_agent)
ELSE (verify_report_format)
ELSE (verify_scanner)
else
{
Expand Down
Loading

0 comments on commit f6cd414

Please sign in to comment.