slightly updated settings error (#2217)

* update settings issues

* slightly updated settings error
This commit is contained in:
pablodanswer
2024-08-22 19:19:00 -07:00
committed by GitHub
parent c042a19c00
commit 7da6d33451
3 changed files with 32 additions and 15 deletions

View File

@@ -16,6 +16,10 @@ import { Inter } from "next/font/google";
import Head from "next/head";
import { EnterpriseSettings } from "./admin/settings/interfaces";
import { redirect } from "next/navigation";
import { Button, Card } from "@tremor/react";
import LogoType from "@/components/header/LogoType";
import { HeaderTitle } from "@/components/header/HeaderTitle";
import { Logo } from "@/components/Logo";
const inter = Inter({
subsets: ["latin"],
@@ -53,14 +57,27 @@ export default async function RootLayout({
const combinedSettings = await fetchSettingsSS();
if (!combinedSettings) {
// Just display a simple full page error if fetching fails.
return (
<html lang="en">
<html lang="en" className={`${inter.variable} font-sans`}>
<Head>
<title>Settings Unavailable</title>
<title>Settings Unavailable | Danswer</title>
</Head>
<body>
<div className="error">
Settings could not be loaded. Please try again later.
<body className="bg-background text-default">
<div className="flex flex-col items-center justify-center min-h-screen">
<div className="mb-2 flex items-center max-w-[175px]">
<HeaderTitle>Danswer</HeaderTitle>
<Logo height={40} width={40} />
</div>
<Card className="p-8 max-w-md">
<h1 className="text-2xl font-bold mb-4 text-error">Error</h1>
<p className="text-text-500">
Your Danswer instance was not configured properly and your
settings could not be loaded. Please contact your admin to fix
this error.
</p>
</Card>
</div>
</body>
</html>

View File

@@ -77,15 +77,15 @@ export default function FunctionalHeader({
style={{ transition: "width 0.30s ease-out" }}
className={`
mobile:hidden
flex-none
mx-auto
overflow-y-hidden
transition-all
duration-300
ease-in-out
h-full
${sidebarToggled ? "w-[250px]" : "w-[0px]"}
`}
flex-none
mx-auto
overflow-y-hidden
transition-all
duration-300
ease-in-out
h-full
${sidebarToggled ? "w-[250px]" : "w-[0px]"}
`}
/>
<div className="w-full mobile:-mx-20 desktop:px-4">
<ChatBanner />

View File

@@ -61,7 +61,7 @@ export async function fetchSettingsSS(): Promise<CombinedSettings | null> {
let enterpriseSettings: EnterpriseSettings | null = null;
if (tasks.length > 1) {
if (!results[1].ok) {
if (results[1].status !== 403 && results[1].status !== 404) {
if (results[1].status !== 403) {
throw new Error(
`fetchEnterpriseSettingsSS failed: status=${results[1].status} body=${await results[1].text()}`
);