Skip to content

Commit b7698be

Browse files
fn-faisalfaisal154
andauthored
Arrays of Pointers dont render correctly #275 (#1727)
* pointer array * fix for array Co-authored-by: Faisal Nadeem <[email protected]>
1 parent 6cfcb46 commit b7698be

File tree

4 files changed

+88
-6
lines changed

4 files changed

+88
-6
lines changed

Parse-Dashboard/public/index.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<head>
3+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
4+
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
5+
<base href="/"/>
6+
<script>
7+
PARSE_DASHBOARD_PATH = "/";
8+
</script>
9+
</head>
10+
<html>
11+
<title>Parse Dashboard</title>
12+
<body>
13+
<div id="browser_mount"></div>
14+
<script type="text/javascript">
15+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
16+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
17+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
18+
})(window,document,'script','https://a.back4app.com/a.js','ga');
19+
ga('create', 'UA-66038885-1', 'auto');
20+
ga('send', 'pageview');
21+
setTimeout("ga('send','event','Profitable Engagement','time on page more than 30 seconds')",30000);
22+
</script>
23+
<!--Start of Zopim Live Chat Script-->
24+
<script>
25+
window.zEmbed||(function(){
26+
var queue = [];
27+
28+
window.zEmbed = function() {
29+
queue.push(arguments);
30+
}
31+
window.zE = window.zE || window.zEmbed;
32+
document.zendeskHost = "back4app.zendesk.com";
33+
document.zEQueue = queue;
34+
}());
35+
</script>
36+
<script src="https://assets.zendesk.com/embeddable_framework/main.js" data-ze-csp="true" async defer></script>
37+
<!--End of Zopim Live Chat Script-->
38+
<script src="https://survey.solucx.com.br/widget.js"></script>
39+
<script type="text/javascript" src="http://localhost:9000/back4app-navigation.bundle.js"></script><script type="text/javascript" src="bundles/dashboard.751689feb1b99fab176b.js"></script><script type="text/javascript" src="bundles/login.2cc31a054b35c671c417.js"></script></body>
40+
</html>

src/components/BrowserCell/BrowserCell.react.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,33 @@ export default class BrowserCell extends Component {
250250
value.id
251251
);
252252
this.copyableValue = value.id;
253-
} else if (type === 'Date') {
253+
}
254+
else if (type === 'Array') {
255+
if ( value[0] && typeof value[0] === 'object' && value[0].__type === 'Pointer' ) {
256+
const array = [];
257+
value.map( (v, i) => {
258+
if ( typeof v !== 'object' || v.__type !== 'Pointer' ) {
259+
throw new Error('Invalid type found in pointer array');
260+
}
261+
const object = new Parse.Object(v.className);
262+
object.id = v.objectId;
263+
array.push(
264+
<a key={i} href='javascript:;' onClick={onPointerClick.bind(undefined, object)}>
265+
<Pill value={v.objectId} />
266+
</a>);
267+
});
268+
this.copyableValue = content = <ul>
269+
{ array.map( a => <li>{a}</li>) }
270+
</ul>
271+
if ( array.length > 1 ) {
272+
classes.push(styles.hasMore);
273+
}
274+
}
275+
else {
276+
this.copyableValue = content = JSON.stringify(value);
277+
}
278+
}
279+
else if (type === 'Date') {
254280
if (typeof value === 'object' && value.__type) {
255281
value = new Date(value.iso);
256282
} else if (typeof value === 'string') {
@@ -259,7 +285,7 @@ export default class BrowserCell extends Component {
259285
this.copyableValue = content = dateStringUTC(value);
260286
} else if (type === 'Boolean') {
261287
this.copyableValue = content = value ? 'True' : 'False';
262-
} else if (type === 'Object' || type === 'Bytes' || type === 'Array') {
288+
} else if (type === 'Object' || type === 'Bytes') {
263289
this.copyableValue = content = JSON.stringify(value);
264290
} else if (type === 'File') {
265291
const fileName = value.url() ? getFileName(value) : 'Uploading\u2026';
@@ -304,11 +330,11 @@ export default class BrowserCell extends Component {
304330
if (current) {
305331
classes.push(styles.current);
306332
}
307-
333+
308334
if (markRequiredField && isRequired && !value) {
309335
classes.push(styles.required);
310336
}
311-
337+
312338
return readonly ? (
313339
<Tooltip placement='bottom' tooltip='Read only (CTRL+C to copy)' visible={this.state.showTooltip} >
314340
<span

src/components/BrowserCell/BrowserCell.scss

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@
3636
}
3737
}
3838

39+
.hasMore{
40+
height: auto;
41+
max-height: 25px;
42+
overflow-y: scroll;
43+
}
44+
45+
.hasMore::-webkit-scrollbar {
46+
-webkit-appearance: none!important;
47+
width: 7px!important;
48+
}
49+
50+
.hasMore::-webkit-scrollbar-thumb {
51+
border-radius: 4px!important;
52+
background-color: rgba(0, 0, 0, .5)!important;
53+
box-shadow: 0 0 1px rgba(255, 255, 255, .5)!important;
54+
}
3955
.required {
4056
position: relative;
4157

@@ -49,4 +65,4 @@
4965
right: 0;
5066
bottom: 0;
5167
}
52-
}
68+
}

src/dashboard/Data/Browser/Browser.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
@include MonospaceFont;
103103
font-size: 12px;
104104
white-space: nowrap;
105-
height: 31px;
105+
height: auto;
106106
border-bottom: 1px solid #e3e3ea;
107107

108108
&:nth-child(odd) {

0 commit comments

Comments
 (0)