Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
e63028e8
Unverified
Commit
e63028e8
authored
Jul 13, 2020
by
Harrison Shoff
Committed by
GitHub
Jul 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AdminUsers: reset page to zero on query change (#26293)
parent
d91e7371
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletions
+33
-1
public/app/features/admin/state/reducers.test.ts
+32
-1
public/app/features/admin/state/reducers.ts
+1
-0
No files found.
public/app/features/admin/state/reducers.test.ts
View file @
e63028e8
...
...
@@ -10,8 +10,10 @@ import {
userMappingInfoLoadedAction
,
userProfileLoadedAction
,
userSessionsLoadedAction
,
userListAdminReducer
,
queryChanged
,
}
from
'./reducers'
;
import
{
LdapState
,
LdapUser
,
UserAdminState
,
UserDTO
}
from
'app/types'
;
import
{
LdapState
,
LdapUser
,
UserAdminState
,
UserDTO
,
UserListAdminState
}
from
'app/types'
;
const
makeInitialLdapState
=
():
LdapState
=>
({
connectionInfo
:
[],
...
...
@@ -29,6 +31,15 @@ const makeInitialUserAdminState = (): UserAdminState => ({
isLoading
:
true
,
});
const
makeInitialUserListAdminState
=
():
UserListAdminState
=>
({
users
:
[],
query
:
''
,
page
:
0
,
perPage
:
50
,
totalPages
:
1
,
showPaging
:
false
,
});
const
getTestUserMapping
=
():
LdapUser
=>
({
info
:
{
email
:
{
cfgAttrValue
:
'mail'
,
ldapValue
:
'user@localhost'
},
...
...
@@ -261,3 +272,23 @@ describe('Edit Admin user page reducer', () => {
});
});
});
describe
(
'User List Admin reducer'
,
()
=>
{
describe
(
'When query changed'
,
()
=>
{
it
(
'should reset page to 0'
,
()
=>
{
const
initialState
=
{
...
makeInitialUserListAdminState
(),
page
:
3
,
};
reducerTester
<
UserListAdminState
>
()
.
givenReducer
(
userListAdminReducer
,
initialState
)
.
whenActionIsDispatched
(
queryChanged
(
'test'
))
.
thenStateShouldEqual
({
...
makeInitialUserListAdminState
(),
query
:
'test'
,
page
:
0
,
});
});
});
});
public/app/features/admin/state/reducers.ts
View file @
e63028e8
...
...
@@ -156,6 +156,7 @@ export const userListAdminSlice = createSlice({
queryChanged
:
(
state
,
action
:
PayloadAction
<
string
>
)
=>
({
...
state
,
query
:
action
.
payload
,
page
:
0
,
}),
pageChanged
:
(
state
,
action
:
PayloadAction
<
number
>
)
=>
({
...
state
,
...
...
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