sensor....
This commit is contained in:
parent
9233f75f6f
commit
43681525e1
|
@ -35,35 +35,27 @@ import readHostReducer from '@overflow/infra/redux/reducer/host_read';
|
||||||
import readOSReducer from '@overflow/infra/redux/reducer/os_read';
|
import readOSReducer from '@overflow/infra/redux/reducer/os_read';
|
||||||
import readServiceReducer from '@overflow/infra/redux/reducer/service_read';
|
import readServiceReducer from '@overflow/infra/redux/reducer/service_read';
|
||||||
import InfraReadServiceReducer from '@overflow/infra/redux/reducer/read';
|
import InfraReadServiceReducer from '@overflow/infra/redux/reducer/read';
|
||||||
|
|
||||||
import CrawlerReadAllByTargetReducer from '@overflow/meta/redux/reducer/crawler_read_all_by_target';
|
import CrawlerReadAllByTargetReducer from '@overflow/meta/redux/reducer/crawler_read_all_by_target';
|
||||||
import CrawlerAuthInputsReducer from '@overflow/meta/redux/reducer/crawler_auth_inputs';
|
import CrawlerAuthInputsReducer from '@overflow/meta/redux/reducer/crawler_auth_inputs';
|
||||||
|
|
||||||
import MetaSensorItemReadAllReducer from '@overflow/meta/redux/reducer/sensor_item_read_all';
|
import MetaSensorItemReadAllReducer from '@overflow/meta/redux/reducer/sensor_item_read_all';
|
||||||
import MetaSensorItemTypeReadAllReducer from '@overflow/meta/redux/reducer/sensor_item_type_read_all';
|
import MetaSensorItemTypeReadAllReducer from '@overflow/meta/redux/reducer/sensor_item_type_read_all';
|
||||||
|
|
||||||
import DiscoveryInfraTargetRegistAllReducer from '@overflow/discovery/redux/reducer/infra_target_regist_all';
|
import DiscoveryInfraTargetRegistAllReducer from '@overflow/discovery/redux/reducer/infra_target_regist_all';
|
||||||
import DiscoveryIngReducer from '@overflow/discovery/redux/reducer/ing';
|
import DiscoveryIngReducer from '@overflow/discovery/redux/reducer/ing';
|
||||||
|
|
||||||
import HistoryReadAllByProbeReducer from '@overflow/history/redux/reducer/read_all_by_probe';
|
import HistoryReadAllByProbeReducer from '@overflow/history/redux/reducer/read_all_by_probe';
|
||||||
import HistoryReadAllByProbeAndTypeReducer from '@overflow/history/redux/reducer/read_all_by_probe_and_type';
|
import HistoryReadAllByProbeAndTypeReducer from '@overflow/history/redux/reducer/read_all_by_probe_and_type';
|
||||||
import HistoryTypeReadAllReducer from '@overflow/meta/redux/reducer/history_type_read_all';
|
import HistoryTypeReadAllReducer from '@overflow/meta/redux/reducer/history_type_read_all';
|
||||||
import NotificationReadAllUnconfirmedReducer from '@overflow/notification/redux/reducer/read_all_unconfirmed';
|
import NotificationReadAllUnconfirmedReducer from '@overflow/notification/redux/reducer/read_all_unconfirmed';
|
||||||
import NotificationReadAllReducer from '@overflow/notification/redux/reducer/read_all';
|
import NotificationReadAllReducer from '@overflow/notification/redux/reducer/read_all';
|
||||||
import NotificationReadCountReducer from '@overflow/notification/redux/reducer/read_unconfirmed_count';
|
import NotificationReadCountReducer from '@overflow/notification/redux/reducer/read_unconfirmed_count';
|
||||||
|
|
||||||
import SensorItemKeyReadAllByCrawlerReducer from '@overflow/meta/redux/reducer/sensor_item_key_read_all_by_crawler';
|
import SensorItemKeyReadAllByCrawlerReducer from '@overflow/meta/redux/reducer/sensor_item_key_read_all_by_crawler';
|
||||||
|
|
||||||
import ForgotPassword from '@overflow/member/redux/reducer/forgotPassword';
|
import ForgotPassword from '@overflow/member/redux/reducer/forgotPassword';
|
||||||
|
|
||||||
import AuthCrawlerRegistReducer from '@overflow/auth/redux/reducer/regist';
|
import AuthCrawlerRegistReducer from '@overflow/auth/redux/reducer/regist';
|
||||||
|
|
||||||
import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
|
import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
|
||||||
import AsyncNotify from '@overflow/app/redux/saga/AsyncNotify';
|
import AsyncNotify from '@overflow/app/redux/saga/AsyncNotify';
|
||||||
import AsyncRestRequest from '@overflow/app/redux/saga/AsyncRestRequest';
|
import AsyncRestRequest from '@overflow/app/redux/saga/AsyncRestRequest';
|
||||||
|
|
||||||
import DiscoveryService from '@overflow/discovery/api/service/DiscoveryService';
|
import DiscoveryService from '@overflow/discovery/api/service/DiscoveryService';
|
||||||
import NoAuthProbeService from '@overflow/noauthprobe/api/service/NoAuthProbeService';
|
import NoAuthProbeService from '@overflow/noauthprobe/api/service/NoAuthProbeService';
|
||||||
|
import MetaSensorDisplayItemReducer from '@overflow/meta/redux/reducer/sensor_display_item_read_all_by_crawler';
|
||||||
|
|
||||||
// Container Configuration
|
// Container Configuration
|
||||||
export interface ContainerConfig {
|
export interface ContainerConfig {
|
||||||
|
@ -78,7 +70,7 @@ export interface RPCConfig {
|
||||||
url: string;
|
url: string;
|
||||||
}
|
}
|
||||||
const rpcConfig: RPCConfig = {
|
const rpcConfig: RPCConfig = {
|
||||||
url: 'ws://192.168.1.209:19090/web',
|
url: 'ws://127.0.0.1:19090/web',
|
||||||
};
|
};
|
||||||
|
|
||||||
// REST Server Configuration
|
// REST Server Configuration
|
||||||
|
@ -146,6 +138,7 @@ const reduxConfig: ReduxConfig = {
|
||||||
AuthCrawlerRegistReducer,
|
AuthCrawlerRegistReducer,
|
||||||
ForgotPassword,
|
ForgotPassword,
|
||||||
SensorItemKeyReadAllByCrawlerReducer,
|
SensorItemKeyReadAllByCrawlerReducer,
|
||||||
|
MetaSensorDisplayItemReducer,
|
||||||
],
|
],
|
||||||
sagaWatchers: [
|
sagaWatchers: [
|
||||||
AsyncRequest,
|
AsyncRequest,
|
||||||
|
|
17
src/ts/@overflow/meta/api/model/MetaSensorDisplayItem.ts
Normal file
17
src/ts/@overflow/meta/api/model/MetaSensorDisplayItem.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import MetaCrawler from './MetaCrawler';
|
||||||
|
import MetaSensorItemUnit from './MetaSensorItemUnit';
|
||||||
|
import MetaSensorItemType from './MetaSensorItemType';
|
||||||
|
|
||||||
|
export interface MetaSensorDisplayItem {
|
||||||
|
id?: number;
|
||||||
|
key?: string;
|
||||||
|
displayName?: string;
|
||||||
|
description?: string;
|
||||||
|
crawler?: MetaCrawler;
|
||||||
|
unit?: MetaSensorItemUnit;
|
||||||
|
createDate?: Date;
|
||||||
|
default?: boolean;
|
||||||
|
itemType?: MetaSensorItemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MetaSensorDisplayItem;
|
8
src/ts/@overflow/meta/api/model/MetaSensorItemUnit.ts
Normal file
8
src/ts/@overflow/meta/api/model/MetaSensorItemUnit.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
export interface MetaSensorItemUnit {
|
||||||
|
id: number;
|
||||||
|
unit: string;
|
||||||
|
createDate: Date;
|
||||||
|
mark: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MetaSensorItemUnit;
|
|
@ -6,10 +6,7 @@ import {
|
||||||
} from './components/SensorItemTree';
|
} from './components/SensorItemTree';
|
||||||
import State from '../redux/state/SensorItemReadAll';
|
import State from '../redux/state/SensorItemReadAll';
|
||||||
|
|
||||||
import * as SensorItemReadAllByActions from '../redux/action/sensor_item_read_all';
|
import * as SensorDisplayItemReadAllByCrawlerActions from '../redux/action/sensor_display_item_read_all_by_crawler';
|
||||||
import * as SensorItemReadAllBySensorActions from '../redux/action/sensor_item_read_all_by_sensor';
|
|
||||||
import * as SensorItemTypeReadAllActions from '../redux/action/sensor_item_type_read_all';
|
|
||||||
import * as SensorItemKeyReadAllByCrawlerActions from '../redux/action/sensor_item_key_read_all_by_crawler';
|
|
||||||
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||||
|
|
||||||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||||
|
@ -22,25 +19,29 @@ export function mapStateToProps(state: any, props: any): SensorItemTreeStateProp
|
||||||
// metaSensorItemTypeList: state.MetaSensorItemTypeList,
|
// metaSensorItemTypeList: state.MetaSensorItemTypeList,
|
||||||
// sensorItemList: state.SensorItemList,
|
// sensorItemList: state.SensorItemList,
|
||||||
// metaSensorItemList: state.MetaSensorItemList,
|
// metaSensorItemList: state.MetaSensorItemList,
|
||||||
metaSensorItemKeyList: state.MetaSensorItemKeyList,
|
sensorDisplayItems: state.sensorDisplayItems,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorItemTreeDispatchProps {
|
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorItemTreeDispatchProps {
|
||||||
return {
|
return {
|
||||||
onReadAll: () => {
|
// onReadAll: () => {
|
||||||
dispatch(asyncRequestActions.request('MetaSensorItemService', 'readAll', SensorItemReadAllByActions.REQUEST));
|
// dispatch(asyncRequestActions.request('MetaSensorItemService', 'readAll', SensorItemReadAllByActions.REQUEST));
|
||||||
},
|
// },
|
||||||
onReadAllBySensor: (sensor: Sensor) => {
|
// onReadAllBySensor: (sensor: Sensor) => {
|
||||||
dispatch(asyncRequestActions.request('SensorItemService', 'readAllBySensor',
|
// dispatch(asyncRequestActions.request('SensorItemService', 'readAllBySensor',
|
||||||
SensorItemReadAllBySensorActions.REQUEST, JSON.stringify(sensor)));
|
// SensorItemReadAllBySensorActions.REQUEST, JSON.stringify(sensor)));
|
||||||
},
|
// },
|
||||||
onSensorItemTypeReadAll: () => {
|
// onSensorItemTypeReadAll: () => {
|
||||||
dispatch(asyncRequestActions.request('MetaSensorItemTypeService', 'readAll', SensorItemTypeReadAllActions.REQUEST));
|
// dispatch(asyncRequestActions.request('MetaSensorItemTypeService', 'readAll', SensorItemTypeReadAllActions.REQUEST));
|
||||||
},
|
// },
|
||||||
onReadAllSensorItemKeyByCrawler: (metaCrawler: MetaCrawler) => {
|
// onReadAllSensorItemKeyByCrawler: (metaCrawler: MetaCrawler) => {
|
||||||
dispatch(asyncRequestActions.request('MetaSensorItemKeyService', 'readAllByCrawler',
|
// dispatch(asyncRequestActions.request('MetaSensorItemKeyService', 'readAllByCrawler',
|
||||||
SensorItemKeyReadAllByCrawlerActions.REQUEST, JSON.stringify(metaCrawler)));
|
// SensorItemKeyReadAllByCrawlerActions.REQUEST, JSON.stringify(metaCrawler)));
|
||||||
|
// },
|
||||||
|
onReadAllDisplayItemByCrawler: (metaCrawler: MetaCrawler) => {
|
||||||
|
dispatch(asyncRequestActions.request('MetaSensorDisplayItemService', 'readAllByCrawler',
|
||||||
|
SensorDisplayItemReadAllByCrawlerActions.REQUEST, JSON.stringify(metaCrawler)));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
|
|
||||||
import MetaSensorItemType from '../../api/model/MetaSensorItemType';
|
import MetaSensorItemType from '../../api/model/MetaSensorItemType';
|
||||||
import MetaSensorItem from '../../api/model/MetaSensorItem';
|
import MetaSensorItem from '../../api/model/MetaSensorItem';
|
||||||
import MetaSensorItemKey from '../../api/model/MetaSensorItemKey';
|
import MetaSensorDisplayItem from '../../api/model/MetaSensorDisplayItem';
|
||||||
import MetaCrawler from '../../api/model/MetaCrawler';
|
import MetaCrawler from '../../api/model/MetaCrawler';
|
||||||
|
|
||||||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||||
|
@ -27,19 +27,24 @@ import SensorRegistInfo from '@overflow/sensor/api/model/SensorRegistInfo';
|
||||||
|
|
||||||
export interface SensorItemTreeStateProps {
|
export interface SensorItemTreeStateProps {
|
||||||
crawlerId?: number;
|
crawlerId?: number;
|
||||||
sensorItemList?: SensorItem[];
|
|
||||||
metaSensorItemTypeList?: MetaSensorItemType[];
|
// sensorItemList?: SensorItem[];
|
||||||
metaSensorItemList?: MetaSensorItem[];
|
// metaSensorItemTypeList?: MetaSensorItemType[];
|
||||||
metaSensorItemKeyList?: MetaSensorItemKey[];
|
// metaSensorItemList?: MetaSensorItem[];
|
||||||
|
// metaSensorItemKeyList?: MetaSensorItemKey[];
|
||||||
|
|
||||||
|
sensorDisplayItems?: MetaSensorDisplayItem[];
|
||||||
setSensor?(data: SensorRegistInfo): void;
|
setSensor?(data: SensorRegistInfo): void;
|
||||||
getSensor?(): SensorRegistInfo;
|
getSensor?(): SensorRegistInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SensorItemTreeDispatchProps {
|
export interface SensorItemTreeDispatchProps {
|
||||||
onReadAllBySensor?(sensor: Sensor): void;
|
// onReadAllBySensor?(sensor: Sensor): void;
|
||||||
onSensorItemTypeReadAll?(): void;
|
// onSensorItemTypeReadAll?(): void;
|
||||||
onReadAll?(): void;
|
// onReadAll?(): void;
|
||||||
onReadAllSensorItemKeyByCrawler?(metaCrawler: MetaCrawler): void;
|
// onReadAllSensorItemKeyByCrawler?(metaCrawler: MetaCrawler): void;
|
||||||
|
|
||||||
|
onReadAllDisplayItemByCrawler?(metaCrawler: MetaCrawler): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +59,7 @@ export interface SensorItemTreeState {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TreeItem {
|
interface TreeItem {
|
||||||
metaSensorItemList: Array<MetaSensorItem>;
|
metaSensorDisplayItems: Array<MetaSensorDisplayItem>;
|
||||||
metaSensorItemType: MetaSensorItemType;
|
metaSensorItemType: MetaSensorItemType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,25 +80,13 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
itemState: new Map(),
|
itemState: new Map(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.props.onReadAllDisplayItemByCrawler({ id: this.props.crawlerId });
|
||||||
// this.props.onReadAll();
|
|
||||||
// this.props.onSensorItemTypeReadAll();
|
|
||||||
// fs.readFile('../../../../../dh.json', this.handlJSONFile);
|
|
||||||
|
|
||||||
this.props.onReadAllSensorItemKeyByCrawler({id: this.props.crawlerId});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ViewSensorItemType(): JSX.Element[] {
|
public ViewSensorItemType(): JSX.Element[] {
|
||||||
|
|
||||||
// if(this.props.metaSensorItemTypeList === undefined
|
if (this.props.sensorDisplayItems === undefined) {
|
||||||
// || this.props.metaSensorItemList === undefined) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
if(this.props.metaSensorItemKeyList === undefined) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +95,6 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
let elems: JSX.Element[] = new Array();
|
let elems: JSX.Element[] = new Array();
|
||||||
|
|
||||||
this.itemMap.forEach((data: TreeItem, key: number) => {
|
this.itemMap.forEach((data: TreeItem, key: number) => {
|
||||||
// this.state.itemState[key] = new Array(data.metaSensorItemList.length).fill(false);
|
|
||||||
elems.push(
|
elems.push(
|
||||||
<List.Item key={key} >
|
<List.Item key={key} >
|
||||||
<List.Icon name={this.state.categoryState[key] ? 'chevron up' : 'chevron down'}
|
<List.Icon name={this.state.categoryState[key] ? 'chevron up' : 'chevron down'}
|
||||||
|
@ -114,8 +106,8 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
this.onTypeCheckCBox(key, checkProps, data);
|
this.onTypeCheckCBox(key, checkProps, data);
|
||||||
}} />
|
}} />
|
||||||
</List.Header>
|
</List.Header>
|
||||||
<List.Description style={{ marginLeft: '26px' }}>Category</List.Description>
|
<List.Description style={{ marginLeft: '26px' }}></List.Description>
|
||||||
{this.state.categoryState[key] ? this.ViewSensorItem(data.metaSensorItemList, key) : ''}
|
{this.state.categoryState[key] ? this.ViewSensorItem(data.metaSensorDisplayItems, key) : ''}
|
||||||
</List.Content>
|
</List.Content>
|
||||||
</List.Item>,
|
</List.Item>,
|
||||||
);
|
);
|
||||||
|
@ -126,24 +118,26 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ViewSensorItem(metaSensorItemList: MetaSensorItem[], parentKey: number): JSX.Element[] {
|
public ViewSensorItem(metaSensorDisplayItemList: MetaSensorDisplayItem[], parentKey: number): JSX.Element[] {
|
||||||
let elems: JSX.Element[] = new Array();
|
let elems: JSX.Element[] = new Array();
|
||||||
|
|
||||||
if (this.state.itemState[parentKey] === undefined) {
|
if (this.state.itemState[parentKey] === undefined) {
|
||||||
this.state.itemState[parentKey] = new Array(metaSensorItemList.length).fill(false);
|
this.state.itemState[parentKey] = new Array(metaSensorDisplayItemList.length).fill(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
metaSensorItemList.map((item: MetaSensorItem, idx: number) => {
|
metaSensorDisplayItemList.map((item: MetaSensorDisplayItem, idx: number) => {
|
||||||
elems.push(
|
elems.push(
|
||||||
<List.List key={String(parentKey) + String(idx)} onClick={this.onItemClick.bind(this, parentKey, idx)}>
|
<List.List key={String(parentKey) + String(idx)} onClick={this.onItemClick.bind(this, parentKey, idx)}>
|
||||||
<List.Item >
|
<List.Item >
|
||||||
<List.Icon name='file' />
|
<List.Icon name='file' />
|
||||||
<List.Content>
|
<List.Content>
|
||||||
<List.Header> <Checkbox label={item.name} checked={this.state.itemState[parentKey][idx]} onChange={
|
<List.Header>
|
||||||
(event: React.FormEvent<HTMLInputElement>, checkProps: CheckboxProps) => {
|
<Checkbox label={item.displayName} checked={this.state.itemState[parentKey][idx]} onChange={
|
||||||
this.onItemCheckCBox(parentKey, checkProps, item);
|
(event: React.FormEvent<HTMLInputElement>, checkProps: CheckboxProps) => {
|
||||||
}} /></List.Header>
|
this.onItemCheckCBox(parentKey, checkProps, item);
|
||||||
<List.Description style={{ marginLeft: '26px' }}>Sensor Item</List.Description>
|
}} />
|
||||||
|
</List.Header>
|
||||||
|
<List.Description style={{ marginLeft: '26px' }}>{this.getItemDesc(item)}</List.Description>
|
||||||
</List.Content>
|
</List.Content>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
</List.List>,
|
</List.List>,
|
||||||
|
@ -153,50 +147,39 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
return elems;
|
return elems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getItemDesc(item: MetaSensorDisplayItem): string {
|
||||||
|
if(item.default) {
|
||||||
|
return '(Recommend) ' + item.key;
|
||||||
|
}
|
||||||
|
return item.key;
|
||||||
|
}
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Container fluid>
|
<Container fluid>
|
||||||
<List selection>
|
<List selection>
|
||||||
{this.ViewSensorItemType()}
|
{this.ViewSensorItemType()}
|
||||||
</List>
|
</List>
|
||||||
{/*<Button primary floated='right' onClick={() => {
|
|
||||||
console.log(this.selectedItemMap);
|
|
||||||
}}>Test</Button><br /><br />*/}
|
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private sortItemMap(): void {
|
private sortItemMap(): void {
|
||||||
|
|
||||||
if(this.itemMap.size > 0) {
|
if (this.itemMap.size > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for(let si of this.props.metaSensorItemList) {
|
for (let displayItem of this.props.sensorDisplayItems) {
|
||||||
// let sensorItem: MetaSensorItem = si;
|
|
||||||
|
|
||||||
// if (this.itemMap.has(sensorItem.itemType.id)) {
|
if (this.itemMap.has(displayItem.itemType.id)) {
|
||||||
// this.itemMap.get(sensorItem.itemType.id).metaSensorItemList.push(sensorItem);
|
this.itemMap.get(displayItem.itemType.id).metaSensorDisplayItems.push(displayItem);
|
||||||
// } else {
|
|
||||||
// let item: TreeItem = { metaSensorItemList: null, metaSensorItemType: null };
|
|
||||||
// item.metaSensorItemList = [];
|
|
||||||
// item.metaSensorItemList.push(sensorItem);
|
|
||||||
// item.metaSensorItemType = this.GetMetaSensorItemType(sensorItem.itemType.id);
|
|
||||||
// this.itemMap.set(sensorItem.itemType.id, item);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
for(let si of this.props.metaSensorItemKeyList) {
|
|
||||||
let sensorItem: MetaSensorItem = si.item;
|
|
||||||
|
|
||||||
if (this.itemMap.has(sensorItem.itemType.id)) {
|
|
||||||
this.itemMap.get(sensorItem.itemType.id).metaSensorItemList.push(sensorItem);
|
|
||||||
} else {
|
} else {
|
||||||
let item: TreeItem = { metaSensorItemList: null, metaSensorItemType: null };
|
let item: TreeItem = { metaSensorDisplayItems: null, metaSensorItemType: null };
|
||||||
item.metaSensorItemList = [];
|
item.metaSensorDisplayItems = [];
|
||||||
item.metaSensorItemList.push(sensorItem);
|
item.metaSensorDisplayItems.push(displayItem);
|
||||||
item.metaSensorItemType = sensorItem.itemType;
|
item.metaSensorItemType = displayItem.itemType;
|
||||||
this.itemMap.set(sensorItem.itemType.id, item);
|
this.itemMap.set(displayItem.itemType.id, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,11 +223,11 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
this.state.categoryCheckState[key] = checkProps.checked;
|
this.state.categoryCheckState[key] = checkProps.checked;
|
||||||
let newItemState: Map<number, Array<boolean>> = _.clone(this.state.itemState);
|
let newItemState: Map<number, Array<boolean>> = _.clone(this.state.itemState);
|
||||||
if (newItemState[key] === undefined) {
|
if (newItemState[key] === undefined) {
|
||||||
newItemState[key] = new Array(data.metaSensorItemList.length).fill(false);
|
newItemState[key] = new Array(data.metaSensorDisplayItems.length).fill(false);
|
||||||
}
|
}
|
||||||
newItemState[key].fill(checkProps.checked);
|
newItemState[key].fill(checkProps.checked);
|
||||||
if (checkProps.checked) {
|
if (checkProps.checked) {
|
||||||
this.selectedItemMap.set(key, _.clone(data.metaSensorItemList));
|
this.selectedItemMap.set(key, _.clone(data.metaSensorDisplayItems));
|
||||||
} else {
|
} else {
|
||||||
this.selectedItemMap.get(key).length = 0;
|
this.selectedItemMap.get(key).length = 0;
|
||||||
}
|
}
|
||||||
|
@ -262,23 +245,6 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private GetMetaSensorItemType(id: number): MetaSensorItemType {
|
|
||||||
|
|
||||||
for(let sit of this.props.metaSensorItemTypeList) {
|
|
||||||
if(sit.id === id) {
|
|
||||||
return sit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// for (let i: number = 0; i < SensorTypeJsonData.length; ++i) {
|
|
||||||
// let msit: MetaSensorItemType = SensorTypeJsonData[i];
|
|
||||||
// if (msit.id === id) {
|
|
||||||
// return msit;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SensorItemTree;
|
export default SensorItemTree;
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/meta_sensor_display_item/read_all_by_crawler/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/meta_sensor_display_item/read_all_by_crawler/REQUEST/SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/meta_sensor_display_item/read_all_by_crawler/REQUEST/FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/meta_sensor_display_item/read_all_by_crawler/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/meta_sensor_display_item/read_all_by_crawler/REQUEST/SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/meta_sensor_display_item/read_all_by_crawler/REQUEST/FAILURE';
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import { ReducersMapObject } from 'redux';
|
||||||
|
|
||||||
|
|
||||||
|
import * as SensorDisplayItemReadAllByCrawlerActions from '../action/sensor_display_item_read_all_by_crawler';
|
||||||
|
import SensorDisplayItemReadAllByCrawlerState,
|
||||||
|
{ defaultState as SensorDisplayItemReadAllByCrawlerDefaultState }
|
||||||
|
from '../state/SensorDisplayItemReadAllByCrawler';
|
||||||
|
|
||||||
|
import MetaSensorDisplayItem from '../../api/model/MetaSensorDisplayItem';
|
||||||
|
|
||||||
|
const reducer: ReducersMapObject = {
|
||||||
|
[SensorDisplayItemReadAllByCrawlerActions.REQUEST_SUCCESS]:
|
||||||
|
(state: SensorDisplayItemReadAllByCrawlerState = SensorDisplayItemReadAllByCrawlerDefaultState, action: Action<MetaSensorItemKey[]>):
|
||||||
|
SensorDisplayItemReadAllByCrawlerState => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
sensorDisplayItems: <MetaSensorDisplayItem[]>action.payload,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[SensorDisplayItemReadAllByCrawlerActions.REQUEST_FAILURE]:
|
||||||
|
(state: SensorDisplayItemReadAllByCrawlerState = SensorDisplayItemReadAllByCrawlerDefaultState, action: Action<Error>):
|
||||||
|
SensorDisplayItemReadAllByCrawlerState => {
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reducer;
|
|
@ -0,0 +1,13 @@
|
||||||
|
import MetaSensorDisplayItem from '../../api/model/MetaSensorDisplayItem';
|
||||||
|
|
||||||
|
export interface State {
|
||||||
|
readonly sensorDisplayItems: MetaSensorDisplayItem[];
|
||||||
|
readonly error?: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultState: State = {
|
||||||
|
sensorDisplayItems: undefined,
|
||||||
|
error: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default State;
|
|
@ -1,10 +1,10 @@
|
||||||
import Sensor from './Sensor';
|
import Sensor from './Sensor';
|
||||||
import MetaSensorItem from '@overflow/meta/api/model/MetaSensorItem';
|
import MetaSensorDisplayItem from '@overflow/meta/api/model/MetaSensorDisplayItem';
|
||||||
|
|
||||||
interface SensorItem {
|
interface SensorItem {
|
||||||
id?: number;
|
id?: number;
|
||||||
sensor?: Sensor;
|
sensor?: Sensor;
|
||||||
item?: MetaSensorItem;
|
item?: MetaSensorDisplayItem;
|
||||||
createDate?: Date;
|
createDate?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
import MetaSensorItem from '@overflow/meta/api/model/MetaSensorItem';
|
import MetaSensorDisplayItem from '@overflow/meta/api/model/MetaSensorDisplayItem';
|
||||||
import Infra from '@overflow/infra/api/model/Infra';
|
import Infra from '@overflow/infra/api/model/Infra';
|
||||||
import Crawler from '@overflow/meta/api/model/MetaCrawler';
|
import Crawler from '@overflow/meta/api/model/MetaCrawler';
|
||||||
|
|
||||||
interface SensorRegistInfo {
|
interface SensorRegistInfo {
|
||||||
sensorItemMap: Map<number, Array<MetaSensorItem>>;
|
sensorItemMap: Map<number, Array<MetaSensorDisplayItem>>;
|
||||||
crawler: Crawler;
|
crawler: Crawler;
|
||||||
// targetId: number;
|
// targetId: number;
|
||||||
interval: number;
|
interval: number;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import Page from '@overflow/commons/api/model/Page';
|
||||||
import SensorRegistInfo from '../../api/model/SensorRegistInfo';
|
import SensorRegistInfo from '../../api/model/SensorRegistInfo';
|
||||||
import Sensor from '../../api/model/Sensor';
|
import Sensor from '../../api/model/Sensor';
|
||||||
import SensorItem from '../../api/model/SensorItem';
|
import SensorItem from '../../api/model/SensorItem';
|
||||||
import MetaSensorItem from '@overflow/meta/api/model/MetaSensorItem';
|
import MetaSensorDisplayItem from '@overflow/meta/api/model/MetaSensorDisplayItem';
|
||||||
import SensorItemTree from '@overflow/meta/react/SensorItemTree';
|
import SensorItemTree from '@overflow/meta/react/SensorItemTree';
|
||||||
import CrawlerSelectorContainer from '@overflow/meta/react/CrawlerSelector';
|
import CrawlerSelectorContainer from '@overflow/meta/react/CrawlerSelector';
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ export interface SensorConfigStepperDispatchProps {
|
||||||
onMoveTargetSensors?(targetId: number): void;
|
onMoveTargetSensors?(targetId: number): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export type SensorConfigStepperProps = SensorConfigStepperStateProps & SensorConfigStepperDispatchProps;
|
export type SensorConfigStepperProps = SensorConfigStepperStateProps & SensorConfigStepperDispatchProps;
|
||||||
|
|
||||||
export interface SensorConfigStepperState {
|
export interface SensorConfigStepperState {
|
||||||
|
@ -111,8 +112,6 @@ export class SensorConfigStepper extends React.Component<SensorConfigStepperProp
|
||||||
currentStep: step,
|
currentStep: step,
|
||||||
});
|
});
|
||||||
if (step === this.props.steps.length + 1) {
|
if (step === this.props.steps.length + 1) {
|
||||||
console.log('Done');
|
|
||||||
console.log(this.props.getSensor());
|
|
||||||
this.registSensor();
|
this.registSensor();
|
||||||
if (this.props.infraId === undefined) {
|
if (this.props.infraId === undefined) {
|
||||||
this.props.onMoveSensors();
|
this.props.onMoveSensors();
|
||||||
|
@ -172,7 +171,7 @@ export class SensorConfigStepper extends React.Component<SensorConfigStepperProp
|
||||||
|
|
||||||
let result: boolean = false;
|
let result: boolean = false;
|
||||||
|
|
||||||
this.props.getSensor().sensorItemMap.forEach((value: MetaSensorItem[], key: number) => {
|
this.props.getSensor().sensorItemMap.forEach((value: MetaSensorDisplayItem[], key: number) => {
|
||||||
if (value.length > 0) {
|
if (value.length > 0) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
@ -189,11 +188,12 @@ export class SensorConfigStepper extends React.Component<SensorConfigStepperProp
|
||||||
sensor.crawler = { id: sensorData.crawler.id };
|
sensor.crawler = { id: sensorData.crawler.id };
|
||||||
sensor.target = { id: sensorData.infra.target.id };
|
sensor.target = { id: sensorData.infra.target.id };
|
||||||
sensor.status = { id: MetaSensorStatus_ID.RUNNING };
|
sensor.status = { id: MetaSensorStatus_ID.RUNNING };
|
||||||
|
|
||||||
sensor.description = sensorData.infra.infraType.name + '-' + sensorData.crawler.name;
|
sensor.description = sensorData.infra.infraType.name + '-' + sensorData.crawler.name;
|
||||||
|
|
||||||
let siList: Array<SensorItem> = new Array;
|
let siList: Array<SensorItem> = new Array;
|
||||||
|
|
||||||
sensorData.sensorItemMap.forEach((value: MetaSensorItem[], key: number) => {
|
sensorData.sensorItemMap.forEach((value: MetaSensorDisplayItem[], key: number) => {
|
||||||
for (let msi of value) {
|
for (let msi of value) {
|
||||||
siList.push({
|
siList.push({
|
||||||
item: { id: msi.id },
|
item: { id: msi.id },
|
||||||
|
@ -201,9 +201,6 @@ export class SensorConfigStepper extends React.Component<SensorConfigStepperProp
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(sensor);
|
|
||||||
console.log(siList);
|
|
||||||
|
|
||||||
let etc: any = { interval: sensorData.interval };
|
let etc: any = { interval: sensorData.interval };
|
||||||
|
|
||||||
this.props.onRegistSensorConfig(sensor, siList, etc);
|
this.props.onRegistSensorConfig(sensor, siList, etc);
|
||||||
|
@ -267,8 +264,8 @@ export class SensorConfigStepper extends React.Component<SensorConfigStepperProp
|
||||||
<Button content='Prev' icon='left arrow' labelPosition='left'
|
<Button content='Prev' icon='left arrow' labelPosition='left'
|
||||||
onClick={this.handlePrev.bind(this)} disabled={this.checkPrevDisabled()} />
|
onClick={this.handlePrev.bind(this)} disabled={this.checkPrevDisabled()} />
|
||||||
<Button.Or />
|
<Button.Or />
|
||||||
<Button content={this.state.currentStep === 3 ? 'Finish' : 'Next'}
|
<Button content={this.state.currentStep === 4 ? 'Finish' : 'Next'}
|
||||||
icon={this.state.currentStep === 3 ? 'send' : 'right arrow'} labelPosition='right' positive
|
icon={this.state.currentStep === 4 ? 'send' : 'right arrow'} labelPosition='right' positive
|
||||||
onClick={this.handleNext.bind(this)} disabled={this.checkNextDisabled()} />
|
onClick={this.handleNext.bind(this)} disabled={this.checkNextDisabled()} />
|
||||||
</Button.Group>
|
</Button.Group>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
|
@ -81,14 +81,14 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
|
||||||
}
|
}
|
||||||
|
|
||||||
public stepNext = () => {
|
public stepNext = () => {
|
||||||
this.setState({isTarget:true});
|
this.setState({ isTarget: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
let steps = [
|
let steps = [
|
||||||
<SensorConfigTargetSelectContainer setSensor={this.setSensor.bind(this)} getSensor={this.getSensor.bind(this)}
|
<SensorConfigTargetSelectContainer setSensor={this.setSensor.bind(this)} getSensor={this.getSensor.bind(this)}
|
||||||
infraId={this.props.infraId} stepNext={this.stepNext.bind(this)} />,
|
infraId={this.props.infraId} stepNext={this.stepNext.bind(this)} />,
|
||||||
<CrawlerSelectorContainer onSelectCrawlerId={this.onSelectCrawlerId.bind(this)}
|
<CrawlerSelectorContainer onSelectCrawlerId={this.onSelectCrawlerId.bind(this)}
|
||||||
setSensor={this.setSensor.bind(this)} getSensor={this.getSensor.bind(this)} />,
|
setSensor={this.setSensor.bind(this)} getSensor={this.getSensor.bind(this)} />,
|
||||||
<Segment vertical>
|
<Segment vertical>
|
||||||
|
@ -105,9 +105,6 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export interface ETCSelectorProps {
|
export interface ETCSelectorProps {
|
||||||
setSensor?(data: SensorRegistInfo): void;
|
setSensor?(data: SensorRegistInfo): void;
|
||||||
getSensor?(): SensorRegistInfo;
|
getSensor?(): SensorRegistInfo;
|
||||||
|
@ -128,7 +125,7 @@ export class ETCSelector extends React.Component<ETCSelectorProps, ETCSelectorSt
|
||||||
sd.interval = 5;
|
sd.interval = 5;
|
||||||
this.props.setSensor(sd);
|
this.props.setSensor(sd);
|
||||||
}
|
}
|
||||||
public handleIntervalChange = (e: any, { value }: any) => {
|
private handleIntervalChange = (e: any, { value }: any) => {
|
||||||
this.setState({ interval: value });
|
this.setState({ interval: value });
|
||||||
|
|
||||||
let sd = this.props.getSensor();
|
let sd = this.props.getSensor();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user