[TASK] Rename parameters and require image

This commit is contained in:
Xaver Maierhofer 2017-02-10 00:19:41 +01:00 committed by Geno
parent 1506a03fa6
commit b05517360d
3 changed files with 32 additions and 41 deletions

View File

@ -181,13 +181,13 @@ Examples for `fixedCenter`:
This option allows to show node statistics depending on following case-sensitive parameters:
- `name` caption of statistics segment in infobox
- `name` header of statistics segment in infobox
- `href` absolute or relative URL to statistics image
- `thumbnail` absolute or relative URL to thumbnail image,
- `image` `(required)` absolute or relative URL to image,
can be the same like `href`
- `caption` is shown, if `thumbnail` is not present (no thumbnail in infobox)
- `title` for the image
To insert current node-id in either `href`, `thumbnail` or `caption`
To insert current variables in either `href`, `image` or `title`
you can use the case-sensitive template string `{NODE_ID}`, `{NODE_NAME}`, `{LOCALE}` and `{TIME}` as cache-breaker.
Examples for `nodeInfos`:
@ -196,13 +196,13 @@ Examples for `nodeInfos`:
{ "name": "Clientstatistik",
"href": "stats/dashboard/db/node-byid?var-nodeid={NODE_ID}",
"thumbnail": "stats/render/dashboard-solo/db/node-byid?panelId=1&fullscreen&theme=light&width=600&height=300&var-nodeid={NODE_ID}&var-host={NODE_NAME}&_t={TIME}",
"caption": "Knoten {NODE_ID}"
"image": "stats/render/dashboard-solo/db/node-byid?panelId=1&fullscreen&theme=light&width=600&height=300&var-nodeid={NODE_ID}&var-host={NODE_NAME}&_t={TIME}",
"title": "Knoten {NODE_ID}"
},
{ "name": "Uptime",
"href": "stats/dashboard/db/node-byid?var-nodeid={NODE_ID}",
"thumbnail": "stats/render/dashboard-solo/db/node-byid?panelId=2&fullscreen&theme=light&width=600&height=300&var-nodeid={NODE_ID}&_t={TIME}",
"caption": "Knoten {NODE_ID}"
"image": "stats/render/dashboard-solo/db/node-byid?panelId=2&fullscreen&theme=light&width=600&height=300&var-nodeid={NODE_ID}&_t={TIME}",
"title": "Knoten {NODE_ID}"
}
]
@ -212,21 +212,21 @@ In order to have statistics images available, you have to set up an instance of
This option allows to show global statistics on statistics page depending on following case-sensitive parameters:
- `name` caption of statistics segment in infobox
- `name` header of statistics segment in infobox
- `href` absolute or relative URL to statistics image
- `thumbnail` absolute or relative URL to thumbnail image,
- `image` `(required)` absolute or relative URL to image,
can be the same like `href`
- `caption` is shown, if `thumbnail` is not present (no thumbnail in infobox)
- `title` for the image
In contrast to `nodeInfos` there is no template substitution in `href`, `thumbnail` or `caption`.
In contrast to `nodeInfos` there is no template substitution in `href`, `image` or `title`.
Examples for `globalInfos` using Grafana server rendering:
"globalInfos": [
{ "name": "Wochenstatistik",
"href": "stats/render/render/dashboard-solo/db/global?panelId=1&fullscreen&theme=light&width=600&height=300",
"thumbnail": "nodes/globalGraph.png",
"caption": "Bild mit Wochenstatistik"
"image": "nodes/globalGraph.png",
"title": "Bild mit Wochenstatistik"
}
]
@ -234,18 +234,20 @@ Examples for `globalInfos` using Grafana server rendering:
This option allows to show link statistics depending on the following case-sensitive parameters:
- `name` caption of statistics segment in infobox
- `name` header of statistics segment in infobox
- `href` absolute or relative URL to statistics image
- `thumbnail` absolute or relative URL to thumbnail image,
- `image` `(required)` absolute or relative URL to image,
can be the same like `href`
- `caption` is shown, if `thumbnail` is not present (no thumbnail in infobox)
- `title` for the image
To insert the source or target node-id in either `href`, `thumbnail` or `caption`
To insert the source or target variable in either `href`, `image` or `title`
you can use the case-sensitive template strings `{SOURCE_ID}`, `{TARGET_ID}`, `{SOURCE_NAME}`, `{TARGET_NAME}`, `{LOCALE}` and `{TIME}` as cache-breaker.
"linkInfos": [
{ "href": "stats/dashboard/db/links?var-source={SOURCE_ID}&var-target={TARGET_ID}",
"thumbnail": "stats/render/dashboard-solo/db/links?panelId=1&fullscreen&theme=light&width=800&height=600&var-source={SOURCE_ID}&var-target={TARGET_ID}&_t={TIME}"
{ "name": "Linkstatistik",
"href": "stats/dashboard/db/links?var-source={SOURCE_ID}&var-target={TARGET_ID}",
"image": "stats/render/dashboard-solo/db/links?panelId=1&fullscreen&theme=light&width=800&height=600&var-source={SOURCE_ID}&var-target={TARGET_ID}&_t={TIME}",
"title": "Bild mit Linkstatistik"
}
]

View File

@ -5,22 +5,22 @@
{
"name": "Clientstatistik",
"href": "https://regensburg.freifunk.net/netz/statistik/node/{NODE_ID}/",
"thumbnail": "https://grafana.regensburg.freifunk.net/render/dashboard-solo/db/ffrgb-all-nodes?panelId=1&from=now-7d&var-nodeid={NODE_ID}&var-host={NODE_NAME}&width=650&height=350&theme=light&_t={TIME}",
"caption": "Knoten {NODE_ID} - weiteren Statistiken"
"image": "https://grafana.regensburg.freifunk.net/render/dashboard-solo/db/ffrgb-all-nodes?panelId=1&from=now-7d&var-nodeid={NODE_ID}&var-host={NODE_NAME}&width=650&height=350&theme=light&_t={TIME}",
"title": "Knoten {NODE_ID} - weiteren Statistiken"
},
{
"name": "Trafficstatistik",
"href": "https://regensburg.freifunk.net/netz/statistik/node/{NODE_ID}/",
"thumbnail": "https://grafana.regensburg.freifunk.net/render/dashboard-solo/db/ffrgb-all-nodes?panelId=2&from=now-7d&var-nodeid={NODE_ID}&var-host={NODE_NAME}&width=650&height=350&theme=light&_t={TIME}",
"caption": "Knoten {NODE_ID} - weiteren Statistiken"
"image": "https://grafana.regensburg.freifunk.net/render/dashboard-solo/db/ffrgb-all-nodes?panelId=2&from=now-7d&var-nodeid={NODE_ID}&var-host={NODE_NAME}&width=650&height=350&theme=light&_t={TIME}",
"title": "Knoten {NODE_ID} - weiteren Statistiken"
}
],
"globalInfos": [
{
"name": "Statistik",
"href": "https://regensburg.freifunk.net/netz/statistik/",
"thumbnail": "https://grafana.regensburg.freifunk.net/render/dashboard-solo/db/ffrgb-network-wide-stats?panelId=11&from=now-1y&width=600&height=350&theme=light",
"caption": "Jahresstatistik - weiteren Statistiken"
"image": "https://grafana.regensburg.freifunk.net/render/dashboard-solo/db/ffrgb-network-wide-stats?panelId=11&from=now-1y&width=600&height=350&theme=light",
"title": "Jahresstatistik - weiteren Statistiken"
}
],
// String or array of data provider are supported

View File

@ -154,21 +154,10 @@ define({
showStat: function showStat(o, subst) {
var content;
var caption;
subst = typeof subst !== 'undefined' ? subst : {};
if (o.thumbnail) {
content = document.createElement('img');
content.src = require('helper').listReplace(o.thumbnail, subst);
}
if (o.caption) {
caption = require('helper').listReplace(o.caption, subst);
if (!content) {
content = document.createTextNode(caption);
}
}
content = document.createElement('img');
content.src = require('helper').listReplace(o.image, subst);
var p = document.createElement('p');
@ -178,8 +167,8 @@ define({
link.href = require('helper').listReplace(o.href, subst);
link.appendChild(content);
if (caption && o.thumbnail) {
link.title = caption;
if (o.title) {
link.title = require('helper').listReplace(o.title, subst);
}
p.appendChild(link);