-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,028 additions
and
63 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
2 changes: 1 addition & 1 deletion
2
...add_on_ucc_framework/ucc_ui_lib/src/main/resources/splunk/default/data/ui/nav/default.xml
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<nav> | ||
<view name="inputs" /> | ||
<view name="configuration" default="true"/> | ||
<view name="configuration" default="true" /> | ||
<view name="search" /> | ||
</nav> |
36 changes: 36 additions & 0 deletions
36
splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/CheckBoxComponent.jsx
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,36 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Switch from '@splunk/react-ui/Switch'; | ||
|
||
class CheckBoxComponent extends Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
handleChange = (e) => { | ||
this.props.handleChange(this.props.id, 1 - this.props.value); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Switch | ||
key={this.props.field} | ||
value={this.props.field} | ||
onClick={this.handleChange} | ||
disabled={this.props.disabled} | ||
selected={this.props.value ? true : false} | ||
appearance="checkbox" | ||
></Switch> | ||
); | ||
} | ||
} | ||
|
||
CheckBoxComponent.propTypes = { | ||
id: PropTypes.number.isRequired, | ||
value: PropTypes.string, | ||
handleClick: PropTypes.func.isRequired, | ||
field: PropTypes.string, | ||
controlOptions: PropTypes.object, | ||
}; | ||
|
||
export default CheckBoxComponent; |
50 changes: 50 additions & 0 deletions
50
splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/MultiInputControl.jsx
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,50 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Multiselect from '@splunk/react-ui/Multiselect'; | ||
|
||
function MultiInputControl(props) { | ||
const { id, field, disabled = false, value, controlOptions, ...restProps } = props; | ||
const { items, placeholder, createSearchChoice, delimiter = ',' } = controlOptions; | ||
|
||
function handleChange(e, { values }) { | ||
restProps.handleChange(id, values.join(delimiter)); | ||
} | ||
|
||
const valueList = value ? value.split(delimiter) : []; | ||
|
||
return ( | ||
<Multiselect | ||
values={valueList} | ||
name={field} | ||
placeholder={placeholder} | ||
disabled={disabled} | ||
allowNewValues={createSearchChoice} | ||
onChange={handleChange} | ||
> | ||
{items.map((item) => ( | ||
<Multiselect.Option label={item.label} value={item.value} key={item.value} /> | ||
))} | ||
</Multiselect> | ||
); | ||
} | ||
|
||
MultiInputControl.propTypes = { | ||
id: PropTypes.number.isRequired, | ||
disabled: PropTypes.bool, | ||
value: PropTypes.string, | ||
handleChange: PropTypes.func.isRequired, | ||
field: PropTypes.string, | ||
controlOptions: PropTypes.shape({ | ||
delimiter: PropTypes.string, | ||
placeholder: PropTypes.string, | ||
createSearchChoice: PropTypes.bool, | ||
items: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
label: PropTypes.string.isRequired, | ||
value: PropTypes.string.isRequired, | ||
}) | ||
).isRequired, | ||
}), | ||
}; | ||
|
||
export default MultiInputControl; |
40 changes: 40 additions & 0 deletions
40
splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/RadioComponent.jsx
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,40 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import RadioBar from '@splunk/react-ui/RadioBar'; | ||
|
||
class RadioComponent extends Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
handleChange = (e, { value }) => { | ||
this.props.handleChange(this.props.id, value); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<RadioBar | ||
inline | ||
onChange={this.handleChange} | ||
value={this.props.value} | ||
key={this.props.field} | ||
> | ||
{this.props.controlOptions.items.map(item => ( | ||
<RadioBar.Option key={item.value} value={item.value} label={item.label} /> | ||
))} | ||
</RadioBar> | ||
); | ||
} | ||
} | ||
|
||
RadioComponent.propTypes = { | ||
id: PropTypes.number.isRequired, | ||
value: PropTypes.string, | ||
handleChange: PropTypes.func.isRequired, | ||
field: PropTypes.string, | ||
controlOptions: PropTypes.object | ||
}; | ||
|
||
|
||
export default RadioComponent; | ||
|
49 changes: 49 additions & 0 deletions
49
splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/SingleInputControl.jsx
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,49 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Select from '@splunk/react-ui/Select'; | ||
|
||
function SingleInputControl(props) { | ||
const { id, field, disabled = false, value, controlOptions, ...restProps } = props; | ||
const { autoCompleteFields } = controlOptions; | ||
|
||
function handleChange(e, { value }) { | ||
restProps.handleChange(id, value); | ||
} | ||
|
||
function generateOptions() { | ||
const data = []; | ||
autoCompleteFields.forEach((item) => { | ||
if (item.value && item.label) { | ||
data.push(<Select.Option label={item.label} value={item.value} key={item.value} />); | ||
} | ||
if (item.children && item.label) { | ||
data.push(<Select.Heading key={item.label}>{item.label}</Select.Heading>); | ||
item.children.forEach((child) => { | ||
data.push( | ||
<Select.Option label={child.label} value={child.value} key={child.value} /> | ||
); | ||
}); | ||
} | ||
}); | ||
return data; | ||
} | ||
|
||
return ( | ||
<Select value={value} name={field} disabled={disabled} onChange={handleChange}> | ||
{generateOptions()} | ||
</Select> | ||
); | ||
} | ||
|
||
SingleInputControl.propTypes = { | ||
id: PropTypes.number.isRequired, | ||
disabled: PropTypes.bool, | ||
value: PropTypes.string, | ||
handleChange: PropTypes.func.isRequired, | ||
field: PropTypes.string, | ||
controlOptions: PropTypes.shape({ | ||
autoCompleteFields: PropTypes.array.isRequired, | ||
}), | ||
}; | ||
|
||
export default SingleInputControl; |
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
37 changes: 37 additions & 0 deletions
37
splunk_add_on_ucc_framework/ucc_ui_lib/src/main/webapp/components/TextComponent.jsx
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,37 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Text from '@splunk/react-ui/Text'; | ||
|
||
class TextComponent extends Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
handleChange = (e, {value}) => { | ||
this.props.handleChange(this.props.id, value); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<Text | ||
inline | ||
placeholder={this.props.controlOptions.placeholder} | ||
className={this.props.field} | ||
disabled={this.props.disabled} | ||
value={this.props.value} | ||
onChange={this.handleChange} | ||
type={this.props.encrypted ? 'password' : 'text'} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
TextComponent.propTypes = { | ||
id: PropTypes.number.isRequired, | ||
value: PropTypes.string, | ||
handleChange: PropTypes.func.isRequired, | ||
field: PropTypes.string, | ||
controlOptions: PropTypes.object, | ||
}; | ||
|
||
export default TextComponent; |
Oops, something went wrong.