Skip to content
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: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ locales:
msgfmt -o modules/api_docs/locale/ja/LC_MESSAGES/api_docs.mo modules/api_docs/locale/ja/LC_MESSAGES/api_docs.po
msgfmt -o modules/battery_manager/locale/ja/LC_MESSAGES/battery_manager.mo modules/battery_manager/locale/ja/LC_MESSAGES/battery_manager.po
msgfmt -o modules/behavioural_qc/locale/ja/LC_MESSAGES/behavioural_qc.mo modules/behavioural_qc/locale/ja/LC_MESSAGES/behavioural_qc.po
msgfmt -o modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.mo modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.po
npx i18next-conv -l hi -s modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.po -t modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.json
msgfmt -o modules/brainbrowser/locale/ja/LC_MESSAGES/brainbrowser.mo modules/brainbrowser/locale/ja/LC_MESSAGES/brainbrowser.po
msgfmt -o modules/bvl_feedback/locale/ja/LC_MESSAGES/bvl_feedback.mo modules/bvl_feedback/locale/ja/LC_MESSAGES/bvl_feedback.po
msgfmt -o modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.po
Expand Down Expand Up @@ -192,3 +194,8 @@ server_processes_manager: modules/server_processes_manager/locale/ja/LC_MESSAGES

conflict_resolver:
target=conflict_resolver npm run compile

behavioural_qc:
msgfmt -o modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.mo modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.po
npx i18next-conv -l hi -s modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.po -t modules/behavioural_qc/locale/hi/LC_MESSAGES/behavioural_qc.json
target=behavioural_qc npm run compile
9 changes: 9 additions & 0 deletions locale/hi/LC_MESSAGES/loris.po
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ msgstr "रद्द करें"
msgid "Success!"
msgstr "सफलता!"

msgid "Selection Filter"
msgstr "चयन फ़िल्टर"

msgid "Clear Filters"
msgstr "फ़िल्टर साफ़ करें"

# Common candidate terms
msgid "PSCID"
msgstr "पीएससीआईडी"
Expand All @@ -146,6 +152,9 @@ msgstr "साइट"
msgid "Module"
msgstr "मॉड्यूल"

msgid "Instrument"
msgstr "उपकरण"

msgid "Project"
msgstr "परियोजना"

Expand Down
9 changes: 9 additions & 0 deletions locale/loris.pot
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ msgstr ""
msgid "Success!"
msgstr ""

msgid "Selection Filters"
msgstr ""

msgid "Clear Filters"
msgstr ""

# Common candidate terms
msgid "PSCID"
msgstr ""
Expand All @@ -148,6 +154,9 @@ msgstr ""
msgid "Module"
msgstr ""

msgid "Instrument"
msgstr ""

msgid "Project"
msgstr ""

Expand Down
13 changes: 10 additions & 3 deletions modules/behavioural_qc/jsx/behaviouralQCIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import IncompleteForms from './tabs_content/incompleteForms';
import DataConflicts from './tabs_content/dataConflicts';
import BehaviouralFeedback from './tabs_content/behaviouralFeedback';

import hiStrings from '../locale/hi/LC_MESSAGES/behavioural_qc.json';
/**
* Behavioural Quality Control.
*
Expand All @@ -20,10 +21,14 @@ import BehaviouralFeedback from './tabs_content/behaviouralFeedback';
* @version 1.0.0
*/
const BehaviouralQC = (props) => {
const {t} = props;
const tabList = [
{id: 'tabIncompleteForms', label: 'Incomplete Forms'},
{id: 'tabDataConflicts', label: 'Data Conflicts'},
{id: 'tabBehaviouralFeedback', label: 'Behavioural Feedback'},
{id: 'tabIncompleteForms', label: t('Incomplete Forms',
{ns: 'behavioural_qc'})},
{id: 'tabDataConflicts', label: t('Data Conflicts',
{ns: 'behavioural_qc'})},
{id: 'tabBehaviouralFeedback', label: t('Behavioural Feedback',
{ns: 'behavioural_qc'})},
];

/**
Expand All @@ -49,13 +54,15 @@ const BehaviouralQC = (props) => {
};
BehaviouralQC.propTypes = {
baseURL: PropTypes.string.isRequired,
t: PropTypes.func, // ADD THIS
};

/**
* Render Behavioural Quality Control on page load.
*/
window.addEventListener('load', () => {
i18n.addResourceBundle('ja', 'behavioural_qc', {});
i18n.addResourceBundle('hi', 'behavioural_qc', hiStrings);
const Index = withTranslation(
['behavioural_qc', 'loris']
)(BehaviouralQC);
Expand Down
115 changes: 55 additions & 60 deletions modules/behavioural_qc/jsx/tabs_content/behaviouralFeedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Loader from 'jsx/Loader';
import FilterableDataTable from 'jsx/FilterableDataTable';
import {withTranslation} from 'react-i18next';

/**
* Behavioural Feedback Component.
Expand Down Expand Up @@ -80,83 +81,75 @@ class BehaviouralFeedback extends Component {
* @return {*} a formatted table cell for a given column
*/
formatColumn(column, cell, rowData, rowHeaders) {
let reactElement;
switch (column) {
case 'PSCID':
reactElement = (
const {t} = this.props;
const labelPSCID = t('PSCID', {ns: 'loris'});
const labelDCCID = t('DCCID', {ns: 'loris'});
const labelBVL = t('Feedback Level', {ns: 'behavioural_qc'});

// PSCID column (match English or translated)
if (column === 'PSCID' || column === labelPSCID) {
return (
<td>
<a href={this.props.baseURL +
'/' +
rowData['DCCID']
}>
<a href={this.props.baseURL + '/' + rowData['DCCID']}>
{rowData['PSCID']}
</a>
</td>
);
break;
case 'DCCID':
reactElement = (
}

// DCCID column
if (column === 'DCCID' || column === labelDCCID) {
return (
<td>
<a href={this.props.baseURL +
'/' +
rowData['DCCID']
}>
<a href={this.props.baseURL + '/' + rowData['DCCID']}>
{rowData['DCCID']}
</a>
</td>
);
break;
case 'Feedback Level':
}

// Feedback Level column — build link depending on row data
if (column === 'Feedback Level' || column === labelBVL) {
let bvlLink = '';
let bvlLevel = '';
if (rowData['Instrument']) {
bvlLink = this.props.baseURL +
'/instruments/' +
rowData['Test Name'] +
'/?candID=' +
rowData['DCCID'] +
'&sessionID=' +
rowData['sessionID'] +
'&commentID=' +
rowData['commentID'];
// Open feedback panel
bvlLink += '&showFeedback=true';
bvlLevel ='Instrument : ' + rowData['Instrument'];
'/instruments/' +
rowData['Test Name'] +
'/?candID=' + rowData['DCCID'] +
'&sessionID=' + rowData['sessionID'] +
'&commentID=' + rowData['commentID'] +
'&showFeedback=true';
bvlLevel = t('Instrument', {ns: 'behavioural_qc'}) + ' : '
+ rowData['Instrument'];
} else if (rowData['Visit']) {
bvlLink = this.props.baseURL +
'/instrument_list/' +
'?candID=' +
rowData['DCCID'] +
'&sessionID=' +
rowData['sessionID'];
// Open feedback panel
bvlLink += '&showFeedback=true';
bvlLevel ='Visit : ' + rowData['Visit'];
'/instrument_list/?candID=' + rowData['DCCID'] +
'&sessionID=' + rowData['sessionID'] +
'&showFeedback=true';
bvlLevel = t('Visit', {ns: 'behavioural_qc'}) + ' : '
+ rowData['Visit'];
} else {
bvlLink = this.props.baseURL +
'/' + rowData['DCCID'];
// Open feedback panel
bvlLink += '/?showFeedback=true';
bvlLevel ='Profile : ' + rowData['PSCID'];
bvlLink = this.props.baseURL + '/' + rowData['DCCID']
+ '/?showFeedback=true';
bvlLevel = t('Profile', {ns: 'behavioural_qc'}) + ' : '
+ rowData['PSCID'];
}
reactElement = (
return (
<td>
<a href={bvlLink}>{bvlLevel}</a>
</td>
);
break;
default:
reactElement = (
<td>{cell}</td>
);
}
return reactElement;

return <td>{cell}</td>;
}

/**
* @return {JSX} the feedback form to render.
*/
render() {
const {t} = this.props;
// Waiting for async data to load.
if (!this.state.isLoaded) {
return <Loader/>;
Expand All @@ -167,7 +160,7 @@ class BehaviouralFeedback extends Component {
// The fields configured for display/hide.
let fields = [
{
label: 'Instrument',
label: t('Instrument', {ns: 'loris'}),
show: false,
filter: {
name: 'Instrument',
Expand All @@ -179,23 +172,23 @@ class BehaviouralFeedback extends Component {
},
},
{
label: 'DCCID',
label: t('DCCID', {ns: 'loris'}),
show: true,
filter: {
name: 'DCCID',
type: 'text',
},
},
{
label: 'PSCID',
label: t('PSCID', {ns: 'loris'}),
show: true,
filter: {
name: 'PSCID',
type: 'text',
},
},
{
label: 'Visit',
label: t('Visit', {ns: 'loris'}),
show: false,
filter: {
name: 'Visit',
Expand All @@ -204,7 +197,7 @@ class BehaviouralFeedback extends Component {
},
},
{
label: 'Project',
label: t('Project', {ns: 'loris'}),
show: false,
filter: {
name: 'Project',
Expand All @@ -213,7 +206,7 @@ class BehaviouralFeedback extends Component {
},
},
{
label: 'Cohort',
label: t('Cohort', {ns: 'loris'}),
show: false,
filter: {
name: 'Cohort',
Expand All @@ -222,7 +215,7 @@ class BehaviouralFeedback extends Component {
},
},
{
label: 'Site',
label: t('Site', {ns: 'loris'}),
show: false,
filter: {
name: 'Site',
Expand All @@ -243,19 +236,19 @@ class BehaviouralFeedback extends Component {
show: false,
},
{
label: 'Feedback Level',
label: t('Feedback Level', {ns: 'behavioural_qc'}),
show: true,
},
{
label: 'Test Name',
label: t('Test Name', {ns: 'behavioural_qc'}),
show: false,
},
{
label: 'Field Name',
label: t('Field Name', {ns: 'behavioural_qc'}),
show: false,
},
{
label: 'Feedback Status',
label: t('Feedback Status', {ns: 'behavioural_qc'}),
show: true,
},
];
Expand All @@ -280,6 +273,8 @@ BehaviouralFeedback.propTypes = {
display: PropTypes.bool,
data: PropTypes.object,
baseURL: PropTypes.string.isRequired,
t: PropTypes.func,
};

export default BehaviouralFeedback;
export default withTranslation(
['behavioural_qc', 'loris'])(BehaviouralFeedback);
Loading
Loading