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
7f6b75af
Unverified
Commit
7f6b75af
authored
May 26, 2020
by
Zoltán Bedi
Committed by
GitHub
May 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: fix update url on mode change (#25084)
parent
b1cee7a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
public/app/features/explore/state/actions.test.ts
+31
-1
public/app/features/explore/state/actions.ts
+2
-1
No files found.
public/app/features/explore/state/actions.test.ts
View file @
7f6b75af
...
...
@@ -2,7 +2,14 @@ import { PayloadAction } from '@reduxjs/toolkit';
import
{
DataQuery
,
DefaultTimeZone
,
ExploreMode
,
LogsDedupStrategy
,
RawTimeRange
,
toUtc
}
from
'@grafana/data'
;
import
*
as
Actions
from
'./actions'
;
import
{
changeDatasource
,
loadDatasource
,
navigateToExplore
,
refreshExplore
,
cancelQueries
}
from
'./actions'
;
import
{
changeDatasource
,
loadDatasource
,
navigateToExplore
,
refreshExplore
,
cancelQueries
,
changeMode
,
}
from
'./actions'
;
import
{
ExploreId
,
ExploreUpdateState
,
ExploreUrlState
}
from
'app/types'
;
import
{
thunkTester
}
from
'test/core/thunk/thunkTester'
;
import
{
...
...
@@ -15,6 +22,7 @@ import {
updateUIStateAction
,
cancelQueriesAction
,
scanStopAction
,
changeModeAction
,
}
from
'./actionTypes'
;
import
{
Emitter
}
from
'app/core/core'
;
import
{
makeInitialUpdateState
}
from
'./reducers'
;
...
...
@@ -326,6 +334,28 @@ describe('loading datasource', () => {
});
});
describe
(
'changing mode'
,
()
=>
{
it
(
'should trigger changeModeAction and updateLocation'
,
async
()
=>
{
const
{
exploreId
,
initialState
,
range
}
=
setup
();
const
dispatchedActions
=
await
thunkTester
(
initialState
)
.
givenThunk
(
changeMode
)
.
whenThunkIsDispatched
(
exploreId
,
ExploreMode
.
Logs
);
const
rawTimeRange
=
Actions
.
toRawTimeRange
(
range
);
const
leftQuery
=
JSON
.
stringify
([
rawTimeRange
.
from
,
rawTimeRange
.
to
,
initialState
.
explore
.
left
.
datasourceInstance
.
name
,
{},
{
ui
:
[
false
,
true
,
false
,
null
]
},
]);
expect
(
dispatchedActions
).
toEqual
([
changeModeAction
({
exploreId
,
mode
:
ExploreMode
.
Logs
}),
updateLocation
({
query
:
{
left
:
leftQuery
,
orgId
:
'1'
},
replace
:
false
}),
]);
});
});
const
getNavigateToExploreContext
=
async
(
openInNewWindow
?:
(
url
:
string
)
=>
void
)
=>
{
const
url
=
'http://www.someurl.com'
;
const
panel
:
Partial
<
PanelModel
>
=
{
...
...
public/app/features/explore/state/actions.ts
View file @
7f6b75af
...
...
@@ -165,6 +165,7 @@ export function changeDatasource(exploreId: ExploreId, datasourceName: string):
export
function
changeMode
(
exploreId
:
ExploreId
,
mode
:
ExploreMode
):
ThunkResult
<
void
>
{
return
dispatch
=>
{
dispatch
(
changeModeAction
({
exploreId
,
mode
}));
dispatch
(
stateSave
());
};
}
...
...
@@ -547,7 +548,7 @@ export const deleteRichHistory = (): ThunkResult<void> => {
};
};
const toRawTimeRange = (range: TimeRange): RawTimeRange => {
export
const toRawTimeRange = (range: TimeRange): RawTimeRange => {
let from = range.raw.from;
if (isDateTime(from)) {
from = from.valueOf().toString(10);
...
...
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