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

New note dialog: make all fields editable when fixed #1817

Merged
merged 3 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +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)
- New override and note 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) [#1817](https://github.com/greenbone/gsa/pull/1817)
- 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
54 changes: 25 additions & 29 deletions gsa/src/web/pages/notes/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,16 @@ const NoteDialog = ({
{({values: state, onValueChange}) => {
return (
<Layout flex="column">
{state.fixed && (
{state.fixed && isDefined(oid) && (
<FormGroup title={_('NVT')} flex="column">
<span>{renderNvtName(oid, nvt_name)}</span>
</FormGroup>
)}
{state.fixed && !isDefined(oid) && (
<FormGroup title={_('NVT')} flex="column">
<span>{renderNvtName(state.oid, nvt_name)}</span>
</FormGroup>
)}
{is_edit && !state.fixed && (
<FormGroup title={_('NVT')} flex="column">
<Radio
Expand Down Expand Up @@ -222,19 +227,16 @@ const NoteDialog = ({
<Divider>
<Radio
name="hosts"
title={state.fixed ? state.hosts_manual : ''}
checked={state.hosts === MANUAL}
value={MANUAL}
onChange={onValueChange}
/>
{!state.fixed && (
<TextField
name="hosts_manual"
disabled={state.hosts !== MANUAL}
value={state.hosts_manual}
onChange={onValueChange}
/>
)}
<TextField
name="hosts_manual"
disabled={state.hosts !== MANUAL}
value={state.hosts_manual}
onChange={onValueChange}
/>
</Divider>
</FormGroup>

Expand All @@ -249,19 +251,16 @@ const NoteDialog = ({
<Divider>
<Radio
name="port"
title={state.fixed ? state.port_manual : ''}
checked={state.port === MANUAL}
value={MANUAL}
onChange={onValueChange}
/>
{!state.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}
/>
</Divider>
</FormGroup>

Expand Down Expand Up @@ -329,20 +328,17 @@ const NoteDialog = ({
<Divider>
<Radio
name="task_id"
title={state.fixed ? state.task_name : ''}
checked={state.task_id === '0'}
value="0"
onChange={onValueChange}
/>
{!state.fixed && (
<Select
name="task_uuid"
value={state.task_uuid}
items={renderSelectItems(tasks)}
disabled={state.task_id !== '0'}
onChange={onValueChange}
/>
)}
<Select
name="task_uuid"
value={state.task_uuid}
items={renderSelectItems(tasks)}
disabled={state.task_id !== '0'}
onChange={onValueChange}
/>
</Divider>
</FormGroup>

Expand Down