Skip to content

Commit

Permalink
Show when metrics were last fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
srimanachanta committed Aug 9, 2023
1 parent acb68d2 commit 660c6b4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion photon-client/src/components/settings/MetricsCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useSettingsStore } from "@/stores/settings/GeneralSettingsStore";
import { computed, onBeforeMount } from "vue";
import { computed, onBeforeMount, ref } from "vue";
import { useStateStore } from "@/stores/StateStore";
import CvIcon from "@/components/common/cv-icon.vue";
Expand Down Expand Up @@ -57,6 +57,7 @@ const platformMetrics = computed<MetricItem[]>(() => [
}
]);
const metricsLastFetched = ref("Never");
const fetchMetrics = () => {
useSettingsStore()
.requestMetricsUpdate()
Expand All @@ -72,6 +73,14 @@ const fetchMetrics = () => {
message: "An error occurred while trying to fetch Metrics."
});
}
})
.finally(() => {
const pad = (num: number): string => {
return String(num).padStart(2, "0");
};
const date = new Date();
metricsLastFetched.value = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
});
};
Expand Down Expand Up @@ -161,6 +170,9 @@ onBeforeMount(() => {
</tbody>
</v-simple-table>
</v-row>
<div style="text-align: right">
<span>Last Fetched: {{ metricsLastFetched }}</span>
</div>
</v-card>
</template>

Expand Down

0 comments on commit 660c6b4

Please sign in to comment.