diff --git a/examples/nginx-app/Gruntfile.js b/examples/nginx-app/Gruntfile.js index d36a4716f31..b88d857cde3 100644 --- a/examples/nginx-app/Gruntfile.js +++ b/examples/nginx-app/Gruntfile.js @@ -18,14 +18,14 @@ module.exports = function(grunt) { }, pluginDef: { expand: true, - src: 'plugin.json', + src: ['plugin.json', 'readme.md'], dest: 'dist', } }, watch: { rebuild_all: { - files: ['src/**/*', 'plugin.json'], + files: ['src/**/*', 'plugin.json', 'readme.md'], tasks: ['default'], options: {spawn: false} }, diff --git a/examples/nginx-app/package.json b/examples/nginx-app/package.json index 91c53734ec8..32c070f96b0 100644 --- a/examples/nginx-app/package.json +++ b/examples/nginx-app/package.json @@ -31,7 +31,7 @@ "dependencies": { "babel-plugin-transform-es2015-modules-systemjs": "^6.5.0", "babel-preset-es2015": "^6.5.0", - "lodash": "~4.0.0" + "lodash": "~4.0.0", }, "homepage": "https://github.com/raintank/kentik-app-poc#readme" } diff --git a/examples/nginx-app/readme.md b/examples/nginx-app/readme.md new file mode 100644 index 00000000000..c267cfbb1fc --- /dev/null +++ b/examples/nginx-app/readme.md @@ -0,0 +1,7 @@ +## Overview + +This application is an example app. + +### Awesome + +Even though it does not have any features it is still pretty awesome. diff --git a/package.json b/package.json index a0b883fb463..a90dac72b4f 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "grunt-sync": "^0.4.1", "karma-sinon": "^1.0.3", "lodash": "^2.4.1", + "remarkable": "^1.6.2", "sinon": "1.16.1", "systemjs-builder": "^0.15.7", "tether": "^1.2.0", diff --git a/pkg/plugins/models.go b/pkg/plugins/models.go index 26620a45fea..298ca817b5c 100644 --- a/pkg/plugins/models.go +++ b/pkg/plugins/models.go @@ -33,6 +33,14 @@ func (pb *PluginBase) registerPlugin(pluginDir string) error { log.Info("Plugins: Registering plugin %v", pb.Name) } + if len(pb.Dependencies.Plugins) == 0 { + pb.Dependencies.Plugins = []PluginDependencyItem{} + } + + if pb.Dependencies.GrafanaVersion == "" { + pb.Dependencies.GrafanaVersion = "*" + } + pb.PluginDir = pluginDir Plugins[pb.Id] = pb return nil diff --git a/public/app/features/plugins/edit_ctrl.ts b/public/app/features/plugins/edit_ctrl.ts index 5a0e565f3db..d9ba932f53e 100644 --- a/public/app/features/plugins/edit_ctrl.ts +++ b/public/app/features/plugins/edit_ctrl.ts @@ -8,18 +8,21 @@ export class PluginEditCtrl { pluginIcon: string; pluginId: any; includedPanels: any; + readmeHtml: any; includedDatasources: any; tabIndex: number; preUpdateHook: () => any; postUpdateHook: () => any; /** @ngInject */ - constructor(private backendSrv: any, private $routeParams: any) { + constructor(private backendSrv, private $routeParams, private $sce, private $http) { this.model = {}; this.pluginId = $routeParams.pluginId; this.tabIndex = 0; + } - this.backendSrv.get(`/api/org/plugins/${this.pluginId}/settings`).then(result => { + init() { + return this.backendSrv.get(`/api/org/plugins/${this.pluginId}/settings`).then(result => { this.model = result; this.includedPanels = _.where(result.includes, {type: 'panel'}); this.includedDatasources = _.where(result.includes, {type: 'datasource'}); @@ -28,6 +31,17 @@ export class PluginEditCtrl { this.model.dependencies.plugins.forEach(plug => { plug.icon = this.getPluginIcon(plug.type); }); + + return this.initReadme(); + }); + } + + initReadme() { + return this.$http.get(this.model.baseUrl + '/readme.md').then(res => { + return System.import('remarkable').then(Remarkable => { + var md = new Remarkable(); + this.readmeHtml = this.$sce.trustAsHtml(md.render(res.data)); + }); }); } diff --git a/public/app/features/plugins/partials/edit.html b/public/app/features/plugins/partials/edit.html index 70bc3af4a93..265ec673a40 100644 --- a/public/app/features/plugins/partials/edit.html +++ b/public/app/features/plugins/partials/edit.html @@ -1,10 +1,10 @@ - - Plugin details + + {{ctrl.model.name}} -
+