From 4a69de1f3008cdf02239d2787eaa0e580848a6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 21 Nov 2015 13:46:18 +0100 Subject: [PATCH] feat(plugins): made panels work as plugins --- pkg/api/frontendsettings.go | 9 ++++ pkg/plugins/models.go | 7 ++++ pkg/plugins/plugins.go | 17 ++++++++ public/app/core/settings.js | 8 +--- public/app/features/panel/panel_directive.js | 4 +- public/app/plugins/external/example/readme.md | 13 ++++++ .../externalPlugins/example/README.TXT | 3 -- .../externalPlugins/example/_plugin.json | 42 ------------------- .../{ => plugins}/panels/dashlist/editor.html | 0 .../{ => plugins}/panels/dashlist/module.html | 0 .../{ => plugins}/panels/dashlist/module.js | 4 +- .../app/plugins/panels/dashlist/plugin.json | 8 ++++ .../panels/graph/axisEditor.html | 0 .../app/{ => plugins}/panels/graph/graph.js | 0 .../panels/graph/graph.tooltip.js | 0 .../app/{ => plugins}/panels/graph/legend.js | 2 +- .../panels/graph/legend.popover.html | 0 .../{ => plugins}/panels/graph/module.html | 0 .../app/{ => plugins}/panels/graph/module.js | 6 +-- public/app/plugins/panels/graph/plugin.json | 8 ++++ .../panels/graph/seriesOverridesCtrl.js | 0 .../panels/graph/styleEditor.html | 0 .../panels/singlestat/editor.html | 0 .../panels/singlestat/module.html | 0 .../{ => plugins}/panels/singlestat/module.js | 4 +- .../app/plugins/panels/singlestat/plugin.json | 8 ++++ .../panels/singlestat/singleStatPanel.js | 0 .../{ => plugins}/panels/table/controller.ts | 4 +- .../{ => plugins}/panels/table/editor.html | 0 .../app/{ => plugins}/panels/table/editor.ts | 5 +-- .../{ => plugins}/panels/table/module.html | 0 .../app/{ => plugins}/panels/table/module.ts | 4 +- .../{ => plugins}/panels/table/options.html | 0 public/app/plugins/panels/table/plugin.json | 8 ++++ .../{ => plugins}/panels/table/renderer.ts | 2 +- .../panels/table/specs/renderer_specs.ts | 0 .../panels/table/specs/table_model_specs.ts | 0 .../panels/table/specs/transformers_specs.ts | 0 .../{ => plugins}/panels/table/table_model.ts | 0 .../panels/table/transformers.ts | 2 +- .../app/{ => plugins}/panels/text/editor.html | 0 .../app/{ => plugins}/panels/text/module.html | 0 .../app/{ => plugins}/panels/text/module.js | 6 +-- public/app/plugins/panels/text/plugin.json | 8 ++++ .../{PLUGIN_CHANGES.md => plugin_api.md} | 0 public/test/specs/graph-ctrl-specs.js | 2 +- public/test/specs/graph-specs.js | 2 +- public/test/specs/graph-tooltip-specs.js | 2 +- .../test/specs/seriesOverridesCtrl-specs.js | 2 +- public/test/specs/singlestat-specs.js | 2 +- .../panels/text/lib => vendor}/showdown.js | 0 51 files changed, 113 insertions(+), 79 deletions(-) create mode 100644 public/app/plugins/external/example/readme.md delete mode 100644 public/app/plugins/externalPlugins/example/README.TXT delete mode 100644 public/app/plugins/externalPlugins/example/_plugin.json rename public/app/{ => plugins}/panels/dashlist/editor.html (100%) rename public/app/{ => plugins}/panels/dashlist/module.html (100%) rename public/app/{ => plugins}/panels/dashlist/module.js (91%) create mode 100644 public/app/plugins/panels/dashlist/plugin.json rename public/app/{ => plugins}/panels/graph/axisEditor.html (100%) rename public/app/{ => plugins}/panels/graph/graph.js (100%) rename public/app/{ => plugins}/panels/graph/graph.tooltip.js (100%) rename public/app/{ => plugins}/panels/graph/legend.js (98%) rename public/app/{ => plugins}/panels/graph/legend.popover.html (100%) rename public/app/{ => plugins}/panels/graph/module.html (100%) rename public/app/{ => plugins}/panels/graph/module.js (97%) create mode 100644 public/app/plugins/panels/graph/plugin.json rename public/app/{ => plugins}/panels/graph/seriesOverridesCtrl.js (100%) rename public/app/{ => plugins}/panels/graph/styleEditor.html (100%) rename public/app/{ => plugins}/panels/singlestat/editor.html (100%) rename public/app/{ => plugins}/panels/singlestat/module.html (100%) rename public/app/{ => plugins}/panels/singlestat/module.js (97%) create mode 100644 public/app/plugins/panels/singlestat/plugin.json rename public/app/{ => plugins}/panels/singlestat/singleStatPanel.js (100%) rename public/app/{ => plugins}/panels/table/controller.ts (95%) rename public/app/{ => plugins}/panels/table/editor.html (100%) rename public/app/{ => plugins}/panels/table/editor.ts (96%) rename public/app/{ => plugins}/panels/table/module.html (100%) rename public/app/{ => plugins}/panels/table/module.ts (96%) rename public/app/{ => plugins}/panels/table/options.html (100%) create mode 100644 public/app/plugins/panels/table/plugin.json rename public/app/{ => plugins}/panels/table/renderer.ts (98%) rename public/app/{ => plugins}/panels/table/specs/renderer_specs.ts (100%) rename public/app/{ => plugins}/panels/table/specs/table_model_specs.ts (100%) rename public/app/{ => plugins}/panels/table/specs/transformers_specs.ts (100%) rename public/app/{ => plugins}/panels/table/table_model.ts (100%) rename public/app/{ => plugins}/panels/table/transformers.ts (98%) rename public/app/{ => plugins}/panels/text/editor.html (100%) rename public/app/{ => plugins}/panels/text/module.html (100%) rename public/app/{ => plugins}/panels/text/module.js (92%) create mode 100644 public/app/plugins/panels/text/plugin.json rename public/app/plugins/{PLUGIN_CHANGES.md => plugin_api.md} (100%) rename public/{app/panels/text/lib => vendor}/showdown.js (100%) diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index cc07b9cfb49..93b08f79eb4 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -106,9 +106,18 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro defaultDatasource = "-- Grafana --" } + panels := map[string]interface{}{} + for _, panel := range plugins.Panels { + panels[panel.Type] = map[string]interface{}{ + "module": panel.Module, + "name": panel.Name, + } + } + jsonObj := map[string]interface{}{ "defaultDatasource": defaultDatasource, "datasources": datasources, + "panels": panels, "appSubUrl": setting.AppSubUrl, "allowOrgCreate": (setting.AllowUserOrgCreate && c.IsSignedIn) || c.IsGrafanaAdmin, "buildInfo": map[string]interface{}{ diff --git a/pkg/plugins/models.go b/pkg/plugins/models.go index 42a641847aa..49156739b5a 100644 --- a/pkg/plugins/models.go +++ b/pkg/plugins/models.go @@ -15,6 +15,13 @@ type DataSourcePlugin struct { StaticRootConfig *StaticRootConfig `json:"staticRoot"` } +type PanelPlugin struct { + Type string `json:"type"` + Name string `json:"name"` + Module string `json:"module"` + StaticRootConfig *StaticRootConfig `json:"staticRoot"` +} + type StaticRootConfig struct { Url string `json:"url"` Path string `json:"path"` diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go index ff33f23c19a..16ba1cca7d0 100644 --- a/pkg/plugins/plugins.go +++ b/pkg/plugins/plugins.go @@ -14,6 +14,7 @@ import ( var ( DataSources map[string]DataSourcePlugin + Panels []PanelPlugin ExternalPlugins []ExternalPlugin StaticRoutes []*StaticRootConfig ) @@ -27,6 +28,7 @@ func Init() error { DataSources = make(map[string]DataSourcePlugin) ExternalPlugins = make([]ExternalPlugin, 0) StaticRoutes = make([]*StaticRootConfig, 0) + Panels = make([]PanelPlugin, 0) scan(path.Join(setting.StaticRootPath, "app/plugins")) checkExternalPluginPaths() @@ -124,6 +126,21 @@ func (scanner *PluginScanner) loadPluginJson(pluginJsonFilePath string) error { addStaticRoot(p.StaticRootConfig, currentDir) } + if pluginType == "panel" { + p := PanelPlugin{} + reader.Seek(0, 0) + if err := jsonParser.Decode(&p); err != nil { + return err + } + + if p.Type == "" { + return errors.New("Did not find type property in plugin.json") + } + + Panels = append(Panels, p) + addStaticRoot(p.StaticRootConfig, currentDir) + } + if pluginType == "external" { p := ExternalPlugin{} reader.Seek(0, 0) diff --git a/public/app/core/settings.js b/public/app/core/settings.js index fcabe6d207f..cc4ced3b0a0 100644 --- a/public/app/core/settings.js +++ b/public/app/core/settings.js @@ -8,13 +8,7 @@ function (_) { var defaults = { datasources : {}, window_title_prefix : 'Grafana - ', - panels : { - 'graph': { path: 'app/panels/graph', name: 'Graph' }, - 'table': { path: 'app/panels/table', name: 'Table' }, - 'singlestat': { path: 'app/panels/singlestat', name: 'Single stat' }, - 'text': { path: 'app/panels/text', name: 'Text' }, - 'dashlist': { path: 'app/panels/dashlist', name: 'Dashboard list' }, - }, + panels : {}, new_panel_title: 'Panel Title', playlist_timespan: "1m", unsaved_changes_warning: true, diff --git a/public/app/features/panel/panel_directive.js b/public/app/features/panel/panel_directive.js index 8dd9d367922..258b47742b2 100644 --- a/public/app/features/panel/panel_directive.js +++ b/public/app/features/panel/panel_directive.js @@ -13,9 +13,9 @@ function (angular, $, config) { restrict: 'E', link: function(scope, elem, attr) { var getter = $parse(attr.type), panelType = getter(scope); - var panelPath = config.panels[panelType].path; + var module = config.panels[panelType].module; - scope.require([panelPath + "/module"], function () { + scope.require([module], function () { var panelEl = angular.element(document.createElement('grafana-panel-' + panelType)); elem.append(panelEl); $compile(panelEl)(scope); diff --git a/public/app/plugins/external/example/readme.md b/public/app/plugins/external/example/readme.md new file mode 100644 index 00000000000..78a9eb686d0 --- /dev/null +++ b/public/app/plugins/external/example/readme.md @@ -0,0 +1,13 @@ +Example app is available at https://github.com/raintank/grafana-plugin-example + +* Clone plugin repo git@github.com:raintank/grafana-plugin-example.git + +* Modify grafana.ini (or custom.ini if your developing Grafana locally) + +```ini +[plugin.external-test] +path = //grafana-plugin-example +``` + + + diff --git a/public/app/plugins/externalPlugins/example/README.TXT b/public/app/plugins/externalPlugins/example/README.TXT deleted file mode 100644 index 0963375e9fe..00000000000 --- a/public/app/plugins/externalPlugins/example/README.TXT +++ /dev/null @@ -1,3 +0,0 @@ -Example app is available at https://github.com/raintank/grafana-plugin-example - -To use, download the example app from github and run it (requires python Flask). Then rename the "_plugin.json" file in this director to "plugin.json" and restart Grafana. diff --git a/public/app/plugins/externalPlugins/example/_plugin.json b/public/app/plugins/externalPlugins/example/_plugin.json deleted file mode 100644 index 79e996354c4..00000000000 --- a/public/app/plugins/externalPlugins/example/_plugin.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "pluginType": "externalPlugin", - "settings": { - "routes": [ - { - "path": "/example/static/*", - "method": "*", - "req_signed_in": false, - "req_grafana_admin": false, - "req_role": "Admin", - "url": "http://localhost:5000/static" - }, - { - "path": "/example/api/*", - "method": "*", - "req_signed_in": true, - "req_grafana_admin": false, - "req_role": "Admin", - "url": "http://localhost:5000/api" - } - ], - "css": [ - { - "href": "/example/static/css/example.css" - } - ], - "js": [ - { - "src": "/example/static/js/app.js" - } - ], - "menu_items": [ - { - "text": "Example Plugin", - "icon": "fa fa-fw fa-smile-o", - "href": "/example/servers", - "adminOnly": false, - } - ] - } - -} diff --git a/public/app/panels/dashlist/editor.html b/public/app/plugins/panels/dashlist/editor.html similarity index 100% rename from public/app/panels/dashlist/editor.html rename to public/app/plugins/panels/dashlist/editor.html diff --git a/public/app/panels/dashlist/module.html b/public/app/plugins/panels/dashlist/module.html similarity index 100% rename from public/app/panels/dashlist/module.html rename to public/app/plugins/panels/dashlist/module.html diff --git a/public/app/panels/dashlist/module.js b/public/app/plugins/panels/dashlist/module.js similarity index 91% rename from public/app/panels/dashlist/module.js rename to public/app/plugins/panels/dashlist/module.js index d76664eb5c3..fddc762ffe2 100644 --- a/public/app/panels/dashlist/module.js +++ b/public/app/plugins/panels/dashlist/module.js @@ -14,7 +14,7 @@ function (angular, app, _, config, PanelMeta) { module.directive('grafanaPanelDashlist', function() { return { controller: 'DashListPanelCtrl', - templateUrl: 'app/panels/dashlist/module.html', + templateUrl: 'app/plugins/panels/dashlist/module.html', }; }); @@ -26,7 +26,7 @@ function (angular, app, _, config, PanelMeta) { fullscreen: true, }); - $scope.panelMeta.addEditorTab('Options', 'app/panels/dashlist/editor.html'); + $scope.panelMeta.addEditorTab('Options', 'app/plugins/panels/dashlist/editor.html'); var defaults = { mode: 'starred', diff --git a/public/app/plugins/panels/dashlist/plugin.json b/public/app/plugins/panels/dashlist/plugin.json new file mode 100644 index 00000000000..af9b9d8bbc8 --- /dev/null +++ b/public/app/plugins/panels/dashlist/plugin.json @@ -0,0 +1,8 @@ +{ + "pluginType": "panel", + + "name": "Dashboard list", + "type": "dashlist", + + "module": "app/plugins/panels/dashlist/module" +} diff --git a/public/app/panels/graph/axisEditor.html b/public/app/plugins/panels/graph/axisEditor.html similarity index 100% rename from public/app/panels/graph/axisEditor.html rename to public/app/plugins/panels/graph/axisEditor.html diff --git a/public/app/panels/graph/graph.js b/public/app/plugins/panels/graph/graph.js similarity index 100% rename from public/app/panels/graph/graph.js rename to public/app/plugins/panels/graph/graph.js diff --git a/public/app/panels/graph/graph.tooltip.js b/public/app/plugins/panels/graph/graph.tooltip.js similarity index 100% rename from public/app/panels/graph/graph.tooltip.js rename to public/app/plugins/panels/graph/graph.tooltip.js diff --git a/public/app/panels/graph/legend.js b/public/app/plugins/panels/graph/legend.js similarity index 98% rename from public/app/panels/graph/legend.js rename to public/app/plugins/panels/graph/legend.js index 065e74fed30..000fc623303 100644 --- a/public/app/panels/graph/legend.js +++ b/public/app/plugins/panels/graph/legend.js @@ -45,7 +45,7 @@ function (angular, _, $) { popoverScope.series = seriesInfo; popoverSrv.show({ element: el, - templateUrl: 'app/panels/graph/legend.popover.html', + templateUrl: 'app/plugins/panels/graph/legend.popover.html', scope: popoverScope }); } diff --git a/public/app/panels/graph/legend.popover.html b/public/app/plugins/panels/graph/legend.popover.html similarity index 100% rename from public/app/panels/graph/legend.popover.html rename to public/app/plugins/panels/graph/legend.popover.html diff --git a/public/app/panels/graph/module.html b/public/app/plugins/panels/graph/module.html similarity index 100% rename from public/app/panels/graph/module.html rename to public/app/plugins/panels/graph/module.html diff --git a/public/app/panels/graph/module.js b/public/app/plugins/panels/graph/module.js similarity index 97% rename from public/app/panels/graph/module.js rename to public/app/plugins/panels/graph/module.js index ff9633d0576..817a924d965 100644 --- a/public/app/panels/graph/module.js +++ b/public/app/plugins/panels/graph/module.js @@ -17,7 +17,7 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) { module.directive('grafanaPanelGraph', function() { return { controller: 'GraphCtrl', - templateUrl: 'app/panels/graph/module.html', + templateUrl: 'app/plugins/panels/graph/module.html', }; }); @@ -30,8 +30,8 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) { metricsEditor: true, }); - $scope.panelMeta.addEditorTab('Axes & Grid', 'app/panels/graph/axisEditor.html'); - $scope.panelMeta.addEditorTab('Display Styles', 'app/panels/graph/styleEditor.html'); + $scope.panelMeta.addEditorTab('Axes & Grid', 'app/plugins/panels/graph/axisEditor.html'); + $scope.panelMeta.addEditorTab('Display Styles', 'app/plugins/panels/graph/styleEditor.html'); $scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); $scope.panelMeta.addExtendedMenuItem('Export CSV', '', 'exportCsv()'); diff --git a/public/app/plugins/panels/graph/plugin.json b/public/app/plugins/panels/graph/plugin.json new file mode 100644 index 00000000000..8b683c9d750 --- /dev/null +++ b/public/app/plugins/panels/graph/plugin.json @@ -0,0 +1,8 @@ +{ + "pluginType": "panel", + + "name": "Graph", + "type": "graph", + + "module": "app/plugins/panels/graph/module" +} diff --git a/public/app/panels/graph/seriesOverridesCtrl.js b/public/app/plugins/panels/graph/seriesOverridesCtrl.js similarity index 100% rename from public/app/panels/graph/seriesOverridesCtrl.js rename to public/app/plugins/panels/graph/seriesOverridesCtrl.js diff --git a/public/app/panels/graph/styleEditor.html b/public/app/plugins/panels/graph/styleEditor.html similarity index 100% rename from public/app/panels/graph/styleEditor.html rename to public/app/plugins/panels/graph/styleEditor.html diff --git a/public/app/panels/singlestat/editor.html b/public/app/plugins/panels/singlestat/editor.html similarity index 100% rename from public/app/panels/singlestat/editor.html rename to public/app/plugins/panels/singlestat/editor.html diff --git a/public/app/panels/singlestat/module.html b/public/app/plugins/panels/singlestat/module.html similarity index 100% rename from public/app/panels/singlestat/module.html rename to public/app/plugins/panels/singlestat/module.html diff --git a/public/app/panels/singlestat/module.js b/public/app/plugins/panels/singlestat/module.js similarity index 97% rename from public/app/panels/singlestat/module.js rename to public/app/plugins/panels/singlestat/module.js index 18d02e166f1..47b18ba526f 100644 --- a/public/app/panels/singlestat/module.js +++ b/public/app/plugins/panels/singlestat/module.js @@ -16,7 +16,7 @@ function (angular, app, _, kbn, TimeSeries, PanelMeta) { module.directive('grafanaPanelSinglestat', function() { return { controller: 'SingleStatCtrl', - templateUrl: 'app/panels/singlestat/module.html', + templateUrl: 'app/plugins/panels/singlestat/module.html', }; }); @@ -31,7 +31,7 @@ function (angular, app, _, kbn, TimeSeries, PanelMeta) { $scope.fontSizes = ['20%', '30%','50%','70%','80%','100%', '110%', '120%', '150%', '170%', '200%']; - $scope.panelMeta.addEditorTab('Options', 'app/panels/singlestat/editor.html'); + $scope.panelMeta.addEditorTab('Options', 'app/plugins/panels/singlestat/editor.html'); $scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); // Set and populate defaults diff --git a/public/app/plugins/panels/singlestat/plugin.json b/public/app/plugins/panels/singlestat/plugin.json new file mode 100644 index 00000000000..dfb38d615c7 --- /dev/null +++ b/public/app/plugins/panels/singlestat/plugin.json @@ -0,0 +1,8 @@ +{ + "pluginType": "panel", + + "name": "Singlestat", + "type": "singlestat", + + "module": "app/plugins/panels/singlestat/module" +} diff --git a/public/app/panels/singlestat/singleStatPanel.js b/public/app/plugins/panels/singlestat/singleStatPanel.js similarity index 100% rename from public/app/panels/singlestat/singleStatPanel.js rename to public/app/plugins/panels/singlestat/singleStatPanel.js diff --git a/public/app/panels/table/controller.ts b/public/app/plugins/panels/table/controller.ts similarity index 95% rename from public/app/panels/table/controller.ts rename to public/app/plugins/panels/table/controller.ts index 4547a9d7896..630c295b95b 100644 --- a/public/app/panels/table/controller.ts +++ b/public/app/plugins/panels/table/controller.ts @@ -1,4 +1,4 @@ -/// +/// import angular = require('angular'); import _ = require('lodash'); @@ -21,7 +21,7 @@ export class TablePanelCtrl { metricsEditor: true, }); - $scope.panelMeta.addEditorTab('Options', 'app/panels/table/options.html'); + $scope.panelMeta.addEditorTab('Options', 'app/plugins/panels/table/options.html'); $scope.panelMeta.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html'); var panelDefaults = { diff --git a/public/app/panels/table/editor.html b/public/app/plugins/panels/table/editor.html similarity index 100% rename from public/app/panels/table/editor.html rename to public/app/plugins/panels/table/editor.html diff --git a/public/app/panels/table/editor.ts b/public/app/plugins/panels/table/editor.ts similarity index 96% rename from public/app/panels/table/editor.ts rename to public/app/plugins/panels/table/editor.ts index 2908023d330..db41ead4710 100644 --- a/public/app/panels/table/editor.ts +++ b/public/app/plugins/panels/table/editor.ts @@ -1,5 +1,4 @@ - -/// +/// import angular = require('angular'); import $ = require('jquery'); @@ -14,7 +13,7 @@ export function tablePanelEditor() { return { restrict: 'E', scope: true, - templateUrl: 'app/panels/table/editor.html', + templateUrl: 'app/plugins/panels/table/editor.html', link: function(scope, elem) { scope.transformers = transformers; scope.unitFormats = kbn.getUnitFormats(); diff --git a/public/app/panels/table/module.html b/public/app/plugins/panels/table/module.html similarity index 100% rename from public/app/panels/table/module.html rename to public/app/plugins/panels/table/module.html diff --git a/public/app/panels/table/module.ts b/public/app/plugins/panels/table/module.ts similarity index 96% rename from public/app/panels/table/module.ts rename to public/app/plugins/panels/table/module.ts index dbdc4d0ba25..1f215b44e55 100644 --- a/public/app/panels/table/module.ts +++ b/public/app/plugins/panels/table/module.ts @@ -1,4 +1,4 @@ -/// +/// import angular = require('angular'); import $ = require('jquery'); @@ -14,7 +14,7 @@ export function tablePanel() { 'use strict'; return { restrict: 'E', - templateUrl: 'app/panels/table/module.html', + templateUrl: 'app/plugins/panels/table/module.html', controller: TablePanelCtrl, link: function(scope, elem) { var data; diff --git a/public/app/panels/table/options.html b/public/app/plugins/panels/table/options.html similarity index 100% rename from public/app/panels/table/options.html rename to public/app/plugins/panels/table/options.html diff --git a/public/app/plugins/panels/table/plugin.json b/public/app/plugins/panels/table/plugin.json new file mode 100644 index 00000000000..cdcfb7081dc --- /dev/null +++ b/public/app/plugins/panels/table/plugin.json @@ -0,0 +1,8 @@ +{ + "pluginType": "panel", + + "name": "Table", + "type": "table", + + "module": "app/plugins/panels/table/module" +} diff --git a/public/app/panels/table/renderer.ts b/public/app/plugins/panels/table/renderer.ts similarity index 98% rename from public/app/panels/table/renderer.ts rename to public/app/plugins/panels/table/renderer.ts index a55a8bf2fac..f45d5fcc5da 100644 --- a/public/app/panels/table/renderer.ts +++ b/public/app/plugins/panels/table/renderer.ts @@ -1,4 +1,4 @@ -/// +/// import _ = require('lodash'); import kbn = require('app/core/utils/kbn'); diff --git a/public/app/panels/table/specs/renderer_specs.ts b/public/app/plugins/panels/table/specs/renderer_specs.ts similarity index 100% rename from public/app/panels/table/specs/renderer_specs.ts rename to public/app/plugins/panels/table/specs/renderer_specs.ts diff --git a/public/app/panels/table/specs/table_model_specs.ts b/public/app/plugins/panels/table/specs/table_model_specs.ts similarity index 100% rename from public/app/panels/table/specs/table_model_specs.ts rename to public/app/plugins/panels/table/specs/table_model_specs.ts diff --git a/public/app/panels/table/specs/transformers_specs.ts b/public/app/plugins/panels/table/specs/transformers_specs.ts similarity index 100% rename from public/app/panels/table/specs/transformers_specs.ts rename to public/app/plugins/panels/table/specs/transformers_specs.ts diff --git a/public/app/panels/table/table_model.ts b/public/app/plugins/panels/table/table_model.ts similarity index 100% rename from public/app/panels/table/table_model.ts rename to public/app/plugins/panels/table/table_model.ts diff --git a/public/app/panels/table/transformers.ts b/public/app/plugins/panels/table/transformers.ts similarity index 98% rename from public/app/panels/table/transformers.ts rename to public/app/plugins/panels/table/transformers.ts index 1a5482693e7..0448b4eaef2 100644 --- a/public/app/panels/table/transformers.ts +++ b/public/app/plugins/panels/table/transformers.ts @@ -1,4 +1,4 @@ -/// +/// import moment = require('moment'); import _ = require('lodash'); diff --git a/public/app/panels/text/editor.html b/public/app/plugins/panels/text/editor.html similarity index 100% rename from public/app/panels/text/editor.html rename to public/app/plugins/panels/text/editor.html diff --git a/public/app/panels/text/module.html b/public/app/plugins/panels/text/module.html similarity index 100% rename from public/app/panels/text/module.html rename to public/app/plugins/panels/text/module.html diff --git a/public/app/panels/text/module.js b/public/app/plugins/panels/text/module.js similarity index 92% rename from public/app/panels/text/module.js rename to public/app/plugins/panels/text/module.js index c301690d2eb..145b3be9b0c 100644 --- a/public/app/panels/text/module.js +++ b/public/app/plugins/panels/text/module.js @@ -16,7 +16,7 @@ function (angular, app, _, require, PanelMeta) { module.directive('grafanaPanelText', function() { return { controller: 'TextPanelCtrl', - templateUrl: 'app/panels/text/module.html', + templateUrl: 'app/plugins/panels/text/module.html', }; }); @@ -28,7 +28,7 @@ function (angular, app, _, require, PanelMeta) { fullscreen: true, }); - $scope.panelMeta.addEditorTab('Edit text', 'app/panels/text/editor.html'); + $scope.panelMeta.addEditorTab('Edit text', 'app/plugins/panels/text/editor.html'); // Set and populate defaults var _d = { @@ -84,7 +84,7 @@ function (angular, app, _, require, PanelMeta) { $scope.updateContent(converter.makeHtml(text)); } else { - require(['./lib/showdown'], function (Showdown) { + require(['vendor/showdown'], function (Showdown) { converter = new Showdown.converter(); $scope.updateContent(converter.makeHtml(text)); }); diff --git a/public/app/plugins/panels/text/plugin.json b/public/app/plugins/panels/text/plugin.json new file mode 100644 index 00000000000..4a6c039104b --- /dev/null +++ b/public/app/plugins/panels/text/plugin.json @@ -0,0 +1,8 @@ +{ + "pluginType": "panel", + + "name": "Text", + "type": "text", + + "module": "app/plugins/panels/text/module" +} diff --git a/public/app/plugins/PLUGIN_CHANGES.md b/public/app/plugins/plugin_api.md similarity index 100% rename from public/app/plugins/PLUGIN_CHANGES.md rename to public/app/plugins/plugin_api.md diff --git a/public/test/specs/graph-ctrl-specs.js b/public/test/specs/graph-ctrl-specs.js index a1f5809dee4..81be9a40b46 100644 --- a/public/test/specs/graph-ctrl-specs.js +++ b/public/test/specs/graph-ctrl-specs.js @@ -2,7 +2,7 @@ define([ './helpers', 'app/features/panel/panel_srv', 'app/features/panel/panel_helper', - 'app/panels/graph/module' + 'app/plugins/panels/graph/module' ], function(helpers) { 'use strict'; diff --git a/public/test/specs/graph-specs.js b/public/test/specs/graph-specs.js index 3a596ce4369..60637296564 100644 --- a/public/test/specs/graph-specs.js +++ b/public/test/specs/graph-specs.js @@ -3,7 +3,7 @@ define([ 'angular', 'jquery', 'app/core/time_series', - 'app/panels/graph/graph' + 'app/plugins/panels/graph/graph' ], function(helpers, angular, $, TimeSeries) { 'use strict'; diff --git a/public/test/specs/graph-tooltip-specs.js b/public/test/specs/graph-tooltip-specs.js index 864e87d07f8..9dc84daefa3 100644 --- a/public/test/specs/graph-tooltip-specs.js +++ b/public/test/specs/graph-tooltip-specs.js @@ -1,6 +1,6 @@ define([ 'jquery', - 'app/panels/graph/graph.tooltip' + 'app/plugins/panels/graph/graph.tooltip' ], function($, GraphTooltip) { 'use strict'; diff --git a/public/test/specs/seriesOverridesCtrl-specs.js b/public/test/specs/seriesOverridesCtrl-specs.js index 96b6d9ec6a3..1290e5f0987 100644 --- a/public/test/specs/seriesOverridesCtrl-specs.js +++ b/public/test/specs/seriesOverridesCtrl-specs.js @@ -1,6 +1,6 @@ define([ './helpers', - 'app/panels/graph/seriesOverridesCtrl' + 'app/plugins/panels/graph/seriesOverridesCtrl' ], function(helpers) { 'use strict'; diff --git a/public/test/specs/singlestat-specs.js b/public/test/specs/singlestat-specs.js index aff33396687..14e1ca63cca 100644 --- a/public/test/specs/singlestat-specs.js +++ b/public/test/specs/singlestat-specs.js @@ -2,7 +2,7 @@ define([ './helpers', 'app/features/panel/panel_srv', 'app/features/panel/panel_helper', - 'app/panels/singlestat/module' + 'app/plugins/panels/singlestat/module' ], function(helpers) { 'use strict'; diff --git a/public/app/panels/text/lib/showdown.js b/public/vendor/showdown.js similarity index 100% rename from public/app/panels/text/lib/showdown.js rename to public/vendor/showdown.js