Skip to content

Commit

Permalink
[front]Adding translations for atomic testing (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanah29 authored Apr 24, 2024
1 parent 7322105 commit b7eef6a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
2 changes: 1 addition & 1 deletion openbas-collectors
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Props } from 'html-react-parser/lib/attributes-to-props';
import { useParams } from 'react-router-dom';
import { Grid, Paper, Typography } from '@mui/material';
import { makeStyles } from '@mui/styles';
import { useFormatter } from '../../../../components/i18n';
import { useAppDispatch } from '../../../../utils/hooks';
import { useHelper } from '../../../../store';
import type { AtomicTestingDetailOutput } from '../../../../utils/api-types';
Expand All @@ -21,6 +22,7 @@ const useStyles = makeStyles(() => ({

const Detail: FunctionComponent<Props> = () => {
const classes = useStyles();
const { t } = useFormatter();
const dispatch = useAppDispatch();
const { atomicId } = useParams() as { atomicId: AtomicTestingDetailOutput['atomic_id'] };

Expand All @@ -42,16 +44,16 @@ const Detail: FunctionComponent<Props> = () => {
<>
<Paper elevation={3} className={classes.paper}>
<Typography variant="h2" gutterBottom>
Atomic testing details
{t('Atomic testing details')}
</Typography>
<Typography variant="subtitle1" gutterBottom>
Description
{t('Description')}
</Typography>
<Typography variant="body1" gutterBottom>
{atomicDetail?.atomic_description || 'N/A'}
</Typography>
<Typography variant="subtitle1" gutterBottom>
Tags
{t('Tags')}
</Typography>
{
atomicDetail.atomic_tags?.map((tag, index) => {
Expand All @@ -63,7 +65,7 @@ const Detail: FunctionComponent<Props> = () => {
})
}
<Typography variant="subtitle1" gutterBottom>
Documents
{t('Documents')}
</Typography>
{
atomicDetail.atomic_documents?.map((document, index) => {
Expand All @@ -75,7 +77,7 @@ const Detail: FunctionComponent<Props> = () => {
})
}
<Typography variant="subtitle1" gutterBottom>
Expectations
{t('Expectations')}
</Typography>
{/* { */}
{/* atomicDetail.atomic_content.expectations?.map((content, index) => ( */}
Expand All @@ -87,7 +89,7 @@ const Detail: FunctionComponent<Props> = () => {
</Paper>
<Paper elevation={3} className={classes.paper}>
<Typography variant="h2" gutterBottom>
Status : {atomicDetail.status_label}
{t('Status')} : {atomicDetail.status_label}
</Typography>
{atomicDetail.status_traces && (
<>
Expand All @@ -104,34 +106,34 @@ const Detail: FunctionComponent<Props> = () => {
</Paper>
<Paper elevation={3} className={classes.paper}>
<Typography variant="body1" gutterBottom>
Tracking Sent Date: {atomicDetail.tracking_sent_date || 'N/A'}
{t('Tracking Sent Date')}: {atomicDetail.tracking_sent_date || 'N/A'}
</Typography>
<Typography variant="body1" gutterBottom>
Tracking Ack Date: {atomicDetail.tracking_ack_date || 'N/A'}
{t('Tracking Ack Date')}: {atomicDetail.tracking_ack_date || 'N/A'}
</Typography>
<Typography variant="body1" gutterBottom>
Tracking End Date: {atomicDetail.tracking_end_date || 'N/A'}
{t('Tracking End Date')}: {atomicDetail.tracking_end_date || 'N/A'}
</Typography>
</Paper>
<Paper elevation={3} className={classes.paper}>
<Typography variant="body1" gutterBottom>
Tracking Total Execution
Time: {atomicDetail.tracking_total_execution_time || 'N/A'} ms
{t('Tracking Total Execution')}
{t('Time')}: {atomicDetail.tracking_total_execution_time || 'N/A'} ms
</Typography>
<Typography variant="body1" gutterBottom>
Tracking Total Count: {atomicDetail.tracking_total_count || 'N/A'}
{t('Tracking Total Count')}: {atomicDetail.tracking_total_count || 'N/A'}
</Typography>
<Typography variant="body1" gutterBottom>
Tracking Total Error: {atomicDetail.tracking_total_error || 'N/A'}
{t('Tracking Total Error')}: {atomicDetail.tracking_total_error || 'N/A'}
</Typography>
<Typography variant="body1" gutterBottom>
Tracking Total Success: {atomicDetail.tracking_total_success || 'N/A'}
{t('Tracking Total Success')}: {atomicDetail.tracking_total_success || 'N/A'}
</Typography>
</Paper>
</>
) : (
<Paper elevation={3} className={classes.paper}>
<Typography variant="body1">No data available</Typography>
<Typography variant="body1">{t('No data available')}</Typography>
</Paper>
)}
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,7 @@ class InjectDefinition extends Component {
sx={{ mr: 1 }}
onClick={handleBack}
>
Back
{t('Back')}
</Button>
</div>

Expand Down
10 changes: 10 additions & 0 deletions openbas-front/src/utils/Localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,16 @@ const i18n = {
techniques: 'Techniques',
'Unknown Data': 'Données inconnues',
'No data available': 'Aucune donnée disponible (répété)',
Expectations: 'Objectifs',
'Atomic testing details': 'Détails de test atomique',
'Tracking Sent Date': 'Date d\'envoi',
'Tracking Ack Date': 'Date de réception',
'Tracking End Date': 'Date de fin',
'Tracking Total Execution': 'Durée totale d\'exécution',
Time: 'Temps',
'Tracking Total Count': 'Nombre total d\'exécutions',
'Tracking Total Error': 'Nombre total d\'échecs',
'Tracking Total Success': 'Nombre total de succès',
},
en: {
openbas_email: 'Email',
Expand Down
2 changes: 1 addition & 1 deletion openbas-injectors

0 comments on commit b7eef6a

Please sign in to comment.