mirror of
https://github.com/grafana/grafana.git
synced 2025-01-07 22:53:56 -06:00
feat(plugins): working on plugin examples
This commit is contained in:
parent
e9982bb27e
commit
5b9ed82d29
0
examples/nginx-app/css/dark.css
Normal file
0
examples/nginx-app/css/dark.css
Normal file
0
examples/nginx-app/css/light.css
Normal file
0
examples/nginx-app/css/light.css
Normal file
BIN
examples/nginx-app/img/logo_large.png
Normal file
BIN
examples/nginx-app/img/logo_large.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
examples/nginx-app/img/logo_small.png
Normal file
BIN
examples/nginx-app/img/logo_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
28
examples/nginx-app/module.js
Normal file
28
examples/nginx-app/module.js
Normal file
@ -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
examples/nginx-app/panel/module.js
Normal file
21
examples/nginx-app/panel/module.js
Normal file
@ -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
examples/nginx-app/panel/plugin.json
Normal file
6
examples/nginx-app/panel/plugin.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "panel",
|
||||
"name": "Nginx Panel",
|
||||
"id": "nginx-panel",
|
||||
"staticRoot": "."
|
||||
}
|
1
examples/nginx-app/partials/config.html
Normal file
1
examples/nginx-app/partials/config.html
Normal file
@ -0,0 +1 @@
|
||||
<h2>nginx config</h2>
|
12
examples/nginx-app/partials/stream.html
Normal file
12
examples/nginx-app/partials/stream.html
Normal file
@ -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
examples/nginx-app/plugin.json
Normal file
44
examples/nginx-app/plugin.json
Normal file
@ -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"}
|
||||
]
|
||||
}
|
||||
}
|
@ -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);
|
||||
});
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user