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
8784be9a
Commit
8784be9a
authored
Feb 09, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(plugins): made it possible to have relative plugin template urls
parent
9653f434
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
61 additions
and
32 deletions
+61
-32
examples/nginx-app/module.js
+3
-3
examples/panel-boilerplate-es5/module.js
+1
-1
pkg/api/dtos/apps.go
+2
-0
pkg/api/frontendsettings.go
+5
-4
pkg/plugins/frontend_plugin.go
+3
-0
pkg/plugins/plugins.go
+4
-0
public/app/core/directives/plugin_component.ts
+19
-0
public/app/plugins/datasource/cloudwatch/module.ts
+2
-2
public/app/plugins/datasource/cloudwatch/query_ctrl.ts
+1
-1
public/app/plugins/datasource/elasticsearch/module.ts
+2
-2
public/app/plugins/datasource/elasticsearch/query_ctrl.ts
+1
-1
public/app/plugins/datasource/grafana/module.ts
+1
-1
public/app/plugins/datasource/graphite/module.ts
+3
-3
public/app/plugins/datasource/graphite/query_ctrl.ts
+1
-1
public/app/plugins/datasource/influxdb/module.ts
+3
-3
public/app/plugins/datasource/influxdb/query_ctrl.ts
+1
-1
public/app/plugins/datasource/opentsdb/module.ts
+1
-1
public/app/plugins/datasource/opentsdb/query_ctrl.ts
+1
-1
public/app/plugins/datasource/prometheus/module.ts
+2
-2
public/app/plugins/datasource/prometheus/query_ctrl.ts
+1
-1
public/app/plugins/panel/dashlist/module.ts
+1
-1
public/app/plugins/panel/graph/module.ts
+1
-1
public/app/plugins/panel/singlestat/module.ts
+1
-1
public/app/plugins/panel/table/module.ts
+1
-1
No files found.
examples/nginx-app/module.js
View file @
8784be9a
...
...
@@ -3,13 +3,13 @@ define([
'use strict'
;
function
StreamPageCtrl
()
{}
StreamPageCtrl
.
templateUrl
=
'p
ublic/plugins/nginx-app/p
artials/stream.html'
;
StreamPageCtrl
.
templateUrl
=
'partials/stream.html'
;
function
LogsPageCtrl
()
{}
LogsPageCtrl
.
templateUrl
=
'p
ublic/plugins/nginx-app/p
artials/logs.html'
;
LogsPageCtrl
.
templateUrl
=
'partials/logs.html'
;
function
NginxConfigCtrl
()
{}
NginxConfigCtrl
.
templateUrl
=
'p
ublic/plugins/nginx-app/p
artials/config.html'
;
NginxConfigCtrl
.
templateUrl
=
'partials/config.html'
;
return
{
ConfigCtrl
:
NginxConfigCtrl
,
...
...
examples/panel-boilerplate-es5/module.js
View file @
8784be9a
...
...
@@ -12,7 +12,7 @@ define([
// BoilerPlatePanel.template = '<h2>boilerplate</h2>';
// all panel static assets can be accessed via 'public/plugins/<plugin-id>/<file>
BoilerPlatePanel
.
templateUrl
=
'p
ublic/plugins/panel-boilerplate-es5/p
anel.html'
;
BoilerPlatePanel
.
templateUrl
=
'panel.html'
;
BoilerPlatePanel
.
prototype
=
Object
.
create
(
_super
.
prototype
);
BoilerPlatePanel
.
prototype
.
constructor
=
BoilerPlatePanel
;
...
...
pkg/api/dtos/apps.go
View file @
8784be9a
...
...
@@ -11,6 +11,7 @@ type AppSettings struct {
Enabled
bool
`json:"enabled"`
Pinned
bool
`json:"pinned"`
Module
string
`json:"module"`
BaseUrl
string
`json:"baseUrl"`
Info
*
plugins
.
PluginInfo
`json:"info"`
Pages
[]
*
plugins
.
AppPluginPage
`json:"pages"`
Includes
[]
*
plugins
.
AppIncludeInfo
`json:"includes"`
...
...
@@ -23,6 +24,7 @@ func NewAppSettingsDto(def *plugins.AppPlugin, data *models.AppSettings) *AppSet
Name
:
def
.
Name
,
Info
:
&
def
.
Info
,
Module
:
def
.
Module
,
BaseUrl
:
def
.
BaseUrl
,
Pages
:
def
.
Pages
,
Includes
:
def
.
Includes
,
}
...
...
pkg/api/frontendsettings.go
View file @
8784be9a
...
...
@@ -121,10 +121,11 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
panels
:=
map
[
string
]
interface
{}{}
for
_
,
panel
:=
range
enabledPlugins
.
Panels
{
panels
[
panel
.
Id
]
=
map
[
string
]
interface
{}{
"module"
:
panel
.
Module
,
"name"
:
panel
.
Name
,
"id"
:
panel
.
Id
,
"info"
:
panel
.
Info
,
"module"
:
panel
.
Module
,
"baseUrl"
:
panel
.
BaseUrl
,
"name"
:
panel
.
Name
,
"id"
:
panel
.
Id
,
"info"
:
panel
.
Info
,
}
}
...
...
pkg/plugins/frontend_plugin.go
View file @
8784be9a
...
...
@@ -9,6 +9,7 @@ import (
type
FrontendPluginBase
struct
{
PluginBase
Module
string
`json:"module"`
BaseUrl
string
`json:"baseUrl"`
StaticRoot
string
`json:"staticRoot"`
StaticRootAbs
string
`json:"-"`
}
...
...
@@ -34,10 +35,12 @@ func (fp *FrontendPluginBase) handleModuleDefaults() {
if
fp
.
StaticRoot
!=
""
{
fp
.
Module
=
path
.
Join
(
"plugins"
,
fp
.
Id
,
"module"
)
fp
.
BaseUrl
=
path
.
Join
(
"public/plugins"
,
fp
.
Id
)
return
}
fp
.
Module
=
path
.
Join
(
"app/plugins"
,
fp
.
Type
,
fp
.
Id
,
"module"
)
fp
.
BaseUrl
=
path
.
Join
(
"public/app/plugins"
,
fp
.
Type
,
fp
.
Id
)
}
func
evalRelativePluginUrlPath
(
pathStr
string
,
pluginId
string
)
string
{
...
...
pkg/plugins/plugins.go
View file @
8784be9a
...
...
@@ -102,6 +102,10 @@ func (scanner *PluginScanner) walker(currentPath string, f os.FileInfo, err erro
return
err
}
if
f
.
Name
()
==
"node_modules"
{
return
util
.
WalkSkipDir
}
if
f
.
IsDir
()
{
return
nil
}
...
...
public/app/core/directives/plugin_component.ts
View file @
8784be9a
...
...
@@ -23,7 +23,16 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
});
}
function
relativeTemplateUrlToAbs
(
templateUrl
,
baseUrl
)
{
if
(
!
templateUrl
)
{
return
undefined
;
}
if
(
templateUrl
.
indexOf
(
'public'
)
===
0
)
{
return
templateUrl
;
}
return
baseUrl
+
'/'
+
templateUrl
;
}
function
getPluginComponentDirective
(
options
)
{
// handle relative template urls for plugin templates
options
.
Component
.
templateUrl
=
relativeTemplateUrlToAbs
(
options
.
Component
.
templateUrl
,
options
.
baseUrl
);
return
function
()
{
return
{
templateUrl
:
options
.
Component
.
templateUrl
,
...
...
@@ -74,6 +83,10 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
});
}
if
(
panelInfo
)
{
PanelCtrl
.
templateUrl
=
relativeTemplateUrlToAbs
(
PanelCtrl
.
templateUrl
,
panelInfo
.
baseUrl
);
}
PanelCtrl
.
templatePromise
=
getTemplate
(
PanelCtrl
).
then
(
template
=>
{
PanelCtrl
.
templateUrl
=
null
;
PanelCtrl
.
template
=
`<grafana-panel ctrl="ctrl">
${
template
}
</grafana-panel>`
;
...
...
@@ -94,6 +107,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
return
System
.
import
(
ds
.
meta
.
module
).
then
(
dsModule
=>
{
return
{
baseUrl
:
ds
.
meta
.
baseUrl
,
name
:
'query-ctrl-'
+
ds
.
meta
.
id
,
bindings
:
{
target
:
"="
,
panelCtrl
:
"="
,
datasource
:
"="
},
attrs
:
{
"target"
:
"target"
,
"panel-ctrl"
:
"ctrl"
,
datasource
:
"datasource"
},
...
...
@@ -111,6 +125,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
}
return
{
baseUrl
:
ds
.
meta
.
baseUrl
,
name
:
'query-options-ctrl-'
+
ds
.
meta
.
id
,
bindings
:
{
panelCtrl
:
"="
},
attrs
:
{
"panel-ctrl"
:
"ctrl"
},
...
...
@@ -123,6 +138,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
case
"annotations-query-ctrl"
:
{
return
System
.
import
(
scope
.
currentDatasource
.
meta
.
module
).
then
(
function
(
dsModule
)
{
return
{
baseUrl
:
scope
.
currentDatasource
.
meta
.
baseUrl
,
name
:
'annotations-query-ctrl-'
+
scope
.
currentDatasource
.
meta
.
id
,
bindings
:
{
annotation
:
"="
,
datasource
:
"="
},
attrs
:
{
"annotation"
:
"currentAnnotation"
,
datasource
:
"currentDatasource"
},
...
...
@@ -134,6 +150,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
case
'datasource-config-ctrl'
:
{
return
System
.
import
(
scope
.
datasourceMeta
.
module
).
then
(
function
(
dsModule
)
{
return
{
baseUrl
:
scope
.
datasourceMeta
.
baseUrl
,
name
:
'ds-config-'
+
scope
.
datasourceMeta
.
id
,
bindings
:
{
meta
:
"="
,
current
:
"="
},
attrs
:
{
meta
:
"datasourceMeta"
,
current
:
"current"
},
...
...
@@ -146,6 +163,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
let
appModel
=
scope
.
ctrl
.
appModel
;
return
System
.
import
(
appModel
.
module
).
then
(
function
(
appModule
)
{
return
{
baseUrl
:
appModel
.
baseUrl
,
name
:
'app-config-'
+
appModel
.
appId
,
bindings
:
{
appModel
:
"="
,
appEditCtrl
:
"="
},
attrs
:
{
"app-model"
:
"ctrl.appModel"
,
"app-edit-ctrl"
:
"ctrl"
},
...
...
@@ -158,6 +176,7 @@ function pluginDirectiveLoader($compile, datasourceSrv, $rootScope, $q, $http, $
let
appModel
=
scope
.
ctrl
.
appModel
;
return
System
.
import
(
appModel
.
module
).
then
(
function
(
appModule
)
{
return
{
baseUrl
:
appModel
.
baseUrl
,
name
:
'app-page-'
+
appModel
.
appId
+
'-'
+
scope
.
ctrl
.
page
.
slug
,
bindings
:
{
appModel
:
"="
},
attrs
:
{
"app-model"
:
"ctrl.appModel"
},
...
...
public/app/plugins/datasource/cloudwatch/module.ts
View file @
8784be9a
...
...
@@ -4,11 +4,11 @@ import {CloudWatchDatasource} from './datasource';
import
{
CloudWatchQueryCtrl
}
from
'./query_ctrl'
;
class
CloudWatchConfigCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/cloudwatch/p
artials/config.html'
;
static
templateUrl
=
'partials/config.html'
;
}
class
CloudWatchAnnotationsQueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/cloudwatch/p
artials/annotations.editor.html'
;
static
templateUrl
=
'partials/annotations.editor.html'
;
}
export
{
...
...
public/app/plugins/datasource/cloudwatch/query_ctrl.ts
View file @
8784be9a
...
...
@@ -5,7 +5,7 @@ import _ from 'lodash';
import
{
QueryCtrl
}
from
'app/plugins/sdk'
;
export
class
CloudWatchQueryCtrl
extends
QueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/cloudwatch/p
artials/query.editor.html'
;
static
templateUrl
=
'partials/query.editor.html'
;
aliasSyntax
:
string
;
...
...
public/app/plugins/datasource/elasticsearch/module.ts
View file @
8784be9a
...
...
@@ -3,11 +3,11 @@ import {ElasticQueryCtrl} from './query_ctrl';
import
{
ElasticConfigCtrl
}
from
'./config_ctrl'
;
class
ElasticQueryOptionsCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/elasticsearch/p
artials/query.options.html'
;
static
templateUrl
=
'partials/query.options.html'
;
}
class
ElasticAnnotationsQueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/elasticsearch/p
artials/annotations.editor.html'
;
static
templateUrl
=
'partials/annotations.editor.html'
;
}
export
{
...
...
public/app/plugins/datasource/elasticsearch/query_ctrl.ts
View file @
8784be9a
...
...
@@ -8,7 +8,7 @@ import _ from 'lodash';
import
{
QueryCtrl
}
from
'app/plugins/sdk'
;
export
class
ElasticQueryCtrl
extends
QueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/elasticsearch/p
artials/query.editor.html'
;
static
templateUrl
=
'partials/query.editor.html'
;
esVersion
:
any
;
rawQueryOld
:
string
;
...
...
public/app/plugins/datasource/grafana/module.ts
View file @
8784be9a
...
...
@@ -5,7 +5,7 @@ import {GrafanaDatasource} from './datasource';
import
{
QueryCtrl
}
from
'app/plugins/sdk'
;
class
GrafanaQueryCtrl
extends
QueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/grafana/p
artials/query.editor.html'
;
static
templateUrl
=
'partials/query.editor.html'
;
}
export
{
...
...
public/app/plugins/datasource/graphite/module.ts
View file @
8784be9a
...
...
@@ -2,15 +2,15 @@ import {GraphiteDatasource} from './datasource';
import
{
GraphiteQueryCtrl
}
from
'./query_ctrl'
;
class
GraphiteConfigCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/graphite/p
artials/config.html'
;
static
templateUrl
=
'partials/config.html'
;
}
class
GraphiteQueryOptionsCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/graphite/p
artials/query.options.html'
;
static
templateUrl
=
'partials/query.options.html'
;
}
class
AnnotationsQueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/graphite/p
artials/annotations.editor.html'
;
static
templateUrl
=
'partials/annotations.editor.html'
;
}
export
{
...
...
public/app/plugins/datasource/graphite/query_ctrl.ts
View file @
8784be9a
...
...
@@ -11,7 +11,7 @@ import {Parser} from './parser';
import
{
QueryCtrl
}
from
'app/plugins/sdk'
;
export
class
GraphiteQueryCtrl
extends
QueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/graphite/p
artials/query.editor.html'
;
static
templateUrl
=
'partials/query.editor.html'
;
functions
:
any
[];
segments
:
any
[];
...
...
public/app/plugins/datasource/influxdb/module.ts
View file @
8784be9a
...
...
@@ -2,15 +2,15 @@ import {InfluxDatasource} from './datasource';
import
{
InfluxQueryCtrl
}
from
'./query_ctrl'
;
class
InfluxConfigCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/influxdb/p
artials/config.html'
;
static
templateUrl
=
'partials/config.html'
;
}
class
InfluxQueryOptionsCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/influxdb/p
artials/query.options.html'
;
static
templateUrl
=
'partials/query.options.html'
;
}
class
InfluxAnnotationsQueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/influxdb/p
artials/annotations.editor.html'
;
static
templateUrl
=
'partials/annotations.editor.html'
;
}
export
{
...
...
public/app/plugins/datasource/influxdb/query_ctrl.ts
View file @
8784be9a
...
...
@@ -11,7 +11,7 @@ import queryPart from './query_part';
import
{
QueryCtrl
}
from
'app/plugins/sdk'
;
export
class
InfluxQueryCtrl
extends
QueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/influxdb/p
artials/query.editor.html'
;
static
templateUrl
=
'partials/query.editor.html'
;
queryModel
:
InfluxQuery
;
queryBuilder
:
any
;
...
...
public/app/plugins/datasource/opentsdb/module.ts
View file @
8784be9a
...
...
@@ -2,7 +2,7 @@ import {OpenTsDatasource} from './datasource';
import
{
OpenTsQueryCtrl
}
from
'./query_ctrl'
;
class
OpenTsConfigCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/opentsdb/p
artials/config.html'
;
static
templateUrl
=
'partials/config.html'
;
}
export
{
...
...
public/app/plugins/datasource/opentsdb/query_ctrl.ts
View file @
8784be9a
...
...
@@ -5,7 +5,7 @@ import kbn from 'app/core/utils/kbn';
import
{
QueryCtrl
}
from
'app/plugins/sdk'
;
export
class
OpenTsQueryCtrl
extends
QueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/opentsdb/p
artials/query.editor.html'
;
static
templateUrl
=
'partials/query.editor.html'
;
aggregators
:
any
;
fillPolicies
:
any
;
aggregator
:
any
;
...
...
public/app/plugins/datasource/prometheus/module.ts
View file @
8784be9a
...
...
@@ -2,11 +2,11 @@ import {PrometheusDatasource} from './datasource';
import
{
PrometheusQueryCtrl
}
from
'./query_ctrl'
;
class
PrometheusConfigCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/prometheus/p
artials/config.html'
;
static
templateUrl
=
'partials/config.html'
;
}
class
PrometheusAnnotationsQueryCtrl
{
static
templateUrl
=
'
public/app/plugins/datasource/prometheus/partials/
annotations.editor.html'
;
static
templateUrl
=
'annotations.editor.html'
;
}
export
{
...
...
public/app/plugins/datasource/prometheus/query_ctrl.ts
View file @
8784be9a
...
...
@@ -8,7 +8,7 @@ import * as dateMath from 'app/core/utils/datemath';
import
{
QueryCtrl
}
from
'app/plugins/sdk'
;
class
PrometheusQueryCtrl
extends
QueryCtrl
{
static
templateUrl
=
'p
ublic/app/plugins/datasource/prometheus/p
artials/query.editor.html'
;
static
templateUrl
=
'partials/query.editor.html'
;
metric
:
any
;
resolutions
:
any
;
...
...
public/app/plugins/panel/dashlist/module.ts
View file @
8784be9a
...
...
@@ -13,7 +13,7 @@ var panelDefaults = {
};
class
DashListCtrl
extends
PanelCtrl
{
static
templateUrl
=
'
public/app/plugins/panel/dashlist/
module.html'
;
static
templateUrl
=
'module.html'
;
dashList
:
any
[];
modes
:
any
[];
...
...
public/app/plugins/panel/graph/module.ts
View file @
8784be9a
...
...
@@ -82,7 +82,7 @@ var panelDefaults = {
};
class
GraphCtrl
extends
MetricsPanelCtrl
{
static
templateUrl
=
'
public/app/plugins/panel/graph/
module.html'
;
static
templateUrl
=
'module.html'
;
hiddenSeries
:
any
=
{};
seriesList
:
any
=
[];
...
...
public/app/plugins/panel/singlestat/module.ts
View file @
8784be9a
...
...
@@ -42,7 +42,7 @@ var panelDefaults = {
};
class
SingleStatCtrl
extends
MetricsPanelCtrl
{
static
templateUrl
=
'
public/app/plugins/panel/singlestat/
module.html'
;
static
templateUrl
=
'module.html'
;
series
:
any
[];
data
:
any
[];
...
...
public/app/plugins/panel/table/module.ts
View file @
8784be9a
...
...
@@ -38,7 +38,7 @@ var panelDefaults = {
};
class
TablePanelCtrl
extends
MetricsPanelCtrl
{
static
templateUrl
=
'
public/app/plugins/panel/table/
module.html'
;
static
templateUrl
=
'module.html'
;
pageIndex
:
number
;
dataRaw
:
any
;
...
...
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