updated for new API view

This commit is contained in:
samuelmcdermott 2020-10-13 12:39:42 +01:00
parent 86d866c5f9
commit abfbf6ae20

View file

@ -6,7 +6,7 @@
<label> <label>
Stage Type Stage Type
<div v-if="this.stageType != 'MissingStage'"> <div v-if="this.stageType != 'MissingStage'">
<form> <form @submit.prevent="setStageType">
<div> <div>
<select v-model="stageType" class="uk-select"> <select v-model="stageType" class="uk-select">
<option value="SangaStage">SangaStage (Standard)</option> <option value="SangaStage">SangaStage (Standard)</option>
@ -14,14 +14,9 @@
</select> </select>
</div> </div>
<div> <div>
<taskSubmitter <button type="submit" class="uk-button uk-button-primary uk-form-small uk-float-right uk-margin-small uk-width-1-1">
:can-terminate="false" Change stage type
:submit-url= "this.stageTypeUri" </button>
:submit-data="{'stage_type' : this.stageType}"
:submit-label="'Change stage type'"
@response="onStageTypeResponse"
@error="onStageTypeError"
>
</div> </div>
</form> </form>
</div> </div>
@ -52,7 +47,7 @@ export default {
computed: { computed: {
stageTypeUri: function() { stageTypeUri: function() {
return `${this.$store.getters.baseUri}/api/v2/actions/stage/type`; return `${this.$store.getters.baseUri}/api/v2/properties/stage/type`;
}, },
}, },
@ -66,21 +61,25 @@ export default {
axios axios
.get(this.stageTypeUri) .get(this.stageTypeUri)
.then(response => { .then(response => {
console.log("Stage type is " + response.data.stage_type) console.log("Stage type is "+ response.data);
this.stageType = response.data.stage_type; this.stageType = response.data;
}) })
.catch(error => { .catch(error => {
this.modalError(error); this.modalError(error);
}); });
}, },
onStageTypeResponse: function(response) { setStageType: function(){
this.modalNotify("Stage type changed."); console.log("Setting stage type")
console.log("Stage type changed to " + response.output.stage_type) axios
this.stageType = response.output.stage_type .put(this.stageTypeUri,this.stageType)
}, .then(response => {
this.stageType = response.data;
onStageTypeError: function(error) { console.log("Stage type set to " + this.stageType);
this.modalError(error); // Let mixin handle error this.modalNotify("Stage type changed.");
})
.catch(error => {
this.modalError(error);
});
} }
} }
} }