diff --git a/src/ts/@overflow/app/config/index.ts b/src/ts/@overflow/app/config/index.ts index 31c37a6..05de6d4 100644 --- a/src/ts/@overflow/app/config/index.ts +++ b/src/ts/@overflow/app/config/index.ts @@ -30,6 +30,7 @@ import readMachineReducer from '@overflow/infra/redux/reducer/machine_read'; import readHostReducer from '@overflow/infra/redux/reducer/host_read'; import readOSReducer from '@overflow/infra/redux/reducer/os_read'; import readServiceReducer from '@overflow/infra/redux/reducer/service_read'; +import InfraReadServiceReducer from '@overflow/infra/redux/reducer/read'; import CrawlerReadAllByTargetReducer from '@overflow/meta/redux/reducer/crawler_read_all_by_target'; import CrawlerAuthInputsReducer from '@overflow/meta/redux/reducer/crawler_auth_inputs'; @@ -106,6 +107,7 @@ const reduxConfig: ReduxConfig = { HistoryReadAllByProbeReducer, HistoryReadAllByProbeAndTypeReducer, readAllTargetByInfraReducer, + InfraReadServiceReducer, ], sagaWatchers: [ AsyncRequest, diff --git a/src/ts/@overflow/infra/redux/reducer/read.ts b/src/ts/@overflow/infra/redux/reducer/read.ts index e69de29..7e26724 100644 --- a/src/ts/@overflow/infra/redux/reducer/read.ts +++ b/src/ts/@overflow/infra/redux/reducer/read.ts @@ -0,0 +1,24 @@ +import Action from '@overflow/commons/redux/Action'; +import { ReducersMapObject } from 'redux'; +import Infra from '@overflow/infra/api/model/Infra'; + +import * as readActionType from '../action/read'; +import ReadState, { defaultState as ReadDefaultState } from '../state/Read'; + +const reducer: ReducersMapObject = { + [readActionType.REQUEST_SUCCESS]: + (state: ReadState = ReadDefaultState, action: Action): + ReadState => { + return { + ...state, + infra: action.payload, + }; + }, + [readActionType.REQUEST_FAILURE]: + (state: ReadState = ReadDefaultState, action: Action): + ReadState => { + return state; + }, +}; + +export default reducer; diff --git a/src/ts/@overflow/infra/redux/state/Read.ts b/src/ts/@overflow/infra/redux/state/Read.ts index e69de29..4224a75 100644 --- a/src/ts/@overflow/infra/redux/state/Read.ts +++ b/src/ts/@overflow/infra/redux/state/Read.ts @@ -0,0 +1,13 @@ +import Infra from '@overflow/infra/api/model/Infra'; + +export interface State { + readonly infra?: Infra; + readonly error?: Error; +} + +export const defaultState: State = { + infra: undefined, + error: undefined, +}; + +export default State; diff --git a/src/ts/@overflow/sensor/react/SensorConfiguration.tsx b/src/ts/@overflow/sensor/react/SensorConfiguration.tsx index 8df04d4..af0ea43 100644 --- a/src/ts/@overflow/sensor/react/SensorConfiguration.tsx +++ b/src/ts/@overflow/sensor/react/SensorConfiguration.tsx @@ -17,6 +17,7 @@ import * as RegistActions from '../redux/action/regist'; import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest'; import * as targetListActions from '@overflow/target/redux/action/read_all_by_probe'; +import * as readActionType from '@overflow/infra/redux/action/read'; // FIXME::.... @@ -24,27 +25,28 @@ export function mapStateToProps(state: any, props: any): SensorConfigurationStat return { infraList: state.infraList, infraId: props.params.id, + infra: state.infra, }; } export function mapDispatchToProps(dispatch: Dispatch): SensorConfigurationDispatchProps { return { - onCrawlerReadAllByTarget: (target: Target) => { - dispatch(asyncRequestActions.request('MetaCrawlerService', 'readAll', CrawlerReadAllByTargetActions.REQUEST)); - }, onReadAllTargetByDomain: (domain: Domain) => { - dispatch(asyncRequestActions.request('InfraService', 'readAllByDomain', targetListActions.REQUEST, JSON.stringify(domain))); + dispatch(asyncRequestActions.request('InfraService', 'readAllByDomain', targetListActions.REQUEST, JSON.stringify(domain))); }, - onCheckCrawlerAuth: (authInfo: string) => { - // dispatch(ReadActions.request(id)); + onReadInfra: (infraId: number) => { + dispatch(asyncRequestActions.request('InfraService', 'read', readActionType.REQUEST, infraId)); }, + // onCheckCrawlerAuth: (authInfo: string) => { + // // dispatch(ReadActions.request(id)); + // }, // FIXME::how to sensor item? - onReadMetaSensorItem: () => { - // dispatch(SensorItemReadAllActions.request()); - }, - onSaveSensor: (sensor: Sensor) => { - // dispatch(RegistActions.request(sensor)); - }, + // onReadMetaSensorItem: () => { + // // dispatch(SensorItemReadAllActions.request()); + // }, + // onSaveSensor: (sensor: Sensor) => { + // // dispatch(RegistActions.request(sensor)); + // }, }; } diff --git a/src/ts/@overflow/sensor/react/components/SensorConfiguration.tsx b/src/ts/@overflow/sensor/react/components/SensorConfiguration.tsx index efb4959..e80833d 100644 --- a/src/ts/@overflow/sensor/react/components/SensorConfiguration.tsx +++ b/src/ts/@overflow/sensor/react/components/SensorConfiguration.tsx @@ -12,10 +12,12 @@ import CrawlerSelectorContainer from '@overflow/meta/react/CrawlerSelector'; export interface SensorConfigurationStateProps { infraId?: number; infraList?: Infra[]; + infra?: Infra; } export interface SensorConfigurationDispatchProps { onReadAllTargetByDomain?(domain: Domain): void; + onReadInfra?(infraId: number ): void; } export interface SensorConfigurationState { @@ -33,6 +35,14 @@ export class SensorConfiguration extends React.Component { this.setState({ selectedCrawlerId: id, @@ -45,7 +55,7 @@ export class SensorConfiguration extends React.Component, ]; return ( - + ); } } @@ -53,6 +63,8 @@ export class SensorConfiguration extends React.Component; + infraList?: Infra[]; + infra?: Infra; } export interface ConfigStepperState { @@ -128,7 +140,11 @@ export class ConfigStepper extends React.Component = new Array; @@ -159,7 +175,7 @@ export class ConfigStepper extends React.Component - + {this.renderInfraList()} {this.showContent()}
{/* floated 사용시 레이아웃 깨지는 현상 */}