From 9d0504b337dc8418bc31468b6736670498944ce0 Mon Sep 17 00:00:00 2001 From: Snyk bot Date: Mon, 24 May 2021 10:18:53 +0300 Subject: [PATCH 1/3] fix: upgrade @babel/runtime from 7.13.17 to 7.14.0 (#1710) Snyk has created this PR to upgrade @babel/runtime from 7.13.17 to 7.14.0. See this package in npm: https://www.npmjs.com/package/@babel/runtime See this project in Snyk: https://app.snyk.io/org/acinader/project/953c8e1a-a9ef-4134-afbe-43474913abbb?utm_source=github&utm_medium=upgrade-pr --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3dcfa1ca5c..e9d8d2ad0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1212,9 +1212,9 @@ } }, "@babel/runtime": { - "version": "7.13.17", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.17.tgz", - "integrity": "sha512-NCdgJEelPTSh+FEFylhnP1ylq848l1z9t9N0j1Lfbcw0+KXGjsTvUmkxy+voLLXB5SOKMbLLx4jxYliGrYQseA==", + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.0.tgz", + "integrity": "sha512-JELkvo/DlpNdJ7dlyw/eY7E0suy5i5GQH+Vlxaq1nsNJ+H7f4Vtv3jMeCEgRhZZQFXTjldYfQgv2qmM6M1v5wA==", "requires": { "regenerator-runtime": "^0.13.4" } diff --git a/package.json b/package.json index 6efa87c3e9..10ca3996b6 100644 --- a/package.json +++ b/package.json @@ -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", From 569db4bf9b2f42dada34f8afae6bb38d294406bc Mon Sep 17 00:00:00 2001 From: Christopher Brookes Date: Mon, 24 May 2021 09:21:38 +0200 Subject: [PATCH 2/3] feat(preventSort): allow preventSort from columnPreferences props (#1709) * feat(preventSort): allow preventSort from columnPreferences props * feat(preventSort): add doc section of prevent sorting --- README.md | 28 +++++++++++++++++++ .../DataBrowserHeaderBar.react.js | 13 ++++++--- .../DataBrowserHeaderBar.scss | 6 ++++ .../Data/Browser/BrowserTable.react.js | 7 +++-- 4 files changed, 47 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4ad256b97a..a59a54c06b 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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. diff --git a/src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.react.js b/src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.react.js index a773e13cf4..04007d4426 100644 --- a/src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.react.js +++ b/src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.react.js @@ -27,7 +27,7 @@ export default class DataBrowserHeaderBar extends React.Component { ]; - 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) { @@ -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(
diff --git a/src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.scss b/src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.scss index eb38c70c29..01a1283b32 100644 --- a/src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.scss +++ b/src/components/DataBrowserHeaderBar/DataBrowserHeaderBar.scss @@ -72,3 +72,9 @@ } } } + +.preventSort { + :hover { + cursor: not-allowed; + } +} diff --git a/src/dashboard/Data/Browser/BrowserTable.react.js b/src/dashboard/Data/Browser/BrowserTable.react.js index bfdc488dab..f68853ac59 100644 --- a/src/dashboard/Data/Browser/BrowserTable.react.js +++ b/src/dashboard/Data/Browser/BrowserTable.react.js @@ -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; @@ -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} />