Skip to content

Commit

Permalink
Some further amendments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelmold committed Nov 3, 2023
1 parent 4c7671d commit 8f451db
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 26 deletions.
4 changes: 3 additions & 1 deletion src/web/pages/credentials/__tests__/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('CredentialsDialog component tests', () => {
capabilities: true,
});

const {getAllByTestId, getByName, getAllByName} = render(
const {getAllByTestId, getByTestId, getByName, getAllByName} = render(
<CredentialsDialog
allow_insecure={credential.allow_insecure}
comment={credential.comment}
Expand All @@ -123,6 +123,7 @@ describe('CredentialsDialog component tests', () => {
);

const formGroups = getAllByTestId('formgroup-title');
const selectedValue = getByTestId('select-selected-value');

const nameInput = getByName('name');
expect(formGroups[0]).toHaveTextContent('Name');
Expand All @@ -133,6 +134,7 @@ describe('CredentialsDialog component tests', () => {
expect(commentInput).toHaveAttribute('value', 'blah');

expect(formGroups[2]).toHaveTextContent('Type');
expect(selectedValue).toHaveTextContent('Username + SSH Key');

const allowInsecure = getAllByName('allow_insecure');
expect(formGroups[3]).toHaveTextContent('Allow insecure use');
Expand Down
1 change: 1 addition & 0 deletions src/web/pages/credentials/__tests__/listpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ describe('CredentialPage tests', () => {

expect(row[1]).toHaveTextContent('credential 1');
expect(row[1]).toHaveTextContent('(blah)');
expect(row[1]).toHaveTextContent('Username + SSH Key');
expect(row[1]).toHaveTextContent('Yes');

expect(
Expand Down
3 changes: 2 additions & 1 deletion src/web/pages/credentials/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const CredentialDetails = ({entity}) => {
</TableRow>

<TableRow>
<TableData>{_('Login')}</TableData>- <TableData>{login}</TableData>-{' '}
<TableData>{_('Login')}</TableData>
<TableData>{login}</TableData>
</TableRow>
{credential_type === SNMP_CREDENTIAL_TYPE && (
<TableRow>
Expand Down
24 changes: 0 additions & 24 deletions src/web/pages/scanners/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,6 @@ const mapStateToProps = rootState => ({
timezone: getTimezone(rootState),
});

const CertStatus = connect(mapStateToProps)(({info, timezone}) => {
return (
<FootNote>
<Layout>
<KeyIcon />
</Layout>
<span>{render_certificate_info(info, timezone)}</span>
</FootNote>
);
});

CertStatus.propTypes = {
info: PropTypes.object.isRequired,
};

const ScannerDialog = ({
ca_pub,
comment = '',
Expand All @@ -119,13 +104,8 @@ const ScannerDialog = ({
const handleTypeChange = (value, name) => {
if (onScannerTypeChange) {
value = parseInt(value);
const scan_credentials = filter(credentials);

onScannerTypeChange(value, name);
onScannerTypeChange(
selectSaveId(scan_credentials, credential_id),
'credential_id',
);
}
};

Expand Down Expand Up @@ -160,7 +140,6 @@ const ScannerDialog = ({

const scanner_credentials = filter(credentials);
const isInUse = isDefined(scanner) && scanner.isInUse();
const show_cred_info = isDefined(scanner) && isDefined(scanner.credential);

const isGreenboneSensorType = type === GREENBONE_SENSOR_SCANNER_TYPE;

Expand Down Expand Up @@ -235,9 +214,6 @@ const ScannerDialog = ({
/>
</Layout>
</Divider>
{show_cred_info && (
<CertStatus info={scanner.credential.certificate_info} />
)}
</FormGroup>
)}
</Layout>
Expand Down

0 comments on commit 8f451db

Please sign in to comment.