Browse Source

feat(plugin): experimental work on plugin architecture

Torkel Ödegaard 10 years ago
parent
commit
3e3b996963
2 changed files with 48 additions and 0 deletions
  1. 43 0
      public/app/plugins/panel/test/module.ts
  2. 5 0
      public/app/plugins/panel/test/plugin.json

+ 43 - 0
public/app/plugins/panel/test/module.ts

@@ -0,0 +1,43 @@
+///<reference path="../../../headers/common.d.ts" />
+
+import PanelMeta from 'app/features/panel/panel_meta2';
+
+class PanelBaseCtrl {
+  constructor(private $scope) {
+    $scope.panelMeta = new PanelMeta({
+      panelName: 'Table',
+      editIcon:  "fa fa-table",
+      fullscreen: true,
+      metricsEditor: true,
+    });
+    $scope.testProp = "hello";
+  }
+}
+
+class TestPanelCtrl extends PanelBaseCtrl {
+
+  constructor($scope) {
+    super($scope);
+    $scope.panelMeta.panelName = "Test";
+  }
+}
+
+function testPanelDirective() {
+  return {
+    restrict: 'E',
+    template: `
+    <grafana-panel>
+      <div class="text-center" style="padding-top: 2rem">
+        <h2>Test Panel, {{testProp}}</h2>
+      </div>
+    </grafana-panel>
+    `,
+    controller: TestPanelCtrl
+  };
+}
+
+export {
+  PanelBaseCtrl,
+  TestPanelCtrl,
+  testPanelDirective as panel
+}

+ 5 - 0
public/app/plugins/panel/test/plugin.json

@@ -0,0 +1,5 @@
+{
+  "type": "panel",
+  "name": "Test",
+  "id": "test"
+}