Skip to content

Commit

Permalink
Removing the SideNav within the flow framework dashboards
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <[email protected]>
  • Loading branch information
saimedhi committed Oct 30, 2024
1 parent a197021 commit 759faba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 54 deletions.
50 changes: 4 additions & 46 deletions public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,27 @@ import {
Route,
RouteComponentProps,
Switch,
useLocation,
} from 'react-router-dom';
import {
EuiPageSideBar,
EuiSideNav,
EuiFlexGroup,
EuiFlexItem,
} from '@elastic/eui';
import { Navigation, APP_PATH } from './utils';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { APP_PATH } from './utils';
import {
Workflows,
WorkflowDetail,
WorkflowDetailRouterProps,
WorkflowsRouterProps,
} from './pages';
import { MountPoint } from '../../../src/core/public';
import {
constructHrefWithDataSourceId,
getDataSourceFromURL,
} from './utils/utils';

// styling
import './global-styles.scss';

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

export const FlowFrameworkDashboardsApp = (props: Props) => {
const { setHeaderActionMenu, hideInAppSideNavBar } = props;
const location = useLocation();
const queryParams = getDataSourceFromURL(location);
const dataSourceId = queryParams.dataSourceId;
const sidebar = (
<EuiPageSideBar
style={{ minWidth: 190 }}
hidden={hideInAppSideNavBar}
paddingSize="l"
>
<EuiSideNav
style={{ width: 190 }}
items={[
{
name: Navigation.PluginName,
id: 0,
items: [
{
name: Navigation.Workflows,
id: 1,
href: constructHrefWithDataSourceId(
APP_PATH.WORKFLOWS,
dataSourceId
),
isSelected: props.location.pathname === APP_PATH.WORKFLOWS,
},
],
},
]}
/>
</EuiPageSideBar>
);
const { setHeaderActionMenu } = props;


// Render the application DOM.
return (
Expand All @@ -78,7 +37,6 @@ export const FlowFrameworkDashboardsApp = (props: Props) => {
gutterSize="none"
className="stretch-relative"
>
<EuiFlexItem grow={false}>{sidebar}</EuiFlexItem>
<EuiFlexItem>
<Switch>
<Route
Expand Down
3 changes: 1 addition & 2 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ 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 @@ -62,7 +61,7 @@ export class FlowFrameworkDashboardsPlugin
setCore(coreStart);
setHeaderActionMenu(params.setHeaderActionMenu);
setRouteService(routeServices);
return renderApp(coreStart, params, hideInAppSideNavBar);
return renderApp(coreStart, params);
},
});
core.chrome.navGroup.addNavLinksToGroup(DEFAULT_NAV_GROUPS.search, [
Expand Down
7 changes: 1 addition & 6 deletions public/render_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ import { store } from './store';
// styling
import './global-styles.scss';

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

0 comments on commit 759faba

Please sign in to comment.