Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown fix: qr and cattool page #3727

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions public/css/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4610,6 +4610,9 @@ header {
&:hover,
&.active {
opacity: 1;
.menu {
visibility: visible;
}
}

/* Bug fix for Semantic UI Dropdown hover */
Expand Down Expand Up @@ -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;
Expand Down
69 changes: 43 additions & 26 deletions public/js/cat_source/es6/pages/QualityReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const QualityReport = () => {
getReviseUrlParameter(),
)
const [idSegment, setIdSegment] = useState()
const [qualitySummary, setQualitySummary] = useState()

const reviewDropdownRef = useRef()
const wasInitReviewDropDown = useRef(false)
Expand All @@ -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(
Expand Down Expand Up @@ -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',
Expand All @@ -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 (
Expand Down Expand Up @@ -222,7 +239,7 @@ export const QualityReport = () => {

<JobSummary
jobInfo={jobInfo}
qualitySummary={quality_summary}
qualitySummary={qualitySummary}
secondPassReviewEnabled={secondPassReviewEnabled}
/>

Expand All @@ -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}
/>
Expand Down