Skip to content

Commit

Permalink
base role setting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Dec 9, 2024
1 parent 970320b commit c193760
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
16 changes: 16 additions & 0 deletions web/src/app/admin/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { ErrorCallout } from "@/components/ErrorCallout";
import { HidableSection } from "@/app/admin/assistants/HidableSection";
import BulkAdd from "@/components/admin/users/BulkAdd";
import { UsersResponse } from "@/lib/users/interfaces";
import { UserRole } from "@/lib/types";
import SlackUserTable from "@/components/admin/users/SlackUserTable";

const ValidDomainsDisplay = ({ validDomains }: { validDomains: string[] }) => {
if (!validDomains.length) {
Expand Down Expand Up @@ -101,6 +103,9 @@ const UsersTables = ({
const finalInvited = invited.filter(
(user) => !accepted.map((u) => u.email).includes(user.email)
);
const slackUsers = accepted.filter(
(user) => user.role === UserRole.SLACK_USER
);

return (
<>
Expand All @@ -125,6 +130,17 @@ const UsersTables = ({
<ValidDomainsDisplay validDomains={validDomains} />
)}
</HidableSection>

<HidableSection sectionTitle="Slack Users">
{slackUsers.length > 0 ? (
<SlackUserTable users={slackUsers} />
) : (
<div className="text-sm">
To invite additional teammates, use the <b>Invite Users</b> button
above!
</div>
)}
</HidableSection>
<SignedUpUserTable
users={accepted}
setPopup={setPopup}
Expand Down
34 changes: 34 additions & 0 deletions web/src/components/admin/users/SlackUserTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react";
import { User } from "@/lib/types";
import {
Table,
TableCell,
TableBody,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";

interface SlackUserTableProps {
users: User[];
}

const SlackUserTable: React.FC<SlackUserTableProps> = ({ users }) => {
return (
<>
<p className="mb-4 text-sm text-gray-600">
This list displays Slack users who have access to Danswer through the
Slack integration.
</p>
<ul className="list-disc pl-5">
{users.map((user) => (
<li key={user.id} className="mb-2">
{user.email}
</li>
))}
</ul>
</>
);
};

export default SlackUserTable;

0 comments on commit c193760

Please sign in to comment.