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
d4200241
Unverified
Commit
d4200241
authored
Jan 23, 2019
by
Torkel Ödegaard
Committed by
GitHub
Jan 23, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15009 from grafana/davkal/14997-fix-scanner
Explore: Fix scanning for logs
parents
3dca65c6
c0277ab5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
5 deletions
+53
-5
public/app/features/explore/state/reducers.test.ts
+42
-0
public/app/features/explore/state/reducers.ts
+11
-5
No files found.
public/app/features/explore/state/reducers.test.ts
0 → 100644
View file @
d4200241
import
{
Action
,
ActionTypes
}
from
'./actionTypes'
;
import
{
itemReducer
,
makeExploreItemState
}
from
'./reducers'
;
import
{
ExploreId
}
from
'app/types/explore'
;
describe
(
'Explore item reducer'
,
()
=>
{
describe
(
'scanning'
,
()
=>
{
test
(
'should start scanning'
,
()
=>
{
let
state
=
makeExploreItemState
();
const
action
:
Action
=
{
type
:
ActionTypes
.
ScanStart
,
payload
:
{
exploreId
:
ExploreId
.
left
,
scanner
:
jest
.
fn
(),
},
};
state
=
itemReducer
(
state
,
action
);
expect
(
state
.
scanning
).
toBeTruthy
();
expect
(
state
.
scanner
).
toBe
(
action
.
payload
.
scanner
);
});
test
(
'should stop scanning'
,
()
=>
{
let
state
=
makeExploreItemState
();
const
start
:
Action
=
{
type
:
ActionTypes
.
ScanStart
,
payload
:
{
exploreId
:
ExploreId
.
left
,
scanner
:
jest
.
fn
(),
},
};
state
=
itemReducer
(
state
,
start
);
expect
(
state
.
scanning
).
toBeTruthy
();
const
action
:
Action
=
{
type
:
ActionTypes
.
ScanStop
,
payload
:
{
exploreId
:
ExploreId
.
left
,
},
};
state
=
itemReducer
(
state
,
action
);
expect
(
state
.
scanning
).
toBeFalsy
();
expect
(
state
.
scanner
).
toBeUndefined
();
});
});
});
public/app/features/explore/state/reducers.ts
View file @
d4200241
...
...
@@ -20,7 +20,7 @@ const DEFAULT_GRAPH_INTERVAL = 15 * 1000;
/**
* Returns a fresh Explore area state
*/
const
makeExploreItemState
=
():
ExploreItemState
=>
({
export
const
makeExploreItemState
=
():
ExploreItemState
=>
({
StartPage
:
undefined
,
containerWidth
:
0
,
datasourceInstance
:
null
,
...
...
@@ -48,7 +48,7 @@ const makeExploreItemState = (): ExploreItemState => ({
/**
* Global Explore state that handles multiple Explore areas and the split state
*/
const
initialExploreState
:
ExploreState
=
{
export
const
initialExploreState
:
ExploreState
=
{
split
:
null
,
left
:
makeExploreItemState
(),
right
:
makeExploreItemState
(),
...
...
@@ -57,7 +57,7 @@ const initialExploreState: ExploreState = {
/**
* Reducer for an Explore area, to be used by the global Explore reducer.
*/
const
itemReducer
=
(
state
,
action
:
Action
):
ExploreItemState
=>
{
export
const
itemReducer
=
(
state
,
action
:
Action
):
ExploreItemState
=>
{
switch
(
action
.
type
)
{
case
ActionTypes
.
AddQueryRow
:
{
const
{
initialQueries
,
modifiedQueries
,
queryTransactions
}
=
state
;
...
...
@@ -360,13 +360,19 @@ const itemReducer = (state, action: Action): ExploreItemState => {
}
case
ActionTypes
.
ScanStart
:
{
return
{
...
state
,
scanning
:
true
};
return
{
...
state
,
scanning
:
true
,
scanner
:
action
.
payload
.
scanner
};
}
case
ActionTypes
.
ScanStop
:
{
const
{
queryTransactions
}
=
state
;
const
nextQueryTransactions
=
queryTransactions
.
filter
(
qt
=>
qt
.
scanning
&&
!
qt
.
done
);
return
{
...
state
,
queryTransactions
:
nextQueryTransactions
,
scanning
:
false
,
scanRange
:
undefined
};
return
{
...
state
,
queryTransactions
:
nextQueryTransactions
,
scanning
:
false
,
scanRange
:
undefined
,
scanner
:
undefined
,
};
}
case
ActionTypes
.
SetQueries
:
{
...
...
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