Skip to content

Commit

Permalink
fix info panel bug
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Nov 3, 2024
1 parent 6c4d392 commit 8b4a5e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
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 }) => {
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] && classwiseCloudFunctions[appId][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} /> : null}
<div className={styles.actions}>{props.children}</div>
{props.classwiseCloudFunctions && props.classwiseCloudFunctions[props.className] && (
{props.classwiseCloudFunctions && props.classwiseCloudFunctions[props.appId] && props.classwiseCloudFunctions[props.appId][props.className] && (
<button
onClick={props.togglePanel}
className={styles.btn}
Expand Down
13 changes: 7 additions & 6 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,14 @@ class Browser extends DashboardView {
});
}

fetchAggregationPanelData(objectId, className) {
fetchAggregationPanelData(objectId, className, appID) {
this.setState({
isLoading: true,
});
const params = {
objectId: objectId,
};
const cloudCodeFunction = this.state.classwiseCloudFunctions[className][0].cloudCodeFunction;
const cloudCodeFunction = this.state.classwiseCloudFunctions[appID][className][0].cloudCodeFunction;

Parse.Cloud.run(cloudCodeFunction, params).then(
result => {
Expand Down Expand Up @@ -328,12 +328,13 @@ class Browser extends DashboardView {
classAndCloudFuntionMap(data) {
const classMap = {};
data.apps.forEach(app => {
app.infoPanel.forEach(panel => {
classMap[app.appId] = {};
app.infoPanel && app.infoPanel.forEach(panel => {
panel.classes.forEach(className => {
if (!classMap[className]) {
classMap[className] = [];
if (!classMap[app.appId][className]) {
classMap[app.appId][className] = [];
}
classMap[className].push({
classMap[app.appId][className].push({
title: panel.title,
cloudCodeFunction: panel.cloudCodeFunction,
classes: panel.classes,
Expand Down
4 changes: 3 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,8 @@ const BrowserToolbar = ({

togglePanel,
isPanelVisible,
classwiseCloudFunctions
classwiseCloudFunctions,
appId
}) => {
const selectionLength = Object.keys(selection).length;
const isPendingEditCloneRows = editCloneRows && editCloneRows.length > 0;
Expand Down Expand Up @@ -276,6 +277,7 @@ const BrowserToolbar = ({
togglePanel={togglePanel}
isPanelVisible={isPanelVisible}
classwiseCloudFunctions={classwiseCloudFunctions}
appId={appId}
>
{onAddRow && (
<a className={classes.join(' ')} onClick={onClick}>
Expand Down

0 comments on commit 8b4a5e5

Please sign in to comment.