Skip to content

Commit

Permalink
Fixed CSV export bug, bumped version (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndobb authored Oct 1, 2020
1 parent af099a0 commit 739d7a7
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/db/build/LeafDB.Data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -495,4 +495,4 @@ INSERT [auth].[Constraint] ([Id], [Type]) VALUES (1, N'User')
INSERT [auth].[Constraint] ([Id], [Type]) VALUES (2, N'Group')
SET IDENTITY_INSERT [auth].[Constraint] OFF
INSERT [network].[Identity] ([Lock], [Name], [Abbreviation], [Description], [TotalPatients], [Latitude], [Longitude], [PrimaryColor], [SecondaryColor]) VALUES (N'X', N'University of Washington', N'UW', N'UW Medicine is the most comprehensive integrated health system in the Puget Sound region, comprising 4 hospitals and hundreds of clinics', 4600000, CAST(47.6062 AS Decimal(7, 4)), CAST(-122.3321 AS Decimal(7, 4)), N'rgb(75, 46, 131)', N'rgb(183, 165, 122)')
INSERT [ref].[Version] ([Lock], [Version]) VALUES (N'X', N'3.8.0')
INSERT [ref].[Version] ([Lock], [Version]) VALUES (N'X', N'3.8.1')
2 changes: 1 addition & 1 deletion src/db/build/LeafDB.Init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ SELECT
,[SecondaryColor] = 'rgb(183, 165, 122)'

INSERT INTO [ref].[Version] (Lock, [Version])
SELECT 'X', N'3.8.0';
SELECT 'X', N'3.8.1';
5 changes: 5 additions & 0 deletions src/db/migration/3.8.0__3.8.1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* No database changes, just update version.
*/
UPDATE ref.[Version]
SET [Version] = '3.8.1'
2 changes: 1 addition & 1 deletion src/server/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<VersionPrefix>3.8.0</VersionPrefix>
<VersionPrefix>3.8.1</VersionPrefix>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/ui-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ui-client",
"version": "3.8.0",
"version": "3.8.1",
"private": true,
"dependencies": {
"@types/d3-format": "^1.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ export default class ExportDataModal extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
selected: props.exportState.redCap ? opts.redcap : props.exportState.csv ? opts.csv : ''
selected: props.exportState.redCap.enabled ? opts.redcap : props.exportState.csv.enabled ? opts.csv : ''
}
}

public render() {
const c = 'patientlist-export-modal';
const { exportState, rowCount, show } = this.props;
const { selected } = this.state;
const { csv, redCap, isExporting } = exportState;
const { enabled, csv, redCap, isExporting } = exportState;
const modalClasses = [ c, 'leaf-modal', (isExporting ? 'exporting' : '') ];
const anyEnabled = !!csv || !!redCap;
const redcapSelected = selected === opts.redcap;
Expand All @@ -54,7 +54,7 @@ export default class ExportDataModal extends React.PureComponent<Props, State> {
<Modal isOpen={show} className={modalClasses.join(' ')} backdrop={true} size="lg">
<ModalHeader>Export Data</ModalHeader>
<ModalBody>
{redCap.enabled &&
{enabled &&
<Row>
<Col className={`${c}-options`} md={3}>
{redCap.enabled &&
Expand Down
2 changes: 1 addition & 1 deletion src/ui-client/src/containers/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Header extends React.PureComponent<Props> {
return (
<Navbar id={`${c}-container`} className="d-flex justify-content-between mb-3">
<div className={`${c}-content-side`}>
<div className={`${c}-title"`} >
<div className={`${c}-title`} >
<img alt="leaf-logo" className="logo" src={process.env.PUBLIC_URL + '/images/logos/apps/leaf.svg'} />
<div className="title">leaf</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/ui-client/src/containers/PatientList/PatientList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class PatientList extends React.PureComponent<Props, State> {
</Col>
<Col md={4}>
<div className={`${c}-export-button-container`}>
{exportState.redCap.enabled && patientList.totalPatients > 0 &&
{exportState.enabled && patientList.totalPatients > 0 &&
<div className="leaf-button-main" onClick={this.handleExportClick}>
<span><GoCloudDownload className={`${c}-export-button`}/>Export Data</span>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/ui-client/src/models/state/Export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface ExportOptionsDTO {
}

export default interface ExportState {
enabled: boolean;
isComplete: boolean;
isErrored: boolean;
isExporting: boolean;
Expand Down
2 changes: 2 additions & 0 deletions src/ui-client/src/reducers/dataExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ExportState from '../models/state/Export';

export function defaultExportState(): ExportState {
return {
enabled: false,
isComplete: false,
isErrored: false,
isExporting: false,
Expand Down Expand Up @@ -49,6 +50,7 @@ export const dataExport = (state: ExportState = defaultExportState(), action: Ex
});
case EXPORT_SET_OPTIONS:
return Object.assign({}, state, {
enabled: (action.exportOptions!.redCap.enabled || action.exportOptions!.csv.enabled),
csv: action.exportOptions!.csv,
redCap: action.exportOptions!.redCap
});
Expand Down
12 changes: 12 additions & 0 deletions src/ui-client/src/services/sessionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,17 @@ const getStoredSessionObject = (state: AppState): StoredSessionState => {
};
};

/**
* Add a custom CSS file by filename specified.
*/
const addCssFile = (filename: string) => {
const head = document.getElementsByTagName('head')[0];
const style = document.createElement('link');
style.href = filename;
style.type = 'text/css';
style.rel = 'stylesheet';
head.append(style);
};

const getSessionStorageKey = (state: AppState) => `__leaf_session_v${state.auth.config!.version}_${window.location.pathname}__`;
const getSessionRetryKey = () => `__leaf_session_retry__`;

0 comments on commit 739d7a7

Please sign in to comment.