Skip to content

Commit

Permalink
Merge pull request #44 from CybercentreCanada/feature/partial_results
Browse files Browse the repository at this point in the history
feature/partial_results
  • Loading branch information
cccs-sgaron authored Mar 27, 2021
2 parents f2f31b8 + 9ef89b0 commit 2073d7d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/routes/submission/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export default function SubmissionDetail() {
const [summary, setSummary] = useState(null);
const [tree, setTree] = useState(null);
const [filtered, setFiltered] = useState(false);
const [partial, setPartial] = useState(false);
const [watchQueue, setWatchQueue] = useState(null);
const [liveResultKeys, setLiveResultKeys] = useReducer(messageReducer, []);
const [liveErrorKeys, setLiveErrorKeys] = useReducer(messageReducer, []);
Expand Down Expand Up @@ -528,6 +529,9 @@ export default function SubmissionDetail() {
if (summ_data.api_response.filtered) {
setFiltered(true);
}
if (summ_data.api_response.partial) {
setPartial(true);
}
}
});
apiCall({
Expand All @@ -537,6 +541,9 @@ export default function SubmissionDetail() {
if (tree_data.api_response.filtered) {
setFiltered(true);
}
if (tree_data.api_response.partial) {
setPartial(true);
}
}
});
} else {
Expand Down Expand Up @@ -958,6 +965,14 @@ export default function SubmissionDetail() {
</div>
)}

{partial && (
<div style={{ paddingBottom: theme.spacing(2), paddingTop: theme.spacing(2) }}>
<Typography variant="subtitle1">
<b>**{t('warning')}</b>: {t('warning.partial')}
</Typography>
</div>
)}

{(!submission || Object.keys(submission.metadata).length !== 0) && (
<MetaSection metadata={submission ? submission.metadata : null} />
)}
Expand Down
8 changes: 8 additions & 0 deletions src/components/routes/submission/report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,14 @@ export default function SubmissionReport() {
</div>
)}

{report && report.report_partial && (
<div style={{ paddingBottom: sp2, paddingTop: sp2 }}>
<Typography variant="subtitle1">
<b>**{t('warning')}</b>: {t('warning.partial')}
</Typography>
</div>
)}

{(!report || Object.keys(report.metadata).length !== 0) && (
<div style={{ paddingBottom: sp2, paddingTop: sp2, pageBreakInside: 'avoid' }}>
<Typography variant="h6">{t('metadata')}</Typography>
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/submission/detail.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
"verdict.set.non_malicious": "Vote for Non-Malicious verdict",
"verdict.suspicious": "Suspicious",
"warning": "Warning",
"warning.partial": "Some information about this submission is missing from the system. Therefore you're only seeing partial results.",
"warning.text": "Some details about the submission has been filtered because you do not have enough privilege to view all the results."
}
1 change: 1 addition & 0 deletions src/locales/en/submission/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
"title": "Submission Report",
"user.verdict": "User's Verdicts",
"warning": "Warning",
"warning.partial": "Some information about this report is missing from the system. Therefore you're only seeing a partial report.",
"warning.text": "Data in this report has been filtered because you do not have enough privilege to view the full report."
}
1 change: 1 addition & 0 deletions src/locales/fr/submission/detail.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
"verdict.set.non_malicious": "Votez pour un verdict non malveillant",
"verdict.suspicious": "Suspect",
"warning": "Avertissement",
"warning.partial": "Certaines informations sur cette soumission sont absentes du système. Par conséquent, vous ne voyez que des résultats partiels.",
"warning.text": "Certains détails sur la soumission ont été filtrés car vous ne disposez pas de suffisamment de privilèges pour afficher tous les résultats."
}
1 change: 1 addition & 0 deletions src/locales/fr/submission/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
"title": "Rapport de Soumission",
"user.verdict": "Verdict des Utilisateurs",
"warning": "Avertissement",
"warning.partial": "Certaines informations sur ce rapport sont manquantes dans le système. Par conséquent, vous ne voyez qu'un rapport partiel.",
"warning.text": "Les données de ce rapport ont été filtrées car vous ne disposez pas des privilèges suffisants pour afficher le rapport complet."
}

0 comments on commit 2073d7d

Please sign in to comment.