-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add placeholder tabs; refactor resources into tools tab
Signed-off-by: Tyler Ohlsen <[email protected]>
- Loading branch information
Showing
8 changed files
with
174 additions
and
44 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { Resources } from './resources'; | ||
export * from './tools'; |
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 * from './resources'; |
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
58 changes: 58 additions & 0 deletions
58
public/pages/workflow_detail/tools/resources/resources.tsx
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,58 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
EuiEmptyPrompt, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiSpacer, | ||
EuiText, | ||
EuiTitle, | ||
} from '@elastic/eui'; | ||
import { Workflow } from '../../../../../common'; | ||
import { ResourceList } from './resource_list'; | ||
|
||
interface ResourcesProps { | ||
workflow?: Workflow; | ||
} | ||
|
||
/** | ||
* A simple resources page to browse created resources for a given Workflow. | ||
*/ | ||
export function Resources(props: ResourcesProps) { | ||
return ( | ||
<> | ||
{props.workflow?.resourcesCreated && | ||
props.workflow.resourcesCreated.length > 0 ? ( | ||
<> | ||
<EuiTitle> | ||
<h2>Resources</h2> | ||
</EuiTitle> | ||
<EuiSpacer size="m" /> | ||
<EuiFlexGroup direction="row"> | ||
<EuiFlexItem> | ||
<ResourceList workflow={props.workflow} /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</> | ||
) : ( | ||
<EuiEmptyPrompt | ||
iconType={'cross'} | ||
title={<h2>No resources available</h2>} | ||
titleSize="s" | ||
body={ | ||
<> | ||
<EuiText> | ||
Provision the workflow to generate resources in order to start | ||
prototyping. | ||
</EuiText> | ||
</> | ||
} | ||
/> | ||
)} | ||
</> | ||
); | ||
} |
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,105 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { useState } from 'react'; | ||
import { | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiSpacer, | ||
EuiTab, | ||
EuiTabs, | ||
EuiText, | ||
EuiTitle, | ||
} from '@elastic/eui'; | ||
import { Workflow } from '../../../../common'; | ||
import { Resources } from './resources'; | ||
|
||
interface ToolsProps { | ||
workflow?: Workflow; | ||
} | ||
|
||
enum TAB_ID { | ||
INGEST = 'ingest', | ||
QUERY = 'query', | ||
ERRORS = 'errors', | ||
RESOURCES = 'resources', | ||
} | ||
|
||
const inputTabs = [ | ||
{ | ||
id: TAB_ID.INGEST, | ||
name: 'Run ingestion', | ||
disabled: false, | ||
}, | ||
{ | ||
id: TAB_ID.QUERY, | ||
name: 'Run queries', | ||
disabled: false, | ||
}, | ||
{ | ||
id: TAB_ID.ERRORS, | ||
name: 'Errors', | ||
disabled: false, | ||
}, | ||
{ | ||
id: TAB_ID.RESOURCES, | ||
name: 'Resources', | ||
disabled: false, | ||
}, | ||
]; | ||
|
||
/** | ||
* The base Tools component for performing ingest and search, viewing resources, and debugging. | ||
*/ | ||
export function Tools(props: ToolsProps) { | ||
const [selectedTabId, setSelectedTabId] = useState<string>(TAB_ID.INGEST); | ||
return ( | ||
<> | ||
<EuiTitle> | ||
<h2>Tools</h2> | ||
</EuiTitle> | ||
<EuiSpacer size="m" /> | ||
<> | ||
<EuiTabs size="m" expand={false}> | ||
{inputTabs.map((tab, idx) => { | ||
return ( | ||
<EuiTab | ||
onClick={() => setSelectedTabId(tab.id)} | ||
isSelected={tab.id === selectedTabId} | ||
disabled={tab.disabled} | ||
key={idx} | ||
> | ||
{tab.name} | ||
</EuiTab> | ||
); | ||
})} | ||
</EuiTabs> | ||
<EuiSpacer size="m" /> | ||
<EuiFlexGroup direction="column"> | ||
{selectedTabId === TAB_ID.INGEST && ( | ||
<EuiFlexItem> | ||
<EuiText>Run ingestion placeholder</EuiText> | ||
</EuiFlexItem> | ||
)} | ||
{selectedTabId === TAB_ID.QUERY && ( | ||
<EuiFlexItem> | ||
<EuiText>Run queries placeholder</EuiText> | ||
</EuiFlexItem> | ||
)} | ||
{selectedTabId === TAB_ID.ERRORS && ( | ||
<EuiFlexItem> | ||
<EuiText>View errors placeholder</EuiText> | ||
</EuiFlexItem> | ||
)} | ||
{selectedTabId === TAB_ID.RESOURCES && ( | ||
<EuiFlexItem> | ||
<Resources /> | ||
</EuiFlexItem> | ||
)} | ||
</EuiFlexGroup> | ||
</> | ||
</> | ||
); | ||
} |