Skip to content

Commit

Permalink
ITEM-326
Browse files Browse the repository at this point in the history
AJOUT Statut base xml
  • Loading branch information
SamuelQuetin committed Oct 31, 2024
1 parent d99b734 commit fe2c035
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 22 deletions.
51 changes: 29 additions & 22 deletions src/components/Structure/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<a class="ma-2 text-white" v-bind="props" @mouseenter="getHealthOfServices" style="cursor: pointer;">Etat des serveurs</a>
</template>
<div style="display: flex; flex-direction: column;">
<v-chip class="ma-1" :color="healthServices['STATUT CBS'] ? 'green' : 'red'" variant="text"><v-icon icon="mdi-server" start></v-icon>CBS</v-chip>
<v-chip class="ma-1" :color="healthServices['STATUT BASE_XML'] ? 'green' : 'red'" variant="text"><v-icon icon="mdi-server" start></v-icon>XML</v-chip>
<v-chip class="ma-1" :color="healthServices['STATUT BASE_ITEM'] ? 'green' : 'red'" variant="text"><v-icon icon="mdi-server" start></v-icon>ITEM</v-chip>
<v-chip class="ma-1" :color="healthServices.STATUT_CBS ? 'green' : 'red'" variant="text"><v-icon icon="mdi-server" start></v-icon>CBS</v-chip>
<v-chip class="ma-1" :color="healthServices.STATUT_BASE_XML ? 'green' : 'red'" variant="text"><v-icon icon="mdi-server" start></v-icon>XML</v-chip>
<v-chip class="ma-1" :color="healthServices.STATUT_BASE_ITEM ? 'green' : 'red'" variant="text"><v-icon icon="mdi-server" start></v-icon>ITEM</v-chip>
</div>
</v-tooltip>
<v-tooltip location="top">
Expand All @@ -36,39 +36,46 @@
<script setup>
import {ref, computed, onMounted} from 'vue'
import itemService from '@/service/ItemService'
import statusService from "@/service/StatusService";
const currentYear = computed(() => new Date().getFullYear())
const test = ref(false)
const packageVersion = process.env.PACKAGE_VERSION.replaceAll('\"', '');
const backVersion = ref()
const healthServices = ref([{
'STATUT CBS':false,
'STATUT BASE_XML':false,
'STATUT BASE_ITEM':false
}])
const healthServices = ref({
STATUT_CBS:false,
STATUT_BASE_XML:false,
STATUT_BASE_ITEM:false
})
onMounted(async () => {
try {
const version = await itemService.getApplicationVersion()
let version = await itemService.getApplicationVersion()
backVersion.value = version.data
} catch (error) {
console.error('Erreur lors de la récupération de la version de l\'application :', error)
}
})
const getHealthOfServices = async () => {
try {
const response = await itemService.getHealthOfServices()
if (response.data) {
healthServices.value = response.data
}
} catch (error) {
healthServices.value = [{
'STATUT CBS':false,
'STATUT BASE_XML':false,
'STATUT BASE_ITEM':false
}]
console.error('Erreur lors de la récupération des statuts des services :', error)
}
statusService.getStatusBaseXML().then(isBaseXmlOk => {
healthServices.value.STATUT_BASE_XML = isBaseXmlOk;
})
// try {
// const response = await itemService.getHealthOfServices()
// if (response.data) {
// healthServices.value = response.data
// }
// } catch (error) {
// healthServices.value = [{
// 'STATUT CBS':false,
// 'STATUT BASE_XML':false,
// 'STATUT BASE_ITEM':false
// }]
// console.error('Erreur lors de la récupération des statuts des services :', error)
// }
}
</script>
20 changes: 20 additions & 0 deletions src/service/StatusService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import axios from 'axios';

export class StatusService {
constructor() {
this.client = axios.create({
baseURL: "https://api.uptimerobot.com/"
});
}

async getStatusBaseXML(){
let data = {"api_key":"ur707639-b082a50474d1cfbe940438bc", "monitors":"782344734"}
return this.client.post(`v2/getMonitors`,data).then(
response => {
return response.data.monitors[0].status === 2;
})
}

}

export default new StatusService()

0 comments on commit fe2c035

Please sign in to comment.