Skip to content

Commit

Permalink
Merge pull request #417 from OHDSI/ARACHNE-2357-release-1.12.1
Browse files Browse the repository at this point in the history
Arachne 2357 release 1.12.1
  • Loading branch information
wivern authored May 17, 2018
2 parents aaf1e53 + 9a8ed02 commit 158c836
Show file tree
Hide file tree
Showing 42 changed files with 321 additions and 127 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arachne-ui",
"version": "1.12.93",
"version": "1.12.104",
"licenses": [
{
"type": "Apache-2.0",
Expand Down Expand Up @@ -46,7 +46,7 @@
"dependencies": {
"@ohdsi/atlascharts": "https://github.com/agackovka/Visualizations",
"@stomp/stompjs": "github:stomp-js/stomp-websocket",
"arachne-ui-components": "1.12.18",
"arachne-ui-components": "1.12.21",
"autoprefixer": "^6.7.6",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.odysseusinc.arachne</groupId>
<artifactId>${final.artifactId}</artifactId>
<version>1.12.0</version>
<version>1.12.1</version>
<packaging>pom</packaging>
<name>Frontend Resources Bundle</name>

Expand Down
2 changes: 1 addition & 1 deletion src/components/FileTree/presenter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class FileTree extends Component {
onClick={(e) => {
e.preventDefault();
if (doDelete) {
Utils.confirmDelete({ message: 'Are you sure want to delete this file?' })
Utils.confirmDelete({ message: 'Are you sure you want to delete this file?' })
.then(() => doDelete(node))
.catch(() => {});
}
Expand Down
64 changes: 35 additions & 29 deletions src/components/Reports/converters/dataToTrellislineData.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,45 @@ export default (rawData, DTO = {
trellisName: 'TRELLIS_NAME',
seriesName: 'SERIES_NAME',
}) => {
const minXValue = d3.min(rawData[DTO.xValue]);
const maxXValue = d3.max(rawData[DTO.xValue]);

const nestByDecile = d3.nest()
.key(d => d[DTO.trellisName])
.key(d => d[DTO.seriesName])
.sortValues((a, b) =>
a[DTO.xValue] - b[DTO.xValue]
);
let data = [];
let trellisSet = [];

// map rawData into chartable form
const normalizedSeries = chart.dataframeToArray(rawData);
let data = nestByDecile.entries(normalizedSeries);
// fill in gaps
const xValuesRange = d3.range(minXValue, maxXValue, 1);

data.forEach((trellis) => {
trellis.values.forEach((series) => {
series.values = xValuesRange.map((year) => { // eslint-disable-line no-param-reassign
const xValue = series.values.filter(
f => f[DTO.xValue] == year // eslint-disable-line eqeqeq
)[0] || ReportUtils.seriesInitializer(trellis.key, series.key, year, 0);
xValue.date = new Date(year, 0, 1);
return xValue;
if (rawData[DTO.xValue]) {
const minXValue = d3.min(rawData[DTO.xValue]);
const maxXValue = d3.max(rawData[DTO.xValue]);

const nestByDecile = d3.nest()
.key(d => d[DTO.trellisName])
.key(d => d[DTO.seriesName])
.sortValues((a, b) =>
a[DTO.xValue] - b[DTO.xValue]
);

// map rawData into chartable form
const normalizedSeries = chart.dataframeToArray(rawData);
data = nestByDecile.entries(normalizedSeries);
// fill in gaps
const xValuesRange = d3.range(minXValue, maxXValue, 1);

data.forEach((trellis) => {
trellis.values.forEach((series) => {
series.values = xValuesRange.map((year) => { // eslint-disable-line no-param-reassign
const xValue = series.values.filter(
f => f[DTO.xValue] == year // eslint-disable-line eqeqeq
)[0] || ReportUtils.seriesInitializer(trellis.key, series.key, year, 0);
xValue.date = new Date(year, 0, 1);
return xValue;
});
});
});
});

data = Array.isArray(data)
? data
: [data];

const trellisSet = data.map(series => series.key);

data = Array.isArray(data)
? data
: [data];

trellisSet = data.map(series => series.key);
}

return {
data,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Admin/components/AdminList/Table/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class AdminTableBuilder extends ContainerBuilder {
...ownProps,
...dispatchProps,
removeAdmin: (id, name) => {
Utils.confirmDelete({ message: `Are you sure want to remove ${name} from admins?` })
Utils.confirmDelete({ message: `Are you sure you want to remove ${name} from admins?` })
.then(() => {
dispatchProps
.removeAdmin({ id })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class UserListTableBuilder extends ContainerBuilder {
...ownProps,
...dispatchProps,
removeUser: (id, name) => {
Utils.confirmDelete({ message: `Are you sure want to delete ${name}?` })
Utils.confirmDelete({ message: `Are you sure you want to delete ${name}?` })
.then(() => {
dispatchProps
.removeUser({ id })
Expand Down
20 changes: 16 additions & 4 deletions src/modules/Admin/components/SystemSettings/container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
import actions from 'actions/index';
import { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import get from 'lodash/get';
import { get } from 'services/Utils';
import { asyncConnect } from 'redux-async-connect';
import presenter from './presenter';
import selectors from './selectors';
import { apply as applySettings } from 'modules/Admin/ducks/systemSettings';
import { ContainerBuilder } from 'services/Utils';
import { solrDomains } from 'modules/Admin/const';
import presenter from './presenter';
import selectors from './selectors';

class SystemSettings extends Component {

Expand All @@ -50,8 +51,9 @@ class SystemSettingsBuilder extends ContainerBuilder {
mapStateToProps(state) {
return {
isApplied: get(state, 'adminSettings.systemSettings.queryResult.result.applied', true),
isLoading: state.adminSettings.systemSettings.isLoading || state.adminSettings.solrIndex.isSaving,
isLoading: state.adminSettings.systemSettings.isLoading,
settingGroupList: selectors.getSystemSettings(state),
reindexProcess: selectors.getReindexProcess(state),
};
}

Expand All @@ -62,6 +64,7 @@ class SystemSettingsBuilder extends ContainerBuilder {
applySettings: applySettings,
solrReindex: actions.adminSettings.solrIndex.create,
closeLoader: () => actions.adminSettings.atlasConnection.reset,
toggleIsReindexing: actions.adminSettings.reindexProcess.toggle,
};
}

Expand Down Expand Up @@ -103,6 +106,15 @@ class SystemSettingsBuilder extends ContainerBuilder {
applySettings: () => {
dispatchProps.applySettings(() => dispatchProps.loadSystemSettings());
},
solrReindex({ domain }) {
alert('Reindex started. Please wait for it to complete');
dispatchProps.toggleIsReindexing(domain.value, true);
dispatchProps
.solrReindex({ domain: domain.value })
.then(() => alert(`${domain.label} reindex completed`))
.catch(() => alert(`${domain.label} reindex failed`))
.finally(() => dispatchProps.toggleIsReindexing(domain.value, false));
},
};
}

Expand Down
31 changes: 21 additions & 10 deletions src/modules/Admin/components/SystemSettings/presenter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ import React from 'react';
import BEMHelper from 'services/BemHelper';
import { Button, Panel } from 'arachne-ui-components';
import PageWrapper from 'modules/Admin/components/PageWrapper';
import { solrDomains } from 'modules/Admin/const';
// import DynamicDataForm from 'components/DynamicDataForm';
import formFactory from 'components/DynamicDataForm/factory';
import {
LoadingPanel,
} from 'arachne-ui-components';
import { get } from 'services/Utils';

require('./style.scss');

Expand All @@ -41,8 +43,12 @@ function SystemSettings(props) {
doSubmit,
settingGroupList,
solrReindex,
reindexProcess,
} = props;

const isReindexing = domain => get(reindexProcess, `[${domain}]`);
const getReindexLabel = (domain, label) => `${isReindexing(domain) ? 'Indexing' : 'Reindex'} ${label}`;

const formComponentList = settingGroupList.map((formData, index) => {
const Form = formFactory({
name: formData.name,
Expand Down Expand Up @@ -83,40 +89,45 @@ function SystemSettings(props) {
<div {...classes('action-bar-btn')}>
<Button
mods={['default']}
label="Reindex Expert Finder"
onClick={() => solrReindex({ domain: 'users' })}
label={getReindexLabel(solrDomains.users.value, 'Expert Finder')}
onClick={() => solrReindex({ domain: solrDomains.users })}
disabled={isReindexing(solrDomains.users.value)}
/>
</div>
<div {...classes('action-bar-btn')}>
<Button
{...classes('reindex-solr')}
mods={['default']}
label="Reindex Data Catalog"
onClick={() => solrReindex({ domain: 'data-sources' })}
label={getReindexLabel(solrDomains.dataSources.value, 'Data Catalog')}
onClick={() => solrReindex({ domain: solrDomains.dataSources })}
disabled={isReindexing(solrDomains.dataSources.value)}
/>
</div>
<div {...classes('action-bar-btn')}>
<Button
{...classes('reindex-solr')}
mods={['default']}
label="Reindex Study Notebook"
onClick={() => solrReindex({ domain: 'studies' })}
label={getReindexLabel(solrDomains.studies.value, 'Study Notebook')}
onClick={() => solrReindex({ domain: solrDomains.studies })}
disabled={isReindexing(solrDomains.studies.value)}
/>
</div>
<div {...classes('action-bar-btn')}>
<Button
{...classes('reindex-solr')}
mods={['default']}
label="Reindex Analyses"
onClick={() => solrReindex({ domain: 'analyses' })}
label={getReindexLabel(solrDomains.analyses.value, 'Analyses')}
onClick={() => solrReindex({ domain: solrDomains.analyses })}
disabled={isReindexing(solrDomains.analyses.value)}
/>
</div>
<div {...classes('action-bar-btn')}>
<Button
{...classes('reindex-solr')}
mods={['default']}
label="Reindex Papers"
onClick={() => solrReindex({ domain: 'papers' })}
label={getReindexLabel(solrDomains.papers.value, 'Papers')}
onClick={() => solrReindex({ domain: solrDomains.papers })}
disabled={isReindexing(solrDomains.papers.value)}
/>
</div>
</div>
Expand Down
9 changes: 8 additions & 1 deletion src/modules/Admin/components/SystemSettings/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
*/

import { createSelector } from 'reselect';
import get from 'lodash/get';
import { get } from 'services/Utils';

function prepareName(name) {
return name.replace(/\./g, '__');
}

const getRawSystemSettings = state => get(state, 'adminSettings.systemSettings.queryResult.result.list') || [];
const parseValue = field => field.type === 'checkbox' ? field.value === 'true' : field.value;
const getRawReindexProcess = state => get(state, 'adminSettings.reindexProcess.data', '', 'Object');

const getSystemSettings = createSelector(
[getRawSystemSettings],
Expand Down Expand Up @@ -56,7 +57,13 @@ const getSystemSettings = createSelector(
})
);

const getReindexProcess = createSelector(
[getRawReindexProcess],
process => process
);

export default {
getSystemSettings,
parseValue,
getReindexProcess,
};
24 changes: 24 additions & 0 deletions src/modules/Admin/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,35 @@ if (__APP_TYPE_CENTRAL__) {
adminPages.push({ label: 'Users', value: paths.users() });
}

const solrDomains = {
users: {
value: 'users',
label: 'Users',
},
dataSources: {
value: 'data-sources',
label: 'Data sources',
},
studies: {
value: 'studies',
label: 'Studies',
},
analyses: {
value: 'analyses',
label: 'Analyses',
},
papers: {
value: 'papers',
label: 'Papers',
},
};

export {
adminPages,
apiPaths,
forms,
imgs,
modal,
paths,
solrDomains,
};
3 changes: 3 additions & 0 deletions src/modules/Admin/ducks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import solrIndex from './solrIndex';
import systemSettings from './systemSettings';
import userOptionList from './userOptionList';
import userList from './userList';
import reindexProcess from './reindexProcess';

const actions = {
adminList: adminList.actions,
Expand All @@ -40,6 +41,7 @@ const actions = {
systemSettings: systemSettings.actions,
userOptionList: userOptionList.actions,
userList: userList.actions,
reindexProcess: reindexProcess.actions,
};

const reducer = {
Expand All @@ -52,6 +54,7 @@ const reducer = {
systemSettings: systemSettings.reducer,
userOptionList: userOptionList.reducer,
userList: userList.reducer,
reindexProcess: reindexProcess.reducer,
};

export default {
Expand Down
Loading

0 comments on commit 158c836

Please sign in to comment.