Skip to content

Commit

Permalink
Merge branch 'feature/2610' of https://github.com/vardhan0604/parse-d…
Browse files Browse the repository at this point in the history
…ashboard into feature/2610
  • Loading branch information
vardhan0604 committed Jan 30, 2025
2 parents 01d1bdb + c81bf1c commit 6ed8fb9
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 39 deletions.
35 changes: 35 additions & 0 deletions changelogs/CHANGELOG_alpha.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# [6.0.0-alpha.24](https://github.com/ParsePlatform/parse-dashboard/compare/6.0.0-alpha.23...6.0.0-alpha.24) (2025-01-29)


### Bug Fixes

* Info panel Cloud Code call sends `objectId` instead of `Parse.Object` ([#2643](https://github.com/ParsePlatform/parse-dashboard/issues/2643)) ([a4bcabc](https://github.com/ParsePlatform/parse-dashboard/commit/a4bcabc5c5eaf07bc9eed11814c19901e1d310da))

# [6.0.0-alpha.23](https://github.com/ParsePlatform/parse-dashboard/compare/6.0.0-alpha.22...6.0.0-alpha.23) (2025-01-29)


### Bug Fixes

* Info panel Cloud Code call is unauthenticated without using master key ([#2641](https://github.com/ParsePlatform/parse-dashboard/issues/2641)) ([e879e4f](https://github.com/ParsePlatform/parse-dashboard/commit/e879e4f541dc0aa3e23afe6606ee7df9ba22b63a))

# [6.0.0-alpha.22](https://github.com/ParsePlatform/parse-dashboard/compare/6.0.0-alpha.21...6.0.0-alpha.22) (2025-01-29)


### Bug Fixes

* Info panel not configurable via `new ParseDashboard()` when running as express middleware ([#2639](https://github.com/ParsePlatform/parse-dashboard/issues/2639)) ([a9b8cd4](https://github.com/ParsePlatform/parse-dashboard/commit/a9b8cd4a7228837cbb462a45e39b01494852f347))

# [6.0.0-alpha.21](https://github.com/ParsePlatform/parse-dashboard/compare/6.0.0-alpha.20...6.0.0-alpha.21) (2025-01-24)


### Bug Fixes

* Info panel not showing when some apps miss infoPanel config ([#2627](https://github.com/ParsePlatform/parse-dashboard/issues/2627)) ([539e883](https://github.com/ParsePlatform/parse-dashboard/commit/539e88348721bc100a80ae00de81a921bc2c53d4))

# [6.0.0-alpha.20](https://github.com/ParsePlatform/parse-dashboard/compare/6.0.0-alpha.19...6.0.0-alpha.20) (2024-11-19)


### Bug Fixes

* Security upgrade cross-spawn from 7.0.3 to 7.0.6 ([#2629](https://github.com/ParsePlatform/parse-dashboard/issues/2629)) ([47a43e0](https://github.com/ParsePlatform/parse-dashboard/commit/47a43e0ac5d55fc9e214079895f71af7c7e3c350))

# [6.0.0-alpha.19](https://github.com/ParsePlatform/parse-dashboard/compare/6.0.0-alpha.18...6.0.0-alpha.19) (2024-10-16)


Expand Down
32 changes: 17 additions & 15 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "parse-dashboard",
"version": "6.0.0-alpha.19",
"version": "6.0.0-alpha.24",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-dashboard"
Expand Down Expand Up @@ -45,7 +45,7 @@
"copy-to-clipboard": "3.3.2",
"core-js": "3.28.0",
"csurf": "1.11.0",
"express": "4.21.1",
"express": "4.21.2",
"graphiql": "2.0.8",
"graphql": "16.8.1",
"immutable": "4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/components/BrowserCell/BrowserCell.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export default class BrowserCell extends Component {
this.props.setShowAggregatedData(true);
this.props.setSelectedObjectId(this.props.objectId);
if (this.props.isPanelVisible) {
this.props.callCloudFunction(this.props.objectId, this.props.className);
this.props.callCloudFunction(this.props.objectId, this.props.className, this.props.appId);
}
}

Expand Down Expand Up @@ -649,7 +649,7 @@ export default class BrowserCell extends Component {
isPanelVisible &&
((e.shiftKey && !this.props.firstSelectedCell) || !e.shiftKey)
) {
callCloudFunction(this.props.objectId, this.props.className);
callCloudFunction(this.props.objectId, this.props.className, this.props.appId);
}
}
handleCellClick(e, row, col);
Expand Down
8 changes: 4 additions & 4 deletions src/components/Toolbar/Toolbar.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useNavigate, useNavigationType, NavigationType } from 'react-router-dom

const POPOVER_CONTENT_ID = 'toolbarStatsPopover';

const Stats = ({ data, classwiseCloudFunctions, className }) => {
const Stats = ({ data, classwiseCloudFunctions, className, appId , appName}) => {
const [selected, setSelected] = React.useState(null);
const [open, setOpen] = React.useState(false);
const buttonRef = React.useRef();
Expand Down Expand Up @@ -98,7 +98,7 @@ const Stats = ({ data, classwiseCloudFunctions, className }) => {
setSelected(statsOptions[0]);
}, []);

const rightMarginStyle = classwiseCloudFunctions && classwiseCloudFunctions[className] ? '120px' : 'initial';
const rightMarginStyle = classwiseCloudFunctions && classwiseCloudFunctions[`${appId}${appName}`] && classwiseCloudFunctions[`${appId}${appName}`][className] ? '120px' : 'initial';

return (
<>
Expand Down Expand Up @@ -140,9 +140,9 @@ const Toolbar = props => {
</div>
</div>
</div>
{props?.selectedData?.length ? <Stats data={props.selectedData} classwiseCloudFunctions={props.classwiseCloudFunctions} className={props.className} /> : null}
{props?.selectedData?.length ? <Stats data={props.selectedData} classwiseCloudFunctions={props.classwiseCloudFunctions} className={props.className} appId={props.appId} appName={props.appName}/> : null}
<div className={styles.actions}>{props.children}</div>
{props.classwiseCloudFunctions && props.classwiseCloudFunctions[props.className] && (
{props.classwiseCloudFunctions && props.classwiseCloudFunctions[`${props.appId}${props.appName}`] && props.classwiseCloudFunctions[`${props.appId}${props.appName}`][props.className] && (
<button
onClick={props.togglePanel}
className={styles.btn}
Expand Down
26 changes: 15 additions & 11 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import { Helmet } from 'react-helmet';
import generatePath from 'lib/generatePath';
import { withRouter } from 'lib/withRouter';
import { get } from 'lib/AJAX';
import { setBasePath } from 'lib/AJAX';

// The initial and max amount of rows fetched by lazy loading
const MAX_ROWS_FETCHED = 200;
Expand Down Expand Up @@ -212,7 +211,6 @@ class Browser extends DashboardView {
componentDidMount() {
this.addLocation(this.props.params.appId);
window.addEventListener('mouseup', this.onMouseUpRowCheckBox);
setBasePath('/');
get('/parse-dashboard-config.json').then(data => {
this.setState({ configData: data });
this.classAndCloudFuntionMap(this.state.configData);
Expand Down Expand Up @@ -266,16 +264,19 @@ class Browser extends DashboardView {
});
}

fetchAggregationPanelData(objectId, className) {
fetchAggregationPanelData(objectId, className, appId) {
this.setState({
isLoading: true,
});
const params = {
objectId: objectId,
object: Parse.Object.extend(className).createWithoutData(objectId).toPointer(),
};
const cloudCodeFunction = this.state.classwiseCloudFunctions[className][0].cloudCodeFunction;

Parse.Cloud.run(cloudCodeFunction, params).then(
const options = {
useMasterKey: true,
}
const appName = this.props.params.appId;
const cloudCodeFunction = this.state.classwiseCloudFunctions[`${appId}${appName}`]?.[className][0].cloudCodeFunction;
Parse.Cloud.run(cloudCodeFunction, params, options).then(
result => {
if (result && result.panel && result.panel && result.panel.segments) {
this.setState({ AggregationPanelData: result, isLoading: false });
Expand Down Expand Up @@ -328,12 +329,14 @@ class Browser extends DashboardView {
classAndCloudFuntionMap(data) {
const classMap = {};
data.apps.forEach(app => {
app.infoPanel.forEach(panel => {
const appName = app.appName;
classMap[`${app.appId}${appName}`] = {};
app.infoPanel && app.infoPanel.forEach(panel => {
panel.classes.forEach(className => {
if (!classMap[className]) {
classMap[className] = [];
if (!classMap[`${app.appId}${appName}`][className]) {
classMap[`${app.appId}${appName}`][className] = [];
}
classMap[className].push({
classMap[`${app.appId}${appName}`][className].push({
title: panel.title,
cloudCodeFunction: panel.cloudCodeFunction,
classes: panel.classes,
Expand Down Expand Up @@ -2066,6 +2069,7 @@ class Browser extends DashboardView {
setAggregationPanelData={this.setAggregationPanelData}
setErrorAggregatedData={this.setErrorAggregatedData}
errorAggregatedData={this.state.errorAggregatedData}
appName = {this.props.params.appId}
/>
);
}
Expand Down
6 changes: 5 additions & 1 deletion src/dashboard/Data/Browser/BrowserToolbar.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ const BrowserToolbar = ({

togglePanel,
isPanelVisible,
classwiseCloudFunctions
classwiseCloudFunctions,
appId,
appName
}) => {
const selectionLength = Object.keys(selection).length;
const isPendingEditCloneRows = editCloneRows && editCloneRows.length > 0;
Expand Down Expand Up @@ -276,6 +278,8 @@ const BrowserToolbar = ({
togglePanel={togglePanel}
isPanelVisible={isPanelVisible}
classwiseCloudFunctions={classwiseCloudFunctions}
appId={appId}
appName = {appName}
>
{onAddRow && (
<a className={classes.join(' ')} onClick={onClick}>
Expand Down
10 changes: 6 additions & 4 deletions src/dashboard/Data/Browser/DataBrowser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class DataBrowser extends React.Component {
this.setState({ order });
}
if (props && props.className) {
if (!props.classwiseCloudFunctions[props.className]) {
if (!props.classwiseCloudFunctions?.[`${props.app.applicationId}${props.appName}`]?.[props.className]) {
this.setState({ isPanelVisible: false });
this.setState({ selectedObjectId: undefined });
}
Expand Down Expand Up @@ -198,7 +198,7 @@ export default class DataBrowser extends React.Component {
if(this.props.errorAggregatedData != {}){
this.props.setErrorAggregatedData({});
}
this.props.callCloudFunction(this.state.selectedObjectId, this.props.className);
this.props.callCloudFunction(this.state.selectedObjectId, this.props.className,this.props.app.applicationId);
}
}

Expand Down Expand Up @@ -364,7 +364,7 @@ export default class DataBrowser extends React.Component {
showAggregatedData:true
})
if(prevObjectID !== this.state.selectedObjectId && this.state.isPanelVisible){
this.props.callCloudFunction(this.state.selectedObjectId,this.props.className)
this.props.callCloudFunction(this.state.selectedObjectId,this.props.className,this.props.app.applicationId)
}
e.preventDefault();
break;
Expand Down Expand Up @@ -405,7 +405,7 @@ export default class DataBrowser extends React.Component {
showAggregatedData: true,
});
if (prevObjectID !== this.state.selectedObjectId && this.state.isPanelVisible) {
this.props.callCloudFunction(this.state.selectedObjectId, this.props.className);
this.props.callCloudFunction(this.state.selectedObjectId, this.props.className,this.props.app.applicationId);
}

e.preventDefault();
Expand Down Expand Up @@ -642,6 +642,8 @@ export default class DataBrowser extends React.Component {
allClassesSchema={this.state.allClassesSchema}
togglePanel={this.togglePanelVisibility}
isPanelVisible={this.state.isPanelVisible}
appId={this.props.app.applicationId}
appName = {this.props.appName}
{...other}
/>

Expand Down

0 comments on commit 6ed8fb9

Please sign in to comment.