Add app insight for uncofigured domains
This commit is contained in:
parent
90d26a1fd1
commit
8e21dddc75
@ -45,6 +45,7 @@ export default async function AdminAppInsights() {
|
||||
const {
|
||||
forkBehind,
|
||||
noAiRateLimiting,
|
||||
noConfiguredDomain,
|
||||
outdatedPhotos,
|
||||
} = getSignificantInsights({
|
||||
codeMeta,
|
||||
@ -59,6 +60,7 @@ export default async function AdminAppInsights() {
|
||||
forkBehind,
|
||||
noAi: !isAiTextGenerationEnabled,
|
||||
noAiRateLimiting,
|
||||
noConfiguredDomain,
|
||||
outdatedPhotos,
|
||||
photoMatting: photosCountPortrait > 0 && !MATTE_PHOTOS,
|
||||
gridFirst: (
|
||||
|
||||
@ -103,6 +103,7 @@ export default function AdminAppInsightsClient({
|
||||
forkBehind,
|
||||
noAi,
|
||||
noAiRateLimiting,
|
||||
noConfiguredDomain,
|
||||
outdatedPhotos,
|
||||
photoMatting,
|
||||
gridFirst,
|
||||
@ -252,6 +253,26 @@ export default function AdminAppInsightsClient({
|
||||
prevent abuse by enabling rate limiting.
|
||||
</>}
|
||||
/>}
|
||||
{(noConfiguredDomain || debug) && <ScoreCardRow
|
||||
icon={<PiWarningBold
|
||||
size={17}
|
||||
className={clsx(
|
||||
'translate-x-[0.5px]',
|
||||
WARNING_TEXT_COLOR,
|
||||
)}
|
||||
/>}
|
||||
content={isExpanded => renderHighlightText(
|
||||
'Configure domain',
|
||||
'yellow',
|
||||
!isExpanded,
|
||||
)}
|
||||
expandContent={<>
|
||||
Not explicitly setting a domain may cause certain features
|
||||
to behave unexpectedly. Domains are stored in
|
||||
{' '}
|
||||
<EnvVar variable="NEXT_PUBLIC_SITE_DOMAIN" />.
|
||||
</>}
|
||||
/>}
|
||||
{(noStaticOptimization || debug) && <ScoreCardRow
|
||||
icon={<RiSpeedMiniLine
|
||||
size={19}
|
||||
|
||||
@ -10,19 +10,30 @@ import {
|
||||
import { PhotoDateRange } from '@/photo';
|
||||
import { getGitHubMeta } from '@/platforms/github';
|
||||
|
||||
export type AdminAppInsight =
|
||||
type AdminAppInsightCode =
|
||||
'noFork' |
|
||||
'forkBehind' |
|
||||
'forkBehind';
|
||||
|
||||
type AdminAppInsightRecommendation =
|
||||
'noAi' |
|
||||
'noAiRateLimiting' |
|
||||
'outdatedPhotos' |
|
||||
'noConfiguredDomain' |
|
||||
'photoMatting' |
|
||||
'gridFirst' |
|
||||
'noStaticOptimization';
|
||||
|
||||
const RECOMMENDATIONS: AdminAppInsight[] = [
|
||||
type AdminAppInsightLibrary =
|
||||
'outdatedPhotos';
|
||||
|
||||
export type AdminAppInsight =
|
||||
AdminAppInsightCode |
|
||||
AdminAppInsightRecommendation |
|
||||
AdminAppInsightLibrary;
|
||||
|
||||
const RECOMMENDATIONS: AdminAppInsightRecommendation[] = [
|
||||
'noAi',
|
||||
'noAiRateLimiting',
|
||||
'noConfiguredDomain',
|
||||
'photoMatting',
|
||||
'gridFirst',
|
||||
'noStaticOptimization',
|
||||
@ -66,11 +77,13 @@ export const getSignificantInsights = ({
|
||||
const {
|
||||
isAiTextGenerationEnabled,
|
||||
hasRedisStorage,
|
||||
hasDomain,
|
||||
} = APP_CONFIGURATION;
|
||||
|
||||
return {
|
||||
forkBehind: Boolean(codeMeta?.isBehind),
|
||||
noAiRateLimiting: isAiTextGenerationEnabled && !hasRedisStorage,
|
||||
noConfiguredDomain: !hasDomain,
|
||||
outdatedPhotos: Boolean(photosCountOutdated),
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user