Skip to content

Commit

Permalink
Merge pull request #412 from dhis2/fix/dialog-position
Browse files Browse the repository at this point in the history
fix(dialog): dialog position
  • Loading branch information
varl authored Nov 11, 2020
2 parents c32a595 + a925532 commit b45df73
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 26 deletions.
30 changes: 14 additions & 16 deletions client/src/components/dialog/DialogBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Dialog from 'material-ui/Dialog'
import { closeDialog } from '../../actions/actionCreators'

const styles = {
bodyStyle: {},
contentStyle: {
maxWidth: '500px',
},
Expand All @@ -33,7 +32,9 @@ class DialogBase extends Component {

const finalAction = () => {
Promise.resolve(approveAction())
.then(() => this.props.autoCloseOnApprove && defaultCloseDialog())
.then(
() => this.props.autoCloseOnApprove && defaultCloseDialog()
)
.catch(() => {})
}

Expand Down Expand Up @@ -61,14 +62,11 @@ class DialogBase extends Component {
actions={actions}
modal={false}
autoScrollBodyContent
contentStyle={
{ ...styles.contentStyle, ...contentStyle } ||
styles.contentStyle
}
bodyStyle={
{ ...styles.bodyStyle, ...bodyStyle } ||
styles.bodyStyle
}
contentStyle={{
...styles.contentStyle,
...contentStyle,
}}
bodyStyle={{ ...styles.bodyStyle, ...bodyStyle }}
onRequestClose={defaultCloseDialog}
>
<Provider store={ctx.store}>
Expand All @@ -82,15 +80,15 @@ class DialogBase extends Component {
}

DialogBase.propTypes = {
title: PropTypes.string,
cancelLabel: PropTypes.string,
approveAction: PropTypes.func,
approveLabel: PropTypes.string,
autoCloseOnApprove: PropTypes.bool,
bodyStyle: PropTypes.object,
cancelAction: PropTypes.func,
approveAction: PropTypes.func,
defaultCloseDialog: PropTypes.func,
cancelLabel: PropTypes.string,
contentStyle: PropTypes.object,
bodyStyle: PropTypes.object,
autoCloseOnApprove: PropTypes.bool,
defaultCloseDialog: PropTypes.func,
title: PropTypes.string,
}

DialogBase.defaultProps = {
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/dialog/EditAppVersionDialog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// eslint-disable-next-line react/no-deprecated
import PropTypes from 'prop-types';
import PropTypes from 'prop-types'

import React, { Component } from 'react';
import React, { Component } from 'react'

import { connect } from 'react-redux'
import DialogBase from './DialogBase'
Expand Down Expand Up @@ -39,6 +38,7 @@ export class EditAppVersionDialog extends Component {
approveLabel={'Save'}
approveAction={this.submitForm.bind(this)}
cancelAction={this.props.closeDialog}
contentStyle={{ minHeight: '550px' }}
>
<AppVersionForm
isNew={false}
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/dialog/NewAppVersionDialog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// eslint-disable-next-line react/no-deprecated
import PropTypes from 'prop-types';
import PropTypes from 'prop-types'

import React, { Component } from 'react';
import React, { Component } from 'react'

import { connect } from 'react-redux'
import DialogBase from './DialogBase'
Expand Down Expand Up @@ -40,6 +39,7 @@ export class NewAppVersionDialog extends Component {
approveLabel={'Upload'}
approveAction={this.submitForm.bind(this)}
cancelAction={this.props.closeDialog}
contentStyle={{ minHeight: '650px' }}
>
<AppVersionForm
isNew={true}
Expand Down
7 changes: 3 additions & 4 deletions client/src/components/form/AppVersionForm.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// eslint-disable-next-line react/no-deprecated
import PropTypes from 'prop-types';
import PropTypes from 'prop-types'

import React from 'react';
import React from 'react'

import { connect } from 'react-redux'
import * as formUtils from './ReduxFormUtils'
Expand Down Expand Up @@ -56,7 +55,7 @@ const AppVersionForm = props => {
}

//TODO: add error instead of passing false to ErrorOrLoading
return channels.loading || channels.error ? (
return channels.list.length < 1 && (channels.loading || channels.error) ? (
<ErrorOrLoading loading={channels.loading} error={channels.error} />
) : (
<Form onSubmit={handleSubmit(onSub)}>
Expand Down

0 comments on commit b45df73

Please sign in to comment.