From b7698be6be504bc421f3483eb9a5da4fef32461e Mon Sep 17 00:00:00 2001 From: fn-faisal Date: Mon, 26 Jul 2021 22:40:44 +0500 Subject: [PATCH] Arrays of Pointers dont render correctly #275 (#1727) * pointer array * fix for array Co-authored-by: Faisal Nadeem --- Parse-Dashboard/public/index.html | 40 +++++++++++++++++++ .../BrowserCell/BrowserCell.react.js | 34 ++++++++++++++-- src/components/BrowserCell/BrowserCell.scss | 18 ++++++++- src/dashboard/Data/Browser/Browser.scss | 2 +- 4 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 Parse-Dashboard/public/index.html diff --git a/Parse-Dashboard/public/index.html b/Parse-Dashboard/public/index.html new file mode 100644 index 0000000000..bb91f96efc --- /dev/null +++ b/Parse-Dashboard/public/index.html @@ -0,0 +1,40 @@ + + + + + + + + +Parse Dashboard + +
+ + + + + + + + diff --git a/src/components/BrowserCell/BrowserCell.react.js b/src/components/BrowserCell/BrowserCell.react.js index 3155557934..a88af181ba 100644 --- a/src/components/BrowserCell/BrowserCell.react.js +++ b/src/components/BrowserCell/BrowserCell.react.js @@ -250,7 +250,33 @@ export default class BrowserCell extends Component { value.id ); this.copyableValue = value.id; - } else if (type === 'Date') { + } + else if (type === 'Array') { + if ( value[0] && typeof value[0] === 'object' && value[0].__type === 'Pointer' ) { + const array = []; + value.map( (v, i) => { + if ( typeof v !== 'object' || v.__type !== 'Pointer' ) { + throw new Error('Invalid type found in pointer array'); + } + const object = new Parse.Object(v.className); + object.id = v.objectId; + array.push( + + + ); + }); + this.copyableValue = content = + if ( array.length > 1 ) { + classes.push(styles.hasMore); + } + } + else { + this.copyableValue = content = JSON.stringify(value); + } + } + else if (type === 'Date') { if (typeof value === 'object' && value.__type) { value = new Date(value.iso); } else if (typeof value === 'string') { @@ -259,7 +285,7 @@ export default class BrowserCell extends Component { this.copyableValue = content = dateStringUTC(value); } else if (type === 'Boolean') { this.copyableValue = content = value ? 'True' : 'False'; - } else if (type === 'Object' || type === 'Bytes' || type === 'Array') { + } else if (type === 'Object' || type === 'Bytes') { this.copyableValue = content = JSON.stringify(value); } else if (type === 'File') { const fileName = value.url() ? getFileName(value) : 'Uploading\u2026'; @@ -304,11 +330,11 @@ export default class BrowserCell extends Component { if (current) { classes.push(styles.current); } - + if (markRequiredField && isRequired && !value) { classes.push(styles.required); } - + return readonly ? (