apache_restart store
This commit is contained in:
parent
f789ac487b
commit
b413cc312d
@ -84,7 +84,6 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: mapGetters([
|
computed: mapGetters([
|
||||||
"allInfobases",
|
"allInfobases",
|
||||||
"getInfobaseByName",
|
|
||||||
"isLoading",
|
"isLoading",
|
||||||
"isLoadingError",
|
"isLoadingError",
|
||||||
"errorMessage",
|
"errorMessage",
|
||||||
|
53
src/store/modules/apache_restart.js
Normal file
53
src/store/modules/apache_restart.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
import config from "@/config.js";
|
||||||
|
|
||||||
|
const api_base = config.api;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
state: {
|
||||||
|
apache_need_restart: false,
|
||||||
|
restart_flag: false,
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
setApacheNeedRestart(state) {
|
||||||
|
state.apache_need_restart = true;
|
||||||
|
console.log("restart need");
|
||||||
|
},
|
||||||
|
setApacheRestartFlag(state, flag) {
|
||||||
|
state.restart_flag = flag;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
async fetchApacheRestartFlag(ctx) {
|
||||||
|
try {
|
||||||
|
await axios.get(`${api_base}/apache-restart`);
|
||||||
|
ctx.commit("setApacheRestartFlag", true);
|
||||||
|
} catch (err) {
|
||||||
|
ctx.commit("setApacheRestartFlag", false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async updateApacheRestartFlag(ctx) {
|
||||||
|
if (
|
||||||
|
ctx.getters.isApacheRestartPending ||
|
||||||
|
!ctx.getters.isApacheNeedRestart
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await axios.put(`${api_base}/apache-restart`);
|
||||||
|
ctx.commit("setApacheRestartFlag", true);
|
||||||
|
} catch (err) {
|
||||||
|
ctx.commit("setApacheRestartFlag", false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
isApacheNeedRestart(state) {
|
||||||
|
return state.apache_need_restart;
|
||||||
|
},
|
||||||
|
isApacheRestartPending(state) {
|
||||||
|
return state.restart_flag;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
@ -131,6 +131,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
await axios.post(`${api_base}/publications`, data);
|
await axios.post(`${api_base}/publications`, data);
|
||||||
ctx.commit("setInfobaseURL", { name, url });
|
ctx.commit("setInfobaseURL", { name, url });
|
||||||
|
ctx.commit("setApacheNeedRestart", null, { root: true });
|
||||||
ctx.commit("setErrorMessage", "");
|
ctx.commit("setErrorMessage", "");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.commit("setErrorMessage", `Ошибка обновления URL для базы ${name}`);
|
ctx.commit("setErrorMessage", `Ошибка обновления URL для базы ${name}`);
|
||||||
@ -146,6 +147,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
await axios.put(`${api_base}/publications`, { id: name, name });
|
await axios.put(`${api_base}/publications`, { id: name, name });
|
||||||
ctx.commit("setErrorMessage", "");
|
ctx.commit("setErrorMessage", "");
|
||||||
|
ctx.commit("setApacheNeedRestart", null, { root: true });
|
||||||
ctx.dispatch("fetchInfobase", name);
|
ctx.dispatch("fetchInfobase", name);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.commit("setErrorMessage", `Ошибка публикации базы ${name}`);
|
ctx.commit("setErrorMessage", `Ошибка публикации базы ${name}`);
|
||||||
@ -160,6 +162,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
await axios.delete(`${api_base}/publications/${name}`);
|
await axios.delete(`${api_base}/publications/${name}`);
|
||||||
ctx.commit("setErrorMessage", "");
|
ctx.commit("setErrorMessage", "");
|
||||||
|
ctx.commit("setApacheNeedRestart", null, { root: true });
|
||||||
ctx.dispatch("fetchInfobase", name);
|
ctx.dispatch("fetchInfobase", name);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ctx.commit("setErrorMessage", `Ошибка отмены публикации базы ${name}`);
|
ctx.commit("setErrorMessage", `Ошибка отмены публикации базы ${name}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user