Skip to content

Commit

Permalink
Refactor UseCases into nested tab; standardize page layouts (#54)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Oct 5, 2023
1 parent d2b33f6 commit 34d425f
Show file tree
Hide file tree
Showing 17 changed files with 218 additions and 171 deletions.
16 changes: 7 additions & 9 deletions public/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { EuiPageSideBar, EuiSideNav, EuiPageTemplate } from '@elastic/eui';
import { Navigation, APP_PATH } from './utils';
import {
Overview,
UseCases,
Workflows,
WorkflowDetail,
WorkflowDetailRouterProps,
WorkflowsRouterProps,
} from './pages';

interface Props extends RouteComponentProps {}
Expand All @@ -28,10 +28,10 @@ export const AiFlowDashboardsApp = (props: Props) => {
id: 0,
items: [
{
name: Navigation.UseCases,
name: Navigation.Overview,
id: 1,
href: `#${APP_PATH.USE_CASES}`,
isSelected: props.location.pathname === APP_PATH.USE_CASES,
href: `#${APP_PATH.OVERVIEW}`,
isSelected: props.location.pathname === APP_PATH.OVERVIEW,
},
{
name: Navigation.Workflows,
Expand All @@ -54,10 +54,6 @@ export const AiFlowDashboardsApp = (props: Props) => {
pageSideBar={sidebar}
>
<Switch>
<Route
path={APP_PATH.USE_CASES}
render={(routeProps: RouteComponentProps) => <UseCases />}
/>
<Route
path={APP_PATH.WORKFLOW_DETAIL}
render={(
Expand All @@ -66,7 +62,9 @@ export const AiFlowDashboardsApp = (props: Props) => {
/>
<Route
path={APP_PATH.WORKFLOWS}
render={(routeProps: RouteComponentProps) => <Workflows />}
render={(routeProps: RouteComponentProps<WorkflowsRouterProps>) => (
<Workflows {...routeProps} />
)}
/>
{/* Defaulting to Overview page */}
<Route
Expand Down
1 change: 0 additions & 1 deletion public/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

export * from './use_cases';
export * from './workflows';
export * from './overview';
export * from './workflow_detail';
25 changes: 20 additions & 5 deletions public/pages/overview/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,33 @@
*/

import React, { useEffect } from 'react';
import { EuiPageHeader, EuiText } from '@elastic/eui';
import {
EuiPage,
EuiPageBody,
EuiPageHeader,
EuiPageContent,
EuiText,
} from '@elastic/eui';
import { BREADCRUMBS } from '../../utils';
import { getCore } from '../../services';

export function Overview() {
useEffect(() => {
getCore().chrome.setBreadcrumbs([BREADCRUMBS.AI_APPLICATION_BUILDER]);
getCore().chrome.setBreadcrumbs([
BREADCRUMBS.AI_APPLICATION_BUILDER,
BREADCRUMBS.OVERVIEW,
]);
});

return (
<EuiPageHeader>
<EuiText>Welcome to the AI Application Builder!</EuiText>
</EuiPageHeader>
<EuiPage>
<EuiPageBody>
<EuiPageHeader pageTitle="Overview" />

<EuiPageContent>
<EuiText>TODO: Put overview details here...</EuiText>
</EuiPageContent>
</EuiPageBody>
</EuiPage>
);
}
6 changes: 0 additions & 6 deletions public/pages/use_cases/index.ts

This file was deleted.

61 changes: 0 additions & 61 deletions public/pages/use_cases/use_cases.tsx

This file was deleted.

26 changes: 12 additions & 14 deletions public/pages/workflow_detail/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ interface WorkflowDetailHeaderProps {

export function WorkflowDetailHeader(props: WorkflowDetailHeaderProps) {
return (
<div>
<EuiPageHeader
pageTitle={props.workflow ? props.workflow.name : ''}
description={props.workflow ? props.workflow.description : ''}
rightSideItems={[
<EuiButton fill={false} onClick={() => {}}>
Prototype
</EuiButton>,
<EuiButton fill={false} onClick={() => {}}>
Save
</EuiButton>,
]}
/>
</div>
<EuiPageHeader
pageTitle={props.workflow ? props.workflow.name : ''}
description={props.workflow ? props.workflow.description : ''}
rightSideItems={[
<EuiButton fill={false} onClick={() => {}}>
Prototype
</EuiButton>,
<EuiButton fill={false} onClick={() => {}}>
Save
</EuiButton>,
]}
/>
);
}
13 changes: 7 additions & 6 deletions public/pages/workflow_detail/workflow_detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import React, { useEffect } from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { EuiSpacer } from '@elastic/eui';
import { EuiPage, EuiPageBody } from '@elastic/eui';
import { BREADCRUMBS } from '../../utils';
import { getCore } from '../../services';
import { WorkflowDetailHeader } from './components';
Expand Down Expand Up @@ -37,10 +37,11 @@ export function WorkflowDetail(props: WorkflowDetailProps) {
});

return (
<div>
<WorkflowDetailHeader workflow={workflow} />
<EuiSpacer size="l" />
<Workspace workflow={workflow} />
</div>
<EuiPage>
<EuiPageBody>
<WorkflowDetailHeader workflow={workflow} />
<Workspace workflow={workflow} />
</EuiPageBody>
</EuiPage>
);
}
78 changes: 38 additions & 40 deletions public/pages/workflow_detail/workspace/workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,47 +111,45 @@ export function Workspace(props: WorkspaceProps) {
}, [props.workflow]);

return (
<EuiFlexItem grow={true}>
<EuiFlexGroup
direction="column"
gutterSize="m"
justifyContent="spaceBetween"
className="workspace"
<EuiFlexGroup
direction="column"
gutterSize="m"
justifyContent="spaceBetween"
className="workspace"
>
<EuiFlexItem
style={{
borderStyle: 'groove',
borderColor: 'gray',
borderWidth: '1px',
}}
>
<EuiFlexItem
style={{
borderStyle: 'groove',
borderColor: 'gray',
borderWidth: '1px',
}}
>
{/**
* We have these wrapper divs & reactFlowWrapper ref to control and calculate the
* ReactFlow bounds when calculating node positioning.
*/}
<div className="reactflow-parent-wrapper">
<div className="reactflow-wrapper" ref={reactFlowWrapper}>
<ReactFlow
nodes={nodes}
edges={edges}
nodeTypes={nodeTypes}
edgeTypes={edgeTypes}
onNodesChange={onNodesChange}
onEdgesChange={onEdgesChange}
onConnect={onConnect}
onInit={setReactFlowInstance}
onDrop={onDrop}
onDragOver={onDragOver}
className="reactflow-workspace"
fitView
>
<Controls />
<Background />
</ReactFlow>
</div>
{/**
* We have these wrapper divs & reactFlowWrapper ref to control and calculate the
* ReactFlow bounds when calculating node positioning.
*/}
<div className="reactflow-parent-wrapper">
<div className="reactflow-wrapper" ref={reactFlowWrapper}>
<ReactFlow
nodes={nodes}
edges={edges}
nodeTypes={nodeTypes}
edgeTypes={edgeTypes}
onNodesChange={onNodesChange}
onEdgesChange={onEdgesChange}
onConnect={onConnect}
onInit={setReactFlowInstance}
onDrop={onDrop}
onDragOver={onDragOver}
className="reactflow-workspace"
fitView
>
<Controls />
<Background />
</ReactFlow>
</div>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</div>
</EuiFlexItem>
</EuiFlexGroup>
);
}
2 changes: 1 addition & 1 deletion public/pages/workflows/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export { Workflows } from './workflows';
export * from './workflows';
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* SPDX-License-Identifier: Apache-2.0
*/

export { UseCase } from './use_case';
export { NewWorkflow } from './new_workflow';
36 changes: 36 additions & 0 deletions public/pages/workflows/new_workflow/new_workflow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { EuiFlexItem, EuiFlexGrid } from '@elastic/eui';

import { UseCase } from './use_case';

interface NewWorkflowProps {}

export function NewWorkflow(props: NewWorkflowProps) {
return (
<EuiFlexGrid columns={3} gutterSize="l">
<EuiFlexItem>
<UseCase
title="Semantic Search"
description="Semantic search description..."
/>
</EuiFlexItem>
<EuiFlexItem>
<UseCase
title="Multi-modal Search"
description="Multi-modal search description..."
/>
</EuiFlexItem>
<EuiFlexItem>
<UseCase
title="Search Summarization"
description="Search summarization description..."
/>
</EuiFlexItem>
</EuiFlexGrid>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React, { useEffect } from 'react';
import React from 'react';
import {
EuiText,
EuiFlexGroup,
Expand Down
File renamed without changes.
Loading

0 comments on commit 34d425f

Please sign in to comment.