-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
112 additions
and
44 deletions.
There are no files selected for viewing
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,41 @@ | ||
<template> | ||
<div v-if="contextualHealth === Health.Healthy"> | ||
<div class="bg-green-500 w-4 h-4 rounded-full" title="all good"></div> | ||
</div> | ||
<div v-else-if="contextualHealth === Health.Warning"> | ||
<div class="bg-yellow-500 w-4 h-4 rounded-full" title="warnings"></div> | ||
</div> | ||
<div v-else-if="contextualHealth === Health.Critical"> | ||
<div class="bg-red-500 w-4 h-4 rounded-full" title="critical"></div> | ||
</div> | ||
<div v-else> | ||
<div class="bg-gray-500 w-4 h-4 rounded-full" title="health unknown"></div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue'; | ||
import { useSystemHealth, Health } from "@/store/systemHealth.ts"; | ||
import { useRouter } from 'vue-router'; | ||
const systemHealth = useSystemHealth(); | ||
const router = useRouter(); | ||
const contextualHealth = computed(() => { | ||
switch (router.currentRoute.value.path) { | ||
case '/': | ||
return systemHealth.getAggregatedSystemHealth; | ||
case '/teerdays': | ||
return systemHealth.getIntegriteeSystemHealth; | ||
default: | ||
return Health.Unknown; | ||
} | ||
}); | ||
</script> | ||
|
||
|
||
<style scoped> | ||
</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
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,40 @@ | ||
import { defineStore } from "pinia"; | ||
import { ChainId } from "@/configs/chains"; | ||
|
||
class ObservableNumber { | ||
value: number; | ||
timestamp: Date; | ||
constructor(value: number) { | ||
this.value = value; | ||
} | ||
observe(new_value: number) { | ||
this.value = new_value; | ||
this.timestamp = new Date(); | ||
} | ||
} | ||
|
||
export enum Health { | ||
Unknown, | ||
Healthy, | ||
Warning, | ||
Critical, | ||
} | ||
|
||
export const useSystemHealth = defineStore("system-health", { | ||
state: () => ({ | ||
shieldingTargetFinalizedBlockNumber: <ObservableNumber | null>null, | ||
}), | ||
getters: { | ||
getAggregatedSystemHealth({ shieldingTargetFinalizedBlockNumber }): Health { | ||
return Health.Healthy; | ||
}, | ||
getIntegriteeSystemHealth({ shieldingTargetFinalizedBlockNumber }): Health { | ||
return Health.Warning; | ||
} | ||
}, | ||
actions: { | ||
setShieldingTargetFinalizedBlockNumber(block_number: number) { | ||
this.shieldingTargetFinalizedBlockNumber.observe(block_number); | ||
} | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.