Skip to content

Fix display of ParseFile in Config #666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2017

Conversation

natanrolnik
Copy link
Contributor

@natanrolnik natanrolnik commented Feb 19, 2017

This PR fixes the display of Parse.Files and GeoPoints in the Config section of the Dashboard.
Now that @flovilmart fixed saving Files to Config in Parse Server (parse-community/parse-server#3457), this is the last bit to have it working in the dashboard.

Before:

captura de tela 2017-02-20 as 13 30 17

captura de tela 2017-02-20 as 13 19 02

After

captura de tela 2017-02-19 as 23 51 24

captura de tela 2017-02-20 as 13 19 08

@JeremyPlease @dvanwinkle @steven-supersolid if anyone of you could review, it would be great.

Copy link
Contributor

@flovilmart flovilmart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think?

@@ -72,6 +72,8 @@ class Config extends TableView {
let value = data.value;
let modalValue = value;
let type = typeof value;
let openModalWhenClinkingValue = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove that and handle in openModal

} else if (value instanceof Parse.File) {
type = 'File';
value = <a target='_blank' href={value.url()}>Open in new window</a>;
openModalWhenClinkingValue = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove that :)

return (
<tr key={data.param}>
<td style={columnStyle} onClick={openModal}>{data.param}</td>
<td style={columnStyle} onClick={openModal}>{type}</td>
<td style={columnStyle} onClick={openModal}>{value}</td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert that :)

@@ -105,11 +108,19 @@ class Config extends TableView {
modalValue: modalValue
});
let columnStyle = { width: '30%', cursor: 'pointer' };

let valueColumn;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all that, and check in openModal

let openModal = () => this.setState({
       modalOpen: true,
       modalParam: data.param,
       modalType: type,
        modalValue: modalValue
      });

// to:

let openModal = () => {
  if (modalValue instanceof Parse.File) { return }
  this.setState({
       modalOpen: true,
       modalParam: data.param,
       modalType: type,
       modalValue: modalValue
  });
}

@facebook-github-bot
Copy link

@natanrolnik updated the pull request - view changes

@@ -40,7 +40,7 @@ export default class FileInput extends React.Component {
render() {
let inputProps = {
type: 'file',
value: null,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generating a warning with files

@natanrolnik
Copy link
Contributor Author

natanrolnik commented Feb 20, 2017

@flovilmart thanks for your review!
I indeed could do it in a more elegant way, and I've updated the PR.

But I couldn't move the if (modalValue instanceof Parse.File) { return } condition to the openModal callback. This is because I do want to open the modal when it's a file, I just don't want it to be triggered from the last column. So I kinda created a mix of our two solutions, making it cleaner.

As a plus, I've also fixed the display of GeoPoints!

@natanrolnik natanrolnik merged commit e7cd92e into parse-community:master Feb 20, 2017
@natanrolnik natanrolnik deleted the file-display-error branch February 20, 2017 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants