Skip to content

Commit

Permalink
Display a message to user when there is no metric data
Browse files Browse the repository at this point in the history
  • Loading branch information
RoryPTB committed May 17, 2024
1 parent 72b9c98 commit ae895bb
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/frontend/components/ConfigSub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@
<v-toolbar :title="monitorDialogTitle" color="#003DA5">
<v-btn icon="mdi-close" variant="text" size="small" @click="showTopicMonitorDialog = false" />
</v-toolbar>
<v-container>
<v-row class="py-5">
<v-container v-if="topicHasMetrics">
<v-row class="py-5">
<v-col cols="6">
<v-card-title class="text-center">Downloaded Files
</v-card-title>
Expand Down Expand Up @@ -334,6 +334,15 @@
<v-col cols="3" />
</v-row>
</v-container>

<!-- If no metric data to present, show a message -->
<v-container v-else>
<v-row >
<v-col cols="12">
<p class="medium-title text-center">No metrics to display, as no notifications have been received yet from this topic.</p>
</v-col>
</v-row>
</v-container>
</v-card>
</v-dialog>

Expand Down Expand Up @@ -561,6 +570,12 @@ export default defineComponent({
return `http://${host.value}:${port.value}`;
});
// Check if the topic has metrics to display
// (If there are no keys, there is no Prometheus data for the topic)
const topicHasMetrics = computed(() => {
return Object.keys(topicMetrics.value).length > 0;
});
// Methods
// Load the saved information from the electron API
Expand Down Expand Up @@ -946,6 +961,9 @@ export default defineComponent({
// e.g. downloaded files by file type
topicMetrics.value = appendTotals(topicMetrics.value);
// Remove redundant metric key for the subscription status
delete topicMetrics.value['topic_subscription_status'];
// Display the metrics to the user
monitorDialogTitle.value = `Download Metrics of ${selectedTopic}`;
showTopicMonitorDialog.value = true;
Expand Down Expand Up @@ -1082,6 +1100,7 @@ export default defineComponent({
// Computed variables
settings,
serverLink,
topicHasMetrics,
// Methods
processTopicData,
Expand Down

0 comments on commit ae895bb

Please sign in to comment.