fixed sensor tree
This commit is contained in:
parent
8355a6c4ba
commit
8be06bf2ae
|
@ -24,7 +24,7 @@ export type SensorItemTreeProps = SensorItemTreeStateProps & SensorItemTreeDispa
|
|||
|
||||
|
||||
export interface SensorItemTreeState {
|
||||
portState: { [key: number]: boolean };
|
||||
portState: Map<number, boolean>;
|
||||
}
|
||||
|
||||
interface TreeItem {
|
||||
|
@ -42,7 +42,7 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
|||
this.itemMap = new Map;
|
||||
|
||||
this.state = {
|
||||
portState: {},
|
||||
portState: new Map(),
|
||||
};
|
||||
this.sortItemMap();
|
||||
|
||||
|
@ -69,13 +69,20 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
|||
public ViewSensorItemType(): JSX.Element[] {
|
||||
let elems: JSX.Element[] = new Array();
|
||||
this.itemMap.forEach((data: TreeItem, key: number) => {
|
||||
// this.state.portState[key] = false;
|
||||
elems.push(
|
||||
<List.Item key={key} >
|
||||
<List.Icon name='chevron up' />
|
||||
<List.Icon name={this.state.portState[key] ? 'chevron up' : 'chevron down'} onClick={() => {
|
||||
|
||||
let newPortState: Map<number, boolean> = new Map(this.state.portState);
|
||||
newPortState[key] = true;
|
||||
this.setState({ portState: newPortState });
|
||||
|
||||
}} />
|
||||
<List.Content>
|
||||
<List.Header> <Checkbox label={data.metaSensorItemType.name} /> </List.Header>
|
||||
<List.Description>Category</List.Description>
|
||||
{this.ViewSensorItem(data.metaSensorItemList)}
|
||||
{this.state.portState[key] ? this.ViewSensorItem(data.metaSensorItemList) : ''}
|
||||
</List.Content>
|
||||
</List.Item>,
|
||||
);
|
||||
|
|
|
@ -4,6 +4,8 @@ import { Grid, Image, Label, Segment, Dropdown, Input, List, Accordion, Loader }
|
|||
|
||||
import MetaCrawler from '@overflow/meta/api/model/MetaCrawler';
|
||||
|
||||
import SensorItemTree from '@overflow/meta/react/SensorItemTree';
|
||||
|
||||
export interface SensorConfigurationStateProps {
|
||||
|
||||
}
|
||||
|
@ -28,7 +30,7 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
|
|||
|
||||
|
||||
public render(): JSX.Element {
|
||||
let steps = [<CrawlerSelector />, <SensorItemSelector />, <ETCSelector />];
|
||||
let steps = [<CrawlerSelector />, <SensorItemTree />, <ETCSelector />];
|
||||
|
||||
return (
|
||||
<ConfigStepper steps={steps} />
|
||||
|
@ -143,6 +145,7 @@ export class ConfigStepper extends React.Component<ConfigStepperProps, ConfigSte
|
|||
<Button content='Next' icon='right arrow' labelPosition='right' positive
|
||||
onClick={this.handleNext.bind(this)} disabled={this.checkNextDisabled()} />
|
||||
</Button.Group>
|
||||
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user