This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
// SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
||||
// The organization's own settings. `tenancy.org.update` needs the admin role, so the page asks for
|
||||
// it (src/server/guard.ts): a member below it gets the forbidden page, a stranger the not-found
|
||||
// page. Workspaces are created on their own page (`/{org}/workspaces`).
|
||||
|
||||
import { settingsGet } from "@app/modules/knowledge"
|
||||
import { SettingsSection } from "@app/modules/knowledge/ui"
|
||||
import { orgGet } from "@conusai-kit/tenancy"
|
||||
import type { ReactElement } from "react"
|
||||
import { orFallback, requireRole } from "../../../src/server/guard"
|
||||
import { pageContext } from "../../../src/server/page"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export default async function Settings({ params }: { params: Promise<{ org: string }> }): Promise<ReactElement> {
|
||||
const { org } = await params
|
||||
const page = await pageContext()
|
||||
const { caller, i18n, path } = page
|
||||
await requireRole(page, org, "admin")
|
||||
const organization = await orFallback(path, () => caller.call(orgGet, { org }))
|
||||
const knowledge = await orFallback(path, () => caller.call(settingsGet, { org }))
|
||||
// The request's i18n already carries every module's catalogue (kit-i18n merges them from the
|
||||
// manifests), so the module's own keys resolve with no import of its messages here.
|
||||
const t = (key: string) => i18n.message(`knowledge.${key}`)
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1>{i18n.message("app.settings")}</h1>
|
||||
<dl>
|
||||
<dt>{i18n.message("app.name")}</dt>
|
||||
<dd>{organization.name}</dd>
|
||||
<dt>{i18n.message("app.slug")}</dt>
|
||||
<dd>{organization.slug}</dd>
|
||||
<dt>{i18n.message("app.status")}</dt>
|
||||
<dd>{organization.status}</dd>
|
||||
</dl>
|
||||
<p>
|
||||
<a href={`/${org}/workspaces`}>{i18n.message("app.workspaces")}</a>
|
||||
</p>
|
||||
<SettingsSection
|
||||
org={org}
|
||||
initial={knowledge}
|
||||
labels={{
|
||||
heading: t("settings.heading"),
|
||||
state: t("settings.state"),
|
||||
stateOn: t("settings.stateOn"),
|
||||
stateOff: t("settings.stateOff"),
|
||||
backend: t("settings.backend"),
|
||||
backendVectors: t("settings.backendVectors"),
|
||||
source: t("settings.source"),
|
||||
sourceOperator: t("settings.sourceOperator"),
|
||||
sourceManaged: t("settings.sourceManaged"),
|
||||
endpoint: t("settings.endpoint"),
|
||||
enable: t("settings.enable"),
|
||||
enabling: t("settings.enabling"),
|
||||
disable: t("settings.disable"),
|
||||
disabling: t("settings.disabling"),
|
||||
enabledDone: t("settings.enabledDone"),
|
||||
disabledDone: t("settings.disabledDone"),
|
||||
planRequired: t("settings.planRequired"),
|
||||
featureDisabled: t("settings.featureDisabled"),
|
||||
quotaExhausted: t("settings.quotaExhausted"),
|
||||
upgrade: t("settings.upgrade"),
|
||||
hint: t("settings.hint"),
|
||||
failed: i18n.message("app.failed"),
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user