Skip to content

Commit

Permalink
Feat/275 (#292)
Browse files Browse the repository at this point in the history
* pointer array

* parse

* reverting configs

* style update

* reverting configs

* config fix

* config fix2

Co-authored-by: Faisal Nadeem <[email protected]>
  • Loading branch information
fn-faisal and faisal154 authored Jun 15, 2021
1 parent 0fd0197 commit 76f3b4a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 5 deletions.
32 changes: 29 additions & 3 deletions src/components/BrowserCell/BrowserCell.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,33 @@ class BrowserCell extends Component {
value.id
);
this.copyableValue = value.id;
} else if (type === 'Date') {
}
else if (type === 'Array') {
if ( 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(
<a key={i} href='javascript:;' onClick={onPointerClick.bind(undefined, object)}>
<Pill value={v.objectId} />
</a>);
});
this.copyableValue = content = <ul>
{ array.map( a => <li>{a}</li>) }
</ul>
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') {
Expand All @@ -257,7 +283,7 @@ 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';
Expand Down Expand Up @@ -305,7 +331,7 @@ class BrowserCell extends Component {
if (current) {
classes.push(styles.current);
}

return readonly ? (
<Tooltip placement='bottom' tooltip='Read only (CTRL+C to copy)' visible={this.state.showTooltip}>
<span
Expand Down
17 changes: 17 additions & 0 deletions src/components/BrowserCell/BrowserCell.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,20 @@
color: #353446;
opacity: .9;
}

.hasMore{
height: auto;
max-height: 25px;
overflow-y: scroll;
}

.hasMore::-webkit-scrollbar {
-webkit-appearance: none!important;
width: 7px!important;
}

.hasMore::-webkit-scrollbar-thumb {
border-radius: 4px!important;
background-color: rgba(0, 0, 0, .5)!important;
box-shadow: 0 0 1px rgba(255, 255, 255, .5)!important;
}
2 changes: 1 addition & 1 deletion src/components/BrowserRow/BrowserRow.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ export default class BrowserRow extends Component {
</div>
);
}
}
}
2 changes: 1 addition & 1 deletion src/dashboard/Data/Browser/Browser.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ body:global(.expanded) {
@include MonospaceFont;
font-size: 12px;
white-space: nowrap;
height: 31px;
height: auto;
border-bottom: 1px solid #e3e3ea;

&:nth-child(odd) {
Expand Down

0 comments on commit 76f3b4a

Please sign in to comment.