Skip to content

Commit

Permalink
feat(plugins): working on plugin examples
Browse files Browse the repository at this point in the history
  • Loading branch information
torkelo committed Feb 9, 2016
1 parent f4e90df commit 82d5d1b
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 3 deletions.
Empty file added examples/nginx-app/css/dark.css
Empty file.
Empty file.
Binary file added examples/nginx-app/img/logo_large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/nginx-app/img/logo_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions examples/nginx-app/module.js
Original file line number Diff line number Diff line change
@@ -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 changes: 21 additions & 0 deletions examples/nginx-app/panel/module.js
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions examples/nginx-app/panel/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "panel",
"name": "Nginx Panel",
"id": "nginx-panel",
"staticRoot": "."
}
1 change: 1 addition & 0 deletions examples/nginx-app/partials/config.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h2>nginx config</h2>
12 changes: 12 additions & 0 deletions examples/nginx-app/partials/stream.html
Original file line number Diff line number Diff line change
@@ -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 changes: 44 additions & 0 deletions examples/nginx-app/plugin.json
Original file line number Diff line number Diff line change
@@ -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"}
]
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions public/app/boot.js
Original file line number Diff line number Diff line change
@@ -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);
});
Expand Down
2 changes: 1 addition & 1 deletion tasks/systemjs_task.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 82d5d1b

Please sign in to comment.