mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 16:22:45 +08:00
feat(apps): began work on support for apps that contain data sources
This commit is contained in:
@ -77,6 +77,19 @@ func (app *AppPlugin) Load(decoder *json.Decoder, pluginDir string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if we have child datasources
|
||||||
|
for _, ds := range DataSources {
|
||||||
|
if strings.HasPrefix(ds.PluginDir, app.PluginDir) {
|
||||||
|
ds.IncludedInAppId = app.Id
|
||||||
|
app.Includes = append(app.Includes, &AppIncludeInfo{
|
||||||
|
Name: ds.Name,
|
||||||
|
Id: ds.Id,
|
||||||
|
Type: ds.Type,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// slugify pages
|
||||||
for _, page := range app.Pages {
|
for _, page := range app.Pages {
|
||||||
if page.Slug == "" {
|
if page.Slug == "" {
|
||||||
page.Slug = slug.Make(page.Name)
|
page.Slug = slug.Make(page.Name)
|
||||||
|
@ -7,6 +7,7 @@ export class AppEditCtrl {
|
|||||||
appModel: any;
|
appModel: any;
|
||||||
appId: any;
|
appId: any;
|
||||||
includedPanels: any;
|
includedPanels: any;
|
||||||
|
includedDatasources: any;
|
||||||
|
|
||||||
/** @ngInject */
|
/** @ngInject */
|
||||||
constructor(private backendSrv: any, private $routeParams: any) {
|
constructor(private backendSrv: any, private $routeParams: any) {
|
||||||
@ -16,6 +17,7 @@ export class AppEditCtrl {
|
|||||||
this.backendSrv.get(`/api/org/apps/${this.appId}/settings`).then(result => {
|
this.backendSrv.get(`/api/org/apps/${this.appId}/settings`).then(result => {
|
||||||
this.appModel = result;
|
this.appModel = result;
|
||||||
this.includedPanels = _.where(result.includes, {type: 'panel'});
|
this.includedPanels = _.where(result.includes, {type: 'panel'});
|
||||||
|
this.includedDatasources = _.where(result.includes, {type: 'datasource'});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,10 @@
|
|||||||
Datasources
|
Datasources
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
<li><em class="small">None</em></li>
|
<li ng-show="!ctrl.includedDatasources.length"><em class="small">None</em></li>
|
||||||
|
<li ng-repeat="ds in ctrl.includedDatasources">
|
||||||
|
{{ds.name}}
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="simple-box-body simple-box-column">
|
<div class="simple-box-body simple-box-column">
|
||||||
|
Reference in New Issue
Block a user