Skip to content

Commit

Permalink
Merge branch 'main' of github.com:greenbone/gsa into GEA-207_Adjust_G…
Browse files Browse the repository at this point in the history
…SA_error_message_if_CPE_cannot_be_found
  • Loading branch information
jhelmold committed Jun 14, 2023
2 parents 4bd8f1a + c0da6db commit b4ae4b2
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 52 deletions.
2 changes: 2 additions & 0 deletions public/locales/gsa-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@
"No first result available.": "Kein erstes Ergebnis verfügbar.",
"No hosts available": "Keine Hosts vorhanden",
"No information about the Operation System": "Keine Information über das Betriebssystem",
"No information available for existing file. File may not be a correct certificate.": "Keine Informationen für vorhandene Datei verfügbar. Datei ist möglicherweise kein korrektes Zertifikat.",
"No license available": "Keine Lizenz vorhanden",
"No parameters available": "Keine Parameter vorhanden",
"No permissions available": "Keine Berechtigungen vorhanden",
Expand Down Expand Up @@ -1854,6 +1855,7 @@
"or": "oder",
"or add by ID:": "oder per ID hinzufügen:",
"read": "Lese-",
"related resource(s)": "verbundene Ressource(n)",
"reports": "Berichte",
"result(s) NVT(s)": "Ergebnis-NVT(s)",
"result(s) more than previous scan": "Ergebnis(se) mehr als im vorherigen Scan",
Expand Down
8 changes: 7 additions & 1 deletion src/gmp/models/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {isDefined, isObject} from 'gmp/utils/identity';
import {isEmpty} from 'gmp/utils/string';
import {forEach, map} from 'gmp/utils/array';

import {parseYesNo, YES_VALUE} from 'gmp/parser';
import {parseDate, parseYesNo, YES_VALUE} from 'gmp/parser';

import Model, {parseModelFromElement} from 'gmp/model';

Expand Down Expand Up @@ -82,6 +82,12 @@ const create_values = data => {
}
delete obj._id;
}
if (key === 'certificate_info') {
obj.activationTime = parseDate(obj.activation_time);
obj.expirationTime = parseDate(obj.expiration_time);
delete obj.activation_time;
delete obj.expiration_time;
}
values[key] = obj;
}

Expand Down
85 changes: 85 additions & 0 deletions src/web/components/certinfo/certinfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* Copyright (C) 2023 Greenbone AG
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation, either version 3
* 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import React from 'react';

import _ from 'gmp/locale';

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

import PropTypes from 'web/utils/proptypes';

import DateTime from 'web/components/date/datetime';

import {Col} from 'web/entity/page';

import InfoTable from 'web/components/table/infotable';
import TableBody from 'web/components/table/body';
import TableData from 'web/components/table/data';
import TableRow from 'web/components/table/row';

const CertInfo = ({info}) => {
const {activationTime, expirationTime, issuer, md5_fingerprint} = info;
return (
<InfoTable>
<colgroup>
<Col width="10%" />
<Col width="90%" />
</colgroup>
<TableBody>
<TableRow>
<TableData>{_('Activation')}</TableData>
<TableData>
{isDefined(activationTime) ? (
<DateTime date={activationTime} />
) : (
_('N/A')
)}
</TableData>
</TableRow>

<TableRow>
<TableData>{_('Expiration')}</TableData>
<TableData>
{isDefined(expirationTime) ? (
<DateTime date={expirationTime} />
) : (
_('N/A')
)}
</TableData>
</TableRow>

<TableRow>
<TableData>{_('MD5 Fingerprint')}</TableData>
<TableData>{md5_fingerprint}</TableData>
</TableRow>

<TableRow>
<TableData>{_('Issuer')}</TableData>
<TableData>{issuer}</TableData>
</TableRow>
</TableBody>
</InfoTable>
);
};

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

export default CertInfo;
21 changes: 20 additions & 1 deletion src/web/pages/alerts/method.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ import {
} from 'gmp/models/alert';

import PropTypes from 'web/utils/proptypes';

import HorizontalSep from 'web/components/layout/horizontalsep';

import CertInfo from 'web/components/certinfo/certinfo';

import DetailsLink from 'web/components/link/detailslink';

import SimpleTable from 'web/components/table/simpletable';
Expand Down Expand Up @@ -629,6 +630,24 @@ const Method = ({method = {}, details = false, reportFormats = []}) => {
</TableData>
</TableRow>
)}
{isDefined(data.tp_sms_tls_certificate?.value) && (
<TableRow>
<TableData>{_('TLS Certificate')}</TableData>
<TableData>
{isDefined(
data.tp_sms_tls_certificate?.certificate_info,
) ? (
<CertInfo
info={data.tp_sms_tls_certificate.certificate_info}
/>
) : (
_(
'No information available for existing file. File may not be a correct certificate.',
)
)}
</TableData>
</TableRow>
)}
</TableBody>
</Table>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/web/pages/permissions/multipledialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ const MultiplePermissionDialog = withCapabilities(
onChange={onChange}
/>
</Divider>
</FormGroup>
<FormGroup title={_('related resource(s)')} flex="column">
{hasRelated && (
<ul>
{state.related.map(rentity => (
Expand Down
52 changes: 2 additions & 50 deletions src/web/pages/scanners/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,67 +28,19 @@ import PropTypes from 'web/utils/proptypes';

import DetailsBlock from 'web/entity/block';

import CertInfo from 'web/components/certinfo/certinfo';

import Layout from 'web/components/layout/layout';

import DetailsLink from 'web/components/link/detailslink';

import DateTime from 'web/components/date/datetime';
import InfoTable from 'web/components/table/infotable';
import TableBody from 'web/components/table/body';
import TableData, {TableDataAlignTop} from 'web/components/table/data';
import TableRow from 'web/components/table/row';

import {Col} from 'web/entity/page';

const CertInfo = ({info}) => {
const {activationTime, expirationTime, issuer, md5_fingerprint} = info;
return (
<InfoTable>
<colgroup>
<Col width="10%" />
<Col width="90%" />
</colgroup>
<TableBody>
<TableRow>
<TableData>{_('Activation')}</TableData>
<TableData>
{isDefined(activationTime) ? (
<DateTime date={activationTime} />
) : (
_('N/A')
)}
</TableData>
</TableRow>

<TableRow>
<TableData>{_('Expiration')}</TableData>
<TableData>
{isDefined(expirationTime) ? (
<DateTime date={expirationTime} />
) : (
_('N/A')
)}
</TableData>
</TableRow>

<TableRow>
<TableData>{_('MD5 Fingerprint')}</TableData>
<TableData>{md5_fingerprint}</TableData>
</TableRow>

<TableRow>
<TableData>{_('Issuer')}</TableData>
<TableData>{issuer}</TableData>
</TableRow>
</TableBody>
</InfoTable>
);
};

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

const ScannerDetails = ({entity}) => {
const {
comment,
Expand Down

0 comments on commit b4ae4b2

Please sign in to comment.