commit
bdd380e66d
50 changed files with 117056 additions and 0 deletions
@ -0,0 +1,45 @@ |
|||||
|
# Instalación y backup de GITEA |
||||
|
|
||||
|
En esta documentación se detallará como realizar la instalación de GITEA mediante docker y también como realizar un backup del mismo o restaurarlo mendiando un archivo .sql. El tiempo estimado de descarga e instalación de la base de datos y el servicio GITEA mediante docker es de 3:30 minutos en una Raspberry. |
||||
|
|
||||
|
|
||||
|
|
||||
|
### Pre-requisitos 📋 |
||||
|
|
||||
|
_Para poder realizar la instalación de gitea es necesario tener instalado en nuestro terminal Docker y Docker Compose. Acceda a [Instalación de docker y docker compose](http://fabrica.faniot.ar:90/Soporte/docker-raspberry) para más detalles._ |
||||
|
|
||||
|
|
||||
|
### Instalación 🔧 |
||||
|
|
||||
|
_Se deberá ejecutar el archivo docker-compose.yml para que este comience el proceso de descarga e instalación de GITEA y la base de datos Postgres._ |
||||
|
|
||||
|
|
||||
|
|
||||
|
``` |
||||
|
docker-compose up -d |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
_Una vez terminado el servicio quedará establecido en el puerto 3000 por defecto, puede cambiarse este puerto por otro editando el archivo docker-compose.yml._ |
||||
|
|
||||
|
|
||||
|
## Backup 💽 |
||||
|
_Para poder realizar o cargar un backcup es necesario haber instalado previamente el servidor gitea con su base de datos postgres mediante docker._ |
||||
|
|
||||
|
_Una vez descargado el archivo "backup-gitea.sh" deberá ejecutarlo en su terminal de la siguiente manera:_ |
||||
|
|
||||
|
``` |
||||
|
sudo sh backup-gitea.sh |
||||
|
``` |
||||
|
|
||||
|
_Una vez ejecutado siga las instrucciones provistas por el script para poder realizar la carga o descarga de su backup de la base de datos Postgres._ |
||||
|
|
||||
|
## Autores ✒️ |
||||
|
|
||||
|
|
||||
|
* **Matias Gonzalez** - desarrollo de script y documentación - [matias.gonzalez](http://fabrica.faniot.ar:90/matias.gonzalez) |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
--- |
||||
@ -0,0 +1,23 @@ |
|||||
|
version: '3.5' |
||||
|
services: |
||||
|
grafana: |
||||
|
image: grafana/grafana |
||||
|
container_name: grafana |
||||
|
restart: on-failure |
||||
|
ports: |
||||
|
- "3000:3000" |
||||
|
volumes: |
||||
|
# Dados persistentes. |
||||
|
# sudo mkdir -p /srv/docker/grafana/data; chown 472:472 /srv/docker/grafana/data |
||||
|
- /etc/timezone:/etc/timezone:ro |
||||
|
- ./srv/docker/grafana/data:/var/lib/grafana |
||||
|
|
||||
|
influxdb: |
||||
|
image: influxdb:latest |
||||
|
volumes: |
||||
|
- /Users/anaisdotis-georgiou/temp/influxdb2:/var/lib/influxdb2:rw |
||||
|
|
||||
|
ports: |
||||
|
- "8086:8086" |
||||
|
|
||||
|
restart: always |
||||
@ -0,0 +1,48 @@ |
|||||
|
|
||||
|
-----BEGIN PGP SIGNED MESSAGE----- |
||||
|
Hash: SHA512 |
||||
|
|
||||
|
{ |
||||
|
"manifestVersion": "2.0.0", |
||||
|
"signatureType": "community", |
||||
|
"signedByOrg": "grafana", |
||||
|
"signedByOrgName": "Grafana Labs", |
||||
|
"plugin": "aidanmountford-html-panel", |
||||
|
"version": "0.0.2", |
||||
|
"time": 1622740782947, |
||||
|
"keyId": "7e4d0c6a708866e7", |
||||
|
"files": { |
||||
|
"html_ctrl.js.map": "2caa41a34fb44fe6ac995e3c02fd3f8b90ed3ec1af4ac0e61591fc07c1c70cb9", |
||||
|
"polyfills.js.map": "bd92906901a9efe75ef42440dd3b880209a72a89fc2c14e2fd426118b7685e47", |
||||
|
"module.html": "891328f0269753ae1f11b943373e1572b85811a811289121f9b32289ce9b80a6", |
||||
|
"polyfills.js": "95ffd32d521681abd91d9caafe24a57f738b8ab0be76efc8d86ec9ddbd20ed3c", |
||||
|
"node_modules/brace/mode/javascript.js": "f8c8d44e800efbf80b582d8c6db982a9a48ffa0d23657e6e5bdd4899b2e57f2d", |
||||
|
"node_modules/brace/ext/language_tools.js": "7c1a9d963abde5494275bbdae5b29db37a4957f75c6506b7c131311948a30c80", |
||||
|
"node_modules/brace/index.js": "edd3c9f1853ff8272c2d2a116b31eb38746456622ab7914dfccd18c011914887", |
||||
|
"node_modules/brace/theme/tomorrow_night_bright.js": "0a4157986e2b120f2541e5a964d9b5311d83967bede7cac3ce5af0309c14f67d", |
||||
|
"node_modules/brace/worker/xml.js": "10068d244c1d0fd625022383db87b96f8ec8d56ccc931db8e8a718cc674e8131", |
||||
|
"node_modules/brace/worker/javascript.js": "5b0bb2f2c64a76de270922b44f9ab00c9e5f76b3e258d3b81ab7c8e975af76bf", |
||||
|
"module.js.map": "d16ef858d51f67f86cc58682c7c0b5f3100fa1fdd668c20b2bddef51f4901d21", |
||||
|
"rendering.js": "ab18abffcfc566008b92d2146c5926b5f90f7629f5720e1f53eee528075a4caf", |
||||
|
"html_ctrl.js": "1dea91ad0eba1ae6623b4bd7e1b574f9b1f974c78800df053c0094e047b0b462", |
||||
|
"plugin.json": "008bac96f07a194cc074351445a19c05bfbe8e7308825cb31f71336b80ff0847", |
||||
|
"rendering.js.map": "d9694ce64ed91c2a47e05508eb426492bdff4af101820a85af2ec20670938bcb", |
||||
|
"README.md": "96d52b6bf0070dabc20c729ac747a27058e3679953789bd50d692cdd68178c31", |
||||
|
"img/html-panel-logo-small.png": "2a3a73dc38347509ecd8f86c48b84d2841e2d026a56e792a44d6b2a363e5e4bc", |
||||
|
"img/html-panel-logo-large.png": "0b5dbc5e9ddbe2ff862a19d86e892eeeafbc916e74ccf7f7b91781e550c0239f", |
||||
|
"module.js": "30da21790a2b913b37f254eea02544f43de7437af333664a0e7db5ffcd377ae1", |
||||
|
"partials/blank.html": "6adc175599a335b096705123a42bd8b873ff0a69e8fe8ada62c1b10ac774b9e1", |
||||
|
"partials/editor_html.html": "d7fae040f0727da2273c9f0d3817dffc22596616e3cb1fbe8871050576ec56a6", |
||||
|
"partials/editor_events.html": "7ecd3ca6835a70b85751576db62da59b4d69beb69b43d0e8246ae03b90125493" |
||||
|
} |
||||
|
} |
||||
|
-----BEGIN PGP SIGNATURE----- |
||||
|
Version: OpenPGP.js v4.10.1 |
||||
|
Comment: https://openpgpjs.org |
||||
|
|
||||
|
wqEEARMKAAYFAmC5Dy8ACgkQfk0ManCIZuf3IgIJAUnxgbov9bdOMFFg0x5N |
||||
|
Hg69HgJdtibsEdQj8kuSrQcLTqdAFVtoFXaG8fpf9RFRL0tE81o4NL9zZ2cD |
||||
|
VoXlofZSAgd8Db9chuOGZI4R7tjmcGMhrFInc+NQwSsbx2HIM7ei7Kd25xIv |
||||
|
qe4tfbBW3f9UH73L0O8cIJCINPD4PS7A2LYang== |
||||
|
=dR0M |
||||
|
-----END PGP SIGNATURE----- |
||||
@ -0,0 +1,98 @@ |
|||||
|
# Summary |
||||
|
Grafana panel for displaying metric sensitive or arbitary HTML. |
||||
|
|
||||
|
This only works with Grafana 3.X or later |
||||
|
|
||||
|
The control allows the specification of CSS, HTML and JS for |
||||
|
both initialisation and metric updates. |
||||
|
|
||||
|
This is based on the work by Marcus Calidus and the SVG plugin. |
||||
|
|
||||
|
|
||||
|
|
||||
|
## Installation |
||||
|
|
||||
|
It is possible to clone this repo directly into your plugins directory. |
||||
|
(var/lib/grafana/plugins) |
||||
|
|
||||
|
Afterwards restart grafana-server and the plugin should be automatically detected and used. |
||||
|
|
||||
|
``` |
||||
|
npm install |
||||
|
grunt |
||||
|
sudo service grafana-server restart |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
## Clone into a directory of your choice |
||||
|
|
||||
|
If the plugin is cloned to a directory that is not the default plugins directory then you need to edit your grafana.ini config file (Default location is at /etc/grafana/grafana.ini) and add this: |
||||
|
|
||||
|
```ini |
||||
|
[plugin.svg] |
||||
|
path = /home/your/clone/dir/svg-panel |
||||
|
``` |
||||
|
|
||||
|
Note that if you clone it into the grafana plugins directory you do not need to add the above config option. That is only |
||||
|
if you want to place the plugin in a directory outside the standard plugins directory. Be aware that grafana-server |
||||
|
needs read access to the directory. |
||||
|
|
||||
|
# Options |
||||
|
|
||||
|
## HTML Data and CSS |
||||
|
|
||||
|
HTML & CSS is encapsulated in a shadow root and will therefore not "leak" outside the control. |
||||
|
|
||||
|
## Events |
||||
|
### onHandleMetric |
||||
|
this code is execute upon **every Rerfresh** |
||||
|
|
||||
|
``` |
||||
|
onHandleMetric(ctrl: MetricsPanelCtrl, svgnode: HTMLElement) |
||||
|
``` |
||||
|
|
||||
|
`ctrl` passes a grafana `MetricsPanelCtrl` object. This object contains all relevant data pertainig the current panel. |
||||
|
You may want to use the `ctrl.data` array property to access the current measurement data. |
||||
|
|
||||
|
`htmlnode` passes the HTMLElement of the html content on the panel. THis allows direct access to and editing of the html |
||||
|
content |
||||
|
|
||||
|
``` |
||||
|
htmlnode.innerHTML = "Hello World"; |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
### onInit |
||||
|
this event is executed **once**, right after the first initializiation of the SVG. |
||||
|
``` |
||||
|
onHandleMetric(ctrl: MetricsPanelCtrl, svgnode: HTMLElement) |
||||
|
``` |
||||
|
|
||||
|
`ctrl` passes a grafana `MetricsPanelCtrl` object. This object contains all relevant data pertainig the current panel. |
||||
|
You may want to use the `ctrl.data` array property to access the current measurement data. |
||||
|
|
||||
|
`htmlnode` passes the HTMLElement of the html content on the panel. THis allows direct access to and editing of the html |
||||
|
|
||||
|
``` |
||||
|
htmlnode.innerHTML = "Hello World"; |
||||
|
``` |
||||
|
|
||||
|
# Changelog |
||||
|
|
||||
|
## 0.0.1 |
||||
|
* Initial build |
||||
|
|
||||
|
|
||||
|
# To do |
||||
|
|
||||
|
* Fix syntax highlighting for CSS and HTML |
||||
|
* Build "code snippet" library to allow commonly used HTML constructs to be stored and retrieved (including the relevant CSS and JS) |
||||
|
|
||||
|
|
||||
|
# Attributions |
||||
|
|
||||
|
## Marcus Calidus |
||||
|
SVG Grafana plugin on which this HTML plugin is based |
||||
|
|
||||
|
## Simran Singh |
||||
|
Icons used in this plugin |
||||
@ -0,0 +1,491 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
System.register(['app/plugins/sdk', 'lodash', 'app/core/utils/kbn', 'app/core/time_series', './rendering', './node_modules/brace/index.js', './node_modules/brace/ext/language_tools.js', './node_modules/brace/theme/tomorrow_night_bright.js', './node_modules/brace/mode/javascript.js'], function (_export, _context) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var MetricsPanelCtrl, _, kbn, TimeSeries, rendering, ace, _typeof, _createClass, GrafanaJSCompleter, HTMLCtrl; |
||||
|
|
||||
|
function _possibleConstructorReturn(self, call) { |
||||
|
if (!self) { |
||||
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
||||
|
} |
||||
|
|
||||
|
return call && (typeof call === "object" || typeof call === "function") ? call : self; |
||||
|
} |
||||
|
|
||||
|
function _inherits(subClass, superClass) { |
||||
|
if (typeof superClass !== "function" && superClass !== null) { |
||||
|
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); |
||||
|
} |
||||
|
|
||||
|
subClass.prototype = Object.create(superClass && superClass.prototype, { |
||||
|
constructor: { |
||||
|
value: subClass, |
||||
|
enumerable: false, |
||||
|
writable: true, |
||||
|
configurable: true |
||||
|
} |
||||
|
}); |
||||
|
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; |
||||
|
} |
||||
|
|
||||
|
function _classCallCheck(instance, Constructor) { |
||||
|
if (!(instance instanceof Constructor)) { |
||||
|
throw new TypeError("Cannot call a class as a function"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return { |
||||
|
setters: [function (_appPluginsSdk) { |
||||
|
MetricsPanelCtrl = _appPluginsSdk.MetricsPanelCtrl; |
||||
|
}, function (_lodash) { |
||||
|
_ = _lodash.default; |
||||
|
}, function (_appCoreUtilsKbn) { |
||||
|
kbn = _appCoreUtilsKbn.default; |
||||
|
}, function (_appCoreTime_series) { |
||||
|
TimeSeries = _appCoreTime_series.default; |
||||
|
}, function (_rendering) { |
||||
|
rendering = _rendering.default; |
||||
|
}, function (_node_modulesBraceIndexJs) { |
||||
|
ace = _node_modulesBraceIndexJs.default; |
||||
|
}, function (_node_modulesBraceExtLanguage_toolsJs) {}, function (_node_modulesBraceThemeTomorrow_night_brightJs) {}, function (_node_modulesBraceModeJavascriptJs) {}], |
||||
|
execute: function () { |
||||
|
_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { |
||||
|
return typeof obj; |
||||
|
} : function (obj) { |
||||
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; |
||||
|
}; |
||||
|
|
||||
|
_createClass = function () { |
||||
|
function defineProperties(target, props) { |
||||
|
for (var i = 0; i < props.length; i++) { |
||||
|
var descriptor = props[i]; |
||||
|
descriptor.enumerable = descriptor.enumerable || false; |
||||
|
descriptor.configurable = true; |
||||
|
if ("value" in descriptor) descriptor.writable = true; |
||||
|
Object.defineProperty(target, descriptor.key, descriptor); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return function (Constructor, protoProps, staticProps) { |
||||
|
if (protoProps) defineProperties(Constructor.prototype, protoProps); |
||||
|
if (staticProps) defineProperties(Constructor, staticProps); |
||||
|
return Constructor; |
||||
|
}; |
||||
|
}(); |
||||
|
|
||||
|
GrafanaJSCompleter = function () { |
||||
|
function GrafanaJSCompleter($lang_tools, $control, $panel) { |
||||
|
_classCallCheck(this, GrafanaJSCompleter); |
||||
|
|
||||
|
this.$lang_tools = $lang_tools; |
||||
|
this.$control = $control; |
||||
|
this.$panel = $panel; |
||||
|
} |
||||
|
|
||||
|
_createClass(GrafanaJSCompleter, [{ |
||||
|
key: 'getCompletions', |
||||
|
value: function getCompletions(editor, session, pos, prefix, callback) { |
||||
|
var pos = editor.getCursorPosition(); |
||||
|
var line = editor.session.getLine(pos.row); |
||||
|
|
||||
|
prefix = line.substring(0, pos.column).match(/this\.\S*/g); |
||||
|
if (prefix) { |
||||
|
prefix = prefix[prefix.length - 1]; |
||||
|
prefix = prefix.substring(0, prefix.lastIndexOf('.')); |
||||
|
|
||||
|
var panelthis = this.$panel; |
||||
|
var evalObj = eval('panel' + prefix); |
||||
|
this.evaluatePrefix(evalObj, callback); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
prefix = line.substring(0, pos.column).match(/ctrl\.\S*/g); |
||||
|
if (prefix) { |
||||
|
prefix = prefix[prefix.length - 1]; |
||||
|
prefix = prefix.substring(0, prefix.lastIndexOf('.')); |
||||
|
|
||||
|
var ctrl = this.$control; |
||||
|
var evalObj = eval(prefix); |
||||
|
this.evaluatePrefix(evalObj, callback); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
prefix = line.substring(0, pos.column).match(/htmlnode\.\S*/g); |
||||
|
if (prefix) { |
||||
|
prefix = prefix[prefix.length - 1]; |
||||
|
prefix = prefix.substring(0, prefix.lastIndexOf('.')); |
||||
|
|
||||
|
var htmlnode = document.querySelector('.html-object'); |
||||
|
var evalObj = eval(prefix); |
||||
|
this.evaluatePrefix(evalObj, callback); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (prefix == '') { |
||||
|
var wordList = ['ctrl', 'htmlnode', 'this']; |
||||
|
|
||||
|
callback(null, wordList.map(function (word) { |
||||
|
return { |
||||
|
caption: word, |
||||
|
value: word, |
||||
|
meta: 'Grafana keyword' |
||||
|
}; |
||||
|
})); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: 'evaluatePrefix', |
||||
|
value: function evaluatePrefix(evalObj, callback) { |
||||
|
var wordList = []; |
||||
|
for (var key in evalObj) { |
||||
|
wordList.push(key); |
||||
|
} |
||||
|
callback(null, wordList.map(function (word) { |
||||
|
return { |
||||
|
caption: word + ': ' + (Array.isArray(evalObj[word]) ? 'Array[' + (evalObj[word] || []).length + ']' : _typeof(evalObj[word])), |
||||
|
value: word, |
||||
|
meta: "Grafana keyword" |
||||
|
}; |
||||
|
})); |
||||
|
return; |
||||
|
} |
||||
|
}]); |
||||
|
|
||||
|
return GrafanaJSCompleter; |
||||
|
}(); |
||||
|
|
||||
|
_export('HTMLCtrl', HTMLCtrl = function (_MetricsPanelCtrl) { |
||||
|
_inherits(HTMLCtrl, _MetricsPanelCtrl); |
||||
|
|
||||
|
function HTMLCtrl($scope, $injector, $rootScope) { |
||||
|
_classCallCheck(this, HTMLCtrl); |
||||
|
|
||||
|
var _this = _possibleConstructorReturn(this, (HTMLCtrl.__proto__ || Object.getPrototypeOf(HTMLCtrl)).call(this, $scope, $injector)); |
||||
|
|
||||
|
_this.$rootScope = $rootScope; |
||||
|
|
||||
|
var panelDefaults = { |
||||
|
links: [], |
||||
|
datasource: null, |
||||
|
maxDataPoints: 3, |
||||
|
interval: null, |
||||
|
targets: [{}], |
||||
|
cacheTimeout: null, |
||||
|
nullPointMode: 'connected', |
||||
|
aliasColors: {}, |
||||
|
format: 'short', |
||||
|
|
||||
|
css_data: '', |
||||
|
html_data: '', |
||||
|
js_code: '', |
||||
|
js_init_code: '' |
||||
|
}; |
||||
|
|
||||
|
_.defaults(_this.panel, panelDefaults); |
||||
|
|
||||
|
_this.events.on('render', _this.onRender.bind(_this)); |
||||
|
_this.events.on('refresh', _this.onRender.bind(_this)); |
||||
|
_this.events.on('data-received', _this.onDataReceived.bind(_this)); |
||||
|
_this.events.on('data-error', _this.onDataError.bind(_this)); |
||||
|
_this.events.on('data-snapshot-load', _this.onDataReceived.bind(_this)); |
||||
|
_this.events.on('init-edit-mode', _this.onInitEditMode.bind(_this)); |
||||
|
|
||||
|
_this.initialized = 0; |
||||
|
_this.editors = {}; |
||||
|
return _this; |
||||
|
} |
||||
|
|
||||
|
_createClass(HTMLCtrl, [{ |
||||
|
key: 'onInitEditMode', |
||||
|
value: function onInitEditMode() { |
||||
|
this.addEditorTab('HTML', 'public/plugins/aidanmountford-html-panel/partials/editor_html.html', 2); |
||||
|
this.addEditorTab('Events', 'public/plugins/aidanmountford-html-panel/partials/editor_events.html', 3); |
||||
|
this.unitFormats = kbn.getUnitFormats(); |
||||
|
this.aceLangTools = ace.acequire("ace/ext/language_tools"); |
||||
|
this.aceLangTools.addCompleter(new GrafanaJSCompleter(this.aceLangTools, this, this.panel)); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'doShowAceHtml', |
||||
|
value: function doShowAceHtml(nodeId) { |
||||
|
setTimeout(function () { |
||||
|
if ($('#' + nodeId).length === 1) { |
||||
|
this.editors[nodeId] = ace.edit(nodeId); |
||||
|
$('#' + nodeId).attr('id', nodeId + '_initialized'); |
||||
|
this.editors[nodeId].setValue(this.panel[nodeId], 1); |
||||
|
this.editors[nodeId].getSession().on('change', function () { |
||||
|
var val = this.editors[nodeId].getSession().getValue(); |
||||
|
this.panel[nodeId] = val; |
||||
|
try { |
||||
|
this.resetHTML(); |
||||
|
this.render(); |
||||
|
} catch (err) { |
||||
|
console.error(err); |
||||
|
} |
||||
|
}.bind(this)); |
||||
|
this.editors[nodeId].setOptions({ |
||||
|
enableBasicAutocompletion: true, |
||||
|
enableLiveAutocompletion: true, |
||||
|
theme: 'ace/theme/tomorrow_night_bright', |
||||
|
showPrintMargin: false |
||||
|
}); |
||||
|
} |
||||
|
}.bind(this), 100); |
||||
|
return true; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'doShowAceCSS', |
||||
|
value: function doShowAceCSS(nodeId) { |
||||
|
setTimeout(function () { |
||||
|
if ($('#' + nodeId).length === 1) { |
||||
|
this.editors[nodeId] = ace.edit(nodeId); |
||||
|
$('#' + nodeId).attr('id', nodeId + '_initialized'); |
||||
|
this.editors[nodeId].setValue(this.panel[nodeId], 1); |
||||
|
this.editors[nodeId].getSession().on('change', function () { |
||||
|
var val = this.editors[nodeId].getSession().getValue(); |
||||
|
this.panel[nodeId] = val; |
||||
|
try { |
||||
|
this.resetHTML(); |
||||
|
this.render(); |
||||
|
} catch (err) { |
||||
|
console.error(err); |
||||
|
} |
||||
|
}.bind(this)); |
||||
|
this.editors[nodeId].setOptions({ |
||||
|
enableBasicAutocompletion: true, |
||||
|
enableLiveAutocompletion: true, |
||||
|
theme: 'ace/theme/tomorrow_night_bright', |
||||
|
showPrintMargin: false |
||||
|
}); |
||||
|
} |
||||
|
}.bind(this), 100); |
||||
|
return true; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'doShowAceJs', |
||||
|
value: function doShowAceJs(nodeId) { |
||||
|
setTimeout(function () { |
||||
|
if ($('#' + nodeId).length === 1) { |
||||
|
this.editors[nodeId] = ace.edit(nodeId); |
||||
|
$('#' + nodeId).attr('id', nodeId + '_initialized'); |
||||
|
this.editors[nodeId].setValue(this.panel[nodeId], 1); |
||||
|
this.editors[nodeId].getSession().on('change', function () { |
||||
|
var val = this.editors[nodeId].getSession().getValue(); |
||||
|
this.panel[nodeId] = val; |
||||
|
try { |
||||
|
this.setInitFunction(); |
||||
|
this.setHandleMetricFunction(); |
||||
|
this.render(); |
||||
|
} catch (err) { |
||||
|
console.error(err); |
||||
|
} |
||||
|
}.bind(this)); |
||||
|
this.editors[nodeId].setOptions({ |
||||
|
enableBasicAutocompletion: true, |
||||
|
enableLiveAutocompletion: true, |
||||
|
theme: 'ace/theme/tomorrow_night_bright', |
||||
|
mode: 'ace/mode/javascript', |
||||
|
showPrintMargin: false |
||||
|
}); |
||||
|
} |
||||
|
}.bind(this), 100); |
||||
|
return true; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'setUnitFormat', |
||||
|
value: function setUnitFormat(subItem) { |
||||
|
this.panel.format = subItem.value; |
||||
|
this.render(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'onDataError', |
||||
|
value: function onDataError() { |
||||
|
this.data = []; |
||||
|
this.render(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'changeSeriesColor', |
||||
|
value: function changeSeriesColor(series, color) { |
||||
|
series.color = color; |
||||
|
this.panel.aliasColors[series.alias] = series.color; |
||||
|
this.render(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'setHandleMetricFunction', |
||||
|
value: function setHandleMetricFunction() { |
||||
|
this.panel.handleMetric = Function('ctrl', 'htmlnode', this.panel.js_code); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'setInitFunction', |
||||
|
value: function setInitFunction() { |
||||
|
this.initialized = 0; |
||||
|
this.panel.doInit = Function('ctrl', 'htmlnode', this.panel.js_init_code); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'onRender', |
||||
|
value: function onRender() { |
||||
|
if (!_.isFunction(this.panel.handleMetric)) { |
||||
|
this.setHandleMetricFunction(); |
||||
|
} |
||||
|
|
||||
|
if (!_.isFunction(this.panel.doInit)) { |
||||
|
this.setInitFunction(); |
||||
|
} |
||||
|
} |
||||
|
}, { |
||||
|
key: 'onDataReceived', |
||||
|
value: function onDataReceived(dataList) { |
||||
|
this.data = []; |
||||
|
|
||||
|
if (dataList.length > 0 && dataList[0].type === 'table') { |
||||
|
this.data = dataList.map(this.tableHandler.bind(this)); |
||||
|
this.table = this.data; // table should be regarded as deprecated
|
||||
|
} else if (dataList.length > 0 && dataList[0].type === 'docs') { |
||||
|
this.data = dataList.map(this.docsHandler.bind(this)); |
||||
|
} else { |
||||
|
this.data = dataList.map(this.seriesHandler.bind(this)); |
||||
|
this.series = this.data; // series should be regarded as deprectated
|
||||
|
} |
||||
|
|
||||
|
this.render(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'resetHTML', |
||||
|
value: function resetHTML() { |
||||
|
this.initialized = 0; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'seriesHandler', |
||||
|
value: function seriesHandler(seriesData) { |
||||
|
var series = new TimeSeries({ |
||||
|
datapoints: seriesData.datapoints, |
||||
|
alias: seriesData.target |
||||
|
}); |
||||
|
|
||||
|
series.flotpairs = series.getFlotPairs(this.panel.nullPointMode); |
||||
|
return series; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'docsHandler', |
||||
|
value: function docsHandler(seriesData) { |
||||
|
return seriesData; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'tableHandler', |
||||
|
value: function tableHandler(tableData) { |
||||
|
|
||||
|
var columnNames = tableData.columns.map(function (column) { |
||||
|
return column.text; |
||||
|
}); |
||||
|
|
||||
|
var rows = tableData.rows.map(function (row) { |
||||
|
var datapoint = {}; |
||||
|
|
||||
|
row.forEach(function (value, columnIndex) { |
||||
|
var key = columnNames[columnIndex]; |
||||
|
datapoint[key] = value; |
||||
|
}); |
||||
|
|
||||
|
return datapoint; |
||||
|
}); |
||||
|
|
||||
|
return { columnNames: columnNames, rows: rows }; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'getSeriesIdByAlias', |
||||
|
value: function getSeriesIdByAlias(aliasName) { |
||||
|
for (var i = 0; i < this.data.length; i++) { |
||||
|
if (this.data[i].alias == aliasName) { |
||||
|
return i; |
||||
|
} |
||||
|
} |
||||
|
return -1; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'getSeriesElementByAlias', |
||||
|
value: function getSeriesElementByAlias(aliasName) { |
||||
|
var i = this.getSeriesIdByAlias(aliasName); |
||||
|
if (i >= 0) { |
||||
|
return this.data[i]; |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'getDecimalsForValue', |
||||
|
value: function getDecimalsForValue(value) { |
||||
|
if (_.isNumber(this.panel.decimals)) { |
||||
|
return { decimals: this.panel.decimals, scaledDecimals: null }; |
||||
|
} |
||||
|
|
||||
|
var delta = value / 2; |
||||
|
var dec = -Math.floor(Math.log(delta) / Math.LN10); |
||||
|
|
||||
|
var magn = Math.pow(10, -dec); |
||||
|
var norm = delta / magn; // norm is between 1.0 and 10.0
|
||||
|
var size; |
||||
|
|
||||
|
if (norm < 1.5) { |
||||
|
size = 1; |
||||
|
} else if (norm < 3) { |
||||
|
size = 2; |
||||
|
// special case for 2.5, requires an extra decimal
|
||||
|
if (norm > 2.25) { |
||||
|
size = 2.5; |
||||
|
++dec; |
||||
|
} |
||||
|
} else if (norm < 7.5) { |
||||
|
size = 5; |
||||
|
} else { |
||||
|
size = 10; |
||||
|
} |
||||
|
|
||||
|
size *= magn; |
||||
|
|
||||
|
// reduce starting decimals if not needed
|
||||
|
if (Math.floor(value) === value) { |
||||
|
dec = 0; |
||||
|
} |
||||
|
|
||||
|
var result = {}; |
||||
|
result.decimals = Math.max(0, dec); |
||||
|
result.scaledDecimals = result.decimals - Math.floor(Math.log(size) / Math.LN10) + 2; |
||||
|
|
||||
|
return result; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'formatValue', |
||||
|
value: function formatValue(value) { |
||||
|
var decimalInfo = this.getDecimalsForValue(value); |
||||
|
var formatFunc = kbn.valueFormats[this.panel.format]; |
||||
|
if (formatFunc) { |
||||
|
return formatFunc(value, decimalInfo.decimals, decimalInfo.scaledDecimals); |
||||
|
} |
||||
|
return value; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'formatValueWithFormatter', |
||||
|
value: function formatValueWithFormatter(value, formatter) { |
||||
|
var decimalInfo = this.getDecimalsForValue(value); |
||||
|
var formatFunc = kbn.valueFormats[formatter]; |
||||
|
if (formatFunc) { |
||||
|
return formatFunc(value, decimalInfo.decimals, decimalInfo.scaledDecimals); |
||||
|
} |
||||
|
return value; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'link', |
||||
|
value: function link(scope, elem, attrs, ctrl) { |
||||
|
rendering(scope, elem, attrs, ctrl); |
||||
|
} |
||||
|
}]); |
||||
|
|
||||
|
return HTMLCtrl; |
||||
|
}(MetricsPanelCtrl)); |
||||
|
|
||||
|
_export('HTMLCtrl', HTMLCtrl); |
||||
|
|
||||
|
HTMLCtrl.templateUrl = 'module.html'; |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
|
//# sourceMappingURL=html_ctrl.js.map
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,15 @@ |
|||||
|
<div class="graph-canvas-wrapper"> |
||||
|
<div class="html-panel" style="position: relative; padding: 0;"> |
||||
|
<div class="plot-canvas" style="top: 10px;margin: auto;position: relative; height: 100px"> |
||||
|
<table style="height: 100%; width:100%"> |
||||
|
<tr style="height: 100%; width:100%"> |
||||
|
<td style="height: 100%; width:100%"> |
||||
|
<div class="html-object" data="/public/plugins/aidanmountford-html-panel/partials/blank.html" style="height:100%; width:100%"></div> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="clearfix"></div> |
||||
|
|
||||
@ -0,0 +1,19 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
System.register(['./polyfills.js', 'lodash', './html_ctrl'], function (_export, _context) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var _, HTMLCtrl; |
||||
|
|
||||
|
return { |
||||
|
setters: [function (_polyfillsJs) {}, function (_lodash) { |
||||
|
_ = _lodash.default; |
||||
|
}, function (_html_ctrl) { |
||||
|
HTMLCtrl = _html_ctrl.HTMLCtrl; |
||||
|
}], |
||||
|
execute: function () { |
||||
|
_export('PanelCtrl', HTMLCtrl); |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
|
//# sourceMappingURL=module.js.map
|
||||
@ -0,0 +1 @@ |
|||||
|
{"version":3,"sources":["../src/module.js"],"names":["_","HTMLCtrl"],"mappings":";;;;;;;;;AACOA,a;;AACEC,oB,cAAAA,Q;;;iCAGLA,Q","file":"module.js","sourcesContent":["import './polyfills.js';\nimport _ from 'lodash';\nimport { HTMLCtrl } from './html_ctrl';\n\nexport {\n HTMLCtrl as PanelCtrl\n};\n"]} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,789 @@ |
|||||
|
ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var oop = acequire("../lib/oop"); |
||||
|
var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules; |
||||
|
|
||||
|
var DocCommentHighlightRules = function() { |
||||
|
this.$rules = { |
||||
|
"start" : [ { |
||||
|
token : "comment.doc.tag", |
||||
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
||||
|
}, |
||||
|
DocCommentHighlightRules.getTagRule(), |
||||
|
{ |
||||
|
defaultToken : "comment.doc", |
||||
|
caseInsensitive: true |
||||
|
}] |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules); |
||||
|
|
||||
|
DocCommentHighlightRules.getTagRule = function(start) { |
||||
|
return { |
||||
|
token : "comment.doc.tag.storage.type", |
||||
|
regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b" |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
DocCommentHighlightRules.getStartRule = function(start) { |
||||
|
return { |
||||
|
token : "comment.doc", // doc comment
|
||||
|
regex : "\\/\\*(?=\\*)", |
||||
|
next : start |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
DocCommentHighlightRules.getEndRule = function (start) { |
||||
|
return { |
||||
|
token : "comment.doc", // closing comment
|
||||
|
regex : "\\*\\/", |
||||
|
next : start |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
exports.DocCommentHighlightRules = DocCommentHighlightRules; |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(acequire, exports, module) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var oop = acequire("../lib/oop"); |
||||
|
var DocCommentHighlightRules = acequire("./doc_comment_highlight_rules").DocCommentHighlightRules; |
||||
|
var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules; |
||||
|
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*"; |
||||
|
|
||||
|
var JavaScriptHighlightRules = function(options) { |
||||
|
var keywordMapper = this.createKeywordMapper({ |
||||
|
"variable.language": |
||||
|
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
|
||||
|
"Namespace|QName|XML|XMLList|" + // E4X
|
||||
|
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + |
||||
|
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + |
||||
|
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
|
||||
|
"SyntaxError|TypeError|URIError|" + |
||||
|
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
|
||||
|
"isNaN|parseFloat|parseInt|" + |
||||
|
"JSON|Math|" + // Other
|
||||
|
"this|arguments|prototype|window|document" , // Pseudo
|
||||
|
"keyword": |
||||
|
"const|yield|import|get|set|async|await|" + |
||||
|
"break|case|catch|continue|default|delete|do|else|finally|for|function|" + |
||||
|
"if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + |
||||
|
"__parent__|__count__|escape|unescape|with|__proto__|" + |
||||
|
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static", |
||||
|
"storage.type": |
||||
|
"const|let|var|function", |
||||
|
"constant.language": |
||||
|
"null|Infinity|NaN|undefined", |
||||
|
"support.function": |
||||
|
"alert", |
||||
|
"constant.language.boolean": "true|false" |
||||
|
}, "identifier"); |
||||
|
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; |
||||
|
|
||||
|
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
|
||||
|
"u[0-9a-fA-F]{4}|" + // unicode
|
||||
|
"u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
|
||||
|
"[0-2][0-7]{0,2}|" + // oct
|
||||
|
"3[0-7][0-7]?|" + // oct
|
||||
|
"[4-7][0-7]?|" + //oct
|
||||
|
".)"; |
||||
|
|
||||
|
this.$rules = { |
||||
|
"no_regex" : [ |
||||
|
DocCommentHighlightRules.getStartRule("doc-start"), |
||||
|
comments("no_regex"), |
||||
|
{ |
||||
|
token : "string", |
||||
|
regex : "'(?=.)", |
||||
|
next : "qstring" |
||||
|
}, { |
||||
|
token : "string", |
||||
|
regex : '"(?=.)', |
||||
|
next : "qqstring" |
||||
|
}, { |
||||
|
token : "constant.numeric", // hexadecimal, octal and binary
|
||||
|
regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ |
||||
|
}, { |
||||
|
token : "constant.numeric", // decimal integers and floats
|
||||
|
regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/ |
||||
|
}, { |
||||
|
token : [ |
||||
|
"storage.type", "punctuation.operator", "support.function", |
||||
|
"punctuation.operator", "entity.name.function", "text","keyword.operator" |
||||
|
], |
||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", |
||||
|
next: "function_arguments" |
||||
|
}, { |
||||
|
token : [ |
||||
|
"storage.type", "punctuation.operator", "entity.name.function", "text", |
||||
|
"keyword.operator", "text", "storage.type", "text", "paren.lparen" |
||||
|
], |
||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", |
||||
|
next: "function_arguments" |
||||
|
}, { |
||||
|
token : [ |
||||
|
"entity.name.function", "text", "keyword.operator", "text", "storage.type", |
||||
|
"text", "paren.lparen" |
||||
|
], |
||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", |
||||
|
next: "function_arguments" |
||||
|
}, { |
||||
|
token : [ |
||||
|
"storage.type", "punctuation.operator", "entity.name.function", "text", |
||||
|
"keyword.operator", "text", |
||||
|
"storage.type", "text", "entity.name.function", "text", "paren.lparen" |
||||
|
], |
||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", |
||||
|
next: "function_arguments" |
||||
|
}, { |
||||
|
token : [ |
||||
|
"storage.type", "text", "entity.name.function", "text", "paren.lparen" |
||||
|
], |
||||
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", |
||||
|
next: "function_arguments" |
||||
|
}, { |
||||
|
token : [ |
||||
|
"entity.name.function", "text", "punctuation.operator", |
||||
|
"text", "storage.type", "text", "paren.lparen" |
||||
|
], |
||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", |
||||
|
next: "function_arguments" |
||||
|
}, { |
||||
|
token : [ |
||||
|
"text", "text", "storage.type", "text", "paren.lparen" |
||||
|
], |
||||
|
regex : "(:)(\\s*)(function)(\\s*)(\\()", |
||||
|
next: "function_arguments" |
||||
|
}, { |
||||
|
token : "keyword", |
||||
|
regex : "from(?=\\s*('|\"))" |
||||
|
}, { |
||||
|
token : "keyword", |
||||
|
regex : "(?:" + kwBeforeRe + ")\\b", |
||||
|
next : "start" |
||||
|
}, { |
||||
|
token : ["support.constant"], |
||||
|
regex : /that\b/ |
||||
|
}, { |
||||
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"], |
||||
|
regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/ |
||||
|
}, { |
||||
|
token : keywordMapper, |
||||
|
regex : identifierRe |
||||
|
}, { |
||||
|
token : "punctuation.operator", |
||||
|
regex : /[.](?![.])/, |
||||
|
next : "property" |
||||
|
}, { |
||||
|
token : "storage.type", |
||||
|
regex : /=>/ |
||||
|
}, { |
||||
|
token : "keyword.operator", |
||||
|
regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, |
||||
|
next : "start" |
||||
|
}, { |
||||
|
token : "punctuation.operator", |
||||
|
regex : /[?:,;.]/, |
||||
|
next : "start" |
||||
|
}, { |
||||
|
token : "paren.lparen", |
||||
|
regex : /[\[({]/, |
||||
|
next : "start" |
||||
|
}, { |
||||
|
token : "paren.rparen", |
||||
|
regex : /[\])}]/ |
||||
|
}, { |
||||
|
token: "comment", |
||||
|
regex: /^#!.*$/ |
||||
|
} |
||||
|
], |
||||
|
property: [{ |
||||
|
token : "text", |
||||
|
regex : "\\s+" |
||||
|
}, { |
||||
|
token : [ |
||||
|
"storage.type", "punctuation.operator", "entity.name.function", "text", |
||||
|
"keyword.operator", "text", |
||||
|
"storage.type", "text", "entity.name.function", "text", "paren.lparen" |
||||
|
], |
||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()", |
||||
|
next: "function_arguments" |
||||
|
}, { |
||||
|
token : "punctuation.operator", |
||||
|
regex : /[.](?![.])/ |
||||
|
}, { |
||||
|
token : "support.function", |
||||
|
regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ |
||||
|
}, { |
||||
|
token : "support.function.dom", |
||||
|
regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/ |
||||
|
}, { |
||||
|
token : "support.constant", |
||||
|
regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/ |
||||
|
}, { |
||||
|
token : "identifier", |
||||
|
regex : identifierRe |
||||
|
}, { |
||||
|
regex: "", |
||||
|
token: "empty", |
||||
|
next: "no_regex" |
||||
|
} |
||||
|
], |
||||
|
"start": [ |
||||
|
DocCommentHighlightRules.getStartRule("doc-start"), |
||||
|
comments("start"), |
||||
|
{ |
||||
|
token: "string.regexp", |
||||
|
regex: "\\/", |
||||
|
next: "regex" |
||||
|
}, { |
||||
|
token : "text", |
||||
|
regex : "\\s+|^$", |
||||
|
next : "start" |
||||
|
}, { |
||||
|
token: "empty", |
||||
|
regex: "", |
||||
|
next: "no_regex" |
||||
|
} |
||||
|
], |
||||
|
"regex": [ |
||||
|
{ |
||||
|
token: "regexp.keyword.operator", |
||||
|
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" |
||||
|
}, { |
||||
|
token: "string.regexp", |
||||
|
regex: "/[sxngimy]*", |
||||
|
next: "no_regex" |
||||
|
}, { |
||||
|
token : "invalid", |
||||
|
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ |
||||
|
}, { |
||||
|
token : "constant.language.escape", |
||||
|
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ |
||||
|
}, { |
||||
|
token : "constant.language.delimiter", |
||||
|
regex: /\|/ |
||||
|
}, { |
||||
|
token: "constant.language.escape", |
||||
|
regex: /\[\^?/, |
||||
|
next: "regex_character_class" |
||||
|
}, { |
||||
|
token: "empty", |
||||
|
regex: "$", |
||||
|
next: "no_regex" |
||||
|
}, { |
||||
|
defaultToken: "string.regexp" |
||||
|
} |
||||
|
], |
||||
|
"regex_character_class": [ |
||||
|
{ |
||||
|
token: "regexp.charclass.keyword.operator", |
||||
|
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" |
||||
|
}, { |
||||
|
token: "constant.language.escape", |
||||
|
regex: "]", |
||||
|
next: "regex" |
||||
|
}, { |
||||
|
token: "constant.language.escape", |
||||
|
regex: "-" |
||||
|
}, { |
||||
|
token: "empty", |
||||
|
regex: "$", |
||||
|
next: "no_regex" |
||||
|
}, { |
||||
|
defaultToken: "string.regexp.charachterclass" |
||||
|
} |
||||
|
], |
||||
|
"function_arguments": [ |
||||
|
{ |
||||
|
token: "variable.parameter", |
||||
|
regex: identifierRe |
||||
|
}, { |
||||
|
token: "punctuation.operator", |
||||
|
regex: "[, ]+" |
||||
|
}, { |
||||
|
token: "punctuation.operator", |
||||
|
regex: "$" |
||||
|
}, { |
||||
|
token: "empty", |
||||
|
regex: "", |
||||
|
next: "no_regex" |
||||
|
} |
||||
|
], |
||||
|
"qqstring" : [ |
||||
|
{ |
||||
|
token : "constant.language.escape", |
||||
|
regex : escapedRe |
||||
|
}, { |
||||
|
token : "string", |
||||
|
regex : "\\\\$", |
||||
|
consumeLineEnd : true |
||||
|
}, { |
||||
|
token : "string", |
||||
|
regex : '"|$', |
||||
|
next : "no_regex" |
||||
|
}, { |
||||
|
defaultToken: "string" |
||||
|
} |
||||
|
], |
||||
|
"qstring" : [ |
||||
|
{ |
||||
|
token : "constant.language.escape", |
||||
|
regex : escapedRe |
||||
|
}, { |
||||
|
token : "string", |
||||
|
regex : "\\\\$", |
||||
|
consumeLineEnd : true |
||||
|
}, { |
||||
|
token : "string", |
||||
|
regex : "'|$", |
||||
|
next : "no_regex" |
||||
|
}, { |
||||
|
defaultToken: "string" |
||||
|
} |
||||
|
] |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
if (!options || !options.noES6) { |
||||
|
this.$rules.no_regex.unshift({ |
||||
|
regex: "[{}]", onMatch: function(val, state, stack) { |
||||
|
this.next = val == "{" ? this.nextState : ""; |
||||
|
if (val == "{" && stack.length) { |
||||
|
stack.unshift("start", state); |
||||
|
} |
||||
|
else if (val == "}" && stack.length) { |
||||
|
stack.shift(); |
||||
|
this.next = stack.shift(); |
||||
|
if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) |
||||
|
return "paren.quasi.end"; |
||||
|
} |
||||
|
return val == "{" ? "paren.lparen" : "paren.rparen"; |
||||
|
}, |
||||
|
nextState: "start" |
||||
|
}, { |
||||
|
token : "string.quasi.start", |
||||
|
regex : /`/, |
||||
|
push : [{ |
||||
|
token : "constant.language.escape", |
||||
|
regex : escapedRe |
||||
|
}, { |
||||
|
token : "paren.quasi.start", |
||||
|
regex : /\${/, |
||||
|
push : "start" |
||||
|
}, { |
||||
|
token : "string.quasi.end", |
||||
|
regex : /`/, |
||||
|
next : "pop" |
||||
|
}, { |
||||
|
defaultToken: "string.quasi" |
||||
|
}] |
||||
|
}); |
||||
|
|
||||
|
if (!options || options.jsx != false) |
||||
|
JSX.call(this); |
||||
|
} |
||||
|
|
||||
|
this.embedRules(DocCommentHighlightRules, "doc-", |
||||
|
[ DocCommentHighlightRules.getEndRule("no_regex") ]); |
||||
|
|
||||
|
this.normalizeRules(); |
||||
|
}; |
||||
|
|
||||
|
oop.inherits(JavaScriptHighlightRules, TextHighlightRules); |
||||
|
|
||||
|
function JSX() { |
||||
|
var tagRegex = identifierRe.replace("\\d", "\\d\\-"); |
||||
|
var jsxTag = { |
||||
|
onMatch : function(val, state, stack) { |
||||
|
var offset = val.charAt(1) == "/" ? 2 : 1; |
||||
|
if (offset == 1) { |
||||
|
if (state != this.nextState) |
||||
|
stack.unshift(this.next, this.nextState, 0); |
||||
|
else |
||||
|
stack.unshift(this.next); |
||||
|
stack[2]++; |
||||
|
} else if (offset == 2) { |
||||
|
if (state == this.nextState) { |
||||
|
stack[1]--; |
||||
|
if (!stack[1] || stack[1] < 0) { |
||||
|
stack.shift(); |
||||
|
stack.shift(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return [{ |
||||
|
type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", |
||||
|
value: val.slice(0, offset) |
||||
|
}, { |
||||
|
type: "meta.tag.tag-name.xml", |
||||
|
value: val.substr(offset) |
||||
|
}]; |
||||
|
}, |
||||
|
regex : "</?" + tagRegex + "", |
||||
|
next: "jsxAttributes", |
||||
|
nextState: "jsx" |
||||
|
}; |
||||
|
this.$rules.start.unshift(jsxTag); |
||||
|
var jsxJsRule = { |
||||
|
regex: "{", |
||||
|
token: "paren.quasi.start", |
||||
|
push: "start" |
||||
|
}; |
||||
|
this.$rules.jsx = [ |
||||
|
jsxJsRule, |
||||
|
jsxTag, |
||||
|
{include : "reference"}, |
||||
|
{defaultToken: "string"} |
||||
|
]; |
||||
|
this.$rules.jsxAttributes = [{ |
||||
|
token : "meta.tag.punctuation.tag-close.xml", |
||||
|
regex : "/?>", |
||||
|
onMatch : function(value, currentState, stack) { |
||||
|
if (currentState == stack[0]) |
||||
|
stack.shift(); |
||||
|
if (value.length == 2) { |
||||
|
if (stack[0] == this.nextState) |
||||
|
stack[1]--; |
||||
|
if (!stack[1] || stack[1] < 0) { |
||||
|
stack.splice(0, 2); |
||||
|
} |
||||
|
} |
||||
|
this.next = stack[0] || "start"; |
||||
|
return [{type: this.token, value: value}]; |
||||
|
}, |
||||
|
nextState: "jsx" |
||||
|
}, |
||||
|
jsxJsRule, |
||||
|
comments("jsxAttributes"), |
||||
|
{ |
||||
|
token : "entity.other.attribute-name.xml", |
||||
|
regex : tagRegex |
||||
|
}, { |
||||
|
token : "keyword.operator.attribute-equals.xml", |
||||
|
regex : "=" |
||||
|
}, { |
||||
|
token : "text.tag-whitespace.xml", |
||||
|
regex : "\\s+" |
||||
|
}, { |
||||
|
token : "string.attribute-value.xml", |
||||
|
regex : "'", |
||||
|
stateName : "jsx_attr_q", |
||||
|
push : [ |
||||
|
{token : "string.attribute-value.xml", regex: "'", next: "pop"}, |
||||
|
{include : "reference"}, |
||||
|
{defaultToken : "string.attribute-value.xml"} |
||||
|
] |
||||
|
}, { |
||||
|
token : "string.attribute-value.xml", |
||||
|
regex : '"', |
||||
|
stateName : "jsx_attr_qq", |
||||
|
push : [ |
||||
|
{token : "string.attribute-value.xml", regex: '"', next: "pop"}, |
||||
|
{include : "reference"}, |
||||
|
{defaultToken : "string.attribute-value.xml"} |
||||
|
] |
||||
|
}, |
||||
|
jsxTag |
||||
|
]; |
||||
|
this.$rules.reference = [{ |
||||
|
token : "constant.language.escape.reference.xml", |
||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" |
||||
|
}]; |
||||
|
} |
||||
|
|
||||
|
function comments(next) { |
||||
|
return [ |
||||
|
{ |
||||
|
token : "comment", // multi line comment
|
||||
|
regex : /\/\*/, |
||||
|
next: [ |
||||
|
DocCommentHighlightRules.getTagRule(), |
||||
|
{token : "comment", regex : "\\*\\/", next : next || "pop"}, |
||||
|
{defaultToken : "comment", caseInsensitive: true} |
||||
|
] |
||||
|
}, { |
||||
|
token : "comment", |
||||
|
regex : "\\/\\/", |
||||
|
next: [ |
||||
|
DocCommentHighlightRules.getTagRule(), |
||||
|
{token : "comment", regex : "$|^", next : next || "pop"}, |
||||
|
{defaultToken : "comment", caseInsensitive: true} |
||||
|
] |
||||
|
} |
||||
|
]; |
||||
|
} |
||||
|
exports.JavaScriptHighlightRules = JavaScriptHighlightRules; |
||||
|
}); |
||||
|
|
||||
|
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(acequire, exports, module) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var Range = acequire("../range").Range; |
||||
|
|
||||
|
var MatchingBraceOutdent = function() {}; |
||||
|
|
||||
|
(function() { |
||||
|
|
||||
|
this.checkOutdent = function(line, input) { |
||||
|
if (! /^\s+$/.test(line)) |
||||
|
return false; |
||||
|
|
||||
|
return /^\s*\}/.test(input); |
||||
|
}; |
||||
|
|
||||
|
this.autoOutdent = function(doc, row) { |
||||
|
var line = doc.getLine(row); |
||||
|
var match = line.match(/^(\s*\})/); |
||||
|
|
||||
|
if (!match) return 0; |
||||
|
|
||||
|
var column = match[1].length; |
||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column}); |
||||
|
|
||||
|
if (!openBracePos || openBracePos.row == row) return 0; |
||||
|
|
||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
||||
|
doc.replace(new Range(row, 0, row, column-1), indent); |
||||
|
}; |
||||
|
|
||||
|
this.$getIndent = function(line) { |
||||
|
return line.match(/^\s*/)[0]; |
||||
|
}; |
||||
|
|
||||
|
}).call(MatchingBraceOutdent.prototype); |
||||
|
|
||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent; |
||||
|
}); |
||||
|
|
||||
|
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(acequire, exports, module) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var oop = acequire("../../lib/oop"); |
||||
|
var Range = acequire("../../range").Range; |
||||
|
var BaseFoldMode = acequire("./fold_mode").FoldMode; |
||||
|
|
||||
|
var FoldMode = exports.FoldMode = function(commentRegex) { |
||||
|
if (commentRegex) { |
||||
|
this.foldingStartMarker = new RegExp( |
||||
|
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) |
||||
|
); |
||||
|
this.foldingStopMarker = new RegExp( |
||||
|
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) |
||||
|
); |
||||
|
} |
||||
|
}; |
||||
|
oop.inherits(FoldMode, BaseFoldMode); |
||||
|
|
||||
|
(function() { |
||||
|
|
||||
|
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
||||
|
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
||||
|
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; |
||||
|
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
||||
|
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
||||
|
this._getFoldWidgetBase = this.getFoldWidget; |
||||
|
this.getFoldWidget = function(session, foldStyle, row) { |
||||
|
var line = session.getLine(row); |
||||
|
|
||||
|
if (this.singleLineBlockCommentRe.test(line)) { |
||||
|
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
||||
|
return ""; |
||||
|
} |
||||
|
|
||||
|
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
||||
|
|
||||
|
if (!fw && this.startRegionRe.test(line)) |
||||
|
return "start"; // lineCommentRegionStart
|
||||
|
|
||||
|
return fw; |
||||
|
}; |
||||
|
|
||||
|
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { |
||||
|
var line = session.getLine(row); |
||||
|
|
||||
|
if (this.startRegionRe.test(line)) |
||||
|
return this.getCommentRegionBlock(session, line, row); |
||||
|
|
||||
|
var match = line.match(this.foldingStartMarker); |
||||
|
if (match) { |
||||
|
var i = match.index; |
||||
|
|
||||
|
if (match[1]) |
||||
|
return this.openingBracketBlock(session, match[1], row, i); |
||||
|
|
||||
|
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
||||
|
|
||||
|
if (range && !range.isMultiLine()) { |
||||
|
if (forceMultiline) { |
||||
|
range = this.getSectionRange(session, row); |
||||
|
} else if (foldStyle != "all") |
||||
|
range = null; |
||||
|
} |
||||
|
|
||||
|
return range; |
||||
|
} |
||||
|
|
||||
|
if (foldStyle === "markbegin") |
||||
|
return; |
||||
|
|
||||
|
var match = line.match(this.foldingStopMarker); |
||||
|
if (match) { |
||||
|
var i = match.index + match[0].length; |
||||
|
|
||||
|
if (match[1]) |
||||
|
return this.closingBracketBlock(session, match[1], row, i); |
||||
|
|
||||
|
return session.getCommentFoldRange(row, i, -1); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
this.getSectionRange = function(session, row) { |
||||
|
var line = session.getLine(row); |
||||
|
var startIndent = line.search(/\S/); |
||||
|
var startRow = row; |
||||
|
var startColumn = line.length; |
||||
|
row = row + 1; |
||||
|
var endRow = row; |
||||
|
var maxRow = session.getLength(); |
||||
|
while (++row < maxRow) { |
||||
|
line = session.getLine(row); |
||||
|
var indent = line.search(/\S/); |
||||
|
if (indent === -1) |
||||
|
continue; |
||||
|
if (startIndent > indent) |
||||
|
break; |
||||
|
var subRange = this.getFoldWidgetRange(session, "all", row); |
||||
|
|
||||
|
if (subRange) { |
||||
|
if (subRange.start.row <= startRow) { |
||||
|
break; |
||||
|
} else if (subRange.isMultiLine()) { |
||||
|
row = subRange.end.row; |
||||
|
} else if (startIndent == indent) { |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
endRow = row; |
||||
|
} |
||||
|
|
||||
|
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
||||
|
}; |
||||
|
this.getCommentRegionBlock = function(session, line, row) { |
||||
|
var startColumn = line.search(/\s*$/); |
||||
|
var maxRow = session.getLength(); |
||||
|
var startRow = row; |
||||
|
|
||||
|
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
||||
|
var depth = 1; |
||||
|
while (++row < maxRow) { |
||||
|
line = session.getLine(row); |
||||
|
var m = re.exec(line); |
||||
|
if (!m) continue; |
||||
|
if (m[1]) depth--; |
||||
|
else depth++; |
||||
|
|
||||
|
if (!depth) break; |
||||
|
} |
||||
|
|
||||
|
var endRow = row; |
||||
|
if (endRow > startRow) { |
||||
|
return new Range(startRow, startColumn, endRow, line.length); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
}).call(FoldMode.prototype); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(acequire, exports, module) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var oop = acequire("../lib/oop"); |
||||
|
var TextMode = acequire("./text").Mode; |
||||
|
var JavaScriptHighlightRules = acequire("./javascript_highlight_rules").JavaScriptHighlightRules; |
||||
|
var MatchingBraceOutdent = acequire("./matching_brace_outdent").MatchingBraceOutdent; |
||||
|
var WorkerClient = acequire("../worker/worker_client").WorkerClient; |
||||
|
var CstyleBehaviour = acequire("./behaviour/cstyle").CstyleBehaviour; |
||||
|
var CStyleFoldMode = acequire("./folding/cstyle").FoldMode; |
||||
|
|
||||
|
var Mode = function() { |
||||
|
this.HighlightRules = JavaScriptHighlightRules; |
||||
|
|
||||
|
this.$outdent = new MatchingBraceOutdent(); |
||||
|
this.$behaviour = new CstyleBehaviour(); |
||||
|
this.foldingRules = new CStyleFoldMode(); |
||||
|
}; |
||||
|
oop.inherits(Mode, TextMode); |
||||
|
|
||||
|
(function() { |
||||
|
|
||||
|
this.lineCommentStart = "//"; |
||||
|
this.blockComment = {start: "/*", end: "*/"}; |
||||
|
this.$quotes = {'"': '"', "'": "'", "`": "`"}; |
||||
|
|
||||
|
this.getNextLineIndent = function(state, line, tab) { |
||||
|
var indent = this.$getIndent(line); |
||||
|
|
||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state); |
||||
|
var tokens = tokenizedLine.tokens; |
||||
|
var endState = tokenizedLine.state; |
||||
|
|
||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") { |
||||
|
return indent; |
||||
|
} |
||||
|
|
||||
|
if (state == "start" || state == "no_regex") { |
||||
|
var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); |
||||
|
if (match) { |
||||
|
indent += tab; |
||||
|
} |
||||
|
} else if (state == "doc-start") { |
||||
|
if (endState == "start" || endState == "no_regex") { |
||||
|
return ""; |
||||
|
} |
||||
|
var match = line.match(/^\s*(\/?)\*/); |
||||
|
if (match) { |
||||
|
if (match[1]) { |
||||
|
indent += " "; |
||||
|
} |
||||
|
indent += "* "; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return indent; |
||||
|
}; |
||||
|
|
||||
|
this.checkOutdent = function(state, line, input) { |
||||
|
return this.$outdent.checkOutdent(line, input); |
||||
|
}; |
||||
|
|
||||
|
this.autoOutdent = function(state, doc, row) { |
||||
|
this.$outdent.autoOutdent(doc, row); |
||||
|
}; |
||||
|
|
||||
|
this.createWorker = function(session) { |
||||
|
var worker = new WorkerClient(["ace"], require("../worker/javascript"), "JavaScriptWorker"); |
||||
|
worker.attachToDocument(session.getDocument()); |
||||
|
|
||||
|
worker.on("annotate", function(results) { |
||||
|
session.setAnnotations(results.data); |
||||
|
}); |
||||
|
|
||||
|
worker.on("terminate", function() { |
||||
|
session.clearAnnotations(); |
||||
|
}); |
||||
|
|
||||
|
return worker; |
||||
|
}; |
||||
|
|
||||
|
this.$id = "ace/mode/javascript"; |
||||
|
}).call(Mode.prototype); |
||||
|
|
||||
|
exports.Mode = Mode; |
||||
|
}); |
||||
@ -0,0 +1,121 @@ |
|||||
|
ace.define("ace/theme/tomorrow_night_bright",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) { |
||||
|
|
||||
|
exports.isDark = true; |
||||
|
exports.cssClass = "ace-tomorrow-night-bright"; |
||||
|
exports.cssText = ".ace-tomorrow-night-bright .ace_gutter {\ |
||||
|
background: #1a1a1a;\ |
||||
|
color: #DEDEDE\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_print-margin {\ |
||||
|
width: 1px;\ |
||||
|
background: #1a1a1a\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright {\ |
||||
|
background-color: #000000;\ |
||||
|
color: #DEDEDE\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_cursor {\ |
||||
|
color: #9F9F9F\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_marker-layer .ace_selection {\ |
||||
|
background: #424242\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright.ace_multiselect .ace_selection.ace_start {\ |
||||
|
box-shadow: 0 0 3px 0px #000000;\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_marker-layer .ace_step {\ |
||||
|
background: rgb(102, 82, 0)\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_marker-layer .ace_bracket {\ |
||||
|
margin: -1px 0 0 -1px;\ |
||||
|
border: 1px solid #888888\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_marker-layer .ace_highlight {\ |
||||
|
border: 1px solid rgb(110, 119, 0);\ |
||||
|
border-bottom: 0;\ |
||||
|
box-shadow: inset 0 -1px rgb(110, 119, 0);\ |
||||
|
margin: -1px 0 0 -1px;\ |
||||
|
background: rgba(255, 235, 0, 0.1)\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_marker-layer .ace_active-line {\ |
||||
|
background: #2A2A2A\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_gutter-active-line {\ |
||||
|
background-color: #2A2A2A\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_stack {\ |
||||
|
background-color: rgb(66, 90, 44)\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_marker-layer .ace_selected-word {\ |
||||
|
border: 1px solid #888888\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_invisible {\ |
||||
|
color: #343434\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_keyword,\ |
||||
|
.ace-tomorrow-night-bright .ace_meta,\ |
||||
|
.ace-tomorrow-night-bright .ace_storage,\ |
||||
|
.ace-tomorrow-night-bright .ace_storage.ace_type,\ |
||||
|
.ace-tomorrow-night-bright .ace_support.ace_type {\ |
||||
|
color: #C397D8\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_keyword.ace_operator {\ |
||||
|
color: #70C0B1\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_constant.ace_character,\ |
||||
|
.ace-tomorrow-night-bright .ace_constant.ace_language,\ |
||||
|
.ace-tomorrow-night-bright .ace_constant.ace_numeric,\ |
||||
|
.ace-tomorrow-night-bright .ace_keyword.ace_other.ace_unit,\ |
||||
|
.ace-tomorrow-night-bright .ace_support.ace_constant,\ |
||||
|
.ace-tomorrow-night-bright .ace_variable.ace_parameter {\ |
||||
|
color: #E78C45\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_constant.ace_other {\ |
||||
|
color: #EEEEEE\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_invalid {\ |
||||
|
color: #CED2CF;\ |
||||
|
background-color: #DF5F5F\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_invalid.ace_deprecated {\ |
||||
|
color: #CED2CF;\ |
||||
|
background-color: #B798BF\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_fold {\ |
||||
|
background-color: #7AA6DA;\ |
||||
|
border-color: #DEDEDE\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_entity.ace_name.ace_function,\ |
||||
|
.ace-tomorrow-night-bright .ace_support.ace_function,\ |
||||
|
.ace-tomorrow-night-bright .ace_variable {\ |
||||
|
color: #7AA6DA\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_support.ace_class,\ |
||||
|
.ace-tomorrow-night-bright .ace_support.ace_type {\ |
||||
|
color: #E7C547\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_heading,\ |
||||
|
.ace-tomorrow-night-bright .ace_markup.ace_heading,\ |
||||
|
.ace-tomorrow-night-bright .ace_string {\ |
||||
|
color: #B9CA4A\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_entity.ace_name.ace_tag,\ |
||||
|
.ace-tomorrow-night-bright .ace_entity.ace_other.ace_attribute-name,\ |
||||
|
.ace-tomorrow-night-bright .ace_meta.ace_tag,\ |
||||
|
.ace-tomorrow-night-bright .ace_string.ace_regexp,\ |
||||
|
.ace-tomorrow-night-bright .ace_variable {\ |
||||
|
color: #D54E53\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_comment {\ |
||||
|
color: #969896\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_c9searchresults.ace_keyword {\ |
||||
|
color: #C2C280\ |
||||
|
}\ |
||||
|
.ace-tomorrow-night-bright .ace_indent-guide {\ |
||||
|
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYFBXV/8PAAJoAXX4kT2EAAAAAElFTkSuQmCC) right repeat-y\ |
||||
|
}"; |
||||
|
|
||||
|
var dom = acequire("../lib/dom"); |
||||
|
dom.importCssString(exports.cssText, exports.cssClass); |
||||
|
}); |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,3 @@ |
|||||
|
<div name='isInitial'> |
||||
|
|
||||
|
</div> |
||||
@ -0,0 +1,24 @@ |
|||||
|
<div class="editor-row"> |
||||
|
<h5 class="section-heading">JavaScript Code: <code>onHandleMetric(ctrl, htmlnode)</code></h5> |
||||
|
<ul style="padding-left: 40px;"> |
||||
|
<li>This code is executed upon <strong>every refresh</strong></li> |
||||
|
<li>@param {MetricsPanelCtrl} ctrl Instance of current grafana panel object.</li> |
||||
|
<li>@param {HTMLElement} htmlnode Html DOM node containi html data.</li> |
||||
|
</ul> |
||||
|
<div id="js_code" ng-show="ctrl.doShowAceJs('js_code')" style="height: 500px; width: 100%; margin-top: 8px;"></div> |
||||
|
|
||||
|
<!--textarea id="editor2" class="gf-form-input ng-not-empty" style="font-family:'Courier New', Courier, monospace;min-height: 500px" ng-model="ctrl.panel.js_code" ng-change="ctrl.setHandleMetricFunction(); ctrl.render();"></textarea--> |
||||
|
</div> |
||||
|
|
||||
|
<div class="editor-row"> |
||||
|
<p /> |
||||
|
<h5 class="section-heading">JavaScript Code: <code>onInit(ctrl, htmlnode)</code></h5> |
||||
|
<ul style="padding-left: 40px;"> |
||||
|
<li>This code is executed <strong>once</strong>, right after the first initialization of the SVG</li> |
||||
|
<li>@param {MetricsPanelCtrl} ctrl Instance of current grafana panel object.</li> |
||||
|
<li>@param {HTMLElement} htmlnode Html DOM node containing html data.</li> |
||||
|
</ul> |
||||
|
<div id="js_init_code" ng-show="ctrl.doShowAceJs('js_init_code')" style="height: 500px; width: 100%; margin-top: 8px;">Type in a word like "will" below and press ctrl+space or alt+space to get "rhyme completion"</div> |
||||
|
|
||||
|
<!--textarea class="gf-form-input ng-not-empty" style="font-family:'Courier New', Courier, monospace;min-height: 500px" ng-model="ctrl.panel.js_init_code" ng-change="ctrl.setInitFunction(); ctrl.render();"></textarea--> |
||||
|
</div> |
||||
@ -0,0 +1,20 @@ |
|||||
|
<div class="editor-row"> |
||||
|
<h5 class="section-heading">CSS</h5> |
||||
|
<ul style="padding-left: 40px;"> |
||||
|
<li>This is the CSS that will be used to render the panel.</li> |
||||
|
<li>The content here will be placed inside scoped style tags and will only be available to this panel</li> |
||||
|
|
||||
|
<div id="css_data" ng-show="ctrl.doShowAceHtml('css_data')" style="height: 500px; width: 100%; margin-top: 8px;"></div> |
||||
|
<!--textarea class="gf-form-input ng-not-empty" style="font-family:'Courier New', Courier, monospace;min-height: 500px" ng-model="ctrl.panel.css_data" |
||||
|
ng-change="ctrl.resetHTML(); ctrl.render();"></textarea--> |
||||
|
</div> |
||||
|
|
||||
|
<div class="editor-row"> |
||||
|
<h5 class="section-heading">HTML</h5> |
||||
|
<ul style="padding-left: 40px;"> |
||||
|
<li>This is the HTML that will be used to render the panel.</li> |
||||
|
|
||||
|
<div id="html_data" ng-show="ctrl.doShowAceHtml('html_data')" style="height: 500px; width: 100%; margin-top: 8px;"></div> |
||||
|
<!--textarea class="gf-form-input ng-not-empty" style="font-family:'Courier New', Courier, monospace;min-height: 500px" ng-model="ctrl.panel.html_data" ng-change="ctrl.resetHTML(); ctrl.render();"></textarea--> |
||||
|
</div> |
||||
|
<p></p> |
||||
@ -0,0 +1,37 @@ |
|||||
|
{ |
||||
|
"type": "panel", |
||||
|
"name": "HTML", |
||||
|
"id": "aidanmountford-html-panel", |
||||
|
"info": { |
||||
|
"description": "HTML panel for grafana", |
||||
|
"author": { |
||||
|
"name": "aidan@mountford.org", |
||||
|
"url": "https://github.com/aidanmountford/grafana-aidanmountford-html-panel" |
||||
|
}, |
||||
|
"keywords": [ |
||||
|
"html", |
||||
|
"panel" |
||||
|
], |
||||
|
"logos": { |
||||
|
"small": "img/html-panel-logo-small.png", |
||||
|
"large": "img/html-panel-logo-large.png" |
||||
|
}, |
||||
|
"links": [ |
||||
|
{ |
||||
|
"name": "MIT License", |
||||
|
"url": "https://github.com/MarcusCalidus/aidanmountford-html-panel/LICENSE" |
||||
|
}, |
||||
|
{ |
||||
|
"name": "Project", |
||||
|
"url": "https://github.com/AidanMountford/aidanmountford-html-panel" |
||||
|
} |
||||
|
], |
||||
|
"screenshots": [], |
||||
|
"version": "0.0.2", |
||||
|
"updated": "2019-12-27" |
||||
|
}, |
||||
|
"dependencies": { |
||||
|
"grafanaVersion": "3.x.x", |
||||
|
"plugins": [] |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
System.register([], function (_export, _context) { |
||||
|
"use strict"; |
||||
|
|
||||
|
return { |
||||
|
setters: [], |
||||
|
execute: function () { |
||||
|
// Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/append()/append().md
|
||||
|
(function (arr) { |
||||
|
arr.forEach(function (item) { |
||||
|
if (item.hasOwnProperty('append')) { |
||||
|
return; |
||||
|
} |
||||
|
Object.defineProperty(item, 'append', { |
||||
|
configurable: true, |
||||
|
enumerable: true, |
||||
|
writable: true, |
||||
|
value: function append() { |
||||
|
var argArr = Array.prototype.slice.call(arguments), |
||||
|
docFrag = document.createDocumentFragment(); |
||||
|
|
||||
|
argArr.forEach(function (argItem) { |
||||
|
var isNode = argItem instanceof Node; |
||||
|
docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem))); |
||||
|
}); |
||||
|
|
||||
|
this.appendChild(docFrag); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
})([Element.prototype, Document.prototype, DocumentFragment.prototype]); |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
|
//# sourceMappingURL=polyfills.js.map
|
||||
@ -0,0 +1 @@ |
|||||
|
{"version":3,"sources":["../src/polyfills.js"],"names":["arr","forEach","item","hasOwnProperty","Object","defineProperty","configurable","enumerable","writable","value","append","argArr","Array","prototype","slice","call","arguments","docFrag","document","createDocumentFragment","argItem","isNode","Node","appendChild","createTextNode","String","Element","Document","DocumentFragment"],"mappings":";;;;;;;;AAAA;AACA,aAAC,UAASA,GAAT,EAAc;AACXA,oBAAIC,OAAJ,CAAY,UAASC,IAAT,EAAe;AACvB,wBAAIA,KAAKC,cAAL,CAAoB,QAApB,CAAJ,EAAmC;AAC/B;AACH;AACDC,2BAAOC,cAAP,CAAsBH,IAAtB,EAA4B,QAA5B,EAAsC;AAClCI,sCAAc,IADoB;AAElCC,oCAAY,IAFsB;AAGlCC,kCAAU,IAHwB;AAIlCC,+BAAO,SAASC,MAAT,GAAkB;AACrB,gCAAIC,SAASC,MAAMC,SAAN,CAAgBC,KAAhB,CAAsBC,IAAtB,CAA2BC,SAA3B,CAAb;AAAA,gCACIC,UAAUC,SAASC,sBAAT,EADd;;AAGAR,mCAAOV,OAAP,CAAe,UAASmB,OAAT,EAAkB;AAC7B,oCAAIC,SAASD,mBAAmBE,IAAhC;AACAL,wCAAQM,WAAR,CAAoBF,SAASD,OAAT,GAAmBF,SAASM,cAAT,CAAwBC,OAAOL,OAAP,CAAxB,CAAvC;AACH,6BAHD;;AAKA,iCAAKG,WAAL,CAAiBN,OAAjB;AACH;AAdiC,qBAAtC;AAgBH,iBApBD;AAqBH,aAtBD,EAsBG,CAACS,QAAQb,SAAT,EAAoBc,SAASd,SAA7B,EAAwCe,iBAAiBf,SAAzD,CAtBH","file":"polyfills.js","sourcesContent":["// Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/append()/append().md\n(function(arr) {\n arr.forEach(function(item) {\n if (item.hasOwnProperty('append')) {\n return;\n }\n Object.defineProperty(item, 'append', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: function append() {\n var argArr = Array.prototype.slice.call(arguments),\n docFrag = document.createDocumentFragment();\n\n argArr.forEach(function(argItem) {\n var isNode = argItem instanceof Node;\n docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem)));\n });\n\n this.appendChild(docFrag);\n }\n });\n });\n})([Element.prototype, Document.prototype, DocumentFragment.prototype]);"]} |
||||
@ -0,0 +1,107 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
System.register(['lodash', 'jquery', 'jquery.flot', 'jquery.flot.pie'], function (_export, _context) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var _, $; |
||||
|
|
||||
|
function link(scope, elem, attrs, ctrl) { |
||||
|
var panel; |
||||
|
var htmlelem = elem[0].getElementsByClassName('html-object')[0]; |
||||
|
elem = elem.find('.html-panel'); |
||||
|
var plotCanvas = elem.find('.plot-canvas'); |
||||
|
var htmlnode; |
||||
|
var htmlShadow; |
||||
|
|
||||
|
ctrl.events.on('render', function () { |
||||
|
render(); |
||||
|
ctrl.renderingCompleted(); |
||||
|
}); |
||||
|
|
||||
|
function setElementHeight() { |
||||
|
try { |
||||
|
var height = ctrl.height || panel.height || ctrl.row.height; |
||||
|
if (_.isString(height)) { |
||||
|
height = parseInt(height.replace('px', ''), 10); |
||||
|
} |
||||
|
|
||||
|
height -= 5; // padding
|
||||
|
height -= panel.title ? 24 : 9; // subtract panel title bar
|
||||
|
|
||||
|
elem.css('height', height + 'px'); |
||||
|
|
||||
|
return true; |
||||
|
} catch (e) { |
||||
|
// IE throws errors sometimes
|
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function formatter(label, slice) { |
||||
|
return "<div style='font-size:" + ctrl.panel.fontSize + ";text-align:center;padding:2px;color:" + slice.color + ";'>" + label + "<br/>" + Math.round(slice.percent) + "%</div>"; |
||||
|
} |
||||
|
|
||||
|
function addHTML() { |
||||
|
if (!htmlnode.shadowRoot) { |
||||
|
htmlnode.attachShadow({ mode: 'open' }); |
||||
|
} |
||||
|
htmlnode.shadowRoot.innerHTML = "<style>" + panel.css_data + "</style>" + panel.html_data; |
||||
|
} |
||||
|
|
||||
|
function resizePlotCanvas() { |
||||
|
var width = elem.width(); |
||||
|
var height = elem.height(); |
||||
|
|
||||
|
var size = Math.min(width, height); |
||||
|
|
||||
|
var plotCss = { |
||||
|
top: '10px', |
||||
|
margin: 'auto', |
||||
|
position: 'relative', |
||||
|
height: size + 'px' |
||||
|
}; |
||||
|
plotCanvas.css(plotCss); |
||||
|
} |
||||
|
|
||||
|
function render() { |
||||
|
panel = ctrl.panel; |
||||
|
|
||||
|
if (setElementHeight()) { |
||||
|
if (htmlelem) { |
||||
|
htmlnode = htmlelem; |
||||
|
|
||||
|
if (htmlnode.getAttribute("name") == 'isInitial') { |
||||
|
htmlnode.removeAttribute("name"); |
||||
|
ctrl.initialized = 0; |
||||
|
} |
||||
|
|
||||
|
resizePlotCanvas(); |
||||
|
|
||||
|
if (!ctrl.initialized) { |
||||
|
addHTML(); |
||||
|
panel.doInit(ctrl, htmlnode.shadowRoot); |
||||
|
ctrl.initialized = 1; |
||||
|
} |
||||
|
|
||||
|
panel.handleMetric(ctrl, htmlnode.shadowRoot); |
||||
|
|
||||
|
htmlnode = null; |
||||
|
} else { |
||||
|
ctrl.initialized = 0; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
_export('default', link); |
||||
|
|
||||
|
return { |
||||
|
setters: [function (_lodash) { |
||||
|
_ = _lodash.default; |
||||
|
}, function (_jquery) { |
||||
|
$ = _jquery.default; |
||||
|
}, function (_jqueryFlot) {}, function (_jqueryFlotPie) {}], |
||||
|
execute: function () {} |
||||
|
}; |
||||
|
}); |
||||
|
//# sourceMappingURL=rendering.js.map
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,50 @@ |
|||||
|
|
||||
|
-----BEGIN PGP SIGNED MESSAGE----- |
||||
|
Hash: SHA512 |
||||
|
|
||||
|
{ |
||||
|
"manifestVersion": "2.0.0", |
||||
|
"signatureType": "community", |
||||
|
"signedByOrg": "grafana", |
||||
|
"signedByOrgName": "Grafana Labs", |
||||
|
"plugin": "savantly-heatmap-panel", |
||||
|
"version": "0.2.1", |
||||
|
"time": 1622741066287, |
||||
|
"keyId": "7e4d0c6a708866e7", |
||||
|
"files": { |
||||
|
"heatmapEditor.html": "80c1afb1c21b11b22eeadbf68062a3507707fae8bea85efa8a52341f25b569a6", |
||||
|
"displayEditor.html": "c8929259acfee43228cdbb1e61bc2a84bb4fa8fef30141ac4d5bc2c89902cdda", |
||||
|
"properties.js.map": "7d5d976495f563f4cb85ca4770d2da534a97b9b9a70c8da621c3b94d83bba2cf", |
||||
|
"css/heatmap.css": "3c4418e6b56f675f2004a687cc0f9594240f30851dbeb926e74ded6435b085e0", |
||||
|
"css/heatmap.css.map": "6961f3953262b183ef13278b0dc4d871fafb67c4ea4477f73f52b06e2242c0dc", |
||||
|
"module.html": "964b4e25a8a48d47b4b90fb85d7cca816cd042f3337621ad5d10f0a0fb34c79e", |
||||
|
"properties.js": "0939804110c3dfb12a9649fec6001a8c403b9a9a99043f8b224d1b8de46b3920", |
||||
|
"module.js.map": "e50ce84751c196e9710211d8c28327f581ee2cdfef882fe9052fb85a1fb5c501", |
||||
|
"plugin.json": "7dd0dbe6415501b7a7ba8233a0689e57e6f72764551532132fee90d85d4bc6de", |
||||
|
"libs/d3plus/d3plus.min.js": "c381e5bcfe540caa9267e946f4bb7c300f1e8f2d04453e248cf4f48a201cad7a", |
||||
|
"libs/d3plus/d3plus.js": "563ce3c83439cf43a0a98292cfe7774117aee7dbafff65c098a99a31bce7b8c7", |
||||
|
"libs/d3plus/d3plus.full.js": "892243f96b249ca8b11834820d60a03f0f8471ae15cddea4d202c1c4e8a49f5d", |
||||
|
"libs/d3plus/d3plus.full.min.js": "a1fa18301def3cf11f1e69d4547a9943b4b636ccac0cba3881184b8f258cd20b", |
||||
|
"libs/d3/d3.min.js": "a762ca217f7dc1d7eace1d35a067389856810b70e23487082f08bc01f54cdbd4", |
||||
|
"libs/d3/d3.js": "ae9eabdd39bc4eb53905ba27d2b6a3ea56e165147681d9895c712d6d14326478", |
||||
|
"README.md": "d7033e99aa8af059d927de8ca1e46e2969ac7d509a42e71c5b1c986a98866b1c", |
||||
|
"img/timestamp_data.PNG": "f32d5e3c3525c46bdd6ebedb7eaf3035eff2b735851ec1305d7b6e2305a5a22c", |
||||
|
"img/icn-heatmap-panel.svg": "f60466aae62bab47677f610ee2d3f26064b0da36d9769ca3be72b68c9246408f", |
||||
|
"img/heatmap.PNG": "edb73677190e9e806606ab5774ca34c0a30bbdae81c3ce065562c18f5e279a1d", |
||||
|
"module.js": "62068116ddde618e22a98a415ab9ff9c6f9b068ddb461ce147fe5e18ba16a88b", |
||||
|
"heatmapControl.js": "0902a5705ebdd2d0346fbd555a7d904fae32afcf751c099e69567c65a0c4e693", |
||||
|
"series_overrides_heatmap_ctrl.js": "b440b496d2db5e49d7dba0c4c999742bd94e6fcb0d80c85ee0664042ee25b24f", |
||||
|
"heatmapControl.js.map": "50cb635ab209e24ce1064092384146218850365315cbf3434b5d7f8817e041a6", |
||||
|
"series_overrides_heatmap_ctrl.js.map": "d9f57bfc99a551760c28c92d32fac4182cc301496d76dfb444d2c4a311012cb6" |
||||
|
} |
||||
|
} |
||||
|
-----BEGIN PGP SIGNATURE----- |
||||
|
Version: OpenPGP.js v4.10.1 |
||||
|
Comment: https://openpgpjs.org |
||||
|
|
||||
|
wqEEARMKAAYFAmC5EEoACgkQfk0ManCIZud0ogIHdc07O8OH6oP+AEbMzuUn |
||||
|
7GeNGGuPrwR+tVnOqxvEtGpnedOStN7p+LvCfpGF9ZjyIsrIm3aHx07HY66A |
||||
|
8Y8XWq0CCQHxrNcyWr6wB93aucj79Glsho3gSc2Yam7Jk2h+vpve2noKpHFP |
||||
|
WKVU0AsuROf/5+cmm27rkCorB2jLq5UqjDihjQ== |
||||
|
=x7EU |
||||
|
-----END PGP SIGNATURE----- |
||||
@ -0,0 +1,10 @@ |
|||||
|
# grafana-heatmap |
||||
|
[](https://travis-ci.org/savantly-net/grafana-heatmap) |
||||
|
|
||||
|
Heatmap Panel Plugin for Grafana |
||||
|
|
||||
|
Example |
||||
|
 |
||||
|
|
||||
|
Color By Value grouped by timestamp |
||||
|
 |
||||
@ -0,0 +1,386 @@ |
|||||
|
.diagram { |
||||
|
overflow: auto; } |
||||
|
|
||||
|
.gradient-values-container .gradient-value-max { |
||||
|
float: right; } |
||||
|
|
||||
|
.diagram g.label div { |
||||
|
color: #333; } |
||||
|
|
||||
|
.diagram div p { |
||||
|
text-align: center; } |
||||
|
|
||||
|
.diagram svg { |
||||
|
margin: auto; |
||||
|
display: block; } |
||||
|
|
||||
|
g.node > * { |
||||
|
fill: white; } |
||||
|
|
||||
|
svg > g { |
||||
|
overflow: visible; |
||||
|
display: block; } |
||||
|
|
||||
|
.diagram-value { |
||||
|
background-color: white; |
||||
|
padding: 3px; |
||||
|
margin-top: 8px; } |
||||
|
|
||||
|
/** LEGEND **/ |
||||
|
div.graph-legend-wrapper .graph-legend-table { |
||||
|
display: inline-table; } |
||||
|
|
||||
|
/* Flowchart variables */ |
||||
|
/* Sequence Diagram variables */ |
||||
|
/* Gantt chart variables */ |
||||
|
.mermaid .label { |
||||
|
font-family: 'trebuchet ms', verdana, arial; |
||||
|
color: #333; } |
||||
|
|
||||
|
.node rect, |
||||
|
.node circle, |
||||
|
.node ellipse, |
||||
|
.node polygon { |
||||
|
fill: #cde498; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1px; } |
||||
|
|
||||
|
.edgePath .path { |
||||
|
stroke: green; |
||||
|
stroke-width: 1.5px; } |
||||
|
|
||||
|
.edgeLabel { |
||||
|
background-color: #e8e8e8; } |
||||
|
|
||||
|
.cluster rect { |
||||
|
fill: #cdffb2 !important; |
||||
|
rx: 4 !important; |
||||
|
stroke: #6eaa49 !important; |
||||
|
stroke-width: 1px !important; } |
||||
|
|
||||
|
.cluster text { |
||||
|
fill: #333; } |
||||
|
|
||||
|
.actor { |
||||
|
stroke: #13540c; |
||||
|
fill: #cde498; } |
||||
|
|
||||
|
text.actor { |
||||
|
fill: black; |
||||
|
stroke: none; } |
||||
|
|
||||
|
.actor-line { |
||||
|
stroke: grey; } |
||||
|
|
||||
|
.messageLine0 { |
||||
|
stroke-width: 1.5; |
||||
|
stroke-dasharray: "2 2"; |
||||
|
marker-end: "url(#arrowhead)"; |
||||
|
stroke: green; } |
||||
|
|
||||
|
.messageLine1 { |
||||
|
stroke-width: 1.5; |
||||
|
stroke-dasharray: "2 2"; |
||||
|
stroke: green; } |
||||
|
|
||||
|
#arrowhead { |
||||
|
fill: green; } |
||||
|
|
||||
|
#crosshead path { |
||||
|
fill: green !important; |
||||
|
stroke: green !important; } |
||||
|
|
||||
|
.messageText { |
||||
|
fill: #D8D9DA; |
||||
|
stroke: none; } |
||||
|
|
||||
|
.labelBox { |
||||
|
stroke: #326932; |
||||
|
fill: #cde498; } |
||||
|
|
||||
|
.labelText { |
||||
|
fill: black; |
||||
|
stroke: none; } |
||||
|
|
||||
|
.loopText { |
||||
|
fill: #D8D9DA; |
||||
|
stroke: none; } |
||||
|
|
||||
|
.loopLine { |
||||
|
stroke-width: 2; |
||||
|
stroke-dasharray: "2 2"; |
||||
|
marker-end: "url(#arrowhead)"; |
||||
|
stroke: #326932; } |
||||
|
|
||||
|
.note { |
||||
|
stroke: #6eaa49; |
||||
|
fill: #fff5ad; } |
||||
|
|
||||
|
.noteText { |
||||
|
fill: black; |
||||
|
stroke: none; |
||||
|
font-family: 'trebuchet ms', verdana, arial; |
||||
|
font-size: 14px; } |
||||
|
|
||||
|
/** Section styling */ |
||||
|
.diagram .section { |
||||
|
stroke: none; |
||||
|
opacity: 0.2; } |
||||
|
|
||||
|
.section0 { |
||||
|
fill: #6eaa49; } |
||||
|
|
||||
|
.section2 { |
||||
|
fill: #6eaa49; } |
||||
|
|
||||
|
.section1, |
||||
|
.section3 { |
||||
|
fill: white; |
||||
|
opacity: 0.2; } |
||||
|
|
||||
|
.sectionTitle0 { |
||||
|
fill: #333; } |
||||
|
|
||||
|
.sectionTitle1 { |
||||
|
fill: #333; } |
||||
|
|
||||
|
.sectionTitle2 { |
||||
|
fill: #333; } |
||||
|
|
||||
|
.sectionTitle3 { |
||||
|
fill: #333; } |
||||
|
|
||||
|
.sectionTitle { |
||||
|
text-anchor: start; |
||||
|
font-size: 11px; |
||||
|
text-height: 14px; } |
||||
|
|
||||
|
/* Grid and axis */ |
||||
|
.grid .tick { |
||||
|
stroke: lightgrey; |
||||
|
opacity: 0.3; |
||||
|
shape-rendering: crispEdges; } |
||||
|
|
||||
|
.grid path { |
||||
|
stroke-width: 0; } |
||||
|
|
||||
|
/* Today line */ |
||||
|
.today { |
||||
|
fill: none; |
||||
|
stroke: red; |
||||
|
stroke-width: 2px; } |
||||
|
|
||||
|
/* Task styling */ |
||||
|
/* Default task */ |
||||
|
.task { |
||||
|
stroke-width: 2; } |
||||
|
|
||||
|
.taskText { |
||||
|
text-anchor: middle; |
||||
|
font-size: 11px; } |
||||
|
|
||||
|
.taskTextOutsideRight { |
||||
|
fill: black; |
||||
|
text-anchor: start; |
||||
|
font-size: 11px; } |
||||
|
|
||||
|
.taskTextOutsideLeft { |
||||
|
fill: black; |
||||
|
text-anchor: end; |
||||
|
font-size: 11px; } |
||||
|
|
||||
|
/* Specific task settings for the sections*/ |
||||
|
.taskText0, |
||||
|
.taskText1, |
||||
|
.taskText2, |
||||
|
.taskText3 { |
||||
|
fill: white; } |
||||
|
|
||||
|
.task0, |
||||
|
.task1, |
||||
|
.task2, |
||||
|
.task3 { |
||||
|
fill: #487e3a; |
||||
|
stroke: #13540c; } |
||||
|
|
||||
|
.taskTextOutside0, |
||||
|
.taskTextOutside2 { |
||||
|
fill: black; } |
||||
|
|
||||
|
.taskTextOutside1, |
||||
|
.taskTextOutside3 { |
||||
|
fill: black; } |
||||
|
|
||||
|
/* Active task */ |
||||
|
.active0, |
||||
|
.active1, |
||||
|
.active2, |
||||
|
.active3 { |
||||
|
fill: #cde498; |
||||
|
stroke: #13540c; } |
||||
|
|
||||
|
.activeText0, |
||||
|
.activeText1, |
||||
|
.activeText2, |
||||
|
.activeText3 { |
||||
|
fill: black !important; } |
||||
|
|
||||
|
/* Completed task */ |
||||
|
.done0, |
||||
|
.done1, |
||||
|
.done2, |
||||
|
.done3 { |
||||
|
stroke: grey; |
||||
|
fill: lightgrey; |
||||
|
stroke-width: 2; } |
||||
|
|
||||
|
.doneText0, |
||||
|
.doneText1, |
||||
|
.doneText2, |
||||
|
.doneText3 { |
||||
|
fill: black !important; } |
||||
|
|
||||
|
/* Tasks on the critical line */ |
||||
|
.crit0, |
||||
|
.crit1, |
||||
|
.crit2, |
||||
|
.crit3 { |
||||
|
stroke: #ff8888; |
||||
|
fill: red; |
||||
|
stroke-width: 2; } |
||||
|
|
||||
|
.activeCrit0, |
||||
|
.activeCrit1, |
||||
|
.activeCrit2, |
||||
|
.activeCrit3 { |
||||
|
stroke: #ff8888; |
||||
|
fill: #cde498; |
||||
|
stroke-width: 2; } |
||||
|
|
||||
|
.doneCrit0, |
||||
|
.doneCrit1, |
||||
|
.doneCrit2, |
||||
|
.doneCrit3 { |
||||
|
stroke: #ff8888; |
||||
|
fill: lightgrey; |
||||
|
stroke-width: 2; |
||||
|
cursor: pointer; |
||||
|
shape-rendering: crispEdges; } |
||||
|
|
||||
|
.doneCritText0, |
||||
|
.doneCritText1, |
||||
|
.doneCritText2, |
||||
|
.doneCritText3 { |
||||
|
fill: black !important; } |
||||
|
|
||||
|
.activeCritText0, |
||||
|
.activeCritText1, |
||||
|
.activeCritText2, |
||||
|
.activeCritText3 { |
||||
|
fill: black !important; } |
||||
|
|
||||
|
.titleText { |
||||
|
text-anchor: middle; |
||||
|
font-size: 18px; |
||||
|
fill: black; } |
||||
|
|
||||
|
/* |
||||
|
|
||||
|
|
||||
|
*/ |
||||
|
g.classGroup text { |
||||
|
fill: #13540c; |
||||
|
stroke: none; |
||||
|
font-family: 'trebuchet ms', verdana, arial; |
||||
|
font-size: 14px; } |
||||
|
|
||||
|
g.classGroup rect { |
||||
|
fill: #cde498; |
||||
|
stroke: #13540c; } |
||||
|
|
||||
|
g.classGroup line { |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
svg .classLabel .box { |
||||
|
stroke: none; |
||||
|
stroke-width: 0; |
||||
|
fill: #cde498; |
||||
|
opacity: 0.5; } |
||||
|
|
||||
|
svg .classLabel .label { |
||||
|
fill: #13540c; } |
||||
|
|
||||
|
.relation { |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; |
||||
|
fill: none; } |
||||
|
|
||||
|
.composition { |
||||
|
fill: #13540c; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
#compositionStart { |
||||
|
fill: #13540c; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
#compositionEnd { |
||||
|
fill: #13540c; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
.aggregation { |
||||
|
fill: #cde498; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
#aggregationStart { |
||||
|
fill: #cde498; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
#aggregationEnd { |
||||
|
fill: #cde498; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
#dependencyStart { |
||||
|
fill: #13540c; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
#dependencyEnd { |
||||
|
fill: #13540c; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
#extensionStart { |
||||
|
fill: #13540c; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
#extensionEnd { |
||||
|
fill: #13540c; |
||||
|
stroke: #13540c; |
||||
|
stroke-width: 1; } |
||||
|
|
||||
|
.node text { |
||||
|
font-family: 'trebuchet ms', verdana, arial; |
||||
|
font-size: 14px; } |
||||
|
|
||||
|
div.mermaidTooltip { |
||||
|
position: absolute; |
||||
|
text-align: center; |
||||
|
max-width: 200px; |
||||
|
padding: 2px; |
||||
|
font-family: 'trebuchet ms', verdana, arial; |
||||
|
font-size: 12px; |
||||
|
background: #cdffb2; |
||||
|
border: 1px solid #6eaa49; |
||||
|
border-radius: 2px; |
||||
|
pointer-events: none; |
||||
|
z-index: 100; } |
||||
|
|
||||
|
/*# sourceMappingURL=heatmap.css.map */ |
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,122 @@ |
|||||
|
<div class="gf-form-group"> |
||||
|
<h5>Legend</h5> |
||||
|
<div class="gf-form"> |
||||
|
<editor-checkbox text="Series Table" model="ctrl.panel.legend.show" class="gf-form-checkbox" ></editor-checkbox> |
||||
|
<div ng-show="ctrl.panel.legend.show"> |
||||
|
<editor-checkbox text="Min" model="ctrl.panel.legend.min" class="gf-form-checkbox" ></editor-checkbox> |
||||
|
<editor-checkbox text="Max" model="ctrl.panel.legend.max" class="gf-form-checkbox" ></editor-checkbox> |
||||
|
<editor-checkbox text="Avg" model="ctrl.panel.legend.avg" class="gf-form-checkbox" ></editor-checkbox> |
||||
|
<editor-checkbox text="Total" model="ctrl.panel.legend.total" class="gf-form-checkbox" ></editor-checkbox> |
||||
|
<editor-checkbox text="Current" model="ctrl.panel.legend.current" class="gf-form-checkbox" ></editor-checkbox> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="gf-form"> |
||||
|
<editor-checkbox text="Heatmap" model="ctrl.panel.treeMap.showLegend" class="gf-form-checkbox" ></editor-checkbox> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="gf-form-group"> |
||||
|
<h5>Options</h5> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Mode</label> |
||||
|
<select |
||||
|
ng-options="option for option in ctrl.options.treeMap.modes" |
||||
|
ng-model="ctrl.panel.treeMap.mode" ng-change="ctrl.refresh()"></select> |
||||
|
</div> |
||||
|
<!-- <div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Node Size Min</label> |
||||
|
<input type="text" placeholder="auto" class="input-small gf-form-input width-10" ng-model="ctrl.panel.treeMap.sizeDomainMin" ng-change="ctrl.refresh()"></input> |
||||
|
</div> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Node Size Max</label> |
||||
|
<input type="text" placeholder="auto" class="input-small gf-form-input width-10" ng-model="ctrl.panel.treeMap.sizeDomainMax" ng-change="ctrl.refresh()"></input> |
||||
|
</div> --> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Thresholds |
||||
|
<tip>Define threshold values to map the colors</tip> |
||||
|
</label> |
||||
|
<input |
||||
|
type="text" class="input-small gf-form-input width-10" |
||||
|
ng-model="ctrl.panel.thresholds" ng-change="ctrl.updateThresholds()" |
||||
|
placeholder="0,10" ng-model-onblur /> |
||||
|
</div> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Colors</label> |
||||
|
<div class="gf-form-inline" ng-repeat="color in ctrl.panel.colors track by $index"> |
||||
|
<label class="gf-form-label"> |
||||
|
<a ng-click="ctrl.removeColor($index)"><i class="pointer fa fa-remove"> </i></a> |
||||
|
<spectrum-picker ng-model="color" ng-change="ctrl.changeColor($index, color)" ng-model-onblur></spectrum-picker> |
||||
|
</label> |
||||
|
</div> |
||||
|
<span class="gf-form-label"> |
||||
|
<a ng-click="ctrl.addColor()"> |
||||
|
<i class="fa fa-plus"></i> |
||||
|
</a> |
||||
|
</span> |
||||
|
<span class="gf-form-label"> |
||||
|
<a ng-click="ctrl.invertColorOrder()"> |
||||
|
Invert |
||||
|
</a> |
||||
|
</span> |
||||
|
</div> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Color By<tip>falls back to 'value' field on non-aggregated data</tip></label> |
||||
|
<select ng-options="option for option in ctrl.options.aggregationFunctions" ng-model="ctrl.panel.treeMap.colorByFunction" ng-change="ctrl.refresh()"></select> |
||||
|
</div> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Size By<tip>falls back to 'value' field on non-aggregated data</tip></label> |
||||
|
<select ng-model="ctrl.panel.treeMap.sizeByFunction" ng-change="ctrl.refresh()"> |
||||
|
<option>constant</option> |
||||
|
<option ng-repeat="option in ctrl.options.aggregationFunctions">{{option}}</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="gf-form-group" ng-show="false"> |
||||
|
<div class="edit-tab-content"> |
||||
|
<div class="gf-form-group"> |
||||
|
<h5>Series specific overrides <tip>Regex match example: /server[0-3]/i </tip></h5> |
||||
|
<div class="gf-form-inline" ng-repeat="override in ctrl.panel.seriesOverrides" ng-controller="SeriesOverridesHeatmapCtrl"> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label">alias or regex</label> |
||||
|
</div> |
||||
|
<div class="gf-form width-15"> |
||||
|
<input type="text" ng-model="override.alias" bs-typeahead="getSeriesNames" ng-blur="ctrl.render()" data-min-length=0 data-items=100 class="gf-form-input width-15"> |
||||
|
</div> |
||||
|
<div class="gf-form" ng-repeat="option in currentOverrides"> |
||||
|
<label class="gf-form-label"> |
||||
|
<i class="pointer fa fa-remove" ng-click="removeOverride(option)"></i> |
||||
|
<span ng-show="option.propertyName === 'color'"> |
||||
|
Color: <i class="fa fa-circle" ng-style="{color:option.value}"></i> |
||||
|
</span> |
||||
|
<span ng-show="option.propertyName === 'thresholds'"> |
||||
|
Thresholds: <input ng-model="option.value" ng-blur="thresholdsChanged(option)"></input> |
||||
|
</span> |
||||
|
<span ng-show="option.propertyName !== 'color' && option.propertyName !== 'thresholds'"> |
||||
|
{{option.name}}: {{option.value}} |
||||
|
</span> |
||||
|
</label> |
||||
|
</div> |
||||
|
|
||||
|
<div class="gf-form"> |
||||
|
<span class="dropdown" dropdown-typeahead="overrideMenu" dropdown-typeahead-on-select="setOverride($item, $subItem)"> |
||||
|
</span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="gf-form gf-form--grow"> |
||||
|
<div class="gf-form-label gf-form-label--grow"></div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label"> |
||||
|
<i class="fa fa-trash pointer" ng-click="ctrl.removeSeriesOverride(override)"></i> |
||||
|
</label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<button class="btn btn-inverse" ng-click="ctrl.addSeriesOverride()"> |
||||
|
<i class="fa fa-plus"></i> Add override |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
@ -0,0 +1,527 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
System.register(['./libs/d3/d3', 'app/core/time_series2', 'app/core/utils/kbn', 'app/plugins/sdk', './properties', 'lodash', 'moment', './series_overrides_heatmap_ctrl', './css/heatmap.css!'], function (_export, _context) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var TimeSeries, kbn, MetricsPanelCtrl, heatmapEditor, displayEditor, pluginName, _, moment, _createClass, panelOptions, panelDefaults, HeatmapCtrl; |
||||
|
|
||||
|
function _classCallCheck(instance, Constructor) { |
||||
|
if (!(instance instanceof Constructor)) { |
||||
|
throw new TypeError("Cannot call a class as a function"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function _possibleConstructorReturn(self, call) { |
||||
|
if (!self) { |
||||
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); |
||||
|
} |
||||
|
|
||||
|
return call && (typeof call === "object" || typeof call === "function") ? call : self; |
||||
|
} |
||||
|
|
||||
|
function _inherits(subClass, superClass) { |
||||
|
if (typeof superClass !== "function" && superClass !== null) { |
||||
|
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); |
||||
|
} |
||||
|
|
||||
|
subClass.prototype = Object.create(superClass && superClass.prototype, { |
||||
|
constructor: { |
||||
|
value: subClass, |
||||
|
enumerable: false, |
||||
|
writable: true, |
||||
|
configurable: true |
||||
|
} |
||||
|
}); |
||||
|
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; |
||||
|
} |
||||
|
|
||||
|
function ensureArrayContains(array, value) { |
||||
|
if (array.indexOf(value) == -1) { |
||||
|
array.push(value); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function colorToHex(color) { |
||||
|
if (color.substr(0, 1) === '#') { |
||||
|
return color; |
||||
|
} |
||||
|
var digits = color.replace(/[rgba\(\)\ ]/g, '').split(','); |
||||
|
while (digits.length < 3) { |
||||
|
digits.push(255); |
||||
|
} |
||||
|
|
||||
|
var red = parseInt(digits[0]); |
||||
|
var green = parseInt(digits[1]); |
||||
|
var blue = parseInt(digits[2]); |
||||
|
|
||||
|
var rgba = blue | green << 8 | red << 16; |
||||
|
return '#' + rgba.toString(16); |
||||
|
} |
||||
|
|
||||
|
function getColorByXPercentage(canvas, xPercent) { |
||||
|
var x = canvas.width * xPercent || 0; |
||||
|
var context = canvas.getContext("2d"); |
||||
|
var p = context.getImageData(x, 1, 1, 1).data; |
||||
|
var color = 'rgba(' + [p[0] + ',' + p[1] + ',' + p[2] + ',' + p[3]] + ')'; |
||||
|
return color; |
||||
|
} |
||||
|
|
||||
|
return { |
||||
|
setters: [function (_libsD3D) {}, function (_appCoreTime_series) { |
||||
|
TimeSeries = _appCoreTime_series.default; |
||||
|
}, function (_appCoreUtilsKbn) { |
||||
|
kbn = _appCoreUtilsKbn.default; |
||||
|
}, function (_appPluginsSdk) { |
||||
|
MetricsPanelCtrl = _appPluginsSdk.MetricsPanelCtrl; |
||||
|
}, function (_properties) { |
||||
|
heatmapEditor = _properties.heatmapEditor; |
||||
|
displayEditor = _properties.displayEditor; |
||||
|
pluginName = _properties.pluginName; |
||||
|
}, function (_lodash) { |
||||
|
_ = _lodash.default; |
||||
|
}, function (_moment) { |
||||
|
moment = _moment.default; |
||||
|
}, function (_series_overrides_heatmap_ctrl) {}, function (_cssHeatmapCss) {}], |
||||
|
execute: function () { |
||||
|
_createClass = function () { |
||||
|
function defineProperties(target, props) { |
||||
|
for (var i = 0; i < props.length; i++) { |
||||
|
var descriptor = props[i]; |
||||
|
descriptor.enumerable = descriptor.enumerable || false; |
||||
|
descriptor.configurable = true; |
||||
|
if ("value" in descriptor) descriptor.writable = true; |
||||
|
Object.defineProperty(target, descriptor.key, descriptor); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return function (Constructor, protoProps, staticProps) { |
||||
|
if (protoProps) defineProperties(Constructor.prototype, protoProps); |
||||
|
if (staticProps) defineProperties(Constructor, staticProps); |
||||
|
return Constructor; |
||||
|
}; |
||||
|
}(); |
||||
|
|
||||
|
panelOptions = { |
||||
|
aggregationFunctions: ['avg', 'min', 'max', 'total', 'current', 'count'], |
||||
|
treeMap: { |
||||
|
modes: ['squarify', 'slice', 'dice', 'slice-dice'], |
||||
|
aggregationFunctions: ['sum', 'min', 'max', 'extent', 'mean', 'median', 'quantile', 'variance', 'deviation'], |
||||
|
timestampFormats: ['YYYY-MM-DDTHH', 'YYYY-MM-DDTHH:mm', 'YYYY-MM-DDTHH:mm:ss', 'YYYY-MM-DDTHH:mm:ss.sssZ'] |
||||
|
} |
||||
|
}; |
||||
|
panelDefaults = { |
||||
|
// other style overrides
|
||||
|
seriesOverrides: [], |
||||
|
thresholds: '0,10', |
||||
|
colors: ['rgba(50, 172, 45, 1)', 'rgba(241, 255, 0, 1)', 'rgba(245, 54, 54, 1)'], |
||||
|
legend: { |
||||
|
show: true, |
||||
|
min: true, |
||||
|
max: true, |
||||
|
avg: true, |
||||
|
current: true, |
||||
|
total: true |
||||
|
}, |
||||
|
maxDataPoints: 100, |
||||
|
mappingType: 1, |
||||
|
nullPointMode: 'connected', |
||||
|
format: 'none', |
||||
|
valueMaps: [{ value: 'null', op: '=', text: 'N/A' }], |
||||
|
treeMap: { |
||||
|
mode: 'squarify', |
||||
|
groups: [{ key: 'server', value: '/^.*\./g' }], |
||||
|
colorByFunction: 'max', |
||||
|
sizeByFunction: 'constant', |
||||
|
enableTimeBlocks: false, |
||||
|
enableGrouping: true, |
||||
|
debug: false, |
||||
|
depth: 0, |
||||
|
ids: ['alias'], |
||||
|
nodeSizeProperty: "value" |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
_export('MetricsPanelCtrl', _export('HeatmapCtrl', HeatmapCtrl = function (_MetricsPanelCtrl) { |
||||
|
_inherits(HeatmapCtrl, _MetricsPanelCtrl); |
||||
|
|
||||
|
function HeatmapCtrl($scope, $injector, $sce) { |
||||
|
_classCallCheck(this, HeatmapCtrl); |
||||
|
|
||||
|
var _this2 = _possibleConstructorReturn(this, (HeatmapCtrl.__proto__ || Object.getPrototypeOf(HeatmapCtrl)).call(this, $scope, $injector)); |
||||
|
|
||||
|
_.defaults(_this2.panel, panelDefaults); |
||||
|
|
||||
|
_this2.options = panelOptions; |
||||
|
_this2.panel.chartId = 'chart_' + _this2.panel.id; |
||||
|
_this2.containerDivId = 'container_' + _this2.panel.chartId; |
||||
|
_this2.$sce = $sce; |
||||
|
_this2.events.on('init-edit-mode', _this2.onInitEditMode.bind(_this2)); |
||||
|
_this2.events.on('data-received', _this2.onDataReceived.bind(_this2)); |
||||
|
_this2.events.on('data-snapshot-load', _this2.onDataReceived.bind(_this2)); |
||||
|
_this2.initializePanel(); |
||||
|
return _this2; |
||||
|
} |
||||
|
|
||||
|
_createClass(HeatmapCtrl, [{ |
||||
|
key: 'initializePanel', |
||||
|
value: function initializePanel() { |
||||
|
var d3plusPath = 'plugins/' + pluginName + '/libs/d3plus/d3plus.full.js'; |
||||
|
var _this = this; |
||||
|
var meta = {}; |
||||
|
meta[d3plusPath] = { |
||||
|
format: 'global' |
||||
|
}; |
||||
|
|
||||
|
SystemJS.config({ |
||||
|
meta: meta |
||||
|
}); |
||||
|
|
||||
|
SystemJS.import(d3plusPath).then(function d3plusLoaded() { |
||||
|
console.log('d3plus is loaded'); |
||||
|
_this.events.emit('data-received'); |
||||
|
}); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'handleError', |
||||
|
value: function handleError(err) { |
||||
|
this.getPanelContainer().html('<p>Error:</p><pre>' + err + '</pre>'); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'onInitEditMode', |
||||
|
value: function onInitEditMode() { |
||||
|
this.addEditorTab('Heatmap', heatmapEditor, 2); |
||||
|
this.addEditorTab('Display', displayEditor, 3); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'getPanelContainer', |
||||
|
value: function getPanelContainer() { |
||||
|
return $(document.getElementById(this.containerDivId)); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'onDataReceived', |
||||
|
value: function onDataReceived(dataList) { |
||||
|
console.info('received data'); |
||||
|
console.debug(dataList); |
||||
|
if (undefined != dataList) { |
||||
|
this.series = dataList.map(this.seriesHandler.bind(this)); |
||||
|
console.info('mapped dataList to series'); |
||||
|
} |
||||
|
|
||||
|
var preparedData = this.d3plusDataProcessor(this.series); |
||||
|
this.render(preparedData); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'getGroupKeys', |
||||
|
value: function getGroupKeys() { |
||||
|
return this.panel.treeMap.groups.map(function (group) { |
||||
|
return group.key; |
||||
|
}); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'd3plusDataProcessor', |
||||
|
value: function d3plusDataProcessor(dataArray) { |
||||
|
var resultArray = []; |
||||
|
var hasGroups = this.panel.treeMap.groups.length > 0; |
||||
|
|
||||
|
if (!hasGroups) { |
||||
|
// just add the original items since there are no groups
|
||||
|
for (var dataIndex = 0; dataIndex < dataArray.length; dataIndex++) { |
||||
|
var newDataItem = Object.assign({}, dataArray[dataIndex], dataArray[dataIndex].stats); |
||||
|
resultArray.push(newDataItem); |
||||
|
} |
||||
|
} else { |
||||
|
// Process Groups
|
||||
|
var groupArray = []; |
||||
|
for (var groupIndex = 0; groupIndex < this.panel.treeMap.groups.length; groupIndex++) { |
||||
|
groupArray.push({ |
||||
|
key: this.panel.treeMap.groups[groupIndex].key, |
||||
|
regex: kbn.stringToJsRegex(this.panel.treeMap.groups[groupIndex].value) |
||||
|
}); |
||||
|
} |
||||
|
for (var dataIndex = 0; dataIndex < dataArray.length; dataIndex++) { |
||||
|
var newDataItem = Object.assign({}, dataArray[dataIndex]); |
||||
|
// only add the stats if we arent using granular timeblock data
|
||||
|
if (!this.panel.treeMap.enableTimeBlocks) { |
||||
|
Object.assign(newDataItem, dataArray[dataIndex].stats); |
||||
|
} |
||||
|
delete newDataItem.stats; |
||||
|
|
||||
|
for (var groupIndex = 0; groupIndex < groupArray.length; groupIndex++) { |
||||
|
var key = groupArray[groupIndex].key; |
||||
|
var regex = groupArray[groupIndex].regex; |
||||
|
var matches = newDataItem.alias.match(regex); |
||||
|
if (matches && matches.length > 0) { |
||||
|
newDataItem[key] = matches[0]; |
||||
|
} else { |
||||
|
newDataItem[key] = 'NA'; |
||||
|
} |
||||
|
} |
||||
|
resultArray.push(newDataItem); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// If we're using timeBlocks mode
|
||||
|
// replace the aggregated series with individual records
|
||||
|
if (this.panel.treeMap.enableTimeBlocks) { |
||||
|
console.info('creating timeblock records'); |
||||
|
var timeBlockArray = []; |
||||
|
for (var dataIndex = 0; dataIndex < resultArray.length; dataIndex++) { |
||||
|
console.debug('dataIndex:' + dataIndex + ', alias:' + resultArray[dataIndex].alias); |
||||
|
var dataSeries = resultArray[dataIndex]; |
||||
|
for (var dataPointIndex = 0; dataPointIndex < dataSeries.flotpairs.length; dataPointIndex++) { |
||||
|
var dataSeriesCopy = Object.assign({}, dataSeries); |
||||
|
delete dataSeriesCopy.datapoints; |
||||
|
delete dataSeriesCopy.flotpairs; |
||||
|
dataSeriesCopy.count = 1; |
||||
|
dataSeriesCopy.timestamp = dataSeries.flotpairs[dataPointIndex][0]; |
||||
|
dataSeriesCopy.value = dataSeries.flotpairs[dataPointIndex][1]; |
||||
|
timeBlockArray.push(dataSeriesCopy); |
||||
|
} |
||||
|
} |
||||
|
resultArray = timeBlockArray; |
||||
|
} |
||||
|
|
||||
|
return resultArray; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'seriesHandler', |
||||
|
value: function seriesHandler(seriesData) { |
||||
|
var series = new TimeSeries({ |
||||
|
datapoints: seriesData.datapoints, |
||||
|
alias: seriesData.target.replace(/"|,|;|=|:|{|}/g, '_') |
||||
|
}); |
||||
|
series.flotpairs = series.getFlotPairs(this.panel.nullPointMode); |
||||
|
return series; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'addSeriesOverride', |
||||
|
value: function addSeriesOverride(override) { |
||||
|
this.panel.seriesOverrides.push(override || {}); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'addTreeMapGroup', |
||||
|
value: function addTreeMapGroup(group) { |
||||
|
this.panel.treeMap.groups.push(group || {}); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'removeSeriesOverride', |
||||
|
value: function removeSeriesOverride(override) { |
||||
|
this.panel.seriesOverrides = _.without(this.panel.seriesOverrides, override); |
||||
|
this.render(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'removeTreeMapGroup', |
||||
|
value: function removeTreeMapGroup(group) { |
||||
|
this.panel.treeMap.groups = _.without(this.panel.treeMap.groups, group); |
||||
|
this.render(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'updateThresholds', |
||||
|
value: function updateThresholds() { |
||||
|
var thresholdCount = this.panel.thresholds.length; |
||||
|
var colorCount = this.panel.colors.length; |
||||
|
this.refresh(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'changeColor', |
||||
|
value: function changeColor(colorIndex, color) { |
||||
|
this.panel.colors[colorIndex] = color; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'removeColor', |
||||
|
value: function removeColor(colorIndex) { |
||||
|
this.panel.colors.splice(colorIndex, 1); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'addColor', |
||||
|
value: function addColor() { |
||||
|
this.panel.colors.push('rgba(255, 255, 255, 1)'); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'getGradientForValue', |
||||
|
value: function getGradientForValue(data, value) { |
||||
|
var min = Math.min.apply(Math, data.thresholds); |
||||
|
var max = Math.max.apply(Math, data.thresholds); |
||||
|
var absoluteDistance = max - min; |
||||
|
var valueDistanceFromMin = value - min; |
||||
|
var xPercent = valueDistanceFromMin / absoluteDistance; |
||||
|
// Get the smaller number to clamp at 0.99 max
|
||||
|
xPercent = Math.min(0.99, xPercent); |
||||
|
// Get the larger number to clamp at 0.01 min
|
||||
|
xPercent = Math.max(0.01, xPercent); |
||||
|
|
||||
|
return getColorByXPercentage(this.canvas, xPercent); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'applyOverrides', |
||||
|
value: function applyOverrides(seriesItemAlias) { |
||||
|
var seriesItem = {}, |
||||
|
colorData = {}, |
||||
|
overrides = {}; |
||||
|
console.info('applying overrides for seriesItem'); |
||||
|
console.debug(seriesItemAlias); |
||||
|
console.debug(this.panel.seriesOverrides); |
||||
|
for (var i = 0; i <= this.panel.seriesOverrides.length; i++) { |
||||
|
console.debug('comparing:'); |
||||
|
console.debug(this.panel.seriesOverrides[i]); |
||||
|
if (this.panel.seriesOverrides[i] && this.panel.seriesOverrides[i].alias == seriesItemAlias) { |
||||
|
overrides = this.panel.seriesOverrides[i]; |
||||
|
} |
||||
|
} |
||||
|
colorData.thresholds = (overrides.thresholds || this.panel.thresholds).split(',').map(function (strVale) { |
||||
|
return Number(strVale.trim()); |
||||
|
}); |
||||
|
colorData.colorMap = this.panel.colors; |
||||
|
seriesItem.colorData = colorData; |
||||
|
|
||||
|
seriesItem.valueName = overrides.valueName || this.panel.valueName; |
||||
|
|
||||
|
return seriesItem; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'invertColorOrder', |
||||
|
value: function invertColorOrder() { |
||||
|
this.panel.colors.reverse(); |
||||
|
this.refresh(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'addTreeMapId', |
||||
|
value: function addTreeMapId() { |
||||
|
this.panel.treeMap.ids.push(''); |
||||
|
this.refresh(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'removeTreeMapId', |
||||
|
value: function removeTreeMapId(pos) { |
||||
|
this.panel.treeMap.ids.splice(pos, 1); |
||||
|
this.refresh(); |
||||
|
} |
||||
|
}, { |
||||
|
key: 'changeTreeMapId', |
||||
|
value: function changeTreeMapId(idString, pos) { |
||||
|
this.panel.treeMap.ids[pos] = idString; |
||||
|
} |
||||
|
}, { |
||||
|
key: 'link', |
||||
|
value: function link(scope, elem, attrs, ctrl) { |
||||
|
var chartElement = elem.find('.heatmap'); |
||||
|
chartElement.append('<div id="' + ctrl.containerDivId + '"></div>'); |
||||
|
var chartContainer = $(document.getElementById(ctrl.containerDivId)); |
||||
|
console.debug('found chartContainer'); |
||||
|
console.debug(chartContainer); |
||||
|
elem.css('height', ctrl.height + 'px'); |
||||
|
|
||||
|
var canvas = elem.find('.canvas')[0]; |
||||
|
ctrl.canvas = canvas; |
||||
|
var gradientValueMax = elem.find('.gradient-value-max')[0]; |
||||
|
var gradientValueMin = elem.find('.gradient-value-min')[0]; |
||||
|
|
||||
|
var visFormat = { |
||||
|
"text": function text(_text, opts) { |
||||
|
if (opts.key == 'timestamp') { |
||||
|
var timestamp = moment(Number(_text)); |
||||
|
return timestamp.format(ctrl.panel.treeMap.timestampFormat); |
||||
|
} else if (ctrl.getGroupKeys().indexOf(opts.key) > -1) { |
||||
|
return _text; |
||||
|
} else { |
||||
|
return d3plus.string.title(_text, opts); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
function render(data) { |
||||
|
updateSize(); |
||||
|
updateCanvasStyle(); |
||||
|
updateChart(data); |
||||
|
} |
||||
|
|
||||
|
function updateCanvasStyle() { |
||||
|
canvas.width = Math.max(chartElement[0].clientWidth, 100); |
||||
|
var canvasContext = canvas.getContext("2d"); |
||||
|
canvasContext.clearRect(0, 0, canvas.width, canvas.height); |
||||
|
|
||||
|
var grd = canvasContext.createLinearGradient(0, 0, canvas.width, 0); |
||||
|
var colorWidth = 1 / Math.max(ctrl.panel.colors.length, 1); |
||||
|
for (var i = 0; i < ctrl.panel.colors.length; i++) { |
||||
|
var currentColor = ctrl.panel.colors[i]; |
||||
|
grd.addColorStop(Math.min(colorWidth * i, 1), currentColor); |
||||
|
} |
||||
|
canvasContext.fillStyle = grd; |
||||
|
canvasContext.fillRect(0, 0, canvas.width, 3); |
||||
|
ctrl.canvasContext = canvasContext; |
||||
|
|
||||
|
gradientValueMax.innerText = Math.max.apply(Math, ctrl.panel.thresholds.split(',')); |
||||
|
gradientValueMin.innerText = Math.min.apply(Math, ctrl.panel.thresholds.split(',')); |
||||
|
} |
||||
|
|
||||
|
function updateSize() { |
||||
|
elem.css('height', ctrl.height + 'px'); |
||||
|
} |
||||
|
|
||||
|
function getVisSize(dataPoint) { |
||||
|
if (ctrl.panel.treeMap.sizeByFunction == 'constant') return 1;else { |
||||
|
return dataPoint[ctrl.panel.treeMap.sizeByFunction] || dataPoint.value; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function getVisColor(dataPoint) { |
||||
|
var value = dataPoint[ctrl.panel.treeMap.colorByFunction] || dataPoint.value; |
||||
|
var rgbColor = ctrl.getGradientForValue({ thresholds: ctrl.panel.thresholds.split(',') }, value); |
||||
|
var hexColor = colorToHex(rgbColor); |
||||
|
return hexColor; |
||||
|
} |
||||
|
|
||||
|
function updateChart(data) { |
||||
|
d3.select("#" + ctrl.containerDivId).selectAll('*').remove(); |
||||
|
|
||||
|
// Make sure the necessary IDs are added
|
||||
|
var idKeys = Array.from(ctrl.panel.treeMap.ids); |
||||
|
if (idKeys.length == 0) { |
||||
|
ensureArrayContains(idKeys, 'alias'); |
||||
|
} |
||||
|
if (ctrl.panel.treeMap.enableTimeBlocks) { |
||||
|
ensureArrayContains(idKeys, 'timestamp'); |
||||
|
} |
||||
|
|
||||
|
// Setup Aggregations
|
||||
|
var aggs = {}; |
||||
|
aggs.value = ctrl.panel.treeMap.aggregationFunction; |
||||
|
aggs.current = ctrl.panel.treeMap.aggregationFunction; |
||||
|
aggs.count = 'sum'; |
||||
|
aggs.total = 'sum'; |
||||
|
aggs.avg = 'mean'; |
||||
|
aggs.min = 'min'; |
||||
|
aggs.max = 'max'; |
||||
|
|
||||
|
d3plus.viz().dev(ctrl.panel.treeMap.debug).aggs(aggs).container("#" + ctrl.containerDivId).legend(ctrl.panel.treeMap.showLegend).data(data) |
||||
|
//.type("tree_map")
|
||||
|
.type({ "mode": ctrl.panel.treeMap.mode }) // sets the mode of visualization display based on type
|
||||
|
.id({ |
||||
|
"value": _.uniq(idKeys), |
||||
|
"grouping": ctrl.panel.treeMap.enableGrouping |
||||
|
}).depth(Number(ctrl.panel.treeMap.depth)).size(getVisSize).height(ctrl.height).width(ctrl.width).color(getVisColor).format(visFormat).draw(); |
||||
|
} |
||||
|
|
||||
|
this.events.on('render', function onRender(data) { |
||||
|
if (typeof d3plus !== 'undefined' && data) { |
||||
|
render(data); |
||||
|
ctrl.renderingCompleted(); |
||||
|
} else { |
||||
|
console.info('d3plus is not loaded yet'); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}]); |
||||
|
|
||||
|
return HeatmapCtrl; |
||||
|
}(MetricsPanelCtrl))); |
||||
|
|
||||
|
;HeatmapCtrl.templateUrl = 'module.html'; |
||||
|
|
||||
|
_export('HeatmapCtrl', HeatmapCtrl); |
||||
|
|
||||
|
_export('MetricsPanelCtrl', HeatmapCtrl); |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
|
//# sourceMappingURL=heatmapControl.js.map
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,84 @@ |
|||||
|
<div class="gf-form-group"> |
||||
|
<h5>Development</h5> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Debug<tip>Display messages in browser console</tip></label> |
||||
|
<editor-checkbox text="Enable" model="ctrl.panel.treeMap.debug" class="gf-form-checkbox" ></editor-checkbox> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="gf-form-group"> |
||||
|
<h5>Group Options</h5> |
||||
|
|
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Grouped</label> |
||||
|
<editor-checkbox text="Enable" model="ctrl.panel.treeMap.enableGrouping" class="gf-form-checkbox" ></editor-checkbox> |
||||
|
</div> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Group Depth</label> |
||||
|
<input type="text" ng-model="ctrl.panel.treeMap.depth" ng-blur="ctrl.render()" class="gf-form-input width-10" > |
||||
|
</div> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Default Aggregation</label> |
||||
|
<select |
||||
|
ng-options="option for option in ctrl.options.treeMap.aggregationFunctions" class="width-10" |
||||
|
ng-model="ctrl.panel.treeMap.aggregationFunction" ng-change="ctrl.refresh()"></select> |
||||
|
</div> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Time Blocks<tip>Adds a group at the deepest level. Use 'timestamp' in your Group Order to override the nesting level</tip></label> |
||||
|
<editor-checkbox text="Enable" model="ctrl.panel.treeMap.enableTimeBlocks" class="gf-form-checkbox width-10" ></editor-checkbox> |
||||
|
<label class="gf-form-label width-10" ng-show="ctrl.panel.treeMap.enableTimeBlocks">Time Format<tip>ISO Format String</tip></label> |
||||
|
<input type="text" |
||||
|
bs-typeahead="ctrl.options.treeMap.timestampFormats" |
||||
|
ng-show="ctrl.panel.treeMap.enableTimeBlocks" |
||||
|
class="gf-form-input width-20" |
||||
|
ng-model="ctrl.panel.treeMap.timestampFormat" ng-change="ctrl.refresh()"></input> |
||||
|
</div> |
||||
|
|
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label width-10">Group Order</label> |
||||
|
<div class="gf-form" ng-repeat="idString in ctrl.panel.treeMap.ids track by $index"> |
||||
|
<input type="text" ng-model="idString" placeholder="alias" data-min-length=0 ng-change="ctrl.changeTreeMapId(idString, $index)" class="gf-form-input width-10"> |
||||
|
<label class="gf-form-label"> |
||||
|
<i class="fa fa-trash pointer" ng-click="ctrl.removeTreeMapId($index)"></i> |
||||
|
</label> |
||||
|
</div> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label"> |
||||
|
<i class="fa fa-plus pointer" ng-click="ctrl.addTreeMapId()"></i> |
||||
|
</label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="gf-form-group"> |
||||
|
<div class="edit-tab-content"> |
||||
|
<div class="gf-form-group"> |
||||
|
<h5>Grouping <tip>Regex match example: /server[0-3]/i </tip></h5> |
||||
|
|
||||
|
<div class="gf-form-inline" ng-repeat="group in ctrl.panel.treeMap.groups"> |
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label">group name</label> |
||||
|
</div> |
||||
|
<div class="gf-form width-10"> |
||||
|
<input type="text" ng-model="group.key" ng-blur="ctrl.render()" data-min-length=0 data-items=100 class="gf-form-input"> |
||||
|
</div> |
||||
|
|
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label">regex</label> |
||||
|
</div> |
||||
|
<div class="gf-form width-10"> |
||||
|
<input type="text" ng-model="group.value" bs-typeahead="getSeriesNames" ng-blur="ctrl.render()" data-min-length=0 data-items=100 class="gf-form-input"> |
||||
|
</div> |
||||
|
|
||||
|
<div class="gf-form"> |
||||
|
<label class="gf-form-label"> |
||||
|
<i class="fa fa-trash pointer" ng-click="ctrl.removeTreeMapGroup(group)"></i> |
||||
|
</label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<button class="btn btn-inverse" ng-click="ctrl.addTreeMapGroup()"> |
||||
|
<i class="fa fa-plus"></i> Add group |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 80 KiB |
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,31 @@ |
|||||
|
<div class="heatmap"></div> |
||||
|
<div class="diagram-legend-canvas"> |
||||
|
<div class="gradient-values-container"> |
||||
|
<span class="gradient-value-max"></span> |
||||
|
<span class="gradient-value-min"></span> |
||||
|
</div> |
||||
|
<canvas class="canvas" width="300" height="15"></canvas> |
||||
|
</div> |
||||
|
<div class="graph-legend-wrapper" ng-show="ctrl.panel.legend.show" graph-legend="" style="overflow-x: auto; max-height: 200px;"> |
||||
|
<section class="graph-legend graph-legend-table"> |
||||
|
<table> |
||||
|
<tr> |
||||
|
<th colspan="2" style="text-align:left"></th> |
||||
|
<th ng-show="ctrl.panel.legend.min" class="pointer" data-stat="min">min</th> |
||||
|
<th ng-show="ctrl.panel.legend.max" class="pointer" data-stat="max">max</th> |
||||
|
<th ng-show="ctrl.panel.legend.avg" class="pointer" data-stat="avg">avg</th> |
||||
|
<th ng-show="ctrl.panel.legend.total" class="pointer" data-stat="total">total</th> |
||||
|
<th ng-show="ctrl.panel.legend.current" class="pointer" data-stat="current">current</th> |
||||
|
</tr> |
||||
|
<tr class="graph-legend-series" ng-repeat="series in ctrl.series"> |
||||
|
<td class="graph-legend-icon"><i class="fa fa-minus pointer"></i></td> |
||||
|
<td><a class="graph-legend-alias pointer">{{series.alias}}</a></td> |
||||
|
<td ng-show="ctrl.panel.legend.min" class="graph-legend-value min">{{series.stats.min}}</td> |
||||
|
<td ng-show="ctrl.panel.legend.max" class="graph-legend-value max">{{series.stats.max}}</td> |
||||
|
<td ng-show="ctrl.panel.legend.avg" class="graph-legend-value avg">{{series.stats.avg}}</td> |
||||
|
<td ng-show="ctrl.panel.legend.total" class="graph-legend-value total">{{series.stats.total}}</td> |
||||
|
<td ng-show="ctrl.panel.legend.current" class="graph-legend-value current">{{series.stats.current}}</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
</section> |
||||
|
</div> |
||||
@ -0,0 +1,18 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
System.register(['./properties', './heatmapControl'], function (_export, _context) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var pluginName, HeatmapCtrl; |
||||
|
return { |
||||
|
setters: [function (_properties) { |
||||
|
pluginName = _properties.pluginName; |
||||
|
}, function (_heatmapControl) { |
||||
|
HeatmapCtrl = _heatmapControl.HeatmapCtrl; |
||||
|
}], |
||||
|
execute: function () { |
||||
|
_export('PanelCtrl', HeatmapCtrl); |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
|
//# sourceMappingURL=module.js.map
|
||||
@ -0,0 +1 @@ |
|||||
|
{"version":3,"sources":["../src/module.js"],"names":["pluginName","HeatmapCtrl"],"mappings":";;;;;;;;AAAQA,gB,eAAAA,U;;AACAC,iB,mBAAAA,W;;;2BASPA,W","file":"module.js","sourcesContent":["import {pluginName} from './properties';\r\nimport {HeatmapCtrl} from './heatmapControl';\r\n/*import {loadPluginCss} from 'app/plugins/sdk';\r\n\r\nloadPluginCss({\r\n dark: 'plugins/'+pluginName+'/libs/mermaid/dist/mermaid.css',\r\n light: 'plugins/'+pluginName+'/libs/mermaid/dist/mermaid.css'\r\n});*/\r\n\r\nexport {\r\n\tHeatmapCtrl as PanelCtrl\r\n}; "]} |
||||
@ -0,0 +1,36 @@ |
|||||
|
{ |
||||
|
"type": "panel", |
||||
|
"name": "Heatmap", |
||||
|
"id": "savantly-heatmap-panel", |
||||
|
"info": { |
||||
|
"description": "Heatmap panel for grafana", |
||||
|
"author": { |
||||
|
"name": "Jeremy Branham", |
||||
|
"url": "https://github.com/jdbranham" |
||||
|
}, |
||||
|
"keywords": [ |
||||
|
"heatmap", |
||||
|
"panel" |
||||
|
], |
||||
|
"links": [ |
||||
|
{ |
||||
|
"name": "Project site", |
||||
|
"url": "https://github.com/savantly-net/grafana-heatmap" |
||||
|
}, |
||||
|
{ |
||||
|
"name": "Apache License", |
||||
|
"url": "https://github.com/savantly-net/grafana-heatmap/blob/master/LICENSE" |
||||
|
} |
||||
|
], |
||||
|
"version": "0.2.1", |
||||
|
"updated": "2016-10-16", |
||||
|
"logos": { |
||||
|
"small": "img/icn-heatmap-panel.svg", |
||||
|
"large": "img/icn-heatmap-panel.svg" |
||||
|
} |
||||
|
}, |
||||
|
"dependencies": { |
||||
|
"grafanaVersion": "3.x.x", |
||||
|
"plugins": [] |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
System.register([], function (_export, _context) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var pluginName, heatmapEditor, displayEditor; |
||||
|
return { |
||||
|
setters: [], |
||||
|
execute: function () { |
||||
|
_export('pluginName', pluginName = 'savantly-heatmap-panel'); |
||||
|
|
||||
|
_export('heatmapEditor', heatmapEditor = 'public/plugins/' + pluginName + '/heatmapEditor.html'); |
||||
|
|
||||
|
_export('displayEditor', displayEditor = 'public/plugins/' + pluginName + '/displayEditor.html'); |
||||
|
|
||||
|
_export('pluginName', pluginName); |
||||
|
|
||||
|
_export('heatmapEditor', heatmapEditor); |
||||
|
|
||||
|
_export('displayEditor', displayEditor); |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
|
//# sourceMappingURL=properties.js.map
|
||||
@ -0,0 +1 @@ |
|||||
|
{"version":3,"sources":["../src/properties.js"],"names":["pluginName","heatmapEditor","displayEditor"],"mappings":";;;;;;;;;yBACIA,U,GAAa,wB;;4BAChBC,a,GAAgB,oBAAmBD,UAAnB,GAA+B,qB;;4BAC/CE,a,GAAgB,oBAAmBF,UAAnB,GAA+B,qB;;yBAG/CA,U;;4BACAC,a;;4BACAC,a","file":"properties.js","sourcesContent":["\r\nvar pluginName = 'savantly-heatmap-panel',\r\n\theatmapEditor = 'public/plugins/'+ pluginName +'/heatmapEditor.html',\r\n\tdisplayEditor = 'public/plugins/'+ pluginName +'/displayEditor.html';\r\n\r\nexport {\r\n\tpluginName,\r\n\theatmapEditor,\r\n\tdisplayEditor\r\n}"]} |
||||
@ -0,0 +1,103 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
System.register([], function (_export, _context) { |
||||
|
"use strict"; |
||||
|
|
||||
|
return { |
||||
|
setters: [], |
||||
|
execute: function () { |
||||
|
angular.module('grafana.controllers').controller('SeriesOverridesHeatmapCtrl', ['$scope', '$element', 'popoverSrv', function ($scope, $element, popoverSrv) { |
||||
|
$scope.overrideMenu = []; |
||||
|
$scope.currentOverrides = []; |
||||
|
$scope.override = $scope.override || {}; |
||||
|
|
||||
|
$scope.addOverrideOption = function (name, propertyName, values) { |
||||
|
var option = {}; |
||||
|
option.text = name; |
||||
|
option.propertyName = propertyName; |
||||
|
option.index = $scope.overrideMenu.length; |
||||
|
option.values = values; |
||||
|
|
||||
|
option.submenu = _.map(values, function (value) { |
||||
|
return { text: String(value), value: value }; |
||||
|
}); |
||||
|
|
||||
|
$scope.overrideMenu.push(option); |
||||
|
}; |
||||
|
|
||||
|
$scope.setOverride = function (item, subItem) { |
||||
|
// handle color overrides
|
||||
|
if (item.propertyName === 'color') { |
||||
|
$scope.openColorSelector(); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
$scope.override[item.propertyName] = subItem.value; |
||||
|
$scope.updateCurrentOverrides(); |
||||
|
$scope.ctrl.render(); |
||||
|
}; |
||||
|
|
||||
|
$scope.colorSelected = function (color) { |
||||
|
$scope.override['color'] = color; |
||||
|
$scope.updateCurrentOverrides(); |
||||
|
$scope.ctrl.render(); |
||||
|
}; |
||||
|
|
||||
|
$scope.thresholdsChanged = function (thresholds) { |
||||
|
$scope.override['thresholds'] = thresholds.value; |
||||
|
$scope.updateCurrentOverrides(); |
||||
|
$scope.ctrl.render(); |
||||
|
}; |
||||
|
|
||||
|
$scope.openColorSelector = function () { |
||||
|
popoverSrv.show({ |
||||
|
element: $element.find(".dropdown")[0], |
||||
|
position: 'top center', |
||||
|
openOn: 'click', |
||||
|
template: '<gf-color-picker></gf-color-picker>', |
||||
|
model: { |
||||
|
autoClose: true, |
||||
|
colorSelected: $scope.colorSelected |
||||
|
}, |
||||
|
onClose: function onClose() { |
||||
|
$scope.ctrl.render(); |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
$scope.removeOverride = function (option) { |
||||
|
delete $scope.override[option.propertyName]; |
||||
|
$scope.updateCurrentOverrides(); |
||||
|
$scope.ctrl.refresh(); |
||||
|
}; |
||||
|
|
||||
|
$scope.getSeriesNames = function () { |
||||
|
return _.map($scope.ctrl.seriesList, function (series) { |
||||
|
return series.alias; |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
$scope.updateCurrentOverrides = function () { |
||||
|
$scope.currentOverrides = []; |
||||
|
_.each($scope.overrideMenu, function (option) { |
||||
|
var value = $scope.override[option.propertyName]; |
||||
|
if (_.isUndefined(value)) { |
||||
|
return; |
||||
|
} |
||||
|
$scope.currentOverrides.push({ |
||||
|
name: option.text, |
||||
|
propertyName: option.propertyName, |
||||
|
value: String(value) |
||||
|
}); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
//$scope.addOverrideOption('Color', 'color', ['change']);
|
||||
|
$scope.addOverrideOption('Thresholds', 'thresholds', ['custom']); |
||||
|
$scope.addOverrideOption('Value', 'valueName', ['avg', 'min', 'max', 'total', 'current']); |
||||
|
$scope.updateCurrentOverrides(); |
||||
|
}]); |
||||
|
} |
||||
|
}; |
||||
|
}); |
||||
|
//# sourceMappingURL=series_overrides_heatmap_ctrl.js.map
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue