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

Improve workspace to fit entire available page #145

Merged
merged 1 commit into from
Apr 22, 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
80 changes: 44 additions & 36 deletions public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

import React from 'react';
import { Route, RouteComponentProps, Switch } from 'react-router-dom';
import { EuiPageSideBar, EuiSideNav, EuiPageTemplate } from '@elastic/eui';
import {
EuiPageSideBar,
EuiSideNav,
EuiFlexGroup,
EuiFlexItem,
} from '@elastic/eui';
import { Navigation, APP_PATH } from './utils';
import {
Workflows,
Expand All @@ -14,6 +19,9 @@ import {
WorkflowsRouterProps,
} from './pages';

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

interface Props extends RouteComponentProps {}

export const FlowFrameworkDashboardsApp = (props: Props) => {
Expand Down Expand Up @@ -41,44 +49,44 @@ export const FlowFrameworkDashboardsApp = (props: Props) => {

// Render the application DOM.
return (
<EuiPageTemplate
template="empty"
paddingSize="none"
grow={true}
restrictWidth={false}
pageContentProps={{ paddingSize: 's' }}
pageSideBar={sidebar}
<EuiFlexGroup
direction="row"
gutterSize="none"
className="stretch-relative"
>
<Switch>
<Route
path={APP_PATH.WORKFLOW_DETAIL}
render={(
routeProps: RouteComponentProps<WorkflowDetailRouterProps>
) => <WorkflowDetail {...routeProps} />}
/>
<Route
path={APP_PATH.WORKFLOWS}
render={(routeProps: RouteComponentProps<WorkflowsRouterProps>) => (
<Workflows {...routeProps} />
)}
/>
{/*
<EuiFlexItem grow={false}>{sidebar}</EuiFlexItem>
<EuiFlexItem>
<Switch>
<Route
path={APP_PATH.WORKFLOW_DETAIL}
render={(
routeProps: RouteComponentProps<WorkflowDetailRouterProps>
) => <WorkflowDetail {...routeProps} />}
/>
<Route
path={APP_PATH.WORKFLOWS}
render={(routeProps: RouteComponentProps<WorkflowsRouterProps>) => (
<Workflows {...routeProps} />
)}
/>
{/*
Defaulting to Workflows page. The pathname will need to be updated
to handle the redirection and get the router props consistent.
*/}
<Route
path={`${APP_PATH.HOME}`}
render={(routeProps: RouteComponentProps<WorkflowsRouterProps>) => {
if (props.history.location.pathname !== APP_PATH.WORKFLOWS) {
props.history.replace({
...history,
pathname: APP_PATH.WORKFLOWS,
});
}
return <Workflows {...routeProps} />;
}}
/>
</Switch>
</EuiPageTemplate>
<Route
path={`${APP_PATH.HOME}`}
render={(routeProps: RouteComponentProps<WorkflowsRouterProps>) => {
if (props.history.location.pathname !== APP_PATH.WORKFLOWS) {
props.history.replace({
...history,
pathname: APP_PATH.WORKFLOWS,
});
}
return <Workflows {...routeProps} />;
}}
/>
</Switch>
</EuiFlexItem>
</EuiFlexGroup>
);
};
13 changes: 13 additions & 0 deletions public/global-styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Maximize space given its relative position
.stretch-relative {
position: relative;
height: 100%;
width: 100%;
}

// Maximize space given its absolute position
.stretch-absolute {
position: absolute;
height: 100%;
width: 100%;
}
5 changes: 3 additions & 2 deletions public/pages/workflow_detail/workflow_detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ import {
NEW_WORKFLOW_ID_URL,
} from '../../../common';
import { Resources } from './resources';
import { Prototype } from './prototype';

// styling
import './workflow-detail-styles.scss';
import { Prototype } from './prototype';
import '../../global-styles.scss';

export interface WorkflowDetailRouterProps {
workflowId: string;
Expand Down Expand Up @@ -161,7 +162,7 @@ export function WorkflowDetail(props: WorkflowDetailProps) {
return (
<ReactFlowProvider>
<EuiPage>
<EuiPageBody className="workflow-detail">
<EuiPageBody className="workflow-detail stretch-relative">
<WorkflowDetailHeader
workflow={workflow}
isNewWorkflow={isNewWorkflow}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import { ComponentDetails } from '../component_details';

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

interface ResizableWorkspaceProps {
isNewWorkflow: boolean;
Expand Down Expand Up @@ -444,6 +445,7 @@ export function ResizableWorkspace(props: ResizableWorkspaceProps) {
/>
<EuiResizableContainer
direction="horizontal"
className="stretch-absolute"
style={{
marginLeft: '-8px',
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.workspace-panel {
// this ratio will allow the workspace to render on a standard
// laptop (3024 x 1964) without introducing overflow/scrolling
height: 55vh;
height: 100%;
}
5 changes: 5 additions & 0 deletions public/render_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ import { AppMountParameters, CoreStart } from '../../../src/core/public';
import { FlowFrameworkDashboardsApp } from './app';
import { store } from './store';

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

export const renderApp = (
coreStart: CoreStart,
{ appBasePath, element }: AppMountParameters
) => {
// This is so our base element stretches to fit the entire webpage
element.className = 'stretch-absolute';
ReactDOM.render(
<Provider store={store}>
<Router basename={appBasePath + '#/'}>
Expand Down
Loading