mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 12:29:41 +02:00
Fix welcome modal
This commit is contained in:
@@ -41,7 +41,6 @@ export const SlackBotCreationForm = ({
|
|||||||
existingSlackBotConfig?: SlackBotConfig;
|
existingSlackBotConfig?: SlackBotConfig;
|
||||||
}) => {
|
}) => {
|
||||||
const isUpdate = existingSlackBotConfig !== undefined;
|
const isUpdate = existingSlackBotConfig !== undefined;
|
||||||
console.log(existingSlackBotConfig);
|
|
||||||
const { popup, setPopup } = usePopup();
|
const { popup, setPopup } = usePopup();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@@ -209,8 +208,8 @@ export const SlackBotCreationForm = ({
|
|||||||
<Text className="mt-2">
|
<Text className="mt-2">
|
||||||
<b>NOTE:</b> whichever tab you are when you submit the form
|
<b>NOTE:</b> whichever tab you are when you submit the form
|
||||||
will be the one that is used. For example, if you are on the
|
will be the one that is used. For example, if you are on the
|
||||||
"Personas" tab, then the Persona will be used, even if you
|
"Personas" tab, then the Persona will be used,
|
||||||
have Document Sets selected.
|
even if you have Document Sets selected.
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -7,12 +7,13 @@ import { DocumentSet, SlackBotConfig } from "@/lib/types";
|
|||||||
import { Text } from "@tremor/react";
|
import { Text } from "@tremor/react";
|
||||||
import { BackButton } from "@/components/BackButton";
|
import { BackButton } from "@/components/BackButton";
|
||||||
import { Persona } from "../../personas/interfaces";
|
import { Persona } from "../../personas/interfaces";
|
||||||
|
import { InstantSSRAutoRefresh } from "@/components/SSRAutoRefresh";
|
||||||
|
|
||||||
async function Page({ params }: { params: { id: string } }) {
|
async function Page({ params }: { params: { id: string } }) {
|
||||||
const tasks = [
|
const tasks = [
|
||||||
fetchSS("/manage/admin/slack-bot/config", undefined, true),
|
fetchSS("/manage/admin/slack-bot/config"),
|
||||||
fetchSS("/manage/document-set", undefined, true),
|
fetchSS("/manage/document-set"),
|
||||||
fetchSS("/persona", undefined, true),
|
fetchSS("/persona"),
|
||||||
];
|
];
|
||||||
|
|
||||||
const [slackBotsResponse, documentSetsResponse, personasResponse] =
|
const [slackBotsResponse, documentSetsResponse, personasResponse] =
|
||||||
@@ -62,6 +63,8 @@ async function Page({ params }: { params: { id: string } }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto dark">
|
<div className="container mx-auto dark">
|
||||||
|
<InstantSSRAutoRefresh />
|
||||||
|
|
||||||
<BackButton />
|
<BackButton />
|
||||||
<AdminPageTitle
|
<AdminPageTitle
|
||||||
icon={<CPUIcon size={32} />}
|
icon={<CPUIcon size={32} />}
|
||||||
|
@@ -23,6 +23,7 @@ import {
|
|||||||
} from "@tremor/react";
|
} from "@tremor/react";
|
||||||
import { FiArrowUpRight, FiChevronDown, FiChevronUp } from "react-icons/fi";
|
import { FiArrowUpRight, FiChevronDown, FiChevronUp } from "react-icons/fi";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { InstantSSRAutoRefresh } from "@/components/SSRAutoRefresh";
|
||||||
|
|
||||||
const numToDisplay = 50;
|
const numToDisplay = 50;
|
||||||
|
|
||||||
@@ -285,6 +286,7 @@ const Page = () => {
|
|||||||
icon={<CPUIcon size={32} />}
|
icon={<CPUIcon size={32} />}
|
||||||
title="Slack Bot Configuration"
|
title="Slack Bot Configuration"
|
||||||
/>
|
/>
|
||||||
|
<InstantSSRAutoRefresh />
|
||||||
|
|
||||||
<Main />
|
<Main />
|
||||||
</div>
|
</div>
|
||||||
|
@@ -11,6 +11,7 @@ import { SearchType } from "@/lib/search/interfaces";
|
|||||||
import { Persona } from "./admin/personas/interfaces";
|
import { Persona } from "./admin/personas/interfaces";
|
||||||
import { WelcomeModal } from "@/components/WelcomeModal";
|
import { WelcomeModal } from "@/components/WelcomeModal";
|
||||||
import { unstable_noStore as noStore } from "next/cache";
|
import { unstable_noStore as noStore } from "next/cache";
|
||||||
|
import { InstantSSRAutoRefresh } from "@/components/SSRAutoRefresh";
|
||||||
|
|
||||||
export default async function Home() {
|
export default async function Home() {
|
||||||
// Disable caching so we always get the up to date connector / document set / persona info
|
// Disable caching so we always get the up to date connector / document set / persona info
|
||||||
@@ -85,6 +86,7 @@ export default async function Home() {
|
|||||||
<HealthCheckBanner />
|
<HealthCheckBanner />
|
||||||
</div>
|
</div>
|
||||||
<ApiKeyModal />
|
<ApiKeyModal />
|
||||||
|
<InstantSSRAutoRefresh />
|
||||||
{connectors.length === 0 && connectorsResponse?.ok && <WelcomeModal />}
|
{connectors.length === 0 && connectorsResponse?.ok && <WelcomeModal />}
|
||||||
<div className="px-24 pt-10 flex flex-col items-center min-h-screen bg-gray-900 text-gray-100">
|
<div className="px-24 pt-10 flex flex-col items-center min-h-screen bg-gray-900 text-gray-100">
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
|
@@ -13,7 +13,17 @@ export function SSRAutoRefresh({ refreshFreq = 5 }: { refreshFreq?: number }) {
|
|||||||
}, refreshFreq * 1000);
|
}, refreshFreq * 1000);
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
});
|
}, []);
|
||||||
|
|
||||||
|
return <></>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function InstantSSRAutoRefresh() {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
router.refresh();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
|
@@ -3,8 +3,6 @@
|
|||||||
import { Button } from "@tremor/react";
|
import { Button } from "@tremor/react";
|
||||||
import { Modal } from "./Modal";
|
import { Modal } from "./Modal";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useState } from "react";
|
|
||||||
import { FiX } from "react-icons/fi";
|
|
||||||
|
|
||||||
export function WelcomeModal() {
|
export function WelcomeModal() {
|
||||||
return (
|
return (
|
||||||
@@ -29,9 +27,9 @@ export function WelcomeModal() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex mt-3 dark">
|
<div className="flex mt-3 dark">
|
||||||
<Button className="mx-auto">
|
<Link href="/admin/add-connector" className="mx-auto">
|
||||||
<Link href="/admin/add-connector">Setup your first connector!</Link>
|
<Button>Setup your first connector!</Button>
|
||||||
</Button>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@@ -8,11 +8,7 @@ export function buildUrl(path: string) {
|
|||||||
return `${INTERNAL_URL}/${path}`;
|
return `${INTERNAL_URL}/${path}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchSS(
|
export function fetchSS(url: string, options?: RequestInit) {
|
||||||
url: string,
|
|
||||||
options?: RequestInit,
|
|
||||||
addRandomTimestamp: boolean = false
|
|
||||||
) {
|
|
||||||
const init = options || {
|
const init = options || {
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
cache: "no-store",
|
cache: "no-store",
|
||||||
@@ -23,12 +19,5 @@ export function fetchSS(
|
|||||||
.join("; "),
|
.join("; "),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// add a random timestamp to force NextJS to refetch rather than
|
|
||||||
// used cached data
|
|
||||||
if (addRandomTimestamp) {
|
|
||||||
const timestamp = Date.now();
|
|
||||||
url = `${url}?u=${timestamp}`;
|
|
||||||
}
|
|
||||||
return fetch(buildUrl(url), init);
|
return fetch(buildUrl(url), init);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user