Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop to main #162

Merged
merged 6 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 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,38 @@
<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(isOk => {
healthServices.value.STATUT_BASE_XML = isOk;
})
statusService.getStatusCBS().then(isOk => {
healthServices.value.STATUT_CBS = isOk;
})
itemService.getHealthOfServices().then(isOk => {
healthServices.value.STATUT_BASE_ITEM = isOk;
})
}
</script>
7 changes: 5 additions & 2 deletions src/service/ItemService.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,11 @@ export class ItemService {
return this.client.get('applicationDetails');
}

getHealthOfServices(){
return this.client.get('applicationStatutServices')
async getHealthOfServices(){
return this.client.get('applicationStatutServices').then(response => {
console.log(response.data)
return response.data
})
}
}

Expand Down
27 changes: 27 additions & 0 deletions src/service/StatusService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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;
})
}

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

export default new StatusService()
6 changes: 6 additions & 0 deletions src/views/Exemplarisation/ExempSteps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ function prev() {
}

function changeEtat() {
if ((currentStep.value + 1) === 1) {
itemService.choixEtape(demande.value.id, 2, 'EXEMP')
.then(response => {
demande.value = response.data;
})
}
if((currentStep.value + 1) === 3) { //Changement d'etat pour le chargement du fichier car le back est perdu sinon
itemService.choixEtape(demande.value.id, currentStep.value + 1, 'EXEMP')
.then(response => {
Expand Down
Loading