mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Create change lifecycle function
This commit is contained in:
parent
c58264241b
commit
fdd9d77a47
@ -87,22 +87,22 @@ export const getLifecycle = () => dispatch => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const updateLifecycleState = (uuid, nextState, reason) => dispatch => {
|
export const updateLifecycleState = (uuid, nextState, reason) => dispatch => {
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
nextState: nextState,
|
action: nextState,
|
||||||
reason: reason
|
reason: reason
|
||||||
};
|
};
|
||||||
|
|
||||||
const request = "method=get&content-type=application/json&payload=" + JSON.stringify(payload) + "&api-endpoint=/applications/lifecycle-config/" + uuid;
|
const request = "method=get&content-type=application/json&payload=" + JSON.stringify(payload) + "&api-endpoint=/applications/lifecycle/" + uuid;
|
||||||
|
|
||||||
console.log(request);
|
console.log(request);
|
||||||
|
|
||||||
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
|
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
|
||||||
).then(res => {
|
).then(res => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
dispatch({type: ActionTypes.UPDATE_LIFECYCLE_STATE, payload: {currentStatus: nextState}});
|
let release = res.data.data;
|
||||||
|
dispatch({type: ActionTypes.UPDATE_LIFECYCLE_STATE, payload: release});
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
|
|||||||
@ -49,15 +49,12 @@ function rootReducer(state = initialState, action) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else if (action.type === ActionTypes.UPDATE_LIFECYCLE_STATE) {
|
}else if (action.type === ActionTypes.UPDATE_LIFECYCLE_STATE) {
|
||||||
const release = {};
|
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
lifecycleModal: {
|
lifecycleModal: {
|
||||||
visible: false,
|
visible: false,
|
||||||
nextState: null,
|
nextState: null,
|
||||||
},
|
},
|
||||||
release:{
|
release: action.payload
|
||||||
currentStatus : action.payload.currentStatus
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user