Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override: Make host/port/task fields editable even when fixed, and display oid when no name is defined #1814

Merged
merged 3 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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
- Override dialog: Make host/port/task fields editable even when fixed, and display oid when no name is defined [#1814](https://github.com/greenbone/gsa/pull/1814)
- Use consistent setting naming [#1774](https://github.com/greenbone/gsa/pull/1774)
- Consider visibility status of page for calculating the reload interval [#1761](https://github.com/greenbone/gsa/pull/1761)
- Do not simplify filterString in content composer for report download [#1733](https://github.com/greenbone/gsa/pull/1733)
Expand Down
55 changes: 26 additions & 29 deletions gsa/src/web/pages/overrides/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,16 @@ const OverrideDialog = ({
{({values: state, onValueChange}) => {
return (
<Layout flex="column">
{fixed && (
{fixed && isDefined(oid) && (
<FormGroup title={_('NVT')} flex="column">
<span>{renderNvtName(oid, nvt_name)}</span>
</FormGroup>
)}
{fixed && !isDefined(oid) && (
<FormGroup title={_('NVT')} flex="column">
<span>{renderNvtName(state.oid, nvt_name)}</span>
</FormGroup>
)}
{is_edit && !fixed && (
<FormGroup title={_('NVT')} flex="column">
<Radio
Expand Down Expand Up @@ -270,19 +275,16 @@ const OverrideDialog = ({
<Layout>
<Radio
name="hosts"
title={fixed ? state.hosts_manual : ''}
checked={state.hosts === MANUAL}
value={MANUAL}
onChange={onValueChange}
/>
{!fixed && (
<TextField
name="hosts_manual"
value={state.hosts_manual}
disabled={state.hosts !== MANUAL}
onChange={onValueChange}
/>
)}
<TextField
name="hosts_manual"
value={state.hosts_manual}
disabled={state.hosts !== MANUAL}
onChange={onValueChange}
/>
</Layout>
</FormGroup>

Expand All @@ -297,19 +299,16 @@ const OverrideDialog = ({
<Layout>
<Radio
name="port"
title={fixed ? state.port_manual : ''}
checked={state.port === MANUAL}
value={MANUAL}
onChange={onValueChange}
/>
{!fixed && (
<TextField
name="port_manual"
disabled={state.port !== MANUAL}
value={state.port_manual}
onChange={onValueChange}
/>
)}
<TextField
name="port_manual"
disabled={state.port !== MANUAL}
value={state.port_manual}
onChange={onValueChange}
/>
</Layout>
</FormGroup>

Expand Down Expand Up @@ -412,20 +411,18 @@ const OverrideDialog = ({
<Layout>
<Radio
name="task_id"
title={fixed ? state.task_name : ''}
checked={state.task_id === TASK_SELECTED}
value={TASK_SELECTED}
onChange={onValueChange}
/>
{!fixed && (
<Select
name="task_uuid"
disabled={state.task_id !== TASK_SELECTED}
items={renderSelectItems(tasks)}
value={state.task_uuid}
onChange={onValueChange}
/>
)}

<Select
name="task_uuid"
disabled={state.task_id !== TASK_SELECTED}
items={renderSelectItems(tasks)}
value={state.task_uuid}
onChange={onValueChange}
/>
</Layout>
</FormGroup>

Expand Down
2 changes: 1 addition & 1 deletion gsa/src/web/utils/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const severityFormat = format('0.1f');

export const renderNvtName = (oid, name, length = 70) => {
if (!isDefined(name)) {
return '';
return oid;
}

if (name.length < length) {
Expand Down