这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
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
21 changes: 20 additions & 1 deletion src/components/project/InsightsCard.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ref, onMounted, computed } from 'vue';
import { useToast } from 'primevue/usetoast';
import Chart from 'primevue/chart';
import Select from 'primevue/select';
Expand Down Expand Up @@ -68,6 +68,17 @@ const insightsData = ref<Record<string, InsightResponse> | null>(null);
/** Chart configurations for each insight metric */
const charts = ref<Map<string, ChartConfig>>(new Map());

/** Check if insights are disabled (all data arrays are empty) */
const areInsightsDisabled = computed<boolean>(() => {
if (!insightsData.value) return false;

const allDataArrays = Object.values(insightsData.value);
if (allDataArrays.length === 0) return false;

// Check if all data arrays are empty
return allDataArrays.every((response) => response.data?.length === 0);
});

/** Time range options */
const timeRangeOptions = [
{ label: 'Last Hour', value: 'hour' },
Expand Down Expand Up @@ -915,6 +926,14 @@ function handleTimeRangeChange() {
</div>
</div>

<div v-else-if="areInsightsDisabled" class="flex justify-center items-center h-[20rem] text-gray-500">
<div class="text-center">
<i class="pi pi-exclamation-triangle text-4xl mb-3"></i>
<p class="font-semibold">Insights Not Enabled</p>
<p class="text-sm mt-2">Please reach out to support to enable insights on this service.</p>
</div>
</div>

<div v-else-if="charts.size === 0" class="flex justify-center items-center h-[20rem] text-gray-500">
<div class="text-center">
<i class="pi pi-chart-line text-4xl mb-3"></i>
Expand Down