Explorar o código

feat(plugins): working on plugin examples

Torkel Ödegaard %!s(int64=10) %!d(string=hai) anos
pai
achega
82d5d1b003

+ 0 - 0
examples/nginx-app/css/dark.css


+ 0 - 0
examples/nginx-app/css/light.css


BIN=BIN
examples/nginx-app/img/logo_large.png


BIN=BIN
examples/nginx-app/img/logo_small.png


+ 28 - 0
examples/nginx-app/module.js

@@ -0,0 +1,28 @@
+define([
+  'angular',
+  'app/app'
+], function(angular, app)  {
+
+  var module = angular.module('nginx-app', []);
+  app.default.useModule(module);
+
+  module.config(function($routeProvider) {
+    $routeProvider
+      .when('/nginx/stream', {
+        templateUrl: 'public/plugins/nginx-app/partials/stream.html',
+      });
+  });
+
+  function NginxConfigCtrl() {
+    this.appEditCtrl.beforeUpdate = function() {
+      alert('before!');
+    };
+  }
+  NginxConfigCtrl.templateUrl = 'public/plugins/nginx-app/partials/config.html';
+
+
+  return {
+    ConfigCtrl: NginxConfigCtrl
+  };
+
+});

+ 21 - 0
examples/nginx-app/panel/module.js

@@ -0,0 +1,21 @@
+define([
+  'app/plugins/sdk'
+], function(sdk) {
+  'use strict';
+
+  var NginxPanel = (function(_super) {
+    function NginxPanel($scope, $injector) {
+      _super.call(this, $scope, $injector);
+    }
+
+    NginxPanel.template = '<h2>nginx!</h2>';
+    NginxPanel.prototype = Object.create(_super.prototype);
+    NginxPanel.prototype.constructor = NginxPanel;
+
+    return NginxPanel;
+  })(sdk.PanelCtrl);
+
+  return {
+    PanelCtrl: NginxPanel
+  };
+});

+ 6 - 0
examples/nginx-app/panel/plugin.json

@@ -0,0 +1,6 @@
+{
+  "type": "panel",
+  "name": "Nginx Panel",
+  "id": "nginx-panel",
+  "staticRoot": "."
+}

+ 1 - 0
examples/nginx-app/partials/config.html

@@ -0,0 +1 @@
+<h2>nginx config</h2>

+ 12 - 0
examples/nginx-app/partials/stream.html

@@ -0,0 +1,12 @@
+<topnav title="Nginx" icon="fa fa-fw fa-cubes" subnav="true">
+	<ul class="nav">
+		<li class="active" ><a href="org/apps">Overview</a></li>
+	</ul>
+</topnav>
+
+<div class="page-container" style="background: transparent; border: 0;">
+  <div class="page-wide" ng-init="ctrl.init()">
+		<h1>NGINX app</h1>
+	</div>
+</div>
+

+ 44 - 0
examples/nginx-app/plugin.json

@@ -0,0 +1,44 @@
+{
+  "type": "app",
+  "name": "Nginx",
+  "id": "nginx-app",
+
+  "staticRoot": ".",
+
+  "pages": [
+    {"name": "Live stream", "url": "nginx/stream", "reqRole": "Editor"},
+    {"name": "Log view", "url": "nginx/log", "reqRole": "Editor"}
+  ],
+
+  "css": {
+    "dark":  "css/dark.css",
+    "light":  "css/light.css"
+  },
+
+  "info": {
+    "description": "Official Grafana Nginx App & Dashboard bundle",
+    "author": {
+      "name": "Nginx Inc.",
+      "url": "http://nginx.com"
+    },
+    "keywords": ["nginx"],
+    "logos": {
+      "small": "img/logo_small.png",
+      "large": "img/logo_large.png"
+    },
+    "links": [
+      {"name": "Project site", "url": "http://project.com"},
+      {"name": "License & Terms", "url": "http://license.com"}
+    ],
+    "version": "1.0.0",
+    "updated": "2015-02-10"
+  },
+
+  "dependencies": {
+    "grafanaVersion": "2.6.x",
+    "plugins": [
+      {"type": "datasource", "id": "graphite", "name": "Graphite", "version": "1.0.0"},
+      {"type": "panel", "id": "graph", "name": "Graph", "version": "1.0.0"}
+    ]
+  }
+}

+ 0 - 0
examples/panel-plugin-boilerplate-es5/module.js → examples/panel-boilerplate-es5/module.js


+ 0 - 0
examples/panel-plugin-boilerplate-es5/panel.html → examples/panel-boilerplate-es5/panel.html


+ 0 - 0
examples/panel-plugin-boilerplate-es5/plugin.json → examples/panel-boilerplate-es5/plugin.json


+ 0 - 0
public/app/grafana.ts → public/app/app.ts


+ 2 - 2
public/app/boot.js

@@ -1,8 +1,8 @@
 (function bootGrafana() {
   'use strict';
 
-  System.import('app/grafana').then(function(grafana) {
-    grafana.default.init();
+  System.import('app/app').then(function(app) {
+    app.default.init();
   }).catch(function(err) {
     console.log('Loading app module failed: ', err);
   });

+ 1 - 1
tasks/systemjs_task.js

@@ -11,7 +11,7 @@ module.exports = function(grunt) {
     console.log('Starting systemjs-builder');
 
     var modules = [
-      'app/grafana',
+      'app/app',
       'app/features/all',
       'app/plugins/panel/**/module',
       'app/plugins/datasource/graphite/datasource',