diff --git a/pkg/plugins/app_plugin.go b/pkg/plugins/app_plugin.go index cb1349047da..b59eb47a939 100644 --- a/pkg/plugins/app_plugin.go +++ b/pkg/plugins/app_plugin.go @@ -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 { if page.Slug == "" { page.Slug = slug.Make(page.Name) diff --git a/public/app/features/apps/edit_ctrl.ts b/public/app/features/apps/edit_ctrl.ts index fc87c53f7fd..1cb4dd269ef 100644 --- a/public/app/features/apps/edit_ctrl.ts +++ b/public/app/features/apps/edit_ctrl.ts @@ -7,6 +7,7 @@ export class AppEditCtrl { appModel: any; appId: any; includedPanels: any; + includedDatasources: any; /** @ngInject */ 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.appModel = result; this.includedPanels = _.where(result.includes, {type: 'panel'}); + this.includedDatasources = _.where(result.includes, {type: 'datasource'}); }); } diff --git a/public/app/features/apps/partials/edit.html b/public/app/features/apps/partials/edit.html index 5211ac27cf3..4a06d99f8ec 100644 --- a/public/app/features/apps/partials/edit.html +++ b/public/app/features/apps/partials/edit.html @@ -68,7 +68,10 @@ Datasources