Skip to content

Commit 7f81246

Browse files
committed
rServe health
1 parent 3f30d15 commit 7f81246

File tree

5 files changed

+82
-12
lines changed

5 files changed

+82
-12
lines changed

src/services/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ export * from "./massive/massiveTopVal.service";
1717
export * from "./exportCSV/exportCSV.service";
1818
export * from "./tabellaScript/tabellaScript.service";
1919
export * from "./elencoScript/elencoScript.service";
20+
export * from "./rServer/rServer.service";
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { axiosRegedit } from "@/http";
2+
import AbstractService from "@/services/abstract.service";
3+
4+
class RServerService extends AbstractService {
5+
constructor(endpoint) {
6+
super(endpoint);
7+
}
8+
getRServeResponse() {
9+
{
10+
return axiosRegedit
11+
.get(this.endpoint + "/checkR")
12+
.then(res => {
13+
var data = res.data ? res.data : {};
14+
//console.log(data);
15+
return data;
16+
})
17+
.catch(err => {
18+
throw err;
19+
});
20+
}
21+
}
22+
}
23+
24+
export const rServerService = new RServerService("/regedit");

src/store/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { csv } from "./modules/exportCSV/exportCSV";
2929
import { archivio } from "./modules/archivio/archivio";
3030
import { tabella } from "./modules/tabellaScript/tabellaScript";
3131
import { elenco } from "./modules/elencoScript/elencoScript";
32+
import { rServe } from "./modules/rServe/rServe";
3233
Vue.use(Vuex);
3334

3435
export default new Vuex.Store({
@@ -60,6 +61,7 @@ export default new Vuex.Store({
6061
csv,
6162
archivio,
6263
tabella,
63-
elenco
64+
elenco,
65+
rServe
6466
}
6567
});

src/store/modules/rServe/rServe.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { rServerService } from "@/services";
2+
//import { getUserId } from "@/common";
3+
4+
const state = {
5+
rServeResponse: null
6+
};
7+
8+
const mutations = {
9+
SET_RESPONSE(state, risposta) {
10+
state.rServeResponse = risposta;
11+
}
12+
};
13+
14+
const actions = {
15+
getResponse({ commit }) {
16+
//get user from store
17+
//let userId = getUserId();
18+
19+
return rServerService
20+
.getRServeResponse()
21+
.then(data => {
22+
//console.log(data);
23+
commit("SET_RESPONSE", data);
24+
})
25+
.catch(err => {
26+
console.log(err);
27+
});
28+
}
29+
};
30+
31+
const getters = {
32+
rResponse: state => {
33+
return state.rServeResponse;
34+
}
35+
};
36+
37+
export const rServe = {
38+
namespaced: true,
39+
state,
40+
mutations,
41+
actions,
42+
getters
43+
};

src/views/catalogue/toponimo/ToponimoList.vue

+11-11
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,11 @@
149149
Esegui Script
150150
</CButton>
151151
</div>
152-
<div class="col-2">
153-
<CButton
154-
shape="square"
155-
size="sm"
156-
color="primary"
157-
@click="runScript"
158-
>
159-
Attiva Rserver
160-
</CButton>
152+
<div class="col-2" v-if="isRServeOn">
153+
<CBadge color="success">RSERVE Connesso</CBadge>
154+
</div>
155+
<div class="col-2" v-else>
156+
<CBadge color="warning">RSERVE non risponde</CBadge>
161157
</div>
162158
</div>
163159
</CCardBody>
@@ -286,6 +282,7 @@ export default {
286282
returnValueScript: "",
287283
intervalId: null,
288284
intervalIdScriptRunning: null,
285+
rServerConnesso: false,
289286
btnLabel: () => "Elenco Province",
290287
filters: [
291288
{
@@ -326,7 +323,7 @@ export default {
326323
...mapGetters("tabella", ["tabellaScript"]),
327324
...mapGetters("elenco", ["elencoScript"]),
328325
...mapGetters("elenco", ["lastScriptRunning"]),
329-
326+
...mapGetters("rServe", ["rResponse"]),
330327
province: {
331328
get: function() {
332329
return this.provinceScript;
@@ -438,6 +435,9 @@ export default {
438435
this.$store.dispatch("elenco/findElencoByUser");
439436
clearInterval(this.intervalId);
440437
},
438+
isRServeOn() {
439+
return this.rResponse == "ok" ? true : false;
440+
},
441441
async verifyScriptRunning() {
442442
console.log("Verifica in Corso......");
443443
await this.$store.dispatch("elenco/findScriptRunningByUser");
@@ -547,6 +547,7 @@ export default {
547547
? this.filterTopProvincia.denominazioneProvincia
548548
: null
549549
};
550+
this.$store.dispatch("rServe/getResponse");
550551
this.$store.dispatch("coreui/setContext", state);
551552
this.$store.dispatch("toponimo/clearTop");
552553
this.$store.dispatch("toponimo/findByUserAndState", state);
@@ -558,7 +559,6 @@ export default {
558559
);
559560
this.$store.dispatch("elencoProvinceScript/findProvinceByScript");
560561
this.$store.dispatch("archivio/findArchivioCodes");
561-
//this.$store.dispatch("tabella/findTabellaByUser");
562562
this.$store.dispatch("elenco/findElencoByUser");
563563
this.sorterValue.column = parseInt(state) > 1 ? "dataMod" : null;
564564
}

0 commit comments

Comments
 (0)