Skip to content

Commit

Permalink
Merge branch 'parse-community:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sakibguy committed May 25, 2021
2 parents 114c69f + cf3e1f7 commit 2fedd25
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 48 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Parse Dashboard is a standalone dashboard for managing your [Parse Server](https
* [App Icon Configuration](#app-icon-configuration)
* [App Background Color Configuration](#app-background-color-configuration)
* [Other Configuration Options](#other-configuration-options)
* [Prevent columns sorting](#prevent-columns-sorting)
* [Running as Express Middleware](#running-as-express-middleware)
* [Deploying Parse Dashboard](#deploying-parse-dashboard)
* [Preparing for Deployment](#preparing-for-deployment)
Expand Down Expand Up @@ -241,6 +242,33 @@ You can set `appNameForURL` in the config file for each app to control the url o

To change the app to production, simply set `production` to `true` in your config file. The default value is false if not specified.

### Prevent columns sorting

You can prevent some columns to be sortable by adding `preventSort` to columnPreference options in each app configuration

```json

"apps": [
{
"appId": "local_app_id",
"columnPreference": {
"_User": [
{
"name": "createdAt",
"visible": true,
"preventSort": true
},
{
"name": "updatedAt",
"visible": true,
"preventSort": false
},
]
}
}
]
```

# Running as Express Middleware

Instead of starting Parse Dashboard with the CLI, you can also run it as an [express](https://github.com/expressjs/express) middleware.
Expand Down
89 changes: 49 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"LICENSE"
],
"dependencies": {
"@babel/runtime": "7.13.17",
"@babel/runtime": "7.14.0",
"bcryptjs": "2.3.0",
"body-parser": "1.19.0",
"codemirror-graphql": "github:timsuchanek/codemirror-graphql#details-fix",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class DataBrowserHeaderBar extends React.Component {
</div>
];

headers.forEach(({ width, name, type, targetClass, order, visible }, i) => {
headers.forEach(({ width, name, type, targetClass, order, visible, preventSort }, i) => {
if (!visible) return;
let wrapStyle = { width };
if (i % 2) {
Expand All @@ -36,15 +36,20 @@ export default class DataBrowserHeaderBar extends React.Component {
wrapStyle.background = '#66637A';
}
let onClick = null;
if (type === 'String' || type === 'Number' || type === 'Date' || type === 'Boolean') {
if (!preventSort && (type === 'String' || type === 'Number' || type === 'Date' || type === 'Boolean')) {
onClick = () => updateOrdering((order === 'descending' ? '' : '-') + name);
}

let className = styles.wrap;
if (preventSort) {
className += ` ${styles.preventSort} `;
}

elements.push(
<div
onClick={onClick}
key={'header' + i}
className={styles.wrap}
className={className}
style={ wrapStyle }>
<DataBrowserHeader
name={name}
Expand All @@ -65,7 +70,7 @@ export default class DataBrowserHeaderBar extends React.Component {
if (headers.length % 2) {
finalStyle.background = 'rgba(224,224,234,0.10)';
}

elements.push(
readonly || preventSchemaEdits ? null : (
<div key='add' className={styles.addColumn} style={finalStyle}>
Expand Down
6 changes: 6 additions & 0 deletions src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@
}
}
}

.preventSort {
:hover {
cursor: not-allowed;
}
}
7 changes: 4 additions & 3 deletions src/dashboard/Data/Browser/BrowserTable.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ export default class BrowserTable extends React.Component {
}
}

let headers = this.props.order.map(({ name, width, visible }) => (
let headers = this.props.order.map(({ name, width, visible, preventSort }) => (
{
width: width,
name: name,
type: this.props.columns[name].type,
targetClass: this.props.columns[name].targetClass,
order: ordering.col === name ? ordering.direction : null,
visible
visible,
preventSort
}
));
let editor = null;
Expand Down Expand Up @@ -140,7 +141,7 @@ export default class BrowserTable extends React.Component {
setRelation={this.props.setRelation}
setCopyableValue={this.props.setCopyableValue}
setContextMenu={this.props.setContextMenu}
onEditSelectedRow={this.props.onEditSelectedRow}
onEditSelectedRow={this.props.onEditSelectedRow}
/>
<Button
value="Add"
Expand Down

0 comments on commit 2fedd25

Please sign in to comment.