Skip to content

Commit

Permalink
Fix bottom bar visibility using create portal (opensearch-project#3336)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Myssak <[email protected]>
Signed-off-by: Sergey Myssak <[email protected]>
  • Loading branch information
SergeyMyssak and andreymyssak committed May 3, 2023
1 parent ca0bb8f commit 7db78cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/core/public/rendering/rendering_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class RenderingService {
{chromeUi}

<AppWrapper chromeVisible$={chrome.getIsVisible$()}>
<div className="app-wrapper-panel">
<div id="app-wrapper-panel" className="app-wrapper-panel">
<div id="globalBannerList">{bannerUi}</div>
<AppContainer classes$={chrome.getApplicationClasses$()}>{appUi}</AppContainer>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ import {
import { FormattedMessage } from '@osd/i18n/react';
import { isEmpty } from 'lodash';
import { i18n } from '@osd/i18n';
import { DocLinksStart, ToastsStart } from 'opensearch-dashboards/public';
import { createPortal } from 'react-dom';
import { toMountPoint } from '../../../../../opensearch_dashboards_react/public';
import { DocLinksStart, ToastsStart } from '../../../../../../core/public';

import { getCategoryName } from '../../lib';
import { Field, getEditableValue } from '../field';
Expand Down Expand Up @@ -338,7 +339,7 @@ export class Form extends PureComponent<FormProps> {
renderBottomBar = () => {
const areChangesInvalid = this.areChangesInvalid();
return (
<EuiBottomBar data-test-subj="advancedSetting-bottomBar">
<EuiBottomBar data-test-subj="advancedSetting-bottomBar" position="sticky">
<EuiFlexGroup
justifyContent="spaceBetween"
alignItems="center"
Expand Down Expand Up @@ -400,12 +401,7 @@ export class Form extends PureComponent<FormProps> {
const { visibleSettings, categories, categoryCounts, clearQuery } = this.props;
const currentCategories: Category[] = [];
const hasUnsavedChanges = !isEmpty(unsavedChanges);

if (hasUnsavedChanges) {
document.body.classList.add('osdBody--mgtAdvancedSettingsHasBottomBar');
} else {
document.body.classList.remove('osdBody--mgtAdvancedSettingsHasBottomBar');
}
const container = document.getElementById('app-wrapper-panel')!;

categories.forEach((category) => {
if (visibleSettings[category] && visibleSettings[category].length) {
Expand All @@ -426,7 +422,7 @@ export class Form extends PureComponent<FormProps> {
})
: this.maybeRenderNoSettings(clearQuery)}
</div>
{hasUnsavedChanges && this.renderBottomBar()}
{hasUnsavedChanges && createPortal(this.renderBottomBar(), container)}
</Fragment>
);
}
Expand Down

0 comments on commit 7db78cf

Please sign in to comment.