From 442b2c213df5efaffaafa40ff2e9230c3767b599 Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 24 Aug 2017 14:16:20 +0900 Subject: [PATCH] target / sensor --- src/ts/@overflow/app/config/index.ts | 6 +++++ .../@overflow/app/views/layout/AppLayout.tsx | 1 + .../app/views/monitoring/sensor/List.tsx | 2 +- .../app/views/monitoring/sensor/Setup.tsx | 2 +- .../meta/react/components/CrawlerSelector.tsx | 18 ------------- .../sensor/react/SensorConfiguration.tsx | 3 ++- src/ts/@overflow/sensor/react/SensorList.tsx | 12 ++++++--- .../react/components/SensorConfiguration.tsx | 6 ++--- .../sensor/react/components/SensorList.tsx | 4 ++- .../sensor/redux/action/read_all_by_infra.ts | 8 ++++++ .../sensor/redux/reducer/read_all_by_infra.ts | 26 +++++++++++++++++++ .../redux/reducer/read_all_by_target.ts | 2 +- .../sensor/redux/state/ReadAllByInfra.ts | 13 ++++++++++ src/ts/@overflow/target/react/TargetList.tsx | 4 +-- 14 files changed, 76 insertions(+), 31 deletions(-) create mode 100644 src/ts/@overflow/sensor/redux/action/read_all_by_infra.ts create mode 100644 src/ts/@overflow/sensor/redux/reducer/read_all_by_infra.ts create mode 100644 src/ts/@overflow/sensor/redux/state/ReadAllByInfra.ts diff --git a/src/ts/@overflow/app/config/index.ts b/src/ts/@overflow/app/config/index.ts index 2c785bc..514f45d 100644 --- a/src/ts/@overflow/app/config/index.ts +++ b/src/ts/@overflow/app/config/index.ts @@ -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, diff --git a/src/ts/@overflow/app/views/layout/AppLayout.tsx b/src/ts/@overflow/app/views/layout/AppLayout.tsx index 8672470..80c9be2 100644 --- a/src/ts/@overflow/app/views/layout/AppLayout.tsx +++ b/src/ts/@overflow/app/views/layout/AppLayout.tsx @@ -46,6 +46,7 @@ export class AppLayout extends React.Component { + diff --git a/src/ts/@overflow/app/views/monitoring/sensor/List.tsx b/src/ts/@overflow/app/views/monitoring/sensor/List.tsx index db226ee..4e47374 100644 --- a/src/ts/@overflow/app/views/monitoring/sensor/List.tsx +++ b/src/ts/@overflow/app/views/monitoring/sensor/List.tsx @@ -10,7 +10,7 @@ class SensorList extends React.Component, object> { public render(): JSX.Element { return ( - + ); } } diff --git a/src/ts/@overflow/app/views/monitoring/sensor/Setup.tsx b/src/ts/@overflow/app/views/monitoring/sensor/Setup.tsx index 3c312a2..cce3ba6 100644 --- a/src/ts/@overflow/app/views/monitoring/sensor/Setup.tsx +++ b/src/ts/@overflow/app/views/monitoring/sensor/Setup.tsx @@ -10,7 +10,7 @@ class SensorSetup extends React.Component, object> { public render(): JSX.Element { return ( - + ); } } diff --git a/src/ts/@overflow/meta/react/components/CrawlerSelector.tsx b/src/ts/@overflow/meta/react/components/CrawlerSelector.tsx index c81163a..9258e11 100644 --- a/src/ts/@overflow/meta/react/components/CrawlerSelector.tsx +++ b/src/ts/@overflow/meta/react/components/CrawlerSelector.tsx @@ -59,24 +59,6 @@ export class CrawlerSelector extends React.Component): 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): 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))); }, }; } diff --git a/src/ts/@overflow/sensor/react/components/SensorConfiguration.tsx b/src/ts/@overflow/sensor/react/components/SensorConfiguration.tsx index b0554f9..c676984 100644 --- a/src/ts/@overflow/sensor/react/components/SensorConfiguration.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorConfiguration.tsx @@ -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, - , ]; + let steps = [, + , ]; return ( diff --git a/src/ts/@overflow/sensor/react/components/SensorList.tsx b/src/ts/@overflow/sensor/react/components/SensorList.tsx index d9beb85..5425dcb 100644 --- a/src/ts/@overflow/sensor/react/components/SensorList.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorList.tsx @@ -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): ReadAllByInfraState => { + console.log(action); + return { + ...state, + SensorList:action.payload, + }; + }, + [ReadAllByInfraActionTypes.REQUEST_FAILURE]: + (state: ReadAllByInfraState = readAllByInfraDefaultState, action: Action): + ReadAllByInfraState => { + return state; + }, +}; + +export default reducer; diff --git a/src/ts/@overflow/sensor/redux/reducer/read_all_by_target.ts b/src/ts/@overflow/sensor/redux/reducer/read_all_by_target.ts index 14b0888..acebd70 100644 --- a/src/ts/@overflow/sensor/redux/reducer/read_all_by_target.ts +++ b/src/ts/@overflow/sensor/redux/reducer/read_all_by_target.ts @@ -11,7 +11,7 @@ import ReadAllByTargetState, { defaultState as readAllByTargetDefaultState } fro const reducer: ReducersMapObject = { [ReadAllByTargetActionTypes.REQUEST_SUCCESS]: - (state: ReadAllByTargetState = readAllByTargetDefaultState, action: Action): ReadAllByTargetState => { + (state: ReadAllByTargetState = readAllByTargetDefaultState, action: Action): ReadAllByTargetState => { console.log(action); return { ...state, diff --git a/src/ts/@overflow/sensor/redux/state/ReadAllByInfra.ts b/src/ts/@overflow/sensor/redux/state/ReadAllByInfra.ts new file mode 100644 index 0000000..bc8898d --- /dev/null +++ b/src/ts/@overflow/sensor/redux/state/ReadAllByInfra.ts @@ -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; diff --git a/src/ts/@overflow/target/react/TargetList.tsx b/src/ts/@overflow/target/react/TargetList.tsx index b365901..4dbc2f3 100644 --- a/src/ts/@overflow/target/react/TargetList.tsx +++ b/src/ts/@overflow/target/react/TargetList.tsx @@ -26,8 +26,8 @@ export function mapDispatchToProps(dispatch: Dispatch): 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)); }, }; }