Should not check updates in cloud mode. Minor updates.

This commit is contained in:
Mike Cao 2023-07-28 22:28:06 -07:00
parent 8062d7f698
commit 56ab099499
4 changed files with 10 additions and 9 deletions

View file

@ -13,7 +13,11 @@ export function UpdateNotice({ user, config }) {
const { pathname } = useRouter(); const { pathname } = useRouter();
const [dismissed, setDismissed] = useState(checked); const [dismissed, setDismissed] = useState(checked);
const allowUpdate = const allowUpdate =
user?.isAdmin && !config?.updatesDisabled && !pathname.includes('/share/') && !dismissed; user?.isAdmin &&
!config?.updatesDisabled &&
!config?.cloudMode &&
!pathname.includes('/share/') &&
!dismissed;
const updateCheck = useCallback(() => { const updateCheck = useCallback(() => {
setItem(VERSION_CHECK, { version: latest, time: Date.now() }); setItem(VERSION_CHECK, { version: latest, time: Date.now() });

View file

@ -3,7 +3,7 @@ import BarChart from './BarChart';
import { useLocale, useTheme, useMessages } from 'hooks'; import { useLocale, useTheme, useMessages } from 'hooks';
import { renderDateLabels, renderStatusTooltipPopup } from 'lib/charts'; import { renderDateLabels, renderStatusTooltipPopup } from 'lib/charts';
export function PageviewsChart({ websiteId, data, unit, className, loading, ...props }) { export function PageviewsChart({ websiteId, data, unit, loading, ...props }) {
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
const { colors } = useTheme(); const { colors } = useTheme();
const { locale } = useLocale(); const { locale } = useLocale();
@ -31,7 +31,6 @@ export function PageviewsChart({ websiteId, data, unit, className, loading, ...p
<BarChart <BarChart
{...props} {...props}
key={websiteId} key={websiteId}
className={className}
datasets={datasets} datasets={datasets}
unit={unit} unit={unit}
loading={loading} loading={loading}

View file

@ -93,9 +93,7 @@ export function RealtimePage({ websiteId }) {
<Page loading={isLoading} error={error}> <Page loading={isLoading} error={error}>
<WebsiteHeader websiteId={websiteId} /> <WebsiteHeader websiteId={websiteId} />
<RealtimeHeader websiteId={websiteId} data={currentData} /> <RealtimeHeader websiteId={websiteId} data={currentData} />
<div className={styles.chart}> <RealtimeChart className={styles.chart} data={realtimeData} unit="minute" />
<RealtimeChart data={realtimeData} unit="minute" />
</div>
<GridRow> <GridRow>
<GridColumn xs={12} sm={12} md={12} lg={4} xl={4}> <GridColumn xs={12} sm={12} md={12} lg={4} xl={4}>
<RealtimeUrls websiteId={websiteId} websiteDomain={website?.domain} data={realtimeData} /> <RealtimeUrls websiteId={websiteId} websiteDomain={website?.domain} data={realtimeData} />

View file

@ -1,4 +1,4 @@
import { addMinutes, differenceInMinutes } from 'date-fns'; import { subMinutes, differenceInMinutes } from 'date-fns';
import { NextApiResponse } from 'next'; import { NextApiResponse } from 'next';
import { methodNotAllowed, ok, unauthorized } from 'next-basics'; import { methodNotAllowed, ok, unauthorized } from 'next-basics';
import { canViewWebsite } from 'lib/auth'; import { canViewWebsite } from 'lib/auth';
@ -53,8 +53,8 @@ export default async (
const { startDate, endDate } = await parseDateRangeQuery(req); const { startDate, endDate } = await parseDateRangeQuery(req);
const diff = differenceInMinutes(endDate, startDate); const diff = differenceInMinutes(endDate, startDate);
const prevStartDate = addMinutes(startDate, -diff); const prevStartDate = subMinutes(startDate, diff);
const prevEndDate = addMinutes(endDate, -diff); const prevEndDate = subMinutes(endDate, diff);
const metrics = await getWebsiteStats(websiteId, { const metrics = await getWebsiteStats(websiteId, {
startDate, startDate,