-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from inab/login_branch
ADD status to test
- Loading branch information
Showing
9 changed files
with
790 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<template> | ||
<div | ||
class="nav-link flex md:inline-flex items-center hover:bg-gray-50 space-x-2" | ||
> | ||
<div class=""> | ||
<NuxtLink v-if="globalStatus" to="/status/" title="Server status is OK"> | ||
<span class="status-ok" alt="Server status is OK" | ||
><font-awesome-icon :icon="['fas', 'signal']" | ||
/></span> | ||
</NuxtLink> | ||
<NuxtLink v-else to="/status/" title="There is an error in some service"> | ||
<span class="status-error" alt="Server status error" | ||
><font-awesome-icon :icon="['fas', 'signal']" | ||
/></span> | ||
</NuxtLink> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, computed, onMounted } from "vue"; | ||
const runtimeConfig = useRuntimeConfig(); | ||
const vreServicesUrl = `${runtimeConfig.public.VRE_URI}`; | ||
const scientificUrl = `${runtimeConfig.public.SCIENTIFIC_SERVICE_URL}`; | ||
const keycloakUrl = `${runtimeConfig.public.KEYCLOAK_HOST}`; | ||
const observatoryUrl = `${runtimeConfig.public.OBSERVATORY_API_URL}`; | ||
const isVreServicesUp = ref(null); | ||
const isScientificServicesUp = ref(null); | ||
const isKeycloakServiceUp = ref(null); | ||
const isObservatoryServiceUp = ref(null); | ||
const globalStatus = computed(() => { | ||
if ( | ||
isVreServicesUp.value && | ||
isScientificServicesUp.value && | ||
isKeycloakServiceUp.value && | ||
isObservatoryServiceUp.value | ||
) { | ||
return true; | ||
} | ||
return false; | ||
}); | ||
const checkVreServices = async () => { | ||
return fetch(`https://api.allorigins.win/raw?url=${vreServicesUrl}`, { | ||
method: "GET", | ||
headers: { | ||
"Content-Type": "text/html", | ||
}, | ||
}) | ||
.then(async (response) => { | ||
const text = await response.text(); | ||
isVreServicesUp.value = response.ok && text.trim().length > 0; | ||
}) | ||
.catch((error) => { | ||
return false; | ||
}); | ||
}; | ||
const checkScientificServices = async () => { | ||
return fetch(`https://api.allorigins.win/raw?url=${scientificUrl}`, { | ||
method: "GET", | ||
headers: { | ||
"Content-Type": "text/html", | ||
}, | ||
}) | ||
.then(async (response) => { | ||
const text = await response.text(); | ||
isScientificServicesUp.value = response.ok && text.trim().length > 0; | ||
}) | ||
.catch((error) => { | ||
console.log("Error on fetch"); | ||
return false; | ||
}); | ||
}; | ||
const checkKeycloakServices = async () => { | ||
return fetch(`https://thingproxy.freeboard.io/fetch/${keycloakUrl}`, { | ||
method: "GET", | ||
headers: { | ||
"Content-Type": "text/html", | ||
}, | ||
}) | ||
.then(async (response) => { | ||
const text = await response.text(); | ||
isKeycloakServiceUp.value = response.ok && text.trim().length > 0; | ||
}) | ||
.catch((error) => { | ||
return false; | ||
}); | ||
}; | ||
const checkObservatoryServices = async () => { | ||
return fetch(`${observatoryUrl}/stats/tools/count_total`, { | ||
method: "GET", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}) | ||
.then(async (response) => { | ||
const text = await response.json(); | ||
isObservatoryServiceUp.value = response.ok && text.length > 0; | ||
}) | ||
.catch((error) => { | ||
console.log("Observatory error: ", error); | ||
return false; | ||
}); | ||
}; | ||
onMounted(() => { | ||
checkVreServices(); | ||
checkScientificServices(); | ||
checkObservatoryServices(); | ||
checkKeycloakServices(); | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.status-ok { | ||
color: #a0c878; | ||
} | ||
.status-error { | ||
color: #e52020; | ||
animation: pulseanim 1.7s 3 ease-in-out; | ||
} | ||
@keyframes pulseanim { | ||
0% { | ||
transform: scale(0); | ||
opacity: 0.8; | ||
} | ||
100% { | ||
transform: scale(1); | ||
opacity: 0; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<template> | ||
<div class="status-table"> | ||
<UTable | ||
:columns="columns" | ||
:rows="services" | ||
:loading="isTableLoading" | ||
:loading-state="{ | ||
icon: 'i-heroicons-arrow-path-20-solid', | ||
label: 'Loading...', | ||
}" | ||
:progress="{ color: 'primary', animation: 'carousel' }" | ||
> | ||
<template #service-data="{ row }"> | ||
<span v-if="row.status" class="status-ok"> | ||
<font-awesome-icon :icon="['fas', 'circle-check']" /> | ||
</span> | ||
<span v-else class="status-error"> | ||
<font-awesome-icon :icon="['fas', 'triangle-exclamation']" /> | ||
</span> | ||
{{ row.service }} | ||
</template> | ||
<template #status-data="{ row }"> | ||
{{ row.status ? "Operational" : "Down" }} | ||
</template> | ||
<template #response-data="{ row }"> | ||
{{ row.response }} | ||
</template> | ||
<template #page-data="{ row }"> | ||
<a target="_blank" :href="row.page">{{ row.page }}</a> | ||
</template> | ||
</UTable> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineProps<{ | ||
services: any, | ||
isTableLoading: boolean | ||
}>(); | ||
const columns = [ | ||
{ | ||
key: "service", | ||
label: "Service", | ||
}, | ||
{ | ||
key: "status", | ||
label: "Status", | ||
}, | ||
{ | ||
key: "response", | ||
label: "Response time (ms)", | ||
}, | ||
{ | ||
key: "page", | ||
label: "Go to page", | ||
}, | ||
]; | ||
</script> | ||
<style scoped lang="scss"> | ||
.status-ok { | ||
color: #a0c878; | ||
} | ||
.status-error { | ||
color: #e52020; | ||
} | ||
.status-table { | ||
padding: 30px 0 50px; | ||
} | ||
</style> |
Oops, something went wrong.