Skip to content

Commit

Permalink
Merge pull request #205 from compute-tooling/fix-edit-page
Browse files Browse the repository at this point in the history
Post meta parameters to get correct inputs on edit page
  • Loading branch information
hdoupe authored Sep 5, 2019
2 parents 66ec58d + 6f63952 commit 1789d7b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
38 changes: 24 additions & 14 deletions src/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,39 +51,49 @@ class InputsApp extends React.Component {
console.log("edit sim");
return axios
.all([
axios.get(`/${username}/${app_name}/api/v1/inputs/`),
axios.get(`/${username}/${app_name}/api/v1/${model_pk}/edit/`),
axios.get(`/users/status/${username}/${app_name}/`)
])
.then(
axios.spread((inputsResp, detailResp, statusResp) => {
console.log("inputsResp", inputsResp);
axios.spread((detailResp, statusResp) => {
console.log("detailResp", detailResp);
console.log("statusResp", statusResp);
let data = inputsResp.data;
data["detail"] = detailResp.data;
data["accessStatus"] = statusResp.data;
return data;
return axios
.post(`/${username}/${app_name}/api/v1/inputs/`, {
meta_parameters: detailResp.data.meta_parameters
})
.then(inputsResp => {
console.log("inputsResp", inputsResp);
let data = inputsResp.data;
data["detail"] = detailResp.data;
data["accessStatus"] = statusResp.data;
return data;
});
})
);
} else if (this.props.type === "edit_inputs") {
let inputs_hashid = this.props.match.params.inputs_hashid;
console.log("edit inputs");
return axios
.all([
axios.get(`/${username}/${app_name}/api/v1/inputs/`),
axios.get(`/${username}/${app_name}/api/v1/inputs/${inputs_hashid}/`),
axios.get(`/users/status/${username}/${app_name}/`)
])
.then(
axios.spread((inputsResp, detailResp, statusResp) => {
console.log("inputsResp", inputsResp);
axios.spread((detailResp, statusResp) => {
console.log("detailResp", detailResp);
console.log("statusResp", statusResp);
let data = inputsResp.data;
data["detail"] = detailResp.data;
data["accessStatus"] = statusResp.data;
return data;
return axios
.post(`/${username}/${app_name}/api/v1/inputs/`, {
meta_parameters: detailResp.data.meta_parameters
})
.then(inputsResp => {
console.log("inputsResp", inputsResp);
let data = inputsResp.data;
data["detail"] = detailResp.data;
data["accessStatus"] = statusResp.data;
return data;
});
})
);
} else {
Expand Down
Loading

0 comments on commit 1789d7b

Please sign in to comment.