forked from opensearch-project/dashboards-flow-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 changed files
with
129 additions
and
68 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 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
62 changes: 62 additions & 0 deletions
62
public/pages/workflow_builder/components/input_field_list.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,62 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiFlexItem, EuiSpacer } from '@elastic/eui'; | ||
import { IComponentField } from '../../../component_types'; | ||
import { TextField, JsonField, SelectField } from './input_fields'; | ||
|
||
/** | ||
* A helper component to format all of the input fields for a component. Dynamically | ||
* render based on the input type. | ||
*/ | ||
|
||
interface InputFieldListProps { | ||
inputFields?: IComponentField[]; | ||
} | ||
|
||
export function InputFieldList(props: InputFieldListProps) { | ||
return ( | ||
<EuiFlexItem> | ||
{props.inputFields?.map((field, idx) => { | ||
let el; | ||
switch (field.type) { | ||
case 'string': { | ||
el = ( | ||
<EuiFlexItem key={idx}> | ||
<TextField | ||
label={field.label} | ||
placeholder={field.placeholder || ''} | ||
/> | ||
<EuiSpacer size="s" /> | ||
</EuiFlexItem> | ||
); | ||
break; | ||
} | ||
case 'json': { | ||
el = ( | ||
<EuiFlexItem key={idx}> | ||
<JsonField | ||
label={field.label} | ||
placeholder={field.placeholder || ''} | ||
/> | ||
</EuiFlexItem> | ||
); | ||
break; | ||
} | ||
case 'select': { | ||
el = ( | ||
<EuiFlexItem key={idx}> | ||
<SelectField /> | ||
</EuiFlexItem> | ||
); | ||
break; | ||
} | ||
} | ||
return el; | ||
})} | ||
</EuiFlexItem> | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
public/pages/workflow_builder/components/input_fields/index.ts
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,8 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export { TextField } from './text_field'; | ||
export { JsonField } from './json_field'; | ||
export { SelectField } from './select_field'; |
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
File renamed without changes.
File renamed without changes.
48 changes: 48 additions & 0 deletions
48
public/pages/workflow_builder/components/new_or_existing_tabs.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,48 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiTab, EuiTabs } from '@elastic/eui'; | ||
|
||
/** | ||
* A helper component containing the togglable 'New' vs. 'Existing' tabs. | ||
*/ | ||
|
||
interface NewOrExistingTabsProps { | ||
selectedTabId: string; | ||
setSelectedTabId(tabId: string): void; | ||
} | ||
|
||
const inputTabs = [ | ||
{ | ||
id: 'existing', | ||
name: 'Existing', | ||
disabled: false, | ||
}, | ||
{ | ||
id: 'new', | ||
name: 'New', | ||
disabled: false, | ||
}, | ||
]; | ||
|
||
export function NewOrExistingTabs(props: NewOrExistingTabsProps) { | ||
return ( | ||
<EuiTabs size="s" expand={true}> | ||
{inputTabs.map((tab, idx) => { | ||
return ( | ||
<EuiTab | ||
onClick={() => props.setSelectedTabId(tab.id)} | ||
isSelected={tab.id === props.selectedTabId} | ||
disabled={tab.disabled} | ||
key={idx} | ||
> | ||
{tab.name} | ||
</EuiTab> | ||
); | ||
})} | ||
</EuiTabs> | ||
); | ||
} |
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