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
dd326d29
Unverified
Commit
dd326d29
authored
Dec 15, 2020
by
Hugo Häggmark
Committed by
GitHub
Dec 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Varibles: Fixes so clicking on Selected will not include All (#29844)
parent
356fa0dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
public/app/features/variables/pickers/OptionsPicker/reducer.test.ts
+3
-4
public/app/features/variables/pickers/OptionsPicker/reducer.ts
+6
-4
No files found.
public/app/features/variables/pickers/OptionsPicker/reducer.test.ts
View file @
dd326d29
...
...
@@ -15,7 +15,7 @@ import {
updateSearchQuery
,
}
from
'./reducer'
;
import
{
reducerTester
}
from
'../../../../../test/core/redux/reducerTester'
;
import
{
QueryVariableModel
,
Variable
Tag
,
VariableOption
}
from
'../../types'
;
import
{
QueryVariableModel
,
Variable
Option
,
VariableTag
}
from
'../../types'
;
import
{
ALL_VARIABLE_TEXT
,
ALL_VARIABLE_VALUE
}
from
'../../state/types'
;
const
getVariableTestContext
=
(
extend
:
Partial
<
OptionsPickerState
>
)
=>
{
...
...
@@ -570,7 +570,7 @@ describe('optionsPickerReducer', () => {
});
describe
(
'when toggleAllOptions is dispatched'
,
()
=>
{
it
(
'should toggle all values to true'
,
()
=>
{
it
(
'should toggle all values
except All
to true'
,
()
=>
{
const
{
initialState
}
=
getVariableTestContext
({
options
:
[
{
text
:
'All'
,
value
:
'$__all'
,
selected
:
false
},
...
...
@@ -587,12 +587,11 @@ describe('optionsPickerReducer', () => {
.
thenStateShouldEqual
({
...
initialState
,
options
:
[
{
text
:
'All'
,
value
:
'$__all'
,
selected
:
tru
e
},
{
text
:
'All'
,
value
:
'$__all'
,
selected
:
fals
e
},
{
text
:
'A'
,
value
:
'A'
,
selected
:
true
},
{
text
:
'B'
,
value
:
'B'
,
selected
:
true
},
],
selectedValues
:
[
{
text
:
'All'
,
value
:
'$__all'
,
selected
:
true
},
{
text
:
'A'
,
value
:
'A'
,
selected
:
true
},
{
text
:
'B'
,
value
:
'B'
,
selected
:
true
},
],
...
...
public/app/features/variables/pickers/OptionsPicker/reducer.ts
View file @
dd326d29
...
...
@@ -221,10 +221,12 @@ const optionsPickerSlice = createSlice({
return
applyStateChanges
(
state
,
updateOptions
);
}
state
.
selectedValues
=
state
.
options
.
map
(
option
=>
({
...
option
,
selected
:
true
,
}));
state
.
selectedValues
=
state
.
options
.
filter
(
option
=>
option
.
value
!==
ALL_VARIABLE_VALUE
)
.
map
(
option
=>
({
...
option
,
selected
:
true
,
}));
return
applyStateChanges
(
state
,
updateOptions
);
},
...
...
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