confirm before installing software on agent

This commit is contained in:
wh1te909 2020-02-02 21:54:33 +00:00
parent 3d063720ca
commit e8d2fa588d
2 changed files with 24 additions and 7 deletions

View File

@ -49,6 +49,7 @@
<script>
import axios from "axios";
import { mapState } from "vuex";
import { mapGetters } from "vuex";
import mixins from "@/mixins/mixins";
export default {
name: "InstallSoftware",
@ -93,17 +94,30 @@ export default {
},
install(name, version) {
const data = { name: name, version: version, pk: this.agentpk };
axios
.post("/software/install/", data)
.then(r => {
this.$emit("close");
this.notifySuccess(r.data);
this.$q
.dialog({
title: "Install Software",
message: `Install ${name} on ${this.agentHostname}?`,
persistent: true,
ok: { label: "Install" },
cancel: { color: "negative" }
})
.catch(e => {
this.notifyError("Something went wrong");
.onOk(() => {
axios
.post("/software/install/", data)
.then(r => {
this.$emit("close");
this.notifySuccess(r.data);
})
.catch(e => {
this.notifyError("Something went wrong");
});
});
}
},
computed: {
...mapGetters(["agentHostname"])
},
created() {
this.getChocos();
}

View File

@ -47,6 +47,9 @@ export const store = new Vuex.Store({
a.installed === false ? -1 : 1
);
return sortedByInstall;
},
agentHostname(state) {
return state.agentSummary.hostname;
}
},
mutations: {