tab
This commit is contained in:
parent
94e2a39761
commit
4f682fe79c
@ -1,42 +1,33 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Button } from 'semantic-ui-react';
|
|
||||||
import { Probes } from './Probes';
|
import { Probes } from './Probes';
|
||||||
import { NoauthProbes } from './NoauthProbes';
|
import { NoauthProbes } from './NoauthProbes';
|
||||||
import { SensorConfiguration } from './SensorConfiguration';
|
import { SensorConfiguration } from './SensorConfiguration';
|
||||||
import { Targets } from './Targets';
|
import { Targets } from './Targets';
|
||||||
|
import { Tab } from './commons/Tab';
|
||||||
|
|
||||||
import Tab, { TabProps } from 'semantic-ui-react/dist/commonjs/modules/Tab';
|
// import Tab, { TabProps } from 'semantic-ui-react/dist/commonjs/modules/Tab';
|
||||||
|
|
||||||
|
|
||||||
export class Components extends React.Component<any, any> {
|
export class Components extends React.Component<any, any> {
|
||||||
|
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this.state = {
|
this.state = {
|
||||||
no: 0,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
handleButton(n: number): void {
|
|
||||||
this.setState({
|
|
||||||
no: n,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
const panes = [
|
const items = [
|
||||||
{ menuItem: 'Probes', render: () => <Tab.Pane attached={false}><Probes /></Tab.Pane> },
|
{ name: 'Probes', child: <Probes /> },
|
||||||
{ menuItem: 'Noauth Probes', render: () => <Tab.Pane attached={false}><NoauthProbes /></Tab.Pane> },
|
{ name: 'NoauthProbes', child: <NoauthProbes /> },
|
||||||
{ menuItem: 'Sensor Configuration', render: () => <Tab.Pane attached={false}><SensorConfiguration /></Tab.Pane> },
|
{ name: 'SensorConfiguration', child: <SensorConfiguration /> },
|
||||||
{ menuItem: 'Targets', render: () => <Tab.Pane attached={false}><Targets /></Tab.Pane> },
|
{ name: 'Targets', child: <Targets /> },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tab menu={{ pointing: true }} panes={panes} />
|
<Tab panes={items} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,23 +80,25 @@ export class Probes extends React.Component<any, any> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Table celled selectable striped>
|
<Table celled selectable striped collapsing>
|
||||||
<Table.Header>
|
<Table.Header>
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.HeaderCell textAlign={'center'}>No.</Table.HeaderCell>
|
<Table.HeaderCell textAlign={'center'}>Name</Table.HeaderCell>
|
||||||
|
<Table.HeaderCell textAlign={'center'}>CIDR</Table.HeaderCell>
|
||||||
<Table.HeaderCell textAlign={'center'}>Status</Table.HeaderCell>
|
<Table.HeaderCell textAlign={'center'}>Status</Table.HeaderCell>
|
||||||
<Table.HeaderCell textAlign={'center'}>Probe Key</Table.HeaderCell>
|
<Table.HeaderCell textAlign={'center'}>Target Count</Table.HeaderCell>
|
||||||
<Table.HeaderCell textAlign={'center'}>Description</Table.HeaderCell>
|
<Table.HeaderCell textAlign={'center'}>Sensor Count</Table.HeaderCell>
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
</Table.Header>
|
</Table.Header>
|
||||||
|
|
||||||
<Table.Body>
|
<Table.Body>
|
||||||
{this.data.map((probe: any, index: number) => (
|
{this.data.map((probe: any, index: number) => (
|
||||||
<Table.Row key={index} onClick={this.handleSelect.bind(this, probe)}>
|
<Table.Row key={index} onClick={this.handleSelect.bind(this, probe)}>
|
||||||
<Table.Cell textAlign={'center'}>{index + 1}</Table.Cell>
|
<Table.Cell >todo. {probe.name}</Table.Cell>
|
||||||
<Table.Cell negative={this.checkCellStatus(probe.metaProbeStatus)} textAlign={'center'}>{probe.metaProbeStatus.name}</Table.Cell>
|
<Table.Cell>todo. {probe.cidr}</Table.Cell>
|
||||||
<Table.Cell>{probe.probeKey}</Table.Cell>
|
<Table.Cell negative={this.checkCellStatus(probe.metaProbeStatus)} textAlign={'center'}>{probe.metaProbeStatus.name}</Table.Cell>
|
||||||
<Table.Cell>{probe.description}</Table.Cell>
|
<Table.Cell textAlign={'center'} >todo. {probe.targetCnt}</Table.Cell>
|
||||||
|
<Table.Cell textAlign={'center'} >todo. {probe.sensorCnt}</Table.Cell>
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
))}
|
))}
|
||||||
</Table.Body>
|
</Table.Body>
|
||||||
|
38
src/ts/containers/test/commons/Tab.tsx
Normal file
38
src/ts/containers/test/commons/Tab.tsx
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { Menu, Segment } from 'semantic-ui-react';
|
||||||
|
|
||||||
|
export class Tab extends React.Component<any, any> {
|
||||||
|
|
||||||
|
constructor(props: any, context: any) {
|
||||||
|
super(props, context);
|
||||||
|
this.state = {
|
||||||
|
active: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
showContents() {
|
||||||
|
return this.props.panes[this.state.active].child;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick(index: number) {
|
||||||
|
this.setState({
|
||||||
|
active: index,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Menu tabular>
|
||||||
|
{this.props.panes.map((pane: any, index: number) => (
|
||||||
|
<Menu.Item key={index} name={pane.name} onClick={this.handleClick.bind(this, index)} active={this.state.active === index} />
|
||||||
|
))}
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<Segment>
|
||||||
|
{this.showContents()}
|
||||||
|
</Segment>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user