Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Side Nav Redesign #285

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,20 @@ import './global-styles.scss';

interface Props extends RouteComponentProps {
setHeaderActionMenu: (menuMount?: MountPoint) => void;
hideInAppSideNavBar: boolean;
}

export const FlowFrameworkDashboardsApp = (props: Props) => {
const { setHeaderActionMenu } = props;
const { setHeaderActionMenu, hideInAppSideNavBar } = props;
const location = useLocation();
const queryParams = getDataSourceFromURL(location);
const dataSourceId = queryParams.dataSourceId;
const sidebar = (
<EuiPageSideBar style={{ minWidth: 190 }} hidden={false} paddingSize="l">
<EuiPageSideBar
style={{ minWidth: 190 }}
hidden={hideInAppSideNavBar}
paddingSize="l"
>
<EuiSideNav
style={{ width: 190 }}
items={[
Expand Down
13 changes: 12 additions & 1 deletion public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import {
AppMountParameters,
CoreSetup,
DEFAULT_NAV_GROUPS,
DEFAULT_APP_CATEGORIES,
CoreStart,
Plugin,
} from '../../../src/core/public';
Expand Down Expand Up @@ -34,6 +36,7 @@ export class FlowFrameworkDashboardsPlugin
core: CoreSetup,
plugins: any
): FlowFrameworkDashboardsPluginSetup {
const hideInAppSideNavBar = core.chrome.navGroup.getNavGroupEnabled();
// Register the plugin in the side navigation
core.application.register({
id: PLUGIN_ID,
Expand All @@ -52,9 +55,17 @@ export class FlowFrameworkDashboardsPlugin
const routeServices = configureRoutes(coreStart);
setCore(coreStart);
setRouteService(routeServices);
return renderApp(coreStart, params);
return renderApp(coreStart, params, hideInAppSideNavBar);
},
});
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.search, [
{
id: PLUGIN_ID,
title: 'Search Studio',
category: DEFAULT_APP_CATEGORIES.configure,
showInAllNavGroup: true,
},
]);
setDataSourceManagementPlugin(plugins.dataSourceManagement);
const enabled = !!plugins.dataSource;
setDataSourceEnabled({ enabled });
Expand Down
7 changes: 6 additions & 1 deletion public/render_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import { store } from './store';
// styling
import './global-styles.scss';

export const renderApp = (coreStart: CoreStart, params: AppMountParameters) => {
export const renderApp = (
coreStart: CoreStart,
params: AppMountParameters,
hideInAppSideNavBar: boolean
) => {
// This is so our base element stretches to fit the entire webpage
params.element.className = 'stretch-absolute';
ReactDOM.render(
Expand All @@ -24,6 +28,7 @@ export const renderApp = (coreStart: CoreStart, params: AppMountParameters) => {
render={(props) => (
<FlowFrameworkDashboardsApp
setHeaderActionMenu={params.setHeaderActionMenu}
hideInAppSideNavBar={hideInAppSideNavBar}
{...props}
/>
)}
Expand Down
Loading