mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-12 14:14:50 +00:00
Merge pull request #2557 from ManishMadan2882/main
minor ui, filter users intead of exact match
This commit is contained in:
5 files changed
+60
-67
No files matched your search
@@ -94,7 +94,7 @@ class AdminStatsRepository:
|
||||
where = ""
|
||||
count_params: dict = {}
|
||||
if user_id_filter is not None:
|
||||
where = "WHERE lower(u.user_id) = lower(:uid)"
|
||||
where = "WHERE u.user_id ILIKE '%' || :uid || '%'"
|
||||
count_params["uid"] = user_id_filter
|
||||
total = self._conn.execute(
|
||||
text(f"SELECT count(*) FROM users u {where}"), count_params
|
||||
|
||||
+12
-25
@@ -318,7 +318,9 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
||||
|
||||
{/* Icon rail (desktop only, when sidebar collapsed) */}
|
||||
{!navOpen && !isMobile && !isTablet && (
|
||||
<div className="bg-sidebar border-border fixed top-0 left-0 z-10 hidden h-full w-14 flex-col items-center gap-2 border-r py-3 lg:flex">
|
||||
<div
|
||||
ref={navRef}
|
||||
className="bg-sidebar border-border fixed top-0 left-0 z-10 hidden h-full w-14 flex-col items-center gap-2 border-r py-3 lg:flex">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
@@ -385,10 +387,8 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
ref={navRef}
|
||||
className={`${
|
||||
!navOpen && '-ml-96 md:-ml-72'
|
||||
} bg-sidebar dark:border-r-sidebar-border fixed top-0 z-20 flex h-full w-72 flex-col border-r border-b-0 transition-all duration-300 ease-in-out dark:text-white`}
|
||||
className={`${!navOpen && '-ml-96 md:-ml-72'
|
||||
} bg-sidebar dark:border-r-sidebar-border fixed top-0 z-20 flex h-full w-72 flex-col border-r border-b-0 transition-all duration-300 ease-in-out dark:text-white`}
|
||||
>
|
||||
<div
|
||||
className={
|
||||
@@ -436,8 +436,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
||||
resetConversation();
|
||||
}}
|
||||
className={({ isActive }) =>
|
||||
`${
|
||||
isActive ? 'bg-transparent' : ''
|
||||
`${isActive ? 'bg-transparent' : ''
|
||||
} group border-sidebar-border hover:border-sidebar-border sticky mx-4 mt-4 flex cursor-pointer items-center gap-2.5 rounded-3xl border p-3 hover:bg-transparent dark:text-white`
|
||||
}
|
||||
>
|
||||
@@ -475,11 +474,10 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
||||
{recentAgents.map((agent, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
className={`group hover:bg-sidebar-accent mx-4 my-auto mt-4 flex h-9 cursor-pointer items-center justify-between rounded-3xl pl-4 ${
|
||||
agent.id === selectedAgent?.id && !conversationId
|
||||
className={`group hover:bg-sidebar-accent mx-4 my-auto mt-4 flex h-9 cursor-pointer items-center justify-between rounded-3xl pl-4 ${agent.id === selectedAgent?.id && !conversationId
|
||||
? 'bg-sidebar-accent'
|
||||
: ''
|
||||
}`}
|
||||
}`}
|
||||
onClick={() => handleAgentClick(agent)}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -529,8 +527,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
||||
}
|
||||
}}
|
||||
className={({ isActive }) =>
|
||||
`hover:bg-sidebar-accent mx-4 my-auto mt-2 flex h-9 cursor-pointer items-center gap-2 rounded-3xl pl-4 ${
|
||||
isActive ? 'bg-sidebar-accent' : ''
|
||||
`hover:bg-sidebar-accent mx-4 my-auto mt-2 flex h-9 cursor-pointer items-center gap-2 rounded-3xl pl-4 ${isActive ? 'bg-sidebar-accent' : ''
|
||||
}`
|
||||
}
|
||||
>
|
||||
@@ -558,8 +555,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
||||
dispatch(setSelectedAgent(null));
|
||||
}}
|
||||
className={({ isActive }) =>
|
||||
`hover:bg-sidebar-accent mx-4 my-auto mt-2 flex h-9 cursor-pointer items-center gap-2.5 rounded-3xl pl-3 ${
|
||||
isActive ? 'bg-sidebar-accent' : ''
|
||||
`hover:bg-sidebar-accent mx-4 my-auto mt-2 flex h-9 cursor-pointer items-center gap-2.5 rounded-3xl pl-3 ${isActive ? 'bg-sidebar-accent' : ''
|
||||
}`
|
||||
}
|
||||
>
|
||||
@@ -627,8 +623,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
||||
}}
|
||||
to="/settings"
|
||||
className={({ isActive }) =>
|
||||
`hover:bg-sidebar-accent mx-4 my-auto flex h-9 cursor-pointer items-center gap-2.5 rounded-3xl pl-3 ${
|
||||
isActive ? 'bg-sidebar-accent' : ''
|
||||
`hover:bg-sidebar-accent mx-4 my-auto flex h-9 cursor-pointer items-center gap-2.5 rounded-3xl pl-3 ${isActive ? 'bg-sidebar-accent' : ''
|
||||
}`
|
||||
}
|
||||
>
|
||||
@@ -703,15 +698,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
|
||||
>
|
||||
<Menu className="size-5" strokeWidth={1.75} />
|
||||
</Button>
|
||||
<div className="absolute left-1/2 flex -translate-x-1/2 items-center">
|
||||
<TeamSwitcher
|
||||
onNavigate={() => {
|
||||
if (isMobile || isTablet) {
|
||||
setNavOpen(false);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<ConfirmationModal
|
||||
|
||||
@@ -251,7 +251,7 @@ export default function Users() {
|
||||
|
||||
<div className="mb-4 flex flex-wrap items-center gap-2">
|
||||
<Input
|
||||
placeholder="Filter by exact user id"
|
||||
placeholder="Filter by user id"
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
import { Button } from '../components/ui/button';
|
||||
import {
|
||||
Popover,
|
||||
PopoverAnchor,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from '../components/ui/popover';
|
||||
@@ -276,55 +275,62 @@ export default function Prompts({
|
||||
</p>
|
||||
<div className="flex flex-row flex-wrap items-end justify-start gap-6">
|
||||
<Popover open={open} onOpenChange={setOpen}>
|
||||
<PopoverAnchor asChild>
|
||||
<div className={pillClassName}>
|
||||
<PopoverTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="focus-visible:ring-ring/50 flex min-w-0 flex-1 items-center rounded-l-3xl py-3 pl-5 text-left outline-none focus-visible:ring-[3px]"
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
'truncate',
|
||||
!selectedPrompt?.name && 'text-muted-foreground',
|
||||
)}
|
||||
>
|
||||
{selectedPrompt?.name || 'Select a prompt'}
|
||||
</span>
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
<PopoverTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Toggle prompt list"
|
||||
className={cn(
|
||||
pillClassName,
|
||||
'focus-visible:ring-ring/50 outline-none focus-visible:ring-[3px]',
|
||||
)}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
'flex min-w-0 flex-1 items-center py-3 pl-5 text-left',
|
||||
!selectedPrompt?.name && 'text-muted-foreground',
|
||||
)}
|
||||
>
|
||||
<span className="truncate">
|
||||
{selectedPrompt?.name || 'Select a prompt'}
|
||||
</span>
|
||||
</span>
|
||||
{selectedPrompt?.id && selectedPrompt.type !== 'public' && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => openEditModal(selectedPrompt)}
|
||||
<span
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openEditModal(selectedPrompt);
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
openEditModal(selectedPrompt);
|
||||
}
|
||||
}}
|
||||
className="text-muted-foreground hover:bg-foreground/15 hover:text-foreground dark:hover:bg-foreground/20 focus-visible:ring-ring/50 mx-1 my-auto shrink-0 rounded-full p-1.5 transition-colors outline-none focus-visible:ring-[3px]"
|
||||
aria-label="Edit prompt"
|
||||
>
|
||||
<Pencil className="h-4 w-4" />
|
||||
</button>
|
||||
<div
|
||||
</span>
|
||||
<span
|
||||
className="bg-border my-2.5 w-px shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<PopoverTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="text-muted-foreground hover:bg-foreground/15 hover:text-foreground dark:hover:bg-foreground/20 focus-visible:ring-ring/50 my-auto mr-2.5 ml-1 shrink-0 rounded-full p-1.5 transition-colors outline-none focus-visible:ring-[3px]"
|
||||
aria-label="Toggle prompt list"
|
||||
>
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
'h-4 w-4 transition-transform',
|
||||
open && 'rotate-180',
|
||||
)}
|
||||
/>
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
</div>
|
||||
</PopoverAnchor>
|
||||
<span className="text-muted-foreground hover:bg-foreground/15 hover:text-foreground dark:hover:bg-foreground/20 my-auto mr-2.5 ml-1 shrink-0 rounded-full p-1.5 transition-colors">
|
||||
<ChevronDown
|
||||
className={cn(
|
||||
'h-4 w-4 transition-transform',
|
||||
open && 'rotate-180',
|
||||
)}
|
||||
/>
|
||||
</span>
|
||||
</button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent
|
||||
align="start"
|
||||
className={cn(
|
||||
|
||||
@@ -143,7 +143,7 @@ export default function TeamSwitcher({
|
||||
</button>
|
||||
)}
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" className="w-[248px]">
|
||||
<DropdownMenuContent align="start" className="w-62">
|
||||
<DropdownMenuLabel className="flex items-center gap-2">
|
||||
<span className="bg-muted dark:bg-accent flex size-7 shrink-0 items-center justify-center rounded-md">
|
||||
{currentTeam ? (
|
||||
|
||||
Reference in new issue
Block a user