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
7146d576
Unverified
Commit
7146d576
authored
Apr 29, 2019
by
Ryan McKinley
Committed by
GitHub
Apr 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plugins: move datasource specific meta out of the main meta type (#16803)
parent
945cbf47
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
23 deletions
+28
-23
packages/grafana-ui/src/types/datasource.ts
+25
-3
packages/grafana-ui/src/types/plugin.ts
+0
-17
public/app/features/plugins/specs/datasource_srv.test.ts
+3
-3
No files found.
packages/grafana-ui/src/types/datasource.ts
View file @
7146d576
...
...
@@ -68,6 +68,24 @@ export class DataSourcePlugin<TOptions = {}, TQuery extends DataQuery = DataQuer
}
}
export
interface
DataSourcePluginMeta
extends
PluginMeta
{
builtIn
?:
boolean
;
// Is this for all
metrics
?:
boolean
;
tables
?:
boolean
;
logs
?:
boolean
;
explore
?:
boolean
;
annotations
?:
boolean
;
mixed
?:
boolean
;
hasQueryHelp
?:
boolean
;
queryOptions
?:
PluginMetaQueryOptions
;
}
interface
PluginMetaQueryOptions
{
cacheTimeout
?:
boolean
;
maxDataPoints
?:
boolean
;
minInterval
?:
boolean
;
}
export
interface
DataSourcePluginComponents
<
TOptions
=
{},
TQuery
extends
DataQuery
=
DataQuery
>
{
QueryCtrl
?:
any
;
ConfigCtrl
?:
any
;
...
...
@@ -137,7 +155,11 @@ export interface DataSourceApi<TQuery extends DataQuery = DataQuery> {
* we attach the components to this instance for easy access
*/
components
?:
DataSourcePluginComponents
;
meta
?:
PluginMeta
;
/**
* static information about the datasource
*/
meta
?:
DataSourcePluginMeta
;
}
export
interface
ExploreDataSourceApi
<
TQuery
extends
DataQuery
=
DataQuery
>
extends
DataSourceApi
{
...
...
@@ -340,7 +362,7 @@ export interface DataSourceInstanceSettings {
id
:
number
;
type
:
string
;
name
:
string
;
meta
:
PluginMeta
;
meta
:
DataSource
PluginMeta
;
url
?:
string
;
jsonData
:
{
[
str
:
string
]:
any
};
username
?:
string
;
...
...
@@ -359,6 +381,6 @@ export interface DataSourceInstanceSettings {
export
interface
DataSourceSelectItem
{
name
:
string
;
value
:
string
|
null
;
meta
:
PluginMeta
;
meta
:
DataSource
PluginMeta
;
sort
:
string
;
}
packages/grafana-ui/src/types/plugin.ts
View file @
7146d576
...
...
@@ -24,23 +24,6 @@ export interface PluginMeta {
// Filled in by the backend
jsonData
?:
{
[
str
:
string
]:
any
};
enabled
?:
boolean
;
// Datasource-specific
builtIn
?:
boolean
;
metrics
?:
boolean
;
tables
?:
boolean
;
logs
?:
boolean
;
explore
?:
boolean
;
annotations
?:
boolean
;
mixed
?:
boolean
;
hasQueryHelp
?:
boolean
;
queryOptions
?:
PluginMetaQueryOptions
;
}
interface
PluginMetaQueryOptions
{
cacheTimeout
?:
boolean
;
maxDataPoints
?:
boolean
;
minInterval
?:
boolean
;
}
export
enum
PluginIncludeType
{
...
...
public/app/features/plugins/specs/datasource_srv.test.ts
View file @
7146d576
import
config
from
'app/core/config'
;
import
'app/features/plugins/datasource_srv'
;
import
{
DatasourceSrv
}
from
'app/features/plugins/datasource_srv'
;
import
{
PluginMeta
}
from
'@grafana/ui/src/types'
;
import
{
PluginMeta
,
DataSourcePluginMeta
}
from
'@grafana/ui/src/types'
;
// Datasource variable $datasource with current value 'BBB'
const
templateSrv
=
{
...
...
@@ -26,14 +26,14 @@ describe('datasource_srv', () => {
id
:
1
,
type
:
'b'
,
name
:
'buildIn'
,
meta
:
{
builtIn
:
true
}
as
PluginMeta
,
meta
:
{
builtIn
:
true
}
as
DataSource
PluginMeta
,
jsonData
:
{},
},
nonBuildIn
:
{
id
:
2
,
type
:
'e'
,
name
:
'external1'
,
meta
:
{
builtIn
:
false
}
as
PluginMeta
,
meta
:
{
builtIn
:
false
}
as
DataSource
PluginMeta
,
jsonData
:
{},
},
nonExplore
:
{
...
...
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