Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
15072292
authored
Jun 13, 2026
by
Seefs
Committed by
GitHub
Jun 13, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add deleted user status filter (#5464)
parent
1292b8b2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
6 deletions
+18
-6
model/user.go
+5
-1
web/default/src/features/users/components/users-columns.tsx
+7
-2
web/default/src/features/users/components/users-table.tsx
+1
-0
web/default/src/features/users/constants.ts
+4
-2
web/default/src/routes/_authenticated/users/index.tsx
+1
-1
No files found.
model/user.go
View file @
15072292
...
@@ -264,7 +264,11 @@ func SearchUsers(keyword string, group string, role *int, status *int, startIdx
...
@@ -264,7 +264,11 @@ func SearchUsers(keyword string, group string, role *int, status *int, startIdx
query
=
query
.
Where
(
"role = ?"
,
*
role
)
query
=
query
.
Where
(
"role = ?"
,
*
role
)
}
}
if
status
!=
nil
{
if
status
!=
nil
{
query
=
query
.
Where
(
"status = ?"
,
*
status
)
if
*
status
==
-
1
{
query
=
query
.
Where
(
"deleted_at IS NOT NULL"
)
}
else
{
query
=
query
.
Where
(
"deleted_at IS NULL"
)
.
Where
(
"status = ?"
,
*
status
)
}
}
}
// 获取总数
// 获取总数
...
...
web/default/src/features/users/components/users-columns.tsx
View file @
15072292
...
@@ -31,7 +31,12 @@ import { GroupBadge } from '@/components/group-badge'
...
@@ -31,7 +31,12 @@ import { GroupBadge } from '@/components/group-badge'
import
{
LongText
}
from
'@/components/long-text'
import
{
LongText
}
from
'@/components/long-text'
import
{
StatusBadge
}
from
'@/components/status-badge'
import
{
StatusBadge
}
from
'@/components/status-badge'
import
{
TableId
}
from
'@/components/table-id'
import
{
TableId
}
from
'@/components/table-id'
import
{
USER_STATUSES
,
USER_ROLES
,
isUserDeleted
}
from
'../constants'
import
{
USER_STATUS
,
USER_STATUSES
,
USER_ROLES
,
isUserDeleted
,
}
from
'../constants'
import
{
type
User
}
from
'../types'
import
{
type
User
}
from
'../types'
import
{
DataTableRowActions
}
from
'./data-table-row-actions'
import
{
DataTableRowActions
}
from
'./data-table-row-actions'
...
@@ -125,7 +130,7 @@ export function useUsersColumns(): ColumnDef<User>[] {
...
@@ -125,7 +130,7 @@ export function useUsersColumns(): ColumnDef<User>[] {
const
requestCount
=
user
.
request_count
const
requestCount
=
user
.
request_count
const
statusConfig
=
isUserDeleted
(
user
)
const
statusConfig
=
isUserDeleted
(
user
)
?
USER_STATUSES
.
DELETED
?
USER_STATUSES
[
USER_STATUS
.
DELETED
]
:
USER_STATUSES
[
user
.
status
as
keyof
typeof
USER_STATUSES
]
:
USER_STATUSES
[
user
.
status
as
keyof
typeof
USER_STATUSES
]
if
(
!
statusConfig
)
{
if
(
!
statusConfig
)
{
...
...
web/default/src/features/users/components/users-table.tsx
View file @
15072292
...
@@ -156,6 +156,7 @@ export function UsersTable() {
...
@@ -156,6 +156,7 @@ export function UsersTable() {
onGlobalFilterChange
,
onGlobalFilterChange
,
onColumnFiltersChange
,
onColumnFiltersChange
,
manualPagination
:
true
,
manualPagination
:
true
,
manualFiltering
:
true
,
totalCount
:
data
?.
total
||
0
,
totalCount
:
data
?.
total
||
0
,
ensurePageInRange
,
ensurePageInRange
,
})
})
...
...
web/default/src/features/users/constants.ts
View file @
15072292
...
@@ -34,6 +34,7 @@ export const isUserDeleted = (user: UserType): boolean => {
...
@@ -34,6 +34,7 @@ export const isUserDeleted = (user: UserType): boolean => {
export
const
USER_STATUS
=
{
export
const
USER_STATUS
=
{
ENABLED
:
1
,
ENABLED
:
1
,
DISABLED
:
2
,
DISABLED
:
2
,
DELETED
:
-
1
,
}
as
const
}
as
const
export
const
USER_STATUSES
=
{
export
const
USER_STATUSES
=
{
...
@@ -47,16 +48,17 @@ export const USER_STATUSES = {
...
@@ -47,16 +48,17 @@ export const USER_STATUSES = {
variant
:
'neutral'
as
const
,
variant
:
'neutral'
as
const
,
value
:
USER_STATUS
.
DISABLED
,
value
:
USER_STATUS
.
DISABLED
,
},
},
DELETED
:
{
[
USER_STATUS
.
DELETED
]
:
{
labelKey
:
'Deleted'
,
labelKey
:
'Deleted'
,
variant
:
'danger'
as
const
,
variant
:
'danger'
as
const
,
value
:
-
1
,
value
:
USER_STATUS
.
DELETED
,
},
},
}
as
const
}
as
const
export
const
getUserStatusOptions
=
(
t
:
(
key
:
string
)
=>
string
)
=>
[
export
const
getUserStatusOptions
=
(
t
:
(
key
:
string
)
=>
string
)
=>
[
{
label
:
t
(
'Enabled'
),
value
:
String
(
USER_STATUS
.
ENABLED
)
},
{
label
:
t
(
'Enabled'
),
value
:
String
(
USER_STATUS
.
ENABLED
)
},
{
label
:
t
(
'Disabled'
),
value
:
String
(
USER_STATUS
.
DISABLED
)
},
{
label
:
t
(
'Disabled'
),
value
:
String
(
USER_STATUS
.
DISABLED
)
},
{
label
:
t
(
'Deleted'
),
value
:
String
(
USER_STATUS
.
DELETED
)
},
]
]
// ============================================================================
// ============================================================================
...
...
web/default/src/routes/_authenticated/users/index.tsx
View file @
15072292
...
@@ -27,7 +27,7 @@ const usersSearchSchema = z.object({
...
@@ -27,7 +27,7 @@ const usersSearchSchema = z.object({
pageSize
:
z
.
number
().
optional
().
catch
(
undefined
),
pageSize
:
z
.
number
().
optional
().
catch
(
undefined
),
filter
:
z
.
string
().
optional
().
catch
(
''
),
filter
:
z
.
string
().
optional
().
catch
(
''
),
status
:
z
status
:
z
.
array
(
z
.
enum
([
'1'
,
'2'
]))
.
array
(
z
.
enum
([
'
-1'
,
'
1'
,
'2'
]))
.
optional
()
.
optional
()
.
catch
([]),
.
catch
([]),
role
:
z
role
:
z
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment