target / sensor
This commit is contained in:
parent
15ea4947a2
commit
442b2c213d
|
@ -17,12 +17,14 @@ import noauthDenyReducer from '@overflow/noauthprobe/redux/reducer/deny';
|
|||
|
||||
import readAllTargetByProbeReducer from '@overflow/target/redux/reducer/readAllByProbe';
|
||||
import readAllTargetByDomainReducer from '@overflow/target/redux/reducer/read_all_by_domain';
|
||||
|
||||
import readTargetReducer from '@overflow/target/redux/reducer/read';
|
||||
|
||||
import sensorReadAllByTargetReducer from '@overflow/sensor/redux/reducer/read_all_by_target';
|
||||
import sensorReadAllByDomainReducer from '@overflow/sensor/redux/reducer/read_all_by_domain';
|
||||
import SensorReadReducer from '@overflow/sensor/redux/reducer/read';
|
||||
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 readHostReducer from '@overflow/infra/redux/reducer/host_read';
|
||||
|
@ -102,7 +104,11 @@ const reduxConfig: ReduxConfig = {
|
|||
modifyProbeReducer,
|
||||
DiscoveryInfraTargetRegistAllReducer,
|
||||
HistoryReadAllByProbeReducer,
|
||||
<<<<<<< 15ea4947a2911a013b4ba1377088e49bd993a7fa
|
||||
HistoryReadAllByProbeAndTypeReducer,
|
||||
=======
|
||||
readAllTargetByInfraReducer,
|
||||
>>>>>>> fixed target / sensor
|
||||
],
|
||||
sagaWatchers: [
|
||||
AsyncRequest,
|
||||
|
|
|
@ -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}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/:id`} component={SensorSetup}/>
|
||||
<Redirect to='/error/404' />
|
||||
</Switch>
|
||||
</Segment>
|
||||
|
|
|
@ -10,7 +10,7 @@ class SensorList extends React.Component<RouteComponentProps<object>, object> {
|
|||
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<SensorListContainer />
|
||||
<SensorListContainer params={this.props.match.params}/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class SensorSetup extends React.Component<RouteComponentProps<object>, object> {
|
|||
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<SensorSetupContainer />
|
||||
<SensorSetupContainer params={this.props.match.params}/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,24 +59,6 @@ export class CrawlerSelector extends React.Component<CrawlerSelectorProps, Crawl
|
|||
// }
|
||||
|
||||
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 crawler: MetaCrawler;
|
||||
|
|
|
@ -18,8 +18,9 @@ import * as asyncRequestActions from '@overflow/commons/redux/action/asyncReques
|
|||
|
||||
// FIXME::....
|
||||
|
||||
export function mapStateToProps(state: any): SensorConfigurationStateProps {
|
||||
export function mapStateToProps(state: any, props: any): SensorConfigurationStateProps {
|
||||
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 ReadAllByProbeActions from '../redux/action/read_all_by_probe';
|
||||
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 Sensor from '@overflow/sensor/api/model/Sensor';
|
||||
import Probe from '@overflow/probe/api/model/Probe';
|
||||
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';
|
||||
|
||||
export function mapStateToProps(state: any): SensorListStateProps {
|
||||
export function mapStateToProps(state: any, props: any): SensorListStateProps {
|
||||
return {
|
||||
sensorList:state.SensorList,
|
||||
targetId: props.params.id,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -30,6 +33,9 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
|
|||
onReadAllByTarget: (target: 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) => {
|
||||
dispatch(ReadAllByProbeActions.request(probe));
|
||||
},
|
||||
|
@ -39,8 +45,8 @@ export function mapDispatchToProps(dispatch: Dispatch<any>): SensorListDispatchP
|
|||
onSelectSensor: (id: number) => {
|
||||
dispatch(routerPush('/sensor/' + String(id)));
|
||||
},
|
||||
onAddSensor: (target: Target) => {
|
||||
dispatch(routerPush('/sensor/setup'));
|
||||
onAddSensor: (targetId: string) => {
|
||||
dispatch(routerPush('/sensor_setup/' + String(targetId)));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import SensorItemTree from '@overflow/meta/react/SensorItemTree';
|
|||
import CrawlerSelectorContainer from '@overflow/meta/react/CrawlerSelector';
|
||||
|
||||
export interface SensorConfigurationStateProps {
|
||||
|
||||
targetId: number;
|
||||
}
|
||||
|
||||
export interface SensorConfigurationDispatchProps {
|
||||
|
@ -38,8 +38,8 @@ export class SensorConfiguration extends React.Component<SensorConfigurationProp
|
|||
|
||||
|
||||
public render(): JSX.Element {
|
||||
let steps = [<CrawlerSelectorContainer onSelectCrawlerId={this.onSelectCrawlerId.bind(this)}/>,
|
||||
<Segment vertical><SensorItemTree crawlerId={this.state.selectedCrawlerId}/></Segment>, <ETCSelector />];
|
||||
let steps = [<CrawlerSelectorContainer onSelectCrawlerId={this.onSelectCrawlerId.bind(this)} />,
|
||||
<Segment vertical><SensorItemTree crawlerId={this.state.selectedCrawlerId} /></Segment>, <ETCSelector />];
|
||||
|
||||
return (
|
||||
<ConfigStepper steps={steps} />
|
||||
|
|
|
@ -6,6 +6,7 @@ import Probe from '@overflow/probe/api/model/Probe';
|
|||
import Sensor from '@overflow/sensor/api/model/Sensor';
|
||||
import Target from '@overflow/target/api/model/Target';
|
||||
import Domain from '@overflow/domain/api/model/Domain';
|
||||
import Infra from '@overflow/infra/api/model/Infra';
|
||||
|
||||
export interface StateProps {
|
||||
probe?: Probe;
|
||||
|
@ -20,6 +21,7 @@ export interface DispatchProps {
|
|||
onReadAllByDomain?(domain: Domain): void;
|
||||
onSelectSensor?(id: number): void;
|
||||
onAddSensor?(target: Target): void;
|
||||
onReadAllByInfra?(infra: Infra): void;
|
||||
}
|
||||
|
||||
export type SensorListProps = StateProps & DispatchProps;
|
||||
|
@ -83,7 +85,7 @@ export class SensorList extends React.Component<SensorListProps, SensorListState
|
|||
console.log(event);
|
||||
}
|
||||
public handleAddSensor(): void {
|
||||
this.props.onAddSensor(this.props.target);
|
||||
this.props.onAddSensor(this.props.targetId ? this.props.targetId : '');
|
||||
}
|
||||
|
||||
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 = {
|
||||
[ReadAllByTargetActionTypes.REQUEST_SUCCESS]:
|
||||
(state: ReadAllByTargetState = readAllByTargetDefaultState, action: Action<Sensor>): ReadAllByTargetState => {
|
||||
(state: ReadAllByTargetState = readAllByTargetDefaultState, action: Action<Sensor[]>): ReadAllByTargetState => {
|
||||
console.log(action);
|
||||
return {
|
||||
...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) => {
|
||||
dispatch(asyncRequestActions.request('InfraService', 'readAllByDomain', targetListActions.REQUEST, JSON.stringify(domain)));
|
||||
},
|
||||
onTargetSelection: (id: string) => {
|
||||
dispatch(routerPush('/target/' + id));
|
||||
onTargetSelection: (infraId: string) => {
|
||||
dispatch(routerPush('/target/' + infraId));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user