-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tyler Ohlsen <[email protected]>
- Loading branch information
Showing
6 changed files
with
234 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { UseCase } from './use_case'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { useEffect } from 'react'; | ||
import { | ||
EuiText, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiTitle, | ||
EuiCard, | ||
EuiHorizontalRule, | ||
EuiButton, | ||
} from '@elastic/eui'; | ||
import { CoreServicesContext } from '../../../core_services'; | ||
import { CoreStart } from '../../../../../../src/core/public'; | ||
import { BREADCRUMBS } from '../../../utils'; | ||
|
||
interface UseCaseProps { | ||
title: string; | ||
description: string; | ||
} | ||
|
||
export function UseCase(props: UseCaseProps) { | ||
const core = React.useContext(CoreServicesContext) as CoreStart; | ||
useEffect(() => { | ||
core.chrome.setBreadcrumbs([ | ||
BREADCRUMBS.AI_APPLICATION_BUILDER, | ||
BREADCRUMBS.USE_CASES, | ||
]); | ||
}); | ||
|
||
return ( | ||
<EuiCard | ||
title={ | ||
<EuiTitle size="s"> | ||
<h2>{props.title}</h2> | ||
</EuiTitle> | ||
} | ||
titleSize="s" | ||
paddingSize="l" | ||
> | ||
<EuiFlexGroup direction="column" gutterSize="l"> | ||
<EuiHorizontalRule size="full" margin="m" /> | ||
<EuiFlexItem grow={true}> | ||
<EuiText>{props.description}</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexGroup direction="column" alignItems="center"> | ||
<EuiFlexItem grow={false}> | ||
<EuiButton | ||
disabled={false} | ||
isLoading={false} | ||
onClick={() => { | ||
// TODO: possibly link to the workflow builder with a pre-configured flow | ||
}} | ||
> | ||
Go | ||
</EuiButton> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFlexGroup> | ||
</EuiCard> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { WorkflowList } from './workflow_list'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { useEffect, useState } from 'react'; | ||
import { EuiBasicTable } from '@elastic/eui'; | ||
import { CoreServicesContext } from '../../../core_services'; | ||
import { CoreStart } from '../../../../../../src/core/public'; | ||
import { BREADCRUMBS } from '../../../utils'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
interface WorkflowListProps {} | ||
|
||
interface WorkflowItem { | ||
name: string; | ||
description: string; | ||
} | ||
|
||
export function WorkflowList(props: WorkflowListProps) { | ||
const core = React.useContext(CoreServicesContext) as CoreStart; | ||
useEffect(() => { | ||
core.chrome.setBreadcrumbs([ | ||
BREADCRUMBS.AI_APPLICATION_BUILDER, | ||
BREADCRUMBS.USE_CASES, | ||
]); | ||
}); | ||
|
||
const [pageIndex, setPageIndex] = useState(0); | ||
const [pageSize, setPageSize] = useState(5); | ||
const [sortField, setSortField] = useState('name'); | ||
const [sortDirection, setSortDirection] = useState('asc'); | ||
|
||
const columns = [ | ||
{ | ||
field: 'name', | ||
name: 'Name', | ||
sortable: true, | ||
}, | ||
{ | ||
field: 'description', | ||
name: 'Description', | ||
sortable: false, | ||
}, | ||
]; | ||
|
||
const items = [ | ||
{ | ||
name: 'Workflow 1', | ||
}, | ||
] as WorkflowItem[]; | ||
|
||
const sorting = { | ||
sort: { | ||
field: sortField, | ||
direction: sortDirection, | ||
}, | ||
enableAllColumns: false, | ||
readOnly: false, | ||
}; | ||
|
||
const pagination = { | ||
pageIndex, | ||
pageSize, | ||
totalItemCount: items.length, | ||
pageSizeOptions: [5, 10, 20], | ||
}; | ||
|
||
const onTableChange = ({ page = {}, sort = {} }) => { | ||
const { index, size } = page; | ||
const { field, direction } = sort; | ||
|
||
setPageIndex(index); | ||
setPageSize(size); | ||
setSortField(field); | ||
setSortDirection(direction); | ||
}; | ||
|
||
return ( | ||
<EuiBasicTable<WorkflowItem> | ||
items={items} | ||
rowHeader="name" | ||
columns={columns} | ||
sorting={sorting} | ||
pagination={pagination} | ||
onChange={onTableChange} | ||
noItemsMessage={'No existing workflows found'} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters