Merge branch 'master' of https://git.loafle.net/overflow/overflow_app
This commit is contained in:
commit
ebe4703c01
|
@ -23,7 +23,7 @@ export class TargetService extends Service {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public readByProbe(probe:Probe): Promise<Target> {
|
public readAllByProbe(probe:Probe): Promise<Target[]> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
|
43
src/ts/@overflow/target/redux/action/read_all_by_probe.ts
Normal file
43
src/ts/@overflow/target/redux/action/read_all_by_probe.ts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
import Target from '../../api/model/Target';
|
||||||
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
|
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/target/read/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/target/read/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/read/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/read/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (probe: Probe) => Action<ReadAllByProbePayload>;
|
||||||
|
export type requestSuccess = (targets: Target[]) => Action<Target[]>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (probe: Probe): Action<ReadAllByProbePayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
probe: probe,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (targets: Target[]): Action<Target[]> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: targets,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
|
@ -14,26 +14,25 @@ export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/regist/REQUEST
|
||||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
|
||||||
|
|
||||||
// Action Creater
|
// Action Creater
|
||||||
export type request = (probe: Probe, infra: Infra) => Action<RegistPayload>;
|
export type request = (target: Target) => Action<RegistPayload>;
|
||||||
export type requestSuccess = (target: Target) => Action<Target>;
|
export type requestSuccess = (target: Target) => Action<Target>;
|
||||||
export type requestFailure = (error: Error) => Action;
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const request: request = (probe: Probe, infra: Infra): Action<RegistPayload> => {
|
export const request: request = (target: Target): Action<RegistPayload> => {
|
||||||
return {
|
return {
|
||||||
type: REQUEST,
|
type: REQUEST,
|
||||||
payload: {
|
payload: {
|
||||||
probe: probe,
|
target: target,
|
||||||
infra: infra,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestSuccess: requestSuccess = (apiKey: ApiKey): Action<ApiKey> => {
|
export const requestSuccess: requestSuccess = (target: Target): Action<Target> => {
|
||||||
return {
|
return {
|
||||||
type: REQUEST_SUCCESS,
|
type: REQUEST_SUCCESS,
|
||||||
payload: apiKey,
|
payload: target,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,42 @@
|
||||||
/**
|
import Action from '@overflow/commons/redux/Action';
|
||||||
* Created by geek on 17. 7. 3.
|
import Target from '../../api/model/Target';
|
||||||
*/
|
import RemovePayload from '../payload/RemovePayload';
|
||||||
|
|
||||||
|
// Action Type
|
||||||
|
export type REQUEST = '@overflow/target/regist/REQUEST';
|
||||||
|
export type REQUEST_SUCCESS = '@overflow/target/regist/REQUEST_SUCCESS';
|
||||||
|
export type REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
export const REQUEST: REQUEST = '@overflow/target/regist/REQUEST';
|
||||||
|
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/target/regist/REQUEST_SUCCESS';
|
||||||
|
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/target/regist/REQUEST_FAILURE';
|
||||||
|
|
||||||
|
// Action Creater
|
||||||
|
export type request = (target: Target) => Action<RemovePayload>;
|
||||||
|
export type requestSuccess = () => Action<void>;
|
||||||
|
export type requestFailure = (error: Error) => Action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const request: request = (target: Target): Action<RemovePayload> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST,
|
||||||
|
payload: {
|
||||||
|
target: target,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestSuccess: requestSuccess = (target: Target): Action<Target> => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_SUCCESS,
|
||||||
|
payload: target,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||||
|
return {
|
||||||
|
type: REQUEST_FAILURE,
|
||||||
|
error: error,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
import Probe from '@overflow/probe/api/model/Probe';
|
||||||
|
|
||||||
|
interface ReadAllByProbePayload {
|
||||||
|
probe: Probe;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ReadAllByProbePayload;
|
|
@ -1,3 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
interface ReadPayload {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ReadPayload;
|
|
@ -1,9 +1,7 @@
|
||||||
import Infra from '@overflow/infra/api/model/Infra';
|
import Target from '../../api/model/Target';
|
||||||
import Probe from '@overflow/probe/api/model/Probe';
|
|
||||||
|
|
||||||
interface RegistPayload {
|
interface RegistPayload {
|
||||||
infra: Infra;
|
target: Target;
|
||||||
probe: Probe;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RegistPayload;
|
export default RegistPayload;
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
|
7
src/ts/@overflow/target/redux/payload/RemovePayload.ts
Normal file
7
src/ts/@overflow/target/redux/payload/RemovePayload.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import Target from '../../api/model/Target';
|
||||||
|
|
||||||
|
interface RemovePayload {
|
||||||
|
target: Target;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default RemovePayload;
|
|
@ -1,3 +1,38 @@
|
||||||
/**
|
import { SagaIterator } from 'redux-saga';
|
||||||
* Created by geek on 17. 7. 3.
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
*/
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Target from '../../api/model/Target';
|
||||||
|
import TargetService from '../../api/service/TargetService';
|
||||||
|
import * as ReadActions from '../action/read';
|
||||||
|
import ReadPayload from '../payload/ReadPayload';
|
||||||
|
|
||||||
|
function* read(action: Action<RegistPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {target} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(RegistActions.requestSuccess(retTarget));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(RegistActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchSignin(): SagaIterator {
|
||||||
|
yield takeLatest(RegistActions.REQUEST, regist);
|
||||||
|
}
|
||||||
|
|
38
src/ts/@overflow/target/redux/saga/read_all_by_probe.ts
Normal file
38
src/ts/@overflow/target/redux/saga/read_all_by_probe.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { SagaIterator } from 'redux-saga';
|
||||||
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Target from '../../api/model/Target';
|
||||||
|
import TargetService from '../../api/service/TargetService';
|
||||||
|
import * as ReadAllByProbeActions from '../action/read_all_by_probe';
|
||||||
|
import ReadAllByProbePayload from '../payload/ReadAllByProbePayload';
|
||||||
|
|
||||||
|
function* regist(action: Action<RegistPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {target} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(RegistActions.requestSuccess(retTarget));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(RegistActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchSignin(): SagaIterator {
|
||||||
|
yield takeLatest(RegistActions.REQUEST, regist);
|
||||||
|
}
|
|
@ -1,3 +0,0 @@
|
||||||
/**
|
|
||||||
* Created by geek on 17. 7. 3.
|
|
||||||
*/
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
import { SagaIterator } from 'redux-saga';
|
||||||
|
import { call, Effect, fork, put, takeLatest } from 'redux-saga/effects';
|
||||||
|
|
||||||
|
import AppContext from '@overflow/commons/context';
|
||||||
|
import Action from '@overflow/commons/redux/Action';
|
||||||
|
|
||||||
|
import Target from '../../api/model/Target';
|
||||||
|
import TargetService from '../../api/service/TargetService';
|
||||||
|
import * as RegistActions from '../action/regist';
|
||||||
|
import RegistPayload from '../payload/RegistPayload';
|
||||||
|
|
||||||
|
function* regist(action: Action<RegistPayload>): SagaIterator {
|
||||||
|
try {
|
||||||
|
const {target} = action.payload;
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: true},
|
||||||
|
// });
|
||||||
|
|
||||||
|
const retTarget = yield call(AppContext.getService<TargetService>().regist, target);
|
||||||
|
|
||||||
|
// if (responseBody.token === undefined) {
|
||||||
|
// throw new Error(MESSAGES.UNABLE_TO_FIND_TOKEN_IN_LOGIN_RESPONSE);
|
||||||
|
// }
|
||||||
|
yield put(RegistActions.requestSuccess(retTarget));
|
||||||
|
} catch (e) {
|
||||||
|
yield put(RegistActions.requestFailure(e));
|
||||||
|
} finally {
|
||||||
|
// yield put({
|
||||||
|
// type: types.SENDING_REQUEST,
|
||||||
|
// payload: {sendingRequest: false},
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function* watchSignin(): SagaIterator {
|
||||||
|
yield takeLatest(RegistActions.REQUEST, regist);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user