Skip to content

Commit 4013d76

Browse files
author
Saket Hatwar
committed
lint
1 parent 2efd010 commit 4013d76

File tree

5 files changed

+100
-57
lines changed

5 files changed

+100
-57
lines changed

modules/dataquery/jsx/querytree.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function alternateColour(c: string): string {
4040
* @param {object} props.mapModuleName - Function to map the backend module name to a user friendly name
4141
* @param {object} props.mapCategoryName - Function to map the backend category name to a user friendly name
4242
* @param {object} props.fulldictionary - The dictionary of all modules that have been loaded
43+
* @param props.setDeleteItemIndex
4344
* @returns {React.ReactElement} - the react element
4445
*/
4546
function QueryTree(props: {
@@ -206,7 +207,8 @@ function QueryTree(props: {
206207
marginLeft: 10,
207208
}}></i>
208209
<div style={{alignSelf: 'center'}}>
209-
{t('Group only has 1 item. A group with only 1 item is equivalent to not having the group.', {ns: 'dataquery'})}
210+
{t('Group only has 1 item. A group with only 1 item is equivalent'
211+
+' to not having the group.', {ns: 'dataquery'})}
210212
</div>
211213
</div>;
212214
break;
@@ -269,15 +271,17 @@ function QueryTree(props: {
269271
<div style={{...props.buttonGroupStyle, width: '100%'}}>
270272
<div style={{margin: 5}}>
271273
<ButtonElement
272-
label={t('Add "{{operator}}" condition to group', {ns: 'dataquery', operator: props.items.operator})}
274+
label={t('Add "{{operator}}" condition to group', {ns: 'dataquery',
275+
operator: props.items.operator})}
273276
onUserInput={newItemClick}
274277
style={props.buttonStyle}
275278
columnSize='col-sm-12'
276279
/>
277280
</div>
278281
<div style={{margin: 5}}>
279282
<ButtonElement
280-
label={t('New "{{antiOperator}}" subgroup', {ns: 'dataquery', antiOperator})}
283+
label={t('New "{{antiOperator}}" subgroup', {ns: 'dataquery',
284+
antiOperator})}
281285
onUserInput={newGroupClick}
282286
style={props.buttonStyle}
283287
columnSize='col-sm-12'

modules/dataquery/jsx/viewdata.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,30 +120,37 @@ function ProgressBar(props: {type: string, value: number, max: number}) {
120120
return <h2>{t('Query not yet run', {ns: 'dataquery'})}</h2>;
121121
}
122122
return (<div>
123-
<label htmlFor="loadingprogress">{t('Loading data:', {ns: 'dataquery'})}</label>
123+
<label htmlFor="loadingprogress">{t('Loading data:',
124+
{ns: 'dataquery'})}</label>
124125
<progress id="loadingprogress"
125126
value={props.value} max={props.max}>
126-
{t('{{value}} of {{max}} candidates', {ns: 'dataquery', value: props.value, max: props.max})}
127+
{t('{{value}} of {{max}} candidates',
128+
{ns: 'dataquery', value: props.value, max: props.max})}
127129
</progress>
128130
</div>);
129131
case 'headers':
130132
return (<div>
131-
<label htmlFor="loadingprogress">{t('Organizing headers:', {ns: 'dataquery'})}</label>
133+
<label htmlFor="loadingprogress">{t('Organizing headers:',
134+
{ns: 'dataquery'})}</label>
132135
<progress id="loadingprogress"
133136
value={props.value} max={props.max}>
134-
{t('{{value}} of {{max}} columns', {ns: 'dataquery', value: props.value, max: props.max})}
137+
{t('{{value}} of {{max}} columns', {ns: 'dataquery',
138+
value: props.value, max: props.max})}
135139
</progress>
136140
</div>);
137141
case 'dataorganization':
138142
return (<div>
139-
<label htmlFor="loadingprogress">{t('Organizing data:', {ns: 'dataquery'})}</label>
143+
<label htmlFor="loadingprogress">{t('Organizing data:',
144+
{ns: 'dataquery'})}</label>
140145
<progress id="loadingprogress"
141146
value={props.value} max={props.max}>
142-
{t('{{value}} of {{max}} columns', {ns: 'dataquery', value: props.value, max: props.max})}
147+
{t('{{value}} of {{max}} columns', {ns: 'dataquery',
148+
value: props.value, max: props.max})}
143149
</progress>
144150
</div>);
145151
}
146-
return <h2>{t('Invalid progress type: {{type}}', {ns: 'dataquery', type: props.type})}</h2>;
152+
return <h2>{t('Invalid progress type: {{type}}', {ns: 'dataquery',
153+
type: props.type})}</h2>;
147154
}
148155

149156
type RunQueryType = {
@@ -855,7 +862,8 @@ function organizedFormatter(
855862
return <TableCell data={cell} />;
856863
default:
857864
return (<td>
858-
<i>{t('(Internal Error. Unhandled cardinality: {{cardinality}})', {ns: 'dataquery', cardinality: fielddict.cardinality})}</i>
865+
<i>{t('(Internal Error. Unhandled cardinality: {{cardinality}})',
866+
{ns: 'dataquery', cardinality: fielddict.cardinality})}</i>
859867
</td>);
860868
}
861869
}

modules/dataquery/jsx/welcome.adminquerymodal.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ function AdminQueryModal(props: {
4242
if (queryName.trim() == '') {
4343
swal.fire({
4444
type: 'error',
45-
text: t('Must provide a query name to pin query as.', {ns: 'dataquery'}),
45+
text: t('Must provide a query name to pin query as.',
46+
{ns: 'dataquery'}),
4647
});
4748
reject();
4849
return;
4950
}
5051
if (!topQuery && !dashboardQuery && !loginQuery) {
5152
swal.fire({
5253
type: 'error',
53-
text: t('Must pin as study query, to dashboard, or to the login page.', {ns: 'dataquery'}),
54+
text: t('Must pin as study query, to dashboard, or to the '
55+
+'login page.', {ns: 'dataquery'}),
5456
});
5557
reject();
5658
return;

modules/dataquery/jsx/welcome.tsx

Lines changed: 71 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import i18n from 'I18nSetup';
1818
import {withTranslation} from 'react-i18next';
1919
import {createRoot} from 'react-dom/client';
2020

21-
const hiStrings = require('../locale/hi/LC_MESSAGES/dataquery.json');
21+
import hiStrings from '../locale/hi/LC_MESSAGES/dataquery.json';
2222

2323
/**
2424
* Return the welcome tab for the DQT
@@ -491,19 +491,21 @@ function QueryList(props: {
491491
});
492492
}
493493
const starFilter = props.starQuery ?
494-
<CheckboxElement name='onlystar' label={t('Starred Only', {ns: 'dataquery'})}
495-
value={onlyStarred}
496-
offset=''
497-
onUserInput={
498-
(name: string, value: boolean) => setOnlyStarred(value)
499-
}/> : <span />;
494+
<CheckboxElement name='onlystar' label={t('Starred Only',
495+
{ns: 'dataquery'})}
496+
value={onlyStarred}
497+
offset=''
498+
onUserInput={
499+
(name: string, value: boolean) => setOnlyStarred(value)
500+
}/> : <span />;
500501
const shareFilter = props.shareQuery ?
501-
<CheckboxElement name='onlyshare' label={t('Shared Only', {ns: 'dataquery'})}
502-
value={onlyShared}
503-
offset=''
504-
onUserInput={
505-
(name: string, value: boolean) => setOnlyShared(value)
506-
}/>
502+
<CheckboxElement name='onlyshare' label={t('Shared Only',
503+
{ns: 'dataquery'})}
504+
value={onlyShared}
505+
offset=''
506+
onUserInput={
507+
(name: string, value: boolean) => setOnlyShared(value)
508+
}/>
507509
: <span />;
508510
// Use whether shareQuery prop is defined as proxy
509511
// to determine if this is a shared query or a recent
@@ -538,20 +540,22 @@ function QueryList(props: {
538540
}}>
539541
{starFilter}
540542
{shareFilter}
541-
<CheckboxElement name='onlynamed' label={t('Named Only', {ns: 'dataquery'})}
542-
value={onlyNamed}
543-
offset=''
544-
onUserInput={
545-
(name: string, value: boolean) => setOnlyNamed(value)
546-
}/>
543+
<CheckboxElement name='onlynamed' label={t('Named Only',
544+
{ns: 'dataquery'})}
545+
value={onlyNamed}
546+
offset=''
547+
onUserInput={
548+
(name: string, value: boolean) => setOnlyNamed(value)
549+
}/>
547550
{duplicateFilter}
548-
<CheckboxElement name='fullquery' label={t('Collapse queries', {ns: 'dataquery'})}
549-
value={!fullQuery}
550-
offset=''
551-
onUserInput={
552-
(name: string, value: boolean) =>
553-
setFullQuery(!value)
554-
}/>
551+
<CheckboxElement name='fullquery' label={t('Collapse queries',
552+
{ns: 'dataquery'})}
553+
value={!fullQuery}
554+
offset=''
555+
onUserInput={
556+
(name: string, value: boolean) =>
557+
setFullQuery(!value)
558+
}/>
555559
</div>
556560
</div>
557561
<Pager>
@@ -660,15 +664,15 @@ function Pager(props: {
660664
onChangePage={setPageNum}
661665
RowsPerPage={rowsPerPage}
662666
Active={pageNum}
663-
//label={t('Page', {ns: 'dataquery'})}
667+
// label={t('Page', {ns: 'dataquery'})}
664668
/>
665669
{displayedRange}
666670
<PaginationLinks
667671
Total={props.children.length}
668672
onChangePage={setPageNum}
669673
RowsPerPage={rowsPerPage}
670674
Active={pageNum}
671-
//label={t('Page', {ns: 'dataquery'})}
675+
// label={t('Page', {ns: 'dataquery'})}
672676
/>
673677
</div>;
674678
}
@@ -830,9 +834,11 @@ function SingleQueryDisplay(props: {
830834
let desc = query.Name
831835
? <span>
832836
<b>{query.Name}</b>
833-
&nbsp;<i>{t('(Run at {{runTime}})', {ns: 'dataquery', runTime: query.RunTime})}</i>
837+
&nbsp;<i>{t('(Run at {{runTime}})', {ns: 'dataquery',
838+
runTime: query.RunTime})}</i>
834839
</span>
835-
: <i>{t('You ran this query at {{runTime}}', {ns: 'dataquery', runTime: query.RunTime})}</i>;
840+
: <i>{t('You ran this query at {{runTime}}', {ns: 'dataquery',
841+
runTime: query.RunTime})}</i>;
836842
if (!props.includeRuns) {
837843
desc = query.Name
838844
? <span>
@@ -853,9 +859,11 @@ function SingleQueryDisplay(props: {
853859
const desc = query.Name
854860
? <span>
855861
<b>{query.Name}</b>
856-
&nbsp;<i>{t('(Shared by {{sharedBy}})', {ns: 'dataquery', sharedBy: query.SharedBy.join(', ')})}</i>
862+
&nbsp;<i>{t('(Shared by {{sharedBy}})', {ns: 'dataquery',
863+
sharedBy: query.SharedBy.join(', ')})}</i>
857864
</span>
858-
: <i>{t('Query shared by {{sharedBy}}', {ns: 'dataquery', sharedBy: query.SharedBy.join(', ')})}</i>;
865+
: <i>{t('Query shared by {{sharedBy}}', {ns: 'dataquery',
866+
sharedBy: query.SharedBy.join(', ')})}</i>;
859867
msg = <div>{desc}
860868
&nbsp;{loadIcon}{pinIcon}
861869
</div>;
@@ -1075,21 +1083,41 @@ function IntroductionMessage(props: {
10751083
const {t} = useTranslation('dataquery');
10761084
const studyQueriesParagraph = props.hasStudyQueries ? (
10771085
<p>
1078-
{t('Above, there is also a Study Queries panel. This are a special type of shared queries that have been pinned by a study administer to always display at the top of this page.', {ns: 'dataquery'})}
1086+
{t('Above, there is also a Study Queries panel. This are a'
1087+
+' special type of shared queries that have been pinned by a study'
1088+
+' administer to always display at the top of this page.',
1089+
{ns: 'dataquery'})}
10791090
</p>
10801091
) : '';
10811092
return (
10821093
<div>
1083-
<p>{t('The data query tool allows you to query data within LORIS. There are three steps to defining a query:', {ns: 'dataquery'})}</p>
1094+
<p>{t('The data query tool allows you to query data within LORIS. '
1095+
+'There are three steps to defining a query:', {ns: 'dataquery'})}</p>
10841096
<ol>
1085-
<li>{t("First, you must select the fields that you're interested in on the Define Fields page.", {ns: 'dataquery'})}</li>
1086-
<li>{t("Next, you can optionally define filters on the Define Filters page to restrict the population that is returned.", {ns: 'dataquery'})}</li>
1087-
<li>{t("Finally, you view your query results on the View Data page", {ns: 'dataquery'})}</li>
1097+
<li>{t('First, you must select the fields that you\'re interested in'
1098+
+' on the Define Fields page.', {ns: 'dataquery'})}</li>
1099+
<li>{t('Next, you can optionally define filters on the Define '
1100+
+'Filters page to restrict the population that is returned.',
1101+
{ns: 'dataquery'})}</li>
1102+
<li>{t('Finally, you view your query results on the View Data page',
1103+
{ns: 'dataquery'})}</li>
10881104
</ol>
1089-
<p>{t('The Next Steps on the bottom right of your screen always the context-sensitive next steps that you can do to build your query.', {ns: 'dataquery'})}</p>
1090-
<p>{t("Your recently run queries will be displayed in the Recent Queries panel below. Instead of building a new query, you can reload a query that you've recently run by clicking on the icon next to the query.", {ns: 'dataquery'})}</p>
1091-
<p>{t("Queries can be shared with others by clicking the icon. This will cause the query to be shared with all users who have access to the fields used by the query. It will display in a Shared Queries panel below the Recent Queries.", {ns: 'dataquery'})}</p>
1092-
<p>{t("You may also give a query a name at any time by clicking the icon. This makes it easier to find queries you care about by giving them an easier to remember name that can be used for filtering. When you share a query, the name will be shared along with it.", {ns: 'dataquery'})}</p>
1105+
<p>{t('The Next Steps on the bottom right of your screen always the '
1106+
+'context-sensitive next steps that you can do to build your query.',
1107+
{ns: 'dataquery'})}</p>
1108+
<p>{t('Your recently run queries will be displayed in the Recent '
1109+
+'Queries panel below. Instead of building a new query, you can '
1110+
+'reload a query that you\'ve recently run by clicking on the icon'
1111+
+' next to the query.', {ns: 'dataquery'})}</p>
1112+
<p>{t('Queries can be shared with others by clicking the icon. This will'
1113+
+' cause the query to be shared with all users who have access to the '
1114+
+'fields used by the query. It will display in a Shared Queries panel '
1115+
+'below the Recent Queries.', {ns: 'dataquery'})}</p>
1116+
<p>{t('You may also give a query a name at any time by clicking the icon.'
1117+
+'This makes it easier to find queries you care about by giving them an'
1118+
+' easier to remember name that can be used for filtering. When you '
1119+
+'share a query, the name will be shared along with it.',
1120+
{ns: 'dataquery'})}</p>
10931121
{studyQueriesParagraph}
10941122
<div style={{
10951123
display: 'flex',
@@ -1107,14 +1135,14 @@ function IntroductionMessage(props: {
11071135

11081136
window.addEventListener('load', () => {
11091137
i18n.addResourceBundle('hi', 'dataquery', hiStrings);
1110-
const TranslatedWelcome = withTranslation(['dataquery','loris'])(Welcome);
1138+
const TranslatedWelcome = withTranslation(['dataquery', 'loris'])(Welcome);
11111139

11121140
const container = document.getElementById('lorisworkspace');
11131141
if (container) {
11141142
const root = createRoot(container);
11151143
root.render(<TranslatedWelcome />);
11161144
} else {
1117-
console.error("Element with id 'lorisworkspace' not found in DOM");
1145+
console.error('Element with id \'lorisworkspace\' not found in DOM');
11181146
}
11191147
});
11201148

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"lib": [
1717
"es6", "dom", "es2017"
1818
],
19-
"strict" : true
19+
"strict" : true,
20+
"resolveJsonModule": true
2021
}
2122
}

0 commit comments

Comments
 (0)