targetselector
This commit is contained in:
parent
fd014ff386
commit
e7589e4cc1
|
@ -6,22 +6,22 @@ import Subheader from 'material-ui/Subheader';
|
|||
import Checkbox from 'material-ui/Checkbox';
|
||||
|
||||
|
||||
|
||||
let SelectableList = makeSelectable(List);
|
||||
|
||||
function wrapState(ComposedComponent: any, par : any) {
|
||||
function wrapState(ComposedComponent: any, par: any) {
|
||||
return class SelectableList extends React.Component<any, any> {
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.setState({
|
||||
selectedIndex: this.props.defaultValue,
|
||||
selectedIndex: -1,
|
||||
});
|
||||
}
|
||||
|
||||
handleRequestChange = (event: any, index: any) => {
|
||||
this.setState({
|
||||
selectedIndex: index,
|
||||
});
|
||||
par.handleSelect(index);
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,7 @@ export class TargetSelector extends React.Component<any, any> {
|
|||
SelectableList = wrapState(SelectableList, this);
|
||||
}
|
||||
|
||||
handleSelect(idx : any) {
|
||||
handleSelect(idx: any) {
|
||||
this.props.onChange(idx);
|
||||
}
|
||||
|
||||
|
@ -56,37 +56,45 @@ export class TargetSelector extends React.Component<any, any> {
|
|||
return (
|
||||
<MuiThemeProvider >
|
||||
<div>
|
||||
<SelectableList ref={'list'} >
|
||||
<SelectableList >
|
||||
<Subheader>Select a target to monitor</Subheader>
|
||||
<ListItem
|
||||
value={1}
|
||||
primaryText="192.168.1.0"
|
||||
secondaryText={'Zone'}
|
||||
initiallyOpen={true}
|
||||
nestedItems={[
|
||||
<ListItem
|
||||
value={2}
|
||||
primaryText="192.168.1.11"
|
||||
secondaryText={'Host'}
|
||||
initiallyOpen={true}
|
||||
nestedItems={[
|
||||
<ListItem value={3} primaryText="Redis" secondaryText="5432" />,
|
||||
<ListItem value={4} primaryText="FTP" secondaryText="5432" />,
|
||||
<ListItem
|
||||
value={3}
|
||||
primaryText="Redis"
|
||||
secondaryText="Port 5432" />,
|
||||
<ListItem
|
||||
value={4}
|
||||
primaryText="FTP"
|
||||
secondaryText="Port 5432" />,
|
||||
]}
|
||||
/>,
|
||||
<ListItem
|
||||
value={5}
|
||||
primaryText="192.168.1.12"
|
||||
secondaryText={'Host'}
|
||||
initiallyOpen={true}
|
||||
nestedItems={[
|
||||
<ListItem value={6} primaryText="MySQL" secondaryText="5432" />,
|
||||
<ListItem value={7} primaryText="SSH" secondaryText="5432" />,
|
||||
]}
|
||||
/>,
|
||||
<ListItem
|
||||
value={8}
|
||||
primaryText="192.168.1.13"
|
||||
initiallyOpen={true}
|
||||
nestedItems={[
|
||||
<ListItem value={9} primaryText="Tomcat" secondaryText="8080" />,
|
||||
<ListItem
|
||||
value={6}
|
||||
|
||||
primaryText="MySQL"
|
||||
secondaryText="Port 5432" />,
|
||||
<ListItem
|
||||
value={7}
|
||||
primaryText="SSH"
|
||||
secondaryText="Port 5432" />,
|
||||
]}
|
||||
/>,
|
||||
]}
|
||||
|
|
Loading…
Reference in New Issue
Block a user