sensor setup item
This commit is contained in:
parent
99724e10ce
commit
8692555516
|
@ -24,6 +24,9 @@ import readHostReducer from '@overflow/infra/redux/reducer/host_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 MetaSensorItemTypeReadAllReducer from '@overflow/meta/redux/reducer/sensor_item_type_read_all';
|
||||||
|
|
||||||
import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
|
import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
|
||||||
|
|
||||||
// Container Configuration
|
// Container Configuration
|
||||||
|
@ -74,6 +77,8 @@ const reduxConfig: ReduxConfig = {
|
||||||
readHostReducer,
|
readHostReducer,
|
||||||
CrawlerReadAllByTargetReducer,
|
CrawlerReadAllByTargetReducer,
|
||||||
CrawlerAuthInputsReducer,
|
CrawlerAuthInputsReducer,
|
||||||
|
MetaSensorItemReadAllReducer,
|
||||||
|
MetaSensorItemTypeReadAllReducer,
|
||||||
],
|
],
|
||||||
sagaWatchers: [
|
sagaWatchers: [
|
||||||
AsyncRequest,
|
AsyncRequest,
|
||||||
|
|
|
@ -20,10 +20,11 @@ import * as asyncRequestActions from '@overflow/commons/redux/action/asyncReques
|
||||||
|
|
||||||
// FIXME::....
|
// FIXME::....
|
||||||
|
|
||||||
export function mapStateToProps(state: any): CrawlerSelectorStateProps {
|
export function mapStateToProps(state: any, props: any): CrawlerSelectorStateProps {
|
||||||
return {
|
return {
|
||||||
metaCralwerList: state.MetaCrawlerList,
|
metaCralwerList: state.MetaCrawlerList,
|
||||||
metaCrawlerInputItemList:state.MetaCrawlerInputItemList,
|
metaCrawlerInputItemList:state.MetaCrawlerInputItemList,
|
||||||
|
onSelectCrawlerId: props.onSelectCrawlerId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,18 +6,34 @@ import {
|
||||||
} from './components/SensorItemTree';
|
} from './components/SensorItemTree';
|
||||||
import State from '../redux/state/SensorItemReadAll';
|
import State from '../redux/state/SensorItemReadAll';
|
||||||
|
|
||||||
import * as SensorItemReadAllActions from '../redux/action/sensor_item_read_all';
|
import * as SensorItemReadAllByActions from '../redux/action/sensor_item_read_all';
|
||||||
|
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 asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||||
|
|
||||||
export function mapStateToProps(state: any): SensorItemTreeStateProps {
|
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||||
|
|
||||||
|
|
||||||
|
export function mapStateToProps(state: any, props: any): SensorItemTreeStateProps {
|
||||||
return {
|
return {
|
||||||
|
crawlerId: props.crawlerId,
|
||||||
|
metaSensorItemTypeList: state.MetaSensorItemTypeList,
|
||||||
|
sensorItemList: state.SensorItemList,
|
||||||
|
metaSensorItemList: state.MetaSensorItemList,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorItemTreeDispatchProps {
|
export function mapDispatchToProps(dispatch: Dispatch<any>): SensorItemTreeDispatchProps {
|
||||||
return {
|
return {
|
||||||
onReadAll: () => {
|
onReadAll: () => {
|
||||||
dispatch(SensorItemReadAllActions.request());
|
dispatch(asyncRequestActions.request('MetaSensorItemService', 'readAll', SensorItemReadAllByActions.REQUEST));
|
||||||
|
},
|
||||||
|
onReadAllBySensor: (sensor: Sensor) => {
|
||||||
|
dispatch(asyncRequestActions.request('SensorItemService', 'readAllBySensor',
|
||||||
|
SensorItemReadAllBySensorActions.REQUEST, JSON.stringify(sensor)));
|
||||||
|
},
|
||||||
|
onSensorItemTypeReadAll: () => {
|
||||||
|
dispatch(asyncRequestActions.request('MetaSensorItemTypeService', 'readAll', SensorItemTypeReadAllActions.REQUEST));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,13 @@ export interface CrawlerSelectorStateProps {
|
||||||
metaCralwerList?: MetaCrawler[];
|
metaCralwerList?: MetaCrawler[];
|
||||||
targetId?: number;
|
targetId?: number;
|
||||||
metaCrawlerInputItemList?: MetaCrawlerInputItem[];
|
metaCrawlerInputItemList?: MetaCrawlerInputItem[];
|
||||||
|
onSelectCrawlerId?(id: number): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CrawlerSelectorDispatchProps {
|
export interface CrawlerSelectorDispatchProps {
|
||||||
onCrawlerReadAllByTarget?(target: Target): void;
|
onCrawlerReadAllByTarget?(target: Target): void;
|
||||||
onCrawlerReadAllByMetaCrawler?(crawler: MetaCrawler): void;
|
onCrawlerReadAllByMetaCrawler?(crawler: MetaCrawler): void;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CrawlerSelectorProps = CrawlerSelectorStateProps & CrawlerSelectorDispatchProps;
|
export type CrawlerSelectorProps = CrawlerSelectorStateProps & CrawlerSelectorDispatchProps;
|
||||||
|
|
|
@ -17,13 +17,22 @@ 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 Sensor from '@overflow/sensor/api/model/Sensor';
|
||||||
|
import SensorItem from '@overflow/sensor/api/model/SensorItem';
|
||||||
|
|
||||||
import * as Utils from '@overflow/commons/util/Utils';
|
import * as Utils from '@overflow/commons/util/Utils';
|
||||||
|
|
||||||
|
|
||||||
export interface SensorItemTreeStateProps {
|
export interface SensorItemTreeStateProps {
|
||||||
|
crawlerId?: number;
|
||||||
|
sensorItemList?: SensorItem[];
|
||||||
|
metaSensorItemTypeList?: MetaSensorItemType[];
|
||||||
|
metaSensorItemList?: MetaSensorItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SensorItemTreeDispatchProps {
|
export interface SensorItemTreeDispatchProps {
|
||||||
|
onReadAllBySensor?(sensor: Sensor): void;
|
||||||
|
onSensorItemTypeReadAll?(): void;
|
||||||
onReadAll?(): void;
|
onReadAll?(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +67,10 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
categoryCheckState: new Map(),
|
categoryCheckState: new Map(),
|
||||||
itemState: new Map(),
|
itemState: new Map(),
|
||||||
};
|
};
|
||||||
this.sortItemMap();
|
|
||||||
|
|
||||||
|
|
||||||
|
this.props.onReadAll();
|
||||||
|
this.props.onSensorItemTypeReadAll();
|
||||||
// fs.readFile('../../../../../dh.json', this.handlJSONFile);
|
// fs.readFile('../../../../../dh.json', this.handlJSONFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +79,14 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
|
|
||||||
|
|
||||||
public ViewSensorItemType(): JSX.Element[] {
|
public ViewSensorItemType(): JSX.Element[] {
|
||||||
|
|
||||||
|
if(this.props.metaSensorItemTypeList === undefined
|
||||||
|
|| this.props.metaSensorItemList === undefined) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sortItemMap();
|
||||||
|
|
||||||
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) => {
|
||||||
|
@ -83,7 +102,7 @@ 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' }}>Category</List.Description>
|
||||||
{this.state.categoryState[key] ? this.ViewSensorItem(data.metaSensorItemList, key) : ''}
|
{this.state.categoryState[key] ? this.ViewSensorItem(data.metaSensorItemList, key) : ''}
|
||||||
</List.Content>
|
</List.Content>
|
||||||
</List.Item>,
|
</List.Item>,
|
||||||
|
@ -112,7 +131,7 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
(event: React.FormEvent<HTMLInputElement>, checkProps: CheckboxProps) => {
|
(event: React.FormEvent<HTMLInputElement>, checkProps: CheckboxProps) => {
|
||||||
this.onItemCheckCBox(parentKey, checkProps, item);
|
this.onItemCheckCBox(parentKey, checkProps, item);
|
||||||
}} /></List.Header>
|
}} /></List.Header>
|
||||||
<List.Description style={{marginLeft:'26px'}}>Sensor Item</List.Description>
|
<List.Description style={{ marginLeft: '26px' }}>Sensor Item</List.Description>
|
||||||
</List.Content>
|
</List.Content>
|
||||||
</List.Item>
|
</List.Item>
|
||||||
</List.List>,
|
</List.List>,
|
||||||
|
@ -137,8 +156,12 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
|
|
||||||
private sortItemMap(): void {
|
private sortItemMap(): void {
|
||||||
|
|
||||||
SensorJsonData.map((data: any, idx: number) => {
|
if(this.itemMap.size > 0) {
|
||||||
let sensorItem: MetaSensorItem = data;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(let si of this.props.metaSensorItemList) {
|
||||||
|
let sensorItem: MetaSensorItem = si;
|
||||||
|
|
||||||
if (this.itemMap.has(sensorItem.itemType.id)) {
|
if (this.itemMap.has(sensorItem.itemType.id)) {
|
||||||
this.itemMap.get(sensorItem.itemType.id).metaSensorItemList.push(sensorItem);
|
this.itemMap.get(sensorItem.itemType.id).metaSensorItemList.push(sensorItem);
|
||||||
|
@ -149,7 +172,21 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
item.metaSensorItemType = this.GetMetaSensorItemType(sensorItem.itemType.id);
|
item.metaSensorItemType = this.GetMetaSensorItemType(sensorItem.itemType.id);
|
||||||
this.itemMap.set(sensorItem.itemType.id, item);
|
this.itemMap.set(sensorItem.itemType.id, item);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
// SensorJsonData.map((data: any, idx: number) => {
|
||||||
|
// let sensorItem: MetaSensorItem = data;
|
||||||
|
|
||||||
|
// if (this.itemMap.has(sensorItem.itemType.id)) {
|
||||||
|
// this.itemMap.get(sensorItem.itemType.id).metaSensorItemList.push(sensorItem);
|
||||||
|
// } 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);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
private onItemClick = (parentKey: number, idx: number) => {
|
private onItemClick = (parentKey: number, idx: number) => {
|
||||||
|
@ -207,93 +244,91 @@ export class SensorItemTree extends React.Component<SensorItemTreeProps, SensorI
|
||||||
|
|
||||||
private GetMetaSensorItemType(id: number): MetaSensorItemType {
|
private GetMetaSensorItemType(id: number): MetaSensorItemType {
|
||||||
|
|
||||||
for (let i: number = 0; i < SensorTypeJsonData.length; ++i) {
|
for(let sit of this.props.metaSensorItemTypeList) {
|
||||||
let msit: MetaSensorItemType = SensorTypeJsonData[i];
|
if(sit.id === id) {
|
||||||
if (msit.id === id) {
|
return sit;
|
||||||
return msit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
// SensorTypeJsonData.map((data: any, idx: number) => {
|
// for (let i: number = 0; i < SensorTypeJsonData.length; ++i) {
|
||||||
// let msit: MetaSensorItemType = data;
|
// let msit: MetaSensorItemType = SensorTypeJsonData[i];
|
||||||
// if (msit.id === id) {
|
// if (msit.id === id) {
|
||||||
// return msit;
|
// return msit;
|
||||||
// }
|
// }
|
||||||
// return null;
|
// }
|
||||||
// });
|
return null;
|
||||||
// return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const SensorTypeJsonData: any = [
|
// const SensorTypeJsonData: any = [
|
||||||
{
|
// {
|
||||||
'id': 1,
|
// 'id': 1,
|
||||||
'create_date': '2017-06-26T10:49:39Z',
|
// 'create_date': '2017-06-26T10:49:39Z',
|
||||||
'description': 'CPU blah blah blah',
|
// 'description': 'CPU blah blah blah',
|
||||||
'name': 'CPU',
|
// 'name': 'CPU',
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
'id': 2,
|
// 'id': 2,
|
||||||
'create_date': '2017-06-26T10:49:39Z',
|
// 'create_date': '2017-06-26T10:49:39Z',
|
||||||
'description': 'MEMORY blah blah blah',
|
// 'description': 'MEMORY blah blah blah',
|
||||||
'name': 'MEMORY',
|
// 'name': 'MEMORY',
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
'id': 3,
|
// 'id': 3,
|
||||||
'create_date': '2017-06-26T10:49:39Z',
|
// 'create_date': '2017-06-26T10:49:39Z',
|
||||||
'description': 'DISK blah blah blah',
|
// 'description': 'DISK blah blah blah',
|
||||||
'name': 'DISK',
|
// 'name': 'DISK',
|
||||||
},
|
// },
|
||||||
];
|
// ];
|
||||||
|
|
||||||
const SensorJsonData = [{
|
// const SensorJsonData = [{
|
||||||
'id': 1,
|
// 'id': 1,
|
||||||
'itemType': {
|
// 'itemType': {
|
||||||
'id': 1,
|
// 'id': 1,
|
||||||
'name': 'CPU',
|
// 'name': 'CPU',
|
||||||
'description': 'CPU blah blah blah',
|
// 'description': 'CPU blah blah blah',
|
||||||
'createDate': 1498474179690,
|
// 'createDate': 1498474179690,
|
||||||
},
|
// },
|
||||||
'key': 'cpu.usage',
|
// 'key': 'cpu.usage',
|
||||||
'name': 'CPU USAGE',
|
// 'name': 'CPU USAGE',
|
||||||
'createDate': 1498475408269,
|
// 'createDate': 1498475408269,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
'id': 2,
|
// 'id': 2,
|
||||||
'itemType': {
|
// 'itemType': {
|
||||||
'id': 1,
|
// 'id': 1,
|
||||||
'name': 'CPU',
|
// 'name': 'CPU',
|
||||||
'description': 'CPU blah blah blah',
|
// 'description': 'CPU blah blah blah',
|
||||||
'createDate': 1498474179690,
|
// 'createDate': 1498474179690,
|
||||||
},
|
// },
|
||||||
'key': 'cpu.free',
|
// 'key': 'cpu.free',
|
||||||
'name': 'CPU FREE',
|
// 'name': 'CPU FREE',
|
||||||
'createDate': 1498475408361,
|
// 'createDate': 1498475408361,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
'id': 3,
|
// 'id': 3,
|
||||||
'itemType': {
|
// 'itemType': {
|
||||||
'id': 2,
|
// 'id': 2,
|
||||||
'name': 'MEMORY',
|
// 'name': 'MEMORY',
|
||||||
'description': 'MEMORY blah blah blah',
|
// 'description': 'MEMORY blah blah blah',
|
||||||
'createDate': 1498474179811,
|
// 'createDate': 1498474179811,
|
||||||
},
|
// },
|
||||||
'key': 'mem.usage',
|
// 'key': 'mem.usage',
|
||||||
'name': 'MEMORY USAGE',
|
// 'name': 'MEMORY USAGE',
|
||||||
'createDate': 1498475408376,
|
// 'createDate': 1498475408376,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
'id': 4,
|
// 'id': 4,
|
||||||
'itemType': {
|
// 'itemType': {
|
||||||
'id': 2,
|
// 'id': 2,
|
||||||
'name': 'MEMORY',
|
// 'name': 'MEMORY',
|
||||||
'description': 'MEMORY blah blah blah',
|
// 'description': 'MEMORY blah blah blah',
|
||||||
'createDate': 1498474179811,
|
// 'createDate': 1498474179811,
|
||||||
},
|
// },
|
||||||
'key': 'mem.free',
|
// 'key': 'mem.free',
|
||||||
'name': 'MEMORY FREE',
|
// 'name': 'MEMORY FREE',
|
||||||
'createDate': 1498475408394,
|
// 'createDate': 1498475408394,
|
||||||
}];
|
// }];
|
||||||
|
|
||||||
export default SensorItemTree;
|
export default SensorItemTree;
|
||||||
|
|
|
@ -6,39 +6,39 @@ import SensorItemReadAllPayload from '../payload/SensorItemReadAllPayload';
|
||||||
|
|
||||||
// Action Type
|
// Action Type
|
||||||
export type REQUEST = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST';
|
export type REQUEST = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST';
|
||||||
export type REQUEST_SUCCESS = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST_SUCCESS';
|
export type REQUEST_SUCCESS = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST/SUCCESS';
|
||||||
export type REQUEST_FAILURE = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST_FAILURE';
|
export type REQUEST_FAILURE = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST/FAILURE';
|
||||||
|
|
||||||
export const REQUEST: REQUEST = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST';
|
export const REQUEST: REQUEST = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST';
|
||||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST_SUCCESS';
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST/SUCCESS';
|
||||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST_FAILURE';
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/meta_sensor_item/sensor_item_read_all/REQUEST/FAILURE';
|
||||||
|
|
||||||
// Action Creater
|
// // Action Creater
|
||||||
export type request = () => Action<SensorItemReadAllPayload>;
|
// export type request = () => Action<SensorItemReadAllPayload>;
|
||||||
export type requestSuccess = (metaSensorItemList: MetaSensorItem[]) => Action<MetaSensorItem[]>;
|
// export type requestSuccess = (metaSensorItemList: MetaSensorItem[]) => Action<MetaSensorItem[]>;
|
||||||
export type requestFailure = (error: Error) => Action;
|
// export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const request: request = (): Action<SensorItemReadAllPayload> => {
|
// export const request: request = (): Action<SensorItemReadAllPayload> => {
|
||||||
return {
|
// return {
|
||||||
type: REQUEST,
|
// type: REQUEST,
|
||||||
payload: {
|
// payload: {
|
||||||
|
|
||||||
},
|
// },
|
||||||
};
|
// };
|
||||||
};
|
// };
|
||||||
|
|
||||||
export const requestSuccess: requestSuccess = (metaSensorItemList: MetaSensorItem[]): Action<MetaSensorItem[]> => {
|
// export const requestSuccess: requestSuccess = (metaSensorItemList: MetaSensorItem[]): Action<MetaSensorItem[]> => {
|
||||||
return {
|
// return {
|
||||||
type: REQUEST_SUCCESS,
|
// type: REQUEST_SUCCESS,
|
||||||
payload: metaSensorItemList,
|
// payload: metaSensorItemList,
|
||||||
};
|
// };
|
||||||
};
|
// };
|
||||||
|
|
||||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
// export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
return {
|
// return {
|
||||||
type: REQUEST_FAILURE,
|
// type: REQUEST_FAILURE,
|
||||||
error: error,
|
// error: error,
|
||||||
};
|
// };
|
||||||
};
|
// };
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/meta_sensor_item/read_all_by_sensor/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/meta_sensor_item/read_all_by_sensor/REQUEST/SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/meta_sensor_item/read_all_by_sensor/REQUEST/FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/meta_sensor_item/read_all_by_sensor/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/meta_sensor_item/read_all_by_sensor/REQUEST/SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/meta_sensor_item/read_all_by_sensor/REQUEST/FAILURE';
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/meta_sensor_item_type/read_all/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/meta_sensor_item_type/read_all/REQUEST/SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/meta_sensor_item_type/read_all/REQUEST/FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/meta_sensor_item_type/read_all/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/meta_sensor_item_type/read_all/REQUEST/SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/meta_sensor_item_type/read_all/REQUEST/FAILURE';
|
28
src/ts/@overflow/meta/redux/reducer/sensor_item_read_all.ts
Normal file
28
src/ts/@overflow/meta/redux/reducer/sensor_item_read_all.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import { ReducersMapObject } from 'redux';
|
||||||
|
import SensorItem from '@overflow/sensor/api/model/SensorItem';
|
||||||
|
|
||||||
|
import * as SensorItemReadAllActions from '../action/sensor_item_read_all';
|
||||||
|
import SensorItemReadAllState, { defaultState as SensorItemReadAllDefaultState } from '../state/SensorItemReadAll';
|
||||||
|
|
||||||
|
import MetaSensorItem from '../../api/model/MetaSensorItem';
|
||||||
|
|
||||||
|
const reducer: ReducersMapObject = {
|
||||||
|
[SensorItemReadAllActions.REQUEST_SUCCESS]:
|
||||||
|
(state: SensorItemReadAllState = SensorItemReadAllDefaultState, action: Action<MetaSensorItem[]>):
|
||||||
|
SensorItemReadAllState => {
|
||||||
|
console.log(action);
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
MetaSensorItemList: <MetaSensorItem[]>action.payload,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[SensorItemReadAllActions.REQUEST_FAILURE]:
|
||||||
|
(state: SensorItemReadAllState = SensorItemReadAllDefaultState, action: Action<Error>):
|
||||||
|
SensorItemReadAllState => {
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reducer;
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import { ReducersMapObject } from 'redux';
|
||||||
|
import SensorItem from '@overflow/sensor/api/model/SensorItem';
|
||||||
|
|
||||||
|
import * as SensorItemReadAllBySensorActions from '../action/sensor_item_read_all_by_sensor';
|
||||||
|
import SensorItemReadAllBySensorState, { defaultState as SensorItemReadAllBySensorDefaultState } from '../state/SensorItemReadAllBySensor';
|
||||||
|
|
||||||
|
import MetaCrawler from '../../api/model/MetaCrawler';
|
||||||
|
|
||||||
|
const reducer: ReducersMapObject = {
|
||||||
|
[SensorItemReadAllBySensorActions.REQUEST_SUCCESS]:
|
||||||
|
(state: SensorItemReadAllBySensorState = SensorItemReadAllBySensorDefaultState, action: Action<SensorItem[]>):
|
||||||
|
SensorItemReadAllBySensorState => {
|
||||||
|
console.log(action);
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
SensorItemList: <SensorItem[]>action.payload,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[SensorItemReadAllBySensorActions.REQUEST_FAILURE]:
|
||||||
|
(state: SensorItemReadAllBySensorState = SensorItemReadAllBySensorDefaultState, action: Action<Error>):
|
||||||
|
SensorItemReadAllBySensorState => {
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reducer;
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import { ReducersMapObject } from 'redux';
|
||||||
|
import SensorItem from '@overflow/sensor/api/model/SensorItem';
|
||||||
|
|
||||||
|
import * as SensorItemTypeReadAllActions from '../action/sensor_item_type_read_all';
|
||||||
|
import SensorItemTypeReadAllState, { defaultState as SensorItemTypeReadAllDefaultState } from '../state/SensorItemTypeReadAll';
|
||||||
|
|
||||||
|
import MetaSensorItemType from '../../api/model/MetaSensorItemType';
|
||||||
|
|
||||||
|
const reducer: ReducersMapObject = {
|
||||||
|
[SensorItemTypeReadAllActions.REQUEST_SUCCESS]:
|
||||||
|
(state: SensorItemTypeReadAllState = SensorItemTypeReadAllDefaultState, action: Action<MetaSensorItemType[]>):
|
||||||
|
SensorItemTypeReadAllState => {
|
||||||
|
console.log(action);
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
MetaSensorItemTypeList: <MetaSensorItemType[]>action.payload,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[SensorItemTypeReadAllActions.REQUEST_FAILURE]:
|
||||||
|
(state: SensorItemTypeReadAllState = SensorItemTypeReadAllDefaultState, action: Action<Error>):
|
||||||
|
SensorItemTypeReadAllState => {
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reducer;
|
|
@ -1,11 +1,12 @@
|
||||||
|
import MetaSensorItem from '../../api/model/MetaSensorItem';
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
readonly isGetSensorItemAll: boolean;
|
readonly MetaSensorItemList: MetaSensorItem[];
|
||||||
readonly error?: Error;
|
readonly error?: Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultState: State = {
|
export const defaultState: State = {
|
||||||
isGetSensorItemAll: undefined,
|
MetaSensorItemList: undefined,
|
||||||
error: undefined,
|
error: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
import SensorItem from '@overflow/sensor/api/model/SensorItem';
|
||||||
|
|
||||||
|
export interface State {
|
||||||
|
readonly SensorItemList: SensorItem[];
|
||||||
|
readonly error?: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultState: State = {
|
||||||
|
SensorItemList: undefined,
|
||||||
|
error: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default State;
|
14
src/ts/@overflow/meta/redux/state/SensorItemTypeReadAll.ts
Normal file
14
src/ts/@overflow/meta/redux/state/SensorItemTypeReadAll.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
import MetaSensorItemType from '../../api/model/MetaSensorItemType';
|
||||||
|
|
||||||
|
export interface State {
|
||||||
|
readonly MetaSensorItemTypeList: MetaSensorItemType[];
|
||||||
|
readonly error?: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultState: State = {
|
||||||
|
MetaSensorItemTypeList: undefined,
|
||||||
|
error: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default State;
|
Loading…
Reference in New Issue
Block a user