Skip to content

Commit d94dda6

Browse files
committed
Fix display of ParseFile and GeoPoint in Config
1 parent fd121bd commit d94dda6

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/components/FileInput/FileInput.react.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class FileInput extends React.Component {
4040
render() {
4141
let inputProps = {
4242
type: 'file',
43-
value: null,
43+
value: '',
4444
disabled: this.props.disabled,
4545
onChange: this.handleChange.bind(this),
4646
};
@@ -55,7 +55,7 @@ export default class FileInput extends React.Component {
5555
if (label) {
5656
buttonStyles.push(styles.withLabel)
5757
}
58-
58+
5959
return (
6060
<div className={styles.input}>
6161
<div className={buttonStyles.join(' ')}>

src/dashboard/Data/Config/Config.react.js

+21-4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class Config extends TableView {
7272
let value = data.value;
7373
let modalValue = value;
7474
let type = typeof value;
75+
7576
if (type === 'object') {
7677
if (isDate(value)) {
7778
type = 'Date';
@@ -84,9 +85,9 @@ class Config extends TableView {
8485
type = 'GeoPoint';
8586
value = `(${value.latitude}, ${value.longitude})`;
8687
modalValue = data.value.toJSON();
87-
} else if (value instanceof Parse.File) {
88+
} else if (data.value instanceof Parse.File) {
8889
type = 'File';
89-
value = <a target='_blank' href={value.url()}>Open in new window</a>;
90+
value = <a target='_blank' href={data.value.url()}>Open in new window</a>;
9091
} else {
9192
type = 'Object';
9293
value = JSON.stringify(value);
@@ -105,11 +106,19 @@ class Config extends TableView {
105106
modalValue: modalValue
106107
});
107108
let columnStyle = { width: '30%', cursor: 'pointer' };
109+
110+
let openModalValueColumn = () => {
111+
if (data.value instanceof Parse.File) {
112+
return
113+
}
114+
openModal()
115+
}
116+
108117
return (
109118
<tr key={data.param}>
110119
<td style={columnStyle} onClick={openModal}>{data.param}</td>
111120
<td style={columnStyle} onClick={openModal}>{type}</td>
112-
<td style={columnStyle} onClick={openModal}>{value}</td>
121+
<td style={columnStyle} onClick={openModalValueColumn}>{value}</td>
113122
<td style={{ textAlign: 'center' }}>
114123
<a onClick={this.deleteParam.bind(this, data.param)}>
115124
<Icon width={16} height={16} name='trash-solid' fill='#ff395e' />
@@ -145,7 +154,15 @@ class Config extends TableView {
145154
if (params) {
146155
data = [];
147156
params.forEach((value, param) => {
148-
data.push({ param, value });
157+
let type = typeof value;
158+
if (type === 'object' && value.__type == 'File') {
159+
value = Parse.File.fromJSON(value);
160+
}
161+
else if (type === 'object' && value.__type == 'GeoPoint') {
162+
value = new Parse.GeoPoint(value);
163+
}
164+
165+
data.push({ param: param, value: value })
149166
});
150167
}
151168
}

0 commit comments

Comments
 (0)