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
02140fff
Unverified
Commit
02140fff
authored
Apr 27, 2020
by
Ryan McKinley
Committed by
GitHub
Apr 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TestData/Graph: load arrow and zoom to data range (#23764)
parent
843141d9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
3 deletions
+48
-3
packages/grafana-ui/src/components/Table/styles.ts
+2
-0
pkg/tsdb/testdatasource/scenarios.go
+9
-0
public/app/plugins/datasource/testdata/datasource.ts
+24
-2
public/app/plugins/datasource/testdata/partials/query.editor.html
+13
-1
No files found.
packages/grafana-ui/src/components/Table/styles.ts
View file @
02140fff
...
...
@@ -54,6 +54,8 @@ export const getTableStyles = stylesFactory(
headerCell
:
css
`
padding:
${
padding
}
px 10px;
cursor: pointer;
overflow: hidden;
white-space: nowrap;
color:
${
colors
.
textBlue
}
;
border-right: 1px solid
${
theme
.
colors
.
panelBg
}
;
...
...
pkg/tsdb/testdatasource/scenarios.go
View file @
02140fff
...
...
@@ -276,6 +276,15 @@ func init() {
})
registerScenario
(
&
Scenario
{
Id
:
"arrow"
,
Name
:
"Load Apache Arrow Data"
,
Handler
:
func
(
query
*
tsdb
.
Query
,
context
*
tsdb
.
TsdbQuery
)
*
tsdb
.
QueryResult
{
// Real work is in javascript client
return
tsdb
.
NewQueryResult
()
},
})
registerScenario
(
&
Scenario
{
Id
:
"table_static"
,
Name
:
"Table Static"
,
...
...
public/app/plugins/datasource/testdata/datasource.ts
View file @
02140fff
...
...
@@ -9,14 +9,18 @@ import {
TimeSeries
,
LoadingState
,
ArrayDataFrame
,
base64StringToArrowTable
,
arrowTableToDataFrame
,
DataFrame
,
}
from
'@grafana/data'
;
import
{
Scenario
,
TestDataQuery
}
from
'./types'
;
import
{
getBackendSrv
}
from
'@grafana/runtime'
;
import
{
queryMetricTree
}
from
'./metricTree'
;
import
{
from
,
merge
,
Observable
}
from
'rxjs'
;
import
{
from
,
merge
,
Observable
,
of
}
from
'rxjs'
;
import
{
runStream
}
from
'./runStreams'
;
import
templateSrv
from
'app/features/templating/template_srv'
;
import
{
getSearchFilterScopedVar
}
from
'../../../features/templating/utils'
;
import
{
getSearchFilterScopedVar
}
from
'app/features/templating/utils'
;
import
{
processQueryError
}
from
'app/features/dashboard/state/runRequest'
;
type
TestData
=
TimeSeries
|
TableData
;
...
...
@@ -38,6 +42,8 @@ export class TestDataDataSource extends DataSourceApi<TestDataQuery> {
streams
.
push
(
runStream
(
target
,
options
));
}
else
if
(
target
.
scenarioId
===
'grafana_api'
)
{
streams
.
push
(
runGrafanaAPI
(
target
,
options
));
}
else
if
(
target
.
scenarioId
===
'arrow'
)
{
streams
.
push
(
runArrowFile
(
target
,
options
));
}
else
{
queries
.
push
({
...
target
,
...
...
@@ -150,6 +156,22 @@ export class TestDataDataSource extends DataSourceApi<TestDataQuery> {
}
}
function
runArrowFile
(
target
:
TestDataQuery
,
req
:
DataQueryRequest
<
TestDataQuery
>
):
Observable
<
DataQueryResponse
>
{
let
data
:
DataFrame
[]
=
[];
if
(
target
.
stringInput
&&
target
.
stringInput
.
length
>
10
)
{
try
{
const
table
=
base64StringToArrowTable
(
target
.
stringInput
);
data
=
[
arrowTableToDataFrame
(
table
)];
}
catch
(
e
)
{
console
.
warn
(
'Error reading saved arrow'
,
e
);
const
error
=
processQueryError
(
e
);
error
.
refId
=
target
.
refId
;
return
of
({
state
:
LoadingState
.
Error
,
error
,
data
});
}
}
return
of
({
state
:
LoadingState
.
Done
,
data
});
}
function
runGrafanaAPI
(
target
:
TestDataQuery
,
req
:
DataQueryRequest
<
TestDataQuery
>
):
Observable
<
DataQueryResponse
>
{
const
url
=
`/api/
${
target
.
stringInput
}
`
;
return
from
(
...
...
public/app/plugins/datasource/testdata/partials/query.editor.html
View file @
02140fff
...
...
@@ -201,7 +201,6 @@
</div>
</div>
<div
class=
"gf-form-inline"
ng-if=
"ctrl.scenario.id === 'grafana_api'"
>
<div
class=
"gf-form gf-form"
>
<label
class=
"gf-form-label query-keyword width-7"
>
Endpoint
</label>
...
...
@@ -216,6 +215,19 @@
</div>
</div>
<div
class=
"gf-form-inline"
ng-if=
"ctrl.scenario.id === 'arrow'"
>
<div
class=
"gf-form"
style=
"width: 100%;"
>
<textarea
type=
"string"
class=
"gf-form-input"
rows=
"10"
placeholder=
"copy base64 text data from query result"
ng-model=
"ctrl.target.stringInput"
ng-change=
"ctrl.refresh()"
ng-model-onblur
/>
</div>
</div>
<!-- Predictable Pulse Scenario Options Form -->
<div
class=
"gf-form-inline"
ng-if=
"ctrl.scenario.id === 'predictable_pulse'"
>
<div
class=
"gf-form"
>
...
...
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