Skip to content

Commit 5c2b21a

Browse files
committed
Merge branch 'bugfix/issues' into develop
2 parents d7f1cce + 52fcba7 commit 5c2b21a

32 files changed

Lines changed: 1062 additions & 1031 deletions

app/components/modal/modalCodeListTable.js

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import DialogTitle from '@material-ui/core/DialogTitle';
2323
import Button from '@material-ui/core/Button';
2424
import Grid from '@material-ui/core/Grid';
2525
import CdiscLibraryContext from 'constants/cdiscLibraryContext.js';
26-
import getCodeListData from 'utils/getCodeListData.js';
2726
import Loading from 'components/utils/loading.js';
2827
import SearchInTable from 'components/utils/searchInTable.js';
2928
import GeneralTable from 'components/utils/generalTable.js';
29+
import { getGeneralTableDataFromCodeList } from 'utils/codeListUtils.js';
3030
import { dummyRequest } from 'utils/cdiscLibraryUtils.js';
3131
import { getDecode } from 'utils/defineStructureUtils.js';
3232
import {
@@ -141,54 +141,6 @@ const loadFromStdCodeList = (codeLists, codeListOid) => {
141141
};
142142
};
143143

144-
const loadFromCodeLists = (codeLists, codeListOid, defineVersion) => {
145-
let codeList = codeLists[codeListOid];
146-
let codeListType = codeList.codeListType;
147-
let data = [];
148-
let header = [];
149-
150-
let codeListTable, codeListTitle, isDecoded, isRanked, isCcoded;
151-
if (codeList) {
152-
if (codeList.codeListType === 'external') {
153-
codeListTitle = codeList.name;
154-
header = [
155-
{ id: 'dictionary', label: 'Dictionary', key: true },
156-
{ id: 'version', label: 'Version' },
157-
{ id: 'ref', label: 'Ref' },
158-
{ id: 'Href', label: 'Href' },
159-
];
160-
data.push(codeList.externalCodeList);
161-
} else {
162-
({ codeListTable, codeListTitle, isDecoded, isRanked, isCcoded } = getCodeListData(codeList, defineVersion));
163-
data = codeListTable;
164-
165-
header = [
166-
{ id: 'oid', label: 'oid', hidden: true, key: true },
167-
{ id: 'value', label: 'Coded Value' },
168-
];
169-
170-
if (isDecoded === true) {
171-
header.push({ id: 'decode', label: 'Decode' });
172-
}
173-
174-
if (isCcoded === true) {
175-
header.push({ id: 'ccode', label: 'C-Code' });
176-
}
177-
178-
if (isRanked === true) {
179-
header.push({ id: 'rank', label: 'Rank' });
180-
}
181-
}
182-
}
183-
184-
return {
185-
codeListTitle,
186-
codeListType,
187-
data,
188-
header,
189-
};
190-
};
191-
192144
const ModalCodeListTable = (props) => {
193145
const dispatch = useDispatch();
194146
let classes = getStyles();
@@ -252,7 +204,7 @@ const ModalCodeListTable = (props) => {
252204
} else {
253205
codeLists = odm.study.metaDataVersion.codeLists;
254206
let defineVersion = odm.study.metaDataVersion.defineVersion;
255-
setTableData(loadFromCodeLists(codeLists, props.codeListOid, defineVersion));
207+
setTableData(getGeneralTableDataFromCodeList(codeLists[props.codeListOid], defineVersion));
256208
}
257209
}
258210
}, [props, odm, stdCodeLists, cl, retry]);

app/components/settings/editor.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,22 @@ const Editor = (props) => {
146146
label='When a variable is selected using search or filter, show all VLM records for it'
147147
/>
148148
</FormGroup>
149+
<Typography variant="h6" gutterBottom align="left" color='textSecondary'>
150+
Codelists
151+
</Typography>
152+
<FormGroup>
153+
<FormControlLabel
154+
control={
155+
<Switch
156+
checked={props.state.settings.editor.openCodeListAfterAdd}
157+
onChange={props.handleChange('editor', 'openCodeListAfterAdd')}
158+
color='primary'
159+
className={classes.switch}
160+
/>
161+
}
162+
label='Navigate to the coded values tab after adding a new codelist'
163+
/>
164+
</FormGroup>
149165
<Typography variant="h6" gutterBottom align="left" color='textSecondary'>
150166
Coded Values
151167
</Typography>
@@ -200,6 +216,22 @@ const Editor = (props) => {
200216
label='Show line numbers in ARM programming code'
201217
/>
202218
</FormGroup>
219+
<Typography variant="h6" gutterBottom align="left" color='textSecondary'>
220+
Review Comments
221+
</Typography>
222+
<FormGroup>
223+
<FormControlLabel
224+
control={
225+
<Switch
226+
checked={props.state.settings.editor.removeHtmlTagsInCommentsExport}
227+
onChange={props.handleChange('editor', 'removeHtmlTagsInCommentsExport')}
228+
color='primary'
229+
className={classes.switch}
230+
/>
231+
}
232+
label='Remove HTML tags in comments export'
233+
/>
234+
</FormGroup>
203235
</Grid>
204236
</Grid>
205237
</React.Fragment>

app/components/tableActions/addCodeList.js

Lines changed: 26 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@ import { connect } from 'react-redux';
1919
import AppBar from '@material-ui/core/AppBar';
2020
import Tabs from '@material-ui/core/Tabs';
2121
import Tab from '@material-ui/core/Tab';
22-
import Grid from '@material-ui/core/Grid';
23-
import Typography from '@material-ui/core/Typography';
2422
import Dialog from '@material-ui/core/Dialog';
2523
import DialogContent from '@material-ui/core/DialogContent';
26-
import DialogTitle from '@material-ui/core/DialogTitle';
27-
import IconButton from '@material-ui/core/IconButton';
28-
import ClearIcon from '@material-ui/icons/Clear';
2924
import AddCodeListSimple from 'components/tableActions/addCodeListSimple.js';
30-
import AddCodeListFromCT from 'components/tableActions/addCodeListFromCT.js';
31-
import AddCodeListFromOtherStudy from 'components/tableActions/addCodeListFromOtherStudy.js';
25+
import AddCodeListExternal from 'components/tableActions/addCodeListExternal.js';
3226
import { addItemChangeTab } from 'actions/index.js';
3327

3428
const styles = theme => ({
@@ -48,9 +42,12 @@ const styles = theme => ({
4842
appBar: {
4943
transform: 'translate(0%, calc(-20%+0.5px))',
5044
},
51-
title: {
52-
marginTop: theme.spacing(5),
53-
paddingBottom: 0,
45+
content: {
46+
display: 'flex',
47+
},
48+
container: {
49+
display: 'flex',
50+
width: '100%',
5451
},
5552
});
5653

@@ -69,15 +66,7 @@ const mapStateToProps = state => {
6966
};
7067
};
7168

72-
const tabNames = ['New Codelist', 'Controlled Terminology', 'Another Define'];
73-
74-
function TabContainer (props) {
75-
return (
76-
<Typography component="div">
77-
{props.children}
78-
</Typography>
79-
);
80-
}
69+
const tabNames = ['New Codelist', 'Controlled Terminology', 'Other Define'];
8170

8271
class AddCodeListConnected extends React.Component {
8372
handleTabChange = (event, currentTab) => {
@@ -105,22 +94,7 @@ class AddCodeListConnected extends React.Component {
10594
onKeyDown={this.onKeyDown}
10695
tabIndex='0'
10796
>
108-
<DialogTitle className={classes.title}>
109-
<Grid container spacing={0} justify='space-between' alignItems='center'>
110-
<Grid item>
111-
Add Codelist
112-
</Grid>
113-
<Grid item>
114-
<IconButton
115-
color="secondary"
116-
onClick={this.props.onClose}
117-
>
118-
<ClearIcon />
119-
</IconButton>
120-
</Grid>
121-
</Grid>
122-
</DialogTitle>
123-
<DialogContent>
97+
<DialogContent className={classes.content}>
12498
<AppBar position='absolute' color='default'>
12599
<Tabs
126100
value={currentTab}
@@ -140,27 +114,26 @@ class AddCodeListConnected extends React.Component {
140114
}
141115
</Tabs>
142116
</AppBar>
143-
<TabContainer>
144-
<br/>
145-
{tabNames[currentTab] === 'New Codelist' && (
146-
<AddCodeListSimple
117+
{tabNames[currentTab] === 'New Codelist' && (
118+
<AddCodeListSimple
119+
position={this.props.position}
120+
onClose={this.props.onClose}
121+
/>
122+
)}
123+
{tabNames[currentTab] === 'Controlled Terminology' &&
124+
<AddCodeListExternal
125+
type='CT'
126+
position={this.props.position}
127+
onClose={this.props.onClose}
128+
/>
129+
}
130+
{tabNames[currentTab] === 'Other Define' &&
131+
<AddCodeListExternal
132+
type='Define'
147133
position={this.props.position}
148134
onClose={this.props.onClose}
149135
/>
150-
)}
151-
{tabNames[currentTab] === 'Controlled Terminology' &&
152-
<AddCodeListFromCT
153-
position={this.props.position}
154-
onClose={this.props.onClose}
155-
/>
156-
}
157-
{tabNames[currentTab] === 'Another Define' &&
158-
<AddCodeListFromOtherStudy
159-
position={this.props.position}
160-
onClose={this.props.onClose}
161-
/>
162-
}
163-
</TabContainer>
136+
}
164137
</DialogContent>
165138
</Dialog>
166139
</React.Fragment>

0 commit comments

Comments
 (0)