mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-10 17:00:11 +01:00
wip fix delete workspace in default role
This commit is contained in:
parent
610c87ce19
commit
0e5e742c27
@ -69,7 +69,7 @@ export default function App() {
|
||||
<Route path="/login" element={<Login />} />
|
||||
<Route
|
||||
path="/workspace/:slug/settings/:tab"
|
||||
element={<ManagerRoute Component={WorkspaceSettings} />}
|
||||
element={<PrivateRoute Component={WorkspaceSettings} />}
|
||||
/>
|
||||
<Route
|
||||
path="/workspace/:slug"
|
||||
|
@ -25,6 +25,7 @@ export default function ActiveWorkspaces() {
|
||||
const { user } = useUser();
|
||||
const isInWorkspaceSettings = !!useMatch("/workspace/:slug/settings/:tab");
|
||||
|
||||
console.log(user?.role);
|
||||
useEffect(() => {
|
||||
async function getWorkspaces() {
|
||||
const workspaces = await Workspace.all();
|
||||
|
@ -4,6 +4,7 @@ import Workspace from "@/models/workspace";
|
||||
import paths from "@/utils/paths";
|
||||
import System from "@/models/system";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import showToast from "@/utils/toast";
|
||||
|
||||
export default function DeleteWorkspace({ workspace }) {
|
||||
const { slug } = useParams();
|
||||
|
@ -6,6 +6,7 @@ import WorkspaceName from "./WorkspaceName";
|
||||
import SuggestedChatMessages from "./SuggestedChatMessages";
|
||||
import DeleteWorkspace from "./DeleteWorkspace";
|
||||
import WorkspacePfp from "./WorkspacePfp";
|
||||
import useUser from "@/hooks/useUser";
|
||||
|
||||
export default function GeneralInfo({ slug }) {
|
||||
const [workspace, setWorkspace] = useState(null);
|
||||
@ -13,6 +14,7 @@ export default function GeneralInfo({ slug }) {
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const formEl = useRef(null);
|
||||
const { user } = useUser();
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchWorkspace() {
|
||||
@ -43,6 +45,13 @@ export default function GeneralInfo({ slug }) {
|
||||
};
|
||||
|
||||
if (!workspace || loading) return null;
|
||||
if (user?.role === "default") {
|
||||
return (
|
||||
<>
|
||||
<DeleteWorkspace workspace={workspace} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<form
|
||||
|
@ -95,11 +95,13 @@ function ShowWorkspaceChat() {
|
||||
title={t("workspaces—settings.chat")}
|
||||
icon={<ChatText className="h-6 w-6" />}
|
||||
to={paths.workspace.settings.chatSettings(slug)}
|
||||
visible={["admin", "manager"].includes(user?.role)}
|
||||
/>
|
||||
<TabItem
|
||||
title={t("workspaces—settings.vector")}
|
||||
icon={<Database className="h-6 w-6" />}
|
||||
to={paths.workspace.settings.vectorDatabase(slug)}
|
||||
visible={["admin", "manager"].includes(user?.role)}
|
||||
/>
|
||||
<TabItem
|
||||
title={t("workspaces—settings.members")}
|
||||
@ -111,6 +113,7 @@ function ShowWorkspaceChat() {
|
||||
title={t("workspaces—settings.agent")}
|
||||
icon={<Robot className="h-6 w-6" />}
|
||||
to={paths.workspace.settings.agentConfig(slug)}
|
||||
visible={["admin", "manager"].includes(user?.role)}
|
||||
/>
|
||||
</div>
|
||||
<div className="px-16 py-6">
|
||||
|
Loading…
Reference in New Issue
Block a user