Add status to workload creation actions
This commit is contained in:
@@ -20,7 +20,7 @@ epicMiddleware.run(epics);
|
|||||||
|
|
||||||
// demo actions
|
// demo actions
|
||||||
store.dispatch(WorkloadActions.submit({ complexity: 10 }));
|
store.dispatch(WorkloadActions.submit({ complexity: 10 }));
|
||||||
store.dispatch(WorkloadActions.created({ id: 0, complexity: 10, completeDate: moment().add(10, 'second').toDate() }));
|
store.dispatch(WorkloadActions.created({ id: 0, complexity: 10, completeDate: moment().add(10, 'second').toDate(), status: 'WORKING' }));
|
||||||
|
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export type Action = {
|
|||||||
id: number;
|
id: number;
|
||||||
complexity: number;
|
complexity: number;
|
||||||
completeDate: Date;
|
completeDate: Date;
|
||||||
|
status: Status;
|
||||||
};
|
};
|
||||||
} | {
|
} | {
|
||||||
type: 'WORKLOAD_CANCEL';
|
type: 'WORKLOAD_CANCEL';
|
||||||
@@ -37,10 +38,11 @@ export const submit = ({ complexity }: { complexity: number }): Action => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const created = ({ id, complexity, completeDate }: { id: number, complexity: number, completeDate: Date }): Action => ({
|
export const created = ({ id, status, complexity, completeDate }: { id: number, status: Status, complexity: number, completeDate: Date }): Action => ({
|
||||||
type: 'WORKLOAD_CREATED',
|
type: 'WORKLOAD_CREATED',
|
||||||
payload: {
|
payload: {
|
||||||
id,
|
id,
|
||||||
|
status,
|
||||||
completeDate,
|
completeDate,
|
||||||
complexity,
|
complexity,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const reducer = (state: State = initialState, action: Action): State => {
|
|||||||
id: action.payload.id,
|
id: action.payload.id,
|
||||||
complexity: action.payload.complexity,
|
complexity: action.payload.complexity,
|
||||||
completeDate: action.payload.completeDate,
|
completeDate: action.payload.completeDate,
|
||||||
status: 'WORKING',
|
status: action.payload.status,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export class WorkloadService {
|
|||||||
}
|
}
|
||||||
this.workLoads[id] = work;
|
this.workLoads[id] = work;
|
||||||
|
|
||||||
return Promise.resolve({ id, complexity, completeDate });
|
return Promise.resolve({ id, status, complexity, completeDate });
|
||||||
}
|
}
|
||||||
|
|
||||||
public checkStatus({ id }: { id: number }) {
|
public checkStatus({ id }: { id: number }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user