Skip to content

Commit

Permalink
revert back to grid, reference too much of issue without hooks
Browse files Browse the repository at this point in the history
Signed-off-by: abbyhu2000 <[email protected]>
  • Loading branch information
abbyhu2000 committed Jul 6, 2023
1 parent 4b711c2 commit 43172be
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ export const DashboardEditor = () => {
dashboard
);

// const { dashboardContainer } = useDashboardContainer(
// services,
// isChromeVisible,
// eventEmitter,
// dashboard,
// savedDashboardInstance,
// appState
// );

const { isEmbeddableRendered, currentAppState } = useEditorUpdates(
eventEmitter,
dashboard,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import { DashboardPanelState } from '../types';
import { withOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public';
import { DashboardContainerInput } from '../dashboard_container';
import { DashboardContainer, DashboardReactContextValue } from '../dashboard_container';
import { DashboardGridItem } from './dashboard_grid_item';

let lastValidGridSize = 0;

Expand Down Expand Up @@ -263,18 +262,34 @@ class DashboardGridUi extends React.Component<DashboardGridProps, State> {
}
});

return _.map(panelsInOrder, ({ explicitInput, type }) => (
<DashboardGridItem
expandedPanelId={expandedPanelId}
focusedPanelIndex={focusedPanelIndex}
id={explicitInput.id}
key={explicitInput.id}
type={type}
gridItems={this.gridItems}
container={this.props.container}
PanelComponent={this.props.PanelComponent}
/>
));
return _.map(panelsInOrder, (panel) => {
const expandPanel =
expandedPanelId !== undefined && expandedPanelId === panel.explicitInput.id;
const hidePanel = expandedPanelId !== undefined && expandedPanelId !== panel.explicitInput.id;
const classes = classNames({
// eslint-disable-next-line @typescript-eslint/naming-convention
'dshDashboardGrid__item--expanded': expandPanel,
// eslint-disable-next-line @typescript-eslint/naming-convention
'dshDashboardGrid__item--hidden': hidePanel,
});
return (
<div
style={{ zIndex: focusedPanelIndex === panel.explicitInput.id ? 2 : 'auto' }}
className={classes}
key={panel.explicitInput.id}
data-test-subj="dashboardPanel"
ref={(reactGridItem) => {
this.gridItems[panel.explicitInput.id] = reactGridItem;
}}
>
<EmbeddableChildPanel
embeddableId={panel.explicitInput.id}
container={this.props.container}
PanelComponent={this.props.PanelComponent}
/>
</div>
);
});
}

public render() {
Expand Down

This file was deleted.

0 comments on commit 43172be

Please sign in to comment.