Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c790051671
|
@ -17,12 +17,14 @@ import noauthDenyReducer from '@overflow/noauthprobe/redux/reducer/deny';
|
||||||
|
|
||||||
import readAllTargetByProbeReducer from '@overflow/target/redux/reducer/readAllByProbe';
|
import readAllTargetByProbeReducer from '@overflow/target/redux/reducer/readAllByProbe';
|
||||||
import readAllTargetByDomainReducer from '@overflow/target/redux/reducer/read_all_by_domain';
|
import readAllTargetByDomainReducer from '@overflow/target/redux/reducer/read_all_by_domain';
|
||||||
|
|
||||||
import readTargetReducer from '@overflow/target/redux/reducer/read';
|
import readTargetReducer from '@overflow/target/redux/reducer/read';
|
||||||
|
|
||||||
import sensorReadAllByTargetReducer from '@overflow/sensor/redux/reducer/read_all_by_target';
|
import sensorReadAllByTargetReducer from '@overflow/sensor/redux/reducer/read_all_by_target';
|
||||||
import sensorReadAllByDomainReducer from '@overflow/sensor/redux/reducer/read_all_by_domain';
|
import sensorReadAllByDomainReducer from '@overflow/sensor/redux/reducer/read_all_by_domain';
|
||||||
import SensorReadReducer from '@overflow/sensor/redux/reducer/read';
|
import SensorReadReducer from '@overflow/sensor/redux/reducer/read';
|
||||||
import SensorItemReadAllBySensorReducer from '@overflow/sensor/redux/reducer/item_read_all_by_sensor';
|
import SensorItemReadAllBySensorReducer from '@overflow/sensor/redux/reducer/item_read_all_by_sensor';
|
||||||
|
import readAllTargetByInfraReducer from '@overflow/sensor/redux/reducer/read_all_by_infra';
|
||||||
|
|
||||||
import readMachineReducer from '@overflow/infra/redux/reducer/machine_read';
|
import readMachineReducer from '@overflow/infra/redux/reducer/machine_read';
|
||||||
import readHostReducer from '@overflow/infra/redux/reducer/host_read';
|
import readHostReducer from '@overflow/infra/redux/reducer/host_read';
|
||||||
|
@ -38,6 +40,7 @@ import MetaSensorItemTypeReadAllReducer from '@overflow/meta/redux/reducer/senso
|
||||||
import DiscoveryInfraTargetRegistAllReducer from '@overflow/discovery/redux/reducer/infra_target_regist_all';
|
import DiscoveryInfraTargetRegistAllReducer from '@overflow/discovery/redux/reducer/infra_target_regist_all';
|
||||||
|
|
||||||
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 AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
|
import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
|
||||||
|
|
||||||
|
@ -101,6 +104,11 @@ const reduxConfig: ReduxConfig = {
|
||||||
modifyProbeReducer,
|
modifyProbeReducer,
|
||||||
DiscoveryInfraTargetRegistAllReducer,
|
DiscoveryInfraTargetRegistAllReducer,
|
||||||
HistoryReadAllByProbeReducer,
|
HistoryReadAllByProbeReducer,
|
||||||
|
<<<<<<< 15ea4947a2911a013b4ba1377088e49bd993a7fa
|
||||||
|
HistoryReadAllByProbeAndTypeReducer,
|
||||||
|
=======
|
||||||
|
readAllTargetByInfraReducer,
|
||||||
|
>>>>>>> fixed target / sensor
|
||||||
],
|
],
|
||||||
sagaWatchers: [
|
sagaWatchers: [
|
||||||
AsyncRequest,
|
AsyncRequest,
|
||||||
|
|
|
@ -11,7 +11,7 @@ class HistoryList extends React.Component<RouteComponentProps<object>, object> {
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<HistoryListContainer />
|
<HistoryListContainer params={this.props.match.path}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ export class AppLayout extends React.Component<Props, State> {
|
||||||
<Route exact={true} path={`${this.props.match.url}probe_setup`} component={ProbeSetup}/>
|
<Route exact={true} path={`${this.props.match.url}probe_setup`} component={ProbeSetup}/>
|
||||||
<Route exact={true} path={`${this.props.match.url}histories`} component={HistoryList}/>
|
<Route exact={true} path={`${this.props.match.url}histories`} component={HistoryList}/>
|
||||||
<Route exact={true} path={`${this.props.match.url}sensor_setup`} component={SensorSetup}/>
|
<Route exact={true} path={`${this.props.match.url}sensor_setup`} component={SensorSetup}/>
|
||||||
|
<Route exact={true} path={`${this.props.match.url}sensor_setup/:id`} component={SensorSetup}/>
|
||||||
<Redirect to='/error/404' />
|
<Redirect to='/error/404' />
|
||||||
</Switch>
|
</Switch>
|
||||||
</Segment>
|
</Segment>
|
||||||
|
|
|
@ -10,7 +10,7 @@ class SensorList extends React.Component<RouteComponentProps<object>, object> {
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<SensorListContainer />
|
<SensorListContainer params={this.props.match.params}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class SensorSetup extends React.Component<RouteComponentProps<object>, object> {
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<SensorSetupContainer />
|
<SensorSetupContainer params={this.props.match.params}/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,13 @@ import {
|
||||||
import { push as routerPush } from 'react-router-redux';
|
import { push as routerPush } from 'react-router-redux';
|
||||||
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||||
import Probe from '@overflow/probe/api/model/Probe';
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
|
import MetaHistoryType from '@overflow/meta/api/model/MetaHistoryType';
|
||||||
import * as readAllByProbeActions from '../redux/action/read_all_by_probe';
|
import * as readAllByProbeActions from '../redux/action/read_all_by_probe';
|
||||||
|
import * as readAllByProbeAndTypeActions from '../redux/action/read_all_by_probe_and_type';
|
||||||
|
|
||||||
export function mapStateToProps(state: any, ownProps?: any): HistoryStateProps {
|
export function mapStateToProps(state: any, ownProps?: any): HistoryStateProps {
|
||||||
return {
|
return {
|
||||||
probeId: '1',
|
path: ownProps.params,
|
||||||
histories: state.historyPage,
|
histories: state.historyPage,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -23,9 +25,10 @@ export function mapDispatchToProps(dispatch: Dispatch<any>, ownProps?: any): His
|
||||||
dispatch(asyncRequestActions.request('HistoryService', 'readAllByProbe', readAllByProbeActions.REQUEST,
|
dispatch(asyncRequestActions.request('HistoryService', 'readAllByProbe', readAllByProbeActions.REQUEST,
|
||||||
JSON.stringify(probe), pageNo, countPerPage));
|
JSON.stringify(probe), pageNo, countPerPage));
|
||||||
},
|
},
|
||||||
// onRedirectHome: () => {
|
onReadAllByProbeAndType: (probe: Probe, type: MetaHistoryType, pageNo: string, countPerPage: string) => {
|
||||||
// dispatch(routerPush('/'));
|
dispatch(asyncRequestActions.request('HistoryService', 'readAllByProbeAndType', readAllByProbeAndTypeActions.REQUEST,
|
||||||
// },
|
JSON.stringify(probe), JSON.stringify(type), pageNo, countPerPage));
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,20 +4,23 @@ import { ListContainer } from '@overflow/commons/react/component/ListContainer';
|
||||||
import Probe from '@overflow/probe/api/model/Probe';
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
import History from '@overflow/history/api/model/History';
|
import History from '@overflow/history/api/model/History';
|
||||||
import Page from '@overflow/commons/api/model/Page';
|
import Page from '@overflow/commons/api/model/Page';
|
||||||
|
import MetaHistoryType from '@overflow/meta/api/model/MetaHistoryType';
|
||||||
|
|
||||||
export interface StateProps {
|
export interface StateProps {
|
||||||
probeId: string;
|
|
||||||
histories: Page;
|
histories: Page;
|
||||||
|
path: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DispatchProps {
|
export interface DispatchProps {
|
||||||
onReadAllByProbe?(probe: Probe, pageNo: string, countPerPage: string): void;
|
onReadAllByProbe?(probe: Probe, pageNo: string, countPerPage: string): void;
|
||||||
|
onReadAllByProbeAndType?(probe: Probe, type: MetaHistoryType, pageNo: string, countPerPage: string): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Props = StateProps & DispatchProps;
|
export type Props = StateProps & DispatchProps;
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
page: number;
|
page: number;
|
||||||
|
isTypedHistory: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HistoryList extends React.Component<Props, State> {
|
export class HistoryList extends React.Component<Props, State> {
|
||||||
|
@ -28,14 +31,57 @@ export class HistoryList extends React.Component<Props, State> {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this.state = {
|
this.state = {
|
||||||
page: 0,
|
page: 0,
|
||||||
|
isTypedHistory: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillMount(): void {
|
public componentWillMount(): void {
|
||||||
|
if (this.props.path === '/histories') {
|
||||||
|
this.setState({
|
||||||
|
isTypedHistory: false,
|
||||||
|
});
|
||||||
|
this.getAllHistory(0);
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
isTypedHistory: true,
|
||||||
|
});
|
||||||
|
this.getTypedHistory(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public getAllHistory(pageNo: number): void {
|
||||||
let probe: Probe = {
|
let probe: Probe = {
|
||||||
id: Number(1),
|
id: Number(1),
|
||||||
};
|
};
|
||||||
this.props.onReadAllByProbe(probe, String(this.state.page), String(this.countPerPage));
|
this.props.onReadAllByProbe(probe, String(pageNo), String(this.countPerPage));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getTypedHistory(pageNo: number): void {
|
||||||
|
let probe: Probe = {
|
||||||
|
id: Number(1),
|
||||||
|
};
|
||||||
|
let type = this.props.path.split('/')[1];
|
||||||
|
console.log(type + '!!!!!!!!!');
|
||||||
|
this.props.onReadAllByProbeAndType(probe, this.getMetaType(type), String(pageNo), String(this.countPerPage));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getMetaType(typeStr: string): MetaHistoryType {
|
||||||
|
let metaType: MetaHistoryType = {
|
||||||
|
};
|
||||||
|
if (typeStr === 'member') {
|
||||||
|
metaType.id = 1;
|
||||||
|
} else if (typeStr === 'probe') {
|
||||||
|
metaType.id = 2;
|
||||||
|
} else if (typeStr === 'discovery') {
|
||||||
|
metaType.id = 3;
|
||||||
|
} else if (typeStr === 'target') {
|
||||||
|
metaType.id = 4;
|
||||||
|
} else if (typeStr === 'crawler') {
|
||||||
|
metaType.id = 5;
|
||||||
|
} else if (typeStr === 'sensor') {
|
||||||
|
metaType.id = 6;
|
||||||
|
}
|
||||||
|
return metaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public handlePaging = (pageNo: number) => {
|
public handlePaging = (pageNo: number) => {
|
||||||
|
@ -48,7 +94,12 @@ export class HistoryList extends React.Component<Props, State> {
|
||||||
let probe: Probe = {
|
let probe: Probe = {
|
||||||
id: Number(1),
|
id: Number(1),
|
||||||
};
|
};
|
||||||
this.props.onReadAllByProbe(probe, String(pageNo), String(this.countPerPage));
|
if (this.state.isTypedHistory) {
|
||||||
|
this.getTypedHistory(pageNo);
|
||||||
|
} else {
|
||||||
|
// this.props.onReadAllByProbe(probe, String(pageNo), String(this.countPerPage));
|
||||||
|
this.getAllHistory(pageNo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public handlePrevPage = (pn: string) => {
|
public handlePrevPage = (pn: string) => {
|
||||||
|
@ -64,32 +115,37 @@ export class HistoryList extends React.Component<Props, State> {
|
||||||
let probe: Probe = {
|
let probe: Probe = {
|
||||||
id: Number(1),
|
id: Number(1),
|
||||||
};
|
};
|
||||||
this.props.onReadAllByProbe(probe, String(p), String(this.countPerPage));
|
if (this.state.isTypedHistory) {
|
||||||
|
this.getTypedHistory(p);
|
||||||
|
} else {
|
||||||
|
this.getAllHistory(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public renderPagination = (pageObj: Page): (JSX.Element | JSX.Element[]) => {
|
public renderPagination = (pageObj: Page): (JSX.Element | JSX.Element[]) => {
|
||||||
if (pageObj === undefined) {
|
if (pageObj === undefined) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
let keyIdx = 0;
|
||||||
let totalPage = pageObj.totalPages;
|
let totalPage = pageObj.totalPages;
|
||||||
let currPage = pageObj.number;
|
let currPage = pageObj.number;
|
||||||
let elems = new Array;
|
let elems = new Array;
|
||||||
let prevIndicator = pageObj.first ?
|
let prevIndicator = pageObj.first ?
|
||||||
<Menu.Item as='a' icon disabled><Icon name='left chevron' /></Menu.Item> :
|
<Menu.Item as='a' key={keyIdx} icon disabled><Icon name='left chevron' /></Menu.Item> :
|
||||||
<Menu.Item as='a' icon onClick={this.handlePrevPage.bind(this, 'P')}>
|
<Menu.Item as='a' key={keyIdx} icon onClick={this.handlePrevPage.bind(this, 'P')}>
|
||||||
<Icon name='left chevron' />
|
<Icon name='left chevron' />
|
||||||
</Menu.Item>;
|
</Menu.Item>;
|
||||||
elems.push(prevIndicator);
|
elems.push(prevIndicator);
|
||||||
for (let i = 0; i < totalPage; i++) {
|
for (let i = 0; i < totalPage; i++) {
|
||||||
if (i === currPage) {
|
if (i === currPage) {
|
||||||
elems.push(<Menu.Item key={i} active as='a' onClick={this.handlePaging.bind(this, i)}><b>{i + 1}</b></Menu.Item>);
|
elems.push(<Menu.Item key={++keyIdx} active as='a' onClick={this.handlePaging.bind(this, i)}><b>{i + 1}</b></Menu.Item>);
|
||||||
} else {
|
} else {
|
||||||
elems.push(<Menu.Item key={i} as='a' onClick={this.handlePaging.bind(this, i)}>{i + 1}</Menu.Item>);
|
elems.push(<Menu.Item key={++keyIdx} as='a' onClick={this.handlePaging.bind(this, i)}>{i + 1}</Menu.Item>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let nextIndicator = pageObj.last ?
|
let nextIndicator = pageObj.last ?
|
||||||
<Menu.Item as='a' icon disabled><Icon name='right chevron' /></Menu.Item> :
|
<Menu.Item as='a' key={++keyIdx} icon disabled><Icon name='right chevron' /></Menu.Item> :
|
||||||
<Menu.Item as='a' icon onClick={this.handlePrevPage.bind(this, 'N')}>
|
<Menu.Item as='a' key={++keyIdx} icon onClick={this.handlePrevPage.bind(this, 'N')}>
|
||||||
<Icon name='right chevron' />
|
<Icon name='right chevron' />
|
||||||
</Menu.Item>;
|
</Menu.Item>;
|
||||||
elems.push(nextIndicator);
|
elems.push(nextIndicator);
|
||||||
|
@ -100,7 +156,6 @@ export class HistoryList extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
|
|
||||||
let historyList: JSX.Element = (
|
let historyList: JSX.Element = (
|
||||||
<Container fluid>
|
<Container fluid>
|
||||||
<Table celled selectable striped>
|
<Table celled selectable striped>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
export type REQUEST = '@overflow/history/read_all_by_probe_and_type/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/history/read_all_by_probe_and_type/REQUEST/SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/history/read_all_by_probe_and_type/REQUEST/FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/history/read_all_by_probe_and_type/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/history/read_all_by_probe_and_type/REQUEST/SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/history/read_all_by_probe_and_type/REQUEST/FAILURE';
|
|
@ -0,0 +1,25 @@
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import { ReducersMapObject } from 'redux';
|
||||||
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
|
import History from '../../api/model/History';
|
||||||
|
import Page from '@overflow/commons/api/model/Page';
|
||||||
|
import * as ReadAllByProbeAndTypeActionTypes from '../action/read_all_by_probe_and_type';
|
||||||
|
import ReadAllByProbeAndTypeState, { defaultState as ReadAllByProbeAndTypeDefaultState } from '../state/ReadAllByProbeAndType';
|
||||||
|
|
||||||
|
const reducer: ReducersMapObject = {
|
||||||
|
[ReadAllByProbeAndTypeActionTypes.REQUEST_SUCCESS]:
|
||||||
|
(state: ReadAllByProbeAndTypeState = ReadAllByProbeAndTypeDefaultState, action: Action<Page>):
|
||||||
|
ReadAllByProbeAndTypeState => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
historyPage: <Page>action.payload,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[ReadAllByProbeAndTypeActionTypes.REQUEST_FAILURE]:
|
||||||
|
(state: ReadAllByProbeAndTypeState = ReadAllByProbeAndTypeDefaultState, action: Action<Error>):
|
||||||
|
ReadAllByProbeAndTypeState => {
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reducer;
|
|
@ -0,0 +1,14 @@
|
||||||
|
import History from '../../api/model/History';
|
||||||
|
import Page from '@overflow/commons/api/model/Page';
|
||||||
|
|
||||||
|
export interface State {
|
||||||
|
readonly historyPage?: Page;
|
||||||
|
readonly error?: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultState: State = {
|
||||||
|
historyPage: undefined,
|
||||||
|
error: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default State;
|
|
@ -1,7 +1,7 @@
|
||||||
export interface MetaHistoryType {
|
export interface MetaHistoryType {
|
||||||
id: number;
|
id?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
createDate: Date;
|
createDate?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum MetaHistoryType_ID {
|
export enum MetaHistoryType_ID {
|
||||||
|
|
|
@ -59,24 +59,6 @@ export class CrawlerSelector extends React.Component<CrawlerSelectorProps, Crawl
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public convertCrawler(): void {
|
public convertCrawler(): void {
|
||||||
// todo. getting MetaCrawler list
|
|
||||||
// let crawlers = [
|
|
||||||
// {
|
|
||||||
// 'id': '1',
|
|
||||||
// 'name': 'WMI',
|
|
||||||
// 'description': 'WMI DESCRIPTION',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '2',
|
|
||||||
// 'name': 'SNMP',
|
|
||||||
// 'description': 'SNMP DESCRIPTION',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// 'id': '3',
|
|
||||||
// 'name': 'JMX',
|
|
||||||
// 'description': 'JMX DESCRIPTION',
|
|
||||||
// },
|
|
||||||
// ];
|
|
||||||
|
|
||||||
let crawlerOptions = [];
|
let crawlerOptions = [];
|
||||||
let crawler: MetaCrawler;
|
let crawler: MetaCrawler;
|
||||||
|
|
|
@ -18,8 +18,9 @@ import * as asyncRequestActions from '@overflow/commons/redux/action/asyncReques
|
||||||
|
|
||||||
// FIXME::....
|
// FIXME::....
|
||||||
|
|
||||||
export function mapStateToProps(state: any): SensorConfigurationStateProps {
|
export function mapStateToProps(state: any, props: any): SensorConfigurationStateProps {
|
||||||
return {
|
return {
|
||||||
|
targetId: props.params.id,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,16 +12,19 @@ import State from '../redux/state/ReadAllByTarget';
|
||||||
import * as ReadAllByTargetActions from '../redux/action/read_all_by_target';
|
import * as ReadAllByTargetActions from '../redux/action/read_all_by_target';
|
||||||
import * as ReadAllByProbeActions from '../redux/action/read_all_by_probe';
|
import * as ReadAllByProbeActions from '../redux/action/read_all_by_probe';
|
||||||
import * as ReadAllByDomainActions from '../redux/action/read_all_by_domain';
|
import * as ReadAllByDomainActions from '../redux/action/read_all_by_domain';
|
||||||
|
import * as ReadAllByInfraActions from '../redux/action/read_all_by_infra';
|
||||||
import Target from '@overflow/target/api/model/Target';
|
import Target from '@overflow/target/api/model/Target';
|
||||||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||||
import Probe from '@overflow/probe/api/model/Probe';
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
import Domain from '@overflow/domain/api/model/Domain';
|
import Domain from '@overflow/domain/api/model/Domain';
|
||||||
|
import Infra from '@overflow/infra/api/model/Infra';
|
||||||
|
|
||||||
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||||
|
|
||||||
export function mapStateToProps(state: any): SensorListStateProps {
|
export function mapStateToProps(state: any, props: any): SensorListStateProps {
|
||||||
return {
|
return {
|
||||||
sensorList:state.SensorList,
|
sensorList:state.SensorList,
|
||||||
|
targetId: props.params.id,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +33,9 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
|
||||||
onReadAllByTarget: (target: Target) => {
|
onReadAllByTarget: (target: Target) => {
|
||||||
dispatch(asyncRequestActions.request('SensorService', 'readAllByTarget', ReadAllByTargetActions.REQUEST, JSON.stringify(target)));
|
dispatch(asyncRequestActions.request('SensorService', 'readAllByTarget', ReadAllByTargetActions.REQUEST, JSON.stringify(target)));
|
||||||
},
|
},
|
||||||
|
onReadAllByInfra: (infra: Infra) => {
|
||||||
|
dispatch(asyncRequestActions.request('SensorService', 'readAllByInfra', ReadAllByInfraActions.REQUEST, JSON.stringify(infra)));
|
||||||
|
},
|
||||||
onReadAllByProbe: (probe: Probe) => {
|
onReadAllByProbe: (probe: Probe) => {
|
||||||
dispatch(ReadAllByProbeActions.request(probe));
|
dispatch(ReadAllByProbeActions.request(probe));
|
||||||
},
|
},
|
||||||
|
@ -39,8 +45,8 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
|
||||||
onSelectSensor: (id: number) => {
|
onSelectSensor: (id: number) => {
|
||||||
dispatch(routerPush('/sensor/' + String(id)));
|
dispatch(routerPush('/sensor/' + String(id)));
|
||||||
},
|
},
|
||||||
onAddSensor: (target: Target) => {
|
onAddSensor: (targetId: string) => {
|
||||||
dispatch(routerPush('/sensor/setup'));
|
dispatch(routerPush('/sensor_setup/' + String(targetId)));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import SensorItemTree from '@overflow/meta/react/SensorItemTree';
|
||||||
import CrawlerSelectorContainer from '@overflow/meta/react/CrawlerSelector';
|
import CrawlerSelectorContainer from '@overflow/meta/react/CrawlerSelector';
|
||||||
|
|
||||||
export interface SensorConfigurationStateProps {
|
export interface SensorConfigurationStateProps {
|
||||||
|
targetId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SensorConfigurationDispatchProps {
|
export interface SensorConfigurationDispatchProps {
|
||||||
|
@ -38,8 +38,8 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
|
||||||
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
let steps = [<CrawlerSelectorContainer onSelectCrawlerId={this.onSelectCrawlerId.bind(this)}/>,
|
let steps = [<CrawlerSelectorContainer onSelectCrawlerId={this.onSelectCrawlerId.bind(this)} />,
|
||||||
<Segment vertical><SensorItemTree crawlerId={this.state.selectedCrawlerId}/></Segment>, <ETCSelector />];
|
<Segment vertical><SensorItemTree crawlerId={this.state.selectedCrawlerId} /></Segment>, <ETCSelector />];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConfigStepper steps={steps} />
|
<ConfigStepper steps={steps} />
|
||||||
|
|
|
@ -6,6 +6,7 @@ import Probe from '@overflow/probe/api/model/Probe';
|
||||||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||||
import Target from '@overflow/target/api/model/Target';
|
import Target from '@overflow/target/api/model/Target';
|
||||||
import Domain from '@overflow/domain/api/model/Domain';
|
import Domain from '@overflow/domain/api/model/Domain';
|
||||||
|
import Infra from '@overflow/infra/api/model/Infra';
|
||||||
|
|
||||||
export interface StateProps {
|
export interface StateProps {
|
||||||
probe?: Probe;
|
probe?: Probe;
|
||||||
|
@ -20,6 +21,7 @@ export interface DispatchProps {
|
||||||
onReadAllByDomain?(domain: Domain): void;
|
onReadAllByDomain?(domain: Domain): void;
|
||||||
onSelectSensor?(id: number): void;
|
onSelectSensor?(id: number): void;
|
||||||
onAddSensor?(target: Target): void;
|
onAddSensor?(target: Target): void;
|
||||||
|
onReadAllByInfra?(infra: Infra): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SensorListProps = StateProps & DispatchProps;
|
export type SensorListProps = StateProps & DispatchProps;
|
||||||
|
@ -83,7 +85,7 @@ export class SensorList extends React.Component<SensorListProps, SensorListState
|
||||||
console.log(event);
|
console.log(event);
|
||||||
}
|
}
|
||||||
public handleAddSensor(): void {
|
public handleAddSensor(): void {
|
||||||
this.props.onAddSensor(this.props.target);
|
this.props.onAddSensor(this.props.targetId ? this.props.targetId : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/sensor/read_all_by_infra/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/sensor/read_all_by_infra/REQUEST/SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/sensor/read_all_by_infra/REQUEST/FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/sensor/read_all_by_infra/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/sensor/read_all_by_infra/REQUEST/SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/sensor/read_all_by_infra/REQUEST/FAILURE';
|
26
src/ts/@overflow/sensor/redux/reducer/read_all_by_infra.ts
Normal file
26
src/ts/@overflow/sensor/redux/reducer/read_all_by_infra.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import { ReducersMapObject } from 'redux';
|
||||||
|
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||||
|
|
||||||
|
import * as ReadAllByInfraActionTypes from '../action/read_all_by_infra';
|
||||||
|
import ReadAllByInfraState, { defaultState as readAllByInfraDefaultState } from '../state/ReadAllByInfra';
|
||||||
|
|
||||||
|
const reducer: ReducersMapObject = {
|
||||||
|
[ReadAllByInfraActionTypes.REQUEST_SUCCESS]:
|
||||||
|
(state: ReadAllByInfraState = readAllByInfraDefaultState, action: Action<Sensor[]>): ReadAllByInfraState => {
|
||||||
|
console.log(action);
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
SensorList:<Sensor[]>action.payload,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[ReadAllByInfraActionTypes.REQUEST_FAILURE]:
|
||||||
|
(state: ReadAllByInfraState = readAllByInfraDefaultState, action: Action<Error>):
|
||||||
|
ReadAllByInfraState => {
|
||||||
|
return state;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reducer;
|
|
@ -11,7 +11,7 @@ import ReadAllByTargetState, { defaultState as readAllByTargetDefaultState } fro
|
||||||
|
|
||||||
const reducer: ReducersMapObject = {
|
const reducer: ReducersMapObject = {
|
||||||
[ReadAllByTargetActionTypes.REQUEST_SUCCESS]:
|
[ReadAllByTargetActionTypes.REQUEST_SUCCESS]:
|
||||||
(state: ReadAllByTargetState = readAllByTargetDefaultState, action: Action<Sensor>): ReadAllByTargetState => {
|
(state: ReadAllByTargetState = readAllByTargetDefaultState, action: Action<Sensor[]>): ReadAllByTargetState => {
|
||||||
console.log(action);
|
console.log(action);
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
|
13
src/ts/@overflow/sensor/redux/state/ReadAllByInfra.ts
Normal file
13
src/ts/@overflow/sensor/redux/state/ReadAllByInfra.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import Sensor from '../../api/model/Sensor';
|
||||||
|
|
||||||
|
export interface State {
|
||||||
|
readonly SensorList: Sensor[];
|
||||||
|
readonly error?: Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultState: State = {
|
||||||
|
SensorList: undefined,
|
||||||
|
error: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default State;
|
|
@ -26,8 +26,8 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): DispatchProps {
|
||||||
onReadAllByDomain: (domain: Domain) => {
|
onReadAllByDomain: (domain: Domain) => {
|
||||||
dispatch(asyncRequestActions.request('InfraService', 'readAllByDomain', targetListActions.REQUEST, JSON.stringify(domain)));
|
dispatch(asyncRequestActions.request('InfraService', 'readAllByDomain', targetListActions.REQUEST, JSON.stringify(domain)));
|
||||||
},
|
},
|
||||||
onTargetSelection: (id: string) => {
|
onTargetSelection: (infraId: string) => {
|
||||||
dispatch(routerPush('/target/' + id));
|
dispatch(routerPush('/target/' + infraId));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user