listcontainer
This commit is contained in:
		
							parent
							
								
									0d841948aa
								
							
						
					
					
						commit
						6d64f931fc
					
				@ -1,7 +1,6 @@
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
import { Button, Table, Label, Segment, Header, Container } from 'semantic-ui-react';
 | 
			
		||||
import { TargetTable } from './Targets';
 | 
			
		||||
import { DetailContainer } from './commons/DetailContainer';
 | 
			
		||||
 | 
			
		||||
export class ProbeDetails extends React.Component<any, any> {
 | 
			
		||||
 | 
			
		||||
@ -16,12 +15,11 @@ export class ProbeDetails extends React.Component<any, any> {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  render() {
 | 
			
		||||
    const items = [
 | 
			
		||||
      { name: 'Info', child: <ProbeBasicInfo probe={this.props.probe}/> },
 | 
			
		||||
      { name: 'Targets', child: <TargetTable /> },
 | 
			
		||||
    ];
 | 
			
		||||
    return (
 | 
			
		||||
      <DetailContainer panes={items}/>
 | 
			
		||||
      <Container>
 | 
			
		||||
        <ProbeBasicInfo probe={this.props.probe} />
 | 
			
		||||
        <TargetTable />
 | 
			
		||||
      </Container>
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
import { Table, Header, Container } from 'semantic-ui-react';
 | 
			
		||||
import { ProbeDetails } from './ProbeDetails';
 | 
			
		||||
 | 
			
		||||
import { ListContainer } from './commons/ListContainer';
 | 
			
		||||
 | 
			
		||||
export class Probes extends React.Component<any, any> {
 | 
			
		||||
 | 
			
		||||
@ -80,10 +80,9 @@ export class Probes extends React.Component<any, any> {
 | 
			
		||||
 | 
			
		||||
  render() {
 | 
			
		||||
    if (this.state.isDetail) {
 | 
			
		||||
      return <ProbeDetails probe={this.state.selected} onBack={()=>this.setState({isDetail:false})}/>;
 | 
			
		||||
      return <ProbeDetails probe={this.state.selected} onBack={() => this.setState({ isDetail: false })} />;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
    let component =
 | 
			
		||||
      <Container fluid>
 | 
			
		||||
        <Header as='h3' dividing>Probe</Header>
 | 
			
		||||
        <Table selectable striped>
 | 
			
		||||
@ -109,7 +108,10 @@ export class Probes extends React.Component<any, any> {
 | 
			
		||||
            ))}
 | 
			
		||||
          </Table.Body>
 | 
			
		||||
        </Table>
 | 
			
		||||
      </Container>
 | 
			
		||||
      </Container>;
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
      <ListContainer contents={component}/>
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -23,11 +23,15 @@ export class TargetDetails extends React.Component<any, any> {
 | 
			
		||||
 | 
			
		||||
    const items = [
 | 
			
		||||
      { name: 'Info', child: <TargetBasicInfo probe={this.props.probe} /> },
 | 
			
		||||
      { name: 'Sensors', child: <Sensors probe={this.props.probe}/> },
 | 
			
		||||
      { name: 'Sensors', child: <Sensors probe={this.props.probe} /> },
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
      <DetailContainer panes={items}/>
 | 
			
		||||
      // <DetailContainer panes={items}/>
 | 
			
		||||
      <Container>
 | 
			
		||||
        <TargetBasicInfo probe={this.props.probe} />
 | 
			
		||||
        <Sensors probe={this.props.probe} />
 | 
			
		||||
      </Container>
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										30
									
								
								src/ts/containers/test/commons/ListContainer.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/ts/containers/test/commons/ListContainer.tsx
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
			
		||||
import * as React from 'react';
 | 
			
		||||
import { Grid } from 'semantic-ui-react';
 | 
			
		||||
 | 
			
		||||
export class ListContainer extends React.Component<any, any> {
 | 
			
		||||
 | 
			
		||||
  constructor(props: any, context: any) {
 | 
			
		||||
    super(props, context);
 | 
			
		||||
    this.state = {
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  showContents() {
 | 
			
		||||
    return this.props.contents;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  render() {
 | 
			
		||||
    const activeItem = this.state.activeItem;
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
      <Grid>
 | 
			
		||||
        <Grid.Column width={4} textAlign='center' color='grey'>
 | 
			
		||||
          Chart Area
 | 
			
		||||
        </Grid.Column>
 | 
			
		||||
        <Grid.Column stretched width={12} >
 | 
			
		||||
          {this.showContents()}
 | 
			
		||||
        </Grid.Column>
 | 
			
		||||
      </Grid>
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -9,20 +9,19 @@ export class TitleBar extends React.Component<any, any> {
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleMenu(idx: number) {
 | 
			
		||||
    alert(idx);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  render() {
 | 
			
		||||
    let subMenus = [
 | 
			
		||||
      {
 | 
			
		||||
        "name": "Menu1",
 | 
			
		||||
        "href": "#/test2"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "name": "Menu2",
 | 
			
		||||
        "href": "#/test3"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        "name": "Menu3",
 | 
			
		||||
        "href": "#/test4"
 | 
			
		||||
      },
 | 
			
		||||
    ];
 | 
			
		||||
    return (
 | 
			
		||||
@ -43,7 +42,7 @@ export class TitleBar extends React.Component<any, any> {
 | 
			
		||||
          <Grid.Column width='13'>
 | 
			
		||||
            <Menu secondary borderless>
 | 
			
		||||
              {subMenus.map((menu: any, index: number) => (
 | 
			
		||||
                <Menu.Item name={menu.name} key={index} onClick={this.handleMenu.bind(this, index)}/>
 | 
			
		||||
                <Menu.Item key={index} name={menu.name} href={menu.href} />
 | 
			
		||||
              ))}
 | 
			
		||||
            </Menu>
 | 
			
		||||
          </Grid.Column>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user