mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 21:29:08 +03:00
daily stats chart
This commit is contained in:
1 parent
42d1c3f0c0
commit
109bbbcb7a
2 files changed
+7
-15
No files matched your search
@@ -49,21 +49,12 @@ const Usage = () => {
|
||||
const dailyStatsEndDate = useMemo(() => {
|
||||
// If end date is in future, set end date to now
|
||||
if (endDate && dayjs(endDate).isAfter(dayjs())) {
|
||||
const yesterday = dayjs(new Date()).subtract(1, 'day')
|
||||
|
||||
/**
|
||||
* Currently, daily-stats data is only available a day later, so we'll use yesterday as end date, as otherwise the current day would just show up with "0" values
|
||||
*
|
||||
* We are actively working on removing this restriction on the data-eng/LF side and can remove this workaround once that's done
|
||||
*/
|
||||
const newEndDate = yesterday.isAfter(dayjs(startDate)) ? yesterday : new Date()
|
||||
|
||||
// LF seems to have an issue with the milliseconds, causes infinite loading sometimes
|
||||
return newEndDate.toISOString().slice(0, -5) + 'Z'
|
||||
return new Date().toISOString().slice(0, -5) + 'Z'
|
||||
} else if (endDate) {
|
||||
return endDate
|
||||
}
|
||||
}, [endDate, startDate])
|
||||
}, [endDate])
|
||||
|
||||
const { data: ioBudgetData } = useInfraMonitoringQuery({
|
||||
projectRef: selectedProjectRef,
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from 'data/usage/project-usage-query'
|
||||
import { DataPoint } from 'data/analytics/constants'
|
||||
import SectionContent from './SectionContent'
|
||||
import { Button, IconAlertTriangle } from 'ui'
|
||||
import { Button, IconAlertTriangle, IconBarChart2 } from 'ui'
|
||||
import { USAGE_APPROACHING_THRESHOLD } from '../Billing.constants'
|
||||
import Link from 'next/link'
|
||||
import SparkBar from 'components/ui/SparkBar'
|
||||
@@ -175,10 +175,11 @@ const UsageSection = ({ projectRef, categoryKey, chartMeta, subscription }: Usag
|
||||
) : (
|
||||
<Panel>
|
||||
<Panel.Content>
|
||||
<div className="flex flex-col items-center justify-center space-y-2">
|
||||
<p>No data</p>
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
<IconBarChart2 className="text-scale-1100 mb-2" />
|
||||
<p className='text-sm'>No data in period</p>
|
||||
<p className="text-sm text-scale-1000">
|
||||
No {notAllValuesZero ? 'data' : 'usage'} in period
|
||||
May take up to 24 hours to show
|
||||
</p>
|
||||
</div>
|
||||
</Panel.Content>
|
||||
|
||||
Reference in new issue
Block a user