diff --git a/public/css/sass/style.scss b/public/css/sass/style.scss index 734181fda9..148d4f020d 100644 --- a/public/css/sass/style.scss +++ b/public/css/sass/style.scss @@ -4610,6 +4610,9 @@ header { &:hover, &.active { opacity: 1; + .menu { + visibility: visible; + } } /* Bug fix for Semantic UI Dropdown hover */ @@ -4642,11 +4645,11 @@ header { margin: 0 0 0 -1px; background: white; padding: 12px 8px; - top: 50px; + top: 50px !important; font-size: 16px; border-radius: 2px; border: solid 1px #cdd4de; - + visibility: hidden; .item { padding: 0 !important; border-radius: 3px; diff --git a/public/js/cat_source/es6/pages/QualityReport.js b/public/js/cat_source/es6/pages/QualityReport.js index 4d7241322f..9074c9b502 100644 --- a/public/js/cat_source/es6/pages/QualityReport.js +++ b/public/js/cat_source/es6/pages/QualityReport.js @@ -30,6 +30,7 @@ export const QualityReport = () => { getReviseUrlParameter(), ) const [idSegment, setIdSegment] = useState() + const [qualitySummary, setQualitySummary] = useState() const reviewDropdownRef = useRef() const wasInitReviewDropDown = useRef(false) @@ -52,7 +53,14 @@ export const QualityReport = () => { setLastSegment(lastSegment) setMoreSegments(true) } - const renderJobInfo = (jobInfo) => setJobInfo(jobInfo) + const renderJobInfo = (jobInfo) => { + setJobInfo(jobInfo) + setQualitySummary( + jobInfo.get('quality_summary').find((value) => { + return value.get('revision_number') === parseInt(revisionToShow) + }), + ) + } const noMoreSegments = () => setMoreSegments(false) QualityReportStore.addListener( @@ -102,22 +110,38 @@ export const QualityReport = () => { history.pushState(null, '', url) } - // init review dropdown - if ( - secondPassReviewEnabled && - reviewDropdownRef.current && - !wasInitReviewDropDown.current - ) { - $(reviewDropdownRef.current).dropdown({ - onChange: function (value) { - if (value && value !== '') { - updateUrlParameter(value) - setRevisionToShow(value) - } - }, - }) - wasInitReviewDropDown.current = true - } + useEffect(() => { + // init review dropdown + if ( + secondPassReviewEnabled && + reviewDropdownRef.current && + !wasInitReviewDropDown.current + ) { + $(reviewDropdownRef.current).dropdown({ + onChange: function (value) { + if (value && value !== '') { + updateUrlParameter(value) + setRevisionToShow(value) + setQualitySummary( + jobInfo.get('quality_summary').find((item) => { + return item.get('revision_number') === parseInt(value) + }), + ) + } + }, + }) + wasInitReviewDropDown.current = true + } + }, [jobInfo]) + + /*useEffect(() => { + let quality_summary + if (jobInfo) { + quality_summary = jobInfo.get('quality_summary').find((value) => { + return value.get('revision_number') === parseInt(revisionToShow) + }) + } + }, [revisionToShow])*/ const spinnerContainer = { position: 'absolute', @@ -129,13 +153,6 @@ export const QualityReport = () => { zIndex: 3, } - let quality_summary - if (jobInfo) { - quality_summary = jobInfo.get('quality_summary').find((value) => { - return value.get('revision_number') === parseInt(revisionToShow) - }) - } - const cookieBannerMountPoint = document.getElementsByTagName('footer')[0] return ( @@ -222,7 +239,7 @@ export const QualityReport = () => { @@ -234,7 +251,7 @@ export const QualityReport = () => { segmentToFilter={idSegment} updateSegmentToFilter={updateUrlIdSegment} urls={jobInfo.get('urls')} - categories={quality_summary.get('categories')} + categories={qualitySummary.get('categories')} moreSegments={moreSegments} secondPassReviewEnabled={secondPassReviewEnabled} />