[TASK] Rename parameters and require image
This commit is contained in:
parent
1506a03fa6
commit
b05517360d
42
README.md
42
README.md
@ -181,13 +181,13 @@ Examples for `fixedCenter`:
|
|||||||
|
|
||||||
This option allows to show node statistics depending on following case-sensitive parameters:
|
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
|
- `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`
|
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.
|
you can use the case-sensitive template string `{NODE_ID}`, `{NODE_NAME}`, `{LOCALE}` and `{TIME}` as cache-breaker.
|
||||||
|
|
||||||
Examples for `nodeInfos`:
|
Examples for `nodeInfos`:
|
||||||
@ -196,13 +196,13 @@ Examples for `nodeInfos`:
|
|||||||
|
|
||||||
{ "name": "Clientstatistik",
|
{ "name": "Clientstatistik",
|
||||||
"href": "stats/dashboard/db/node-byid?var-nodeid={NODE_ID}",
|
"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}",
|
"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}",
|
||||||
"caption": "Knoten {NODE_ID}"
|
"title": "Knoten {NODE_ID}"
|
||||||
},
|
},
|
||||||
{ "name": "Uptime",
|
{ "name": "Uptime",
|
||||||
"href": "stats/dashboard/db/node-byid?var-nodeid={NODE_ID}",
|
"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}",
|
"image": "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}"
|
"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:
|
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
|
- `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`
|
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:
|
Examples for `globalInfos` using Grafana server rendering:
|
||||||
|
|
||||||
"globalInfos": [
|
"globalInfos": [
|
||||||
{ "name": "Wochenstatistik",
|
{ "name": "Wochenstatistik",
|
||||||
"href": "stats/render/render/dashboard-solo/db/global?panelId=1&fullscreen&theme=light&width=600&height=300",
|
"href": "stats/render/render/dashboard-solo/db/global?panelId=1&fullscreen&theme=light&width=600&height=300",
|
||||||
"thumbnail": "nodes/globalGraph.png",
|
"image": "nodes/globalGraph.png",
|
||||||
"caption": "Bild mit Wochenstatistik"
|
"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:
|
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
|
- `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`
|
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.
|
you can use the case-sensitive template strings `{SOURCE_ID}`, `{TARGET_ID}`, `{SOURCE_NAME}`, `{TARGET_NAME}`, `{LOCALE}` and `{TIME}` as cache-breaker.
|
||||||
|
|
||||||
"linkInfos": [
|
"linkInfos": [
|
||||||
{ "href": "stats/dashboard/db/links?var-source={SOURCE_ID}&var-target={TARGET_ID}",
|
{ "name": "Linkstatistik",
|
||||||
"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}"
|
"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"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
12
config.json
12
config.json
@ -5,22 +5,22 @@
|
|||||||
{
|
{
|
||||||
"name": "Clientstatistik",
|
"name": "Clientstatistik",
|
||||||
"href": "https://regensburg.freifunk.net/netz/statistik/node/{NODE_ID}/",
|
"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}",
|
"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}",
|
||||||
"caption": "Knoten {NODE_ID} - weiteren Statistiken"
|
"title": "Knoten {NODE_ID} - weiteren Statistiken"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Trafficstatistik",
|
"name": "Trafficstatistik",
|
||||||
"href": "https://regensburg.freifunk.net/netz/statistik/node/{NODE_ID}/",
|
"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}",
|
"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}",
|
||||||
"caption": "Knoten {NODE_ID} - weiteren Statistiken"
|
"title": "Knoten {NODE_ID} - weiteren Statistiken"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalInfos": [
|
"globalInfos": [
|
||||||
{
|
{
|
||||||
"name": "Statistik",
|
"name": "Statistik",
|
||||||
"href": "https://regensburg.freifunk.net/netz/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",
|
"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",
|
||||||
"caption": "Jahresstatistik - weiteren Statistiken"
|
"title": "Jahresstatistik - weiteren Statistiken"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// String or array of data provider are supported
|
// String or array of data provider are supported
|
||||||
|
@ -154,21 +154,10 @@ define({
|
|||||||
|
|
||||||
showStat: function showStat(o, subst) {
|
showStat: function showStat(o, subst) {
|
||||||
var content;
|
var content;
|
||||||
var caption;
|
|
||||||
subst = typeof subst !== 'undefined' ? subst : {};
|
subst = typeof subst !== 'undefined' ? subst : {};
|
||||||
|
|
||||||
if (o.thumbnail) {
|
|
||||||
content = document.createElement('img');
|
content = document.createElement('img');
|
||||||
content.src = require('helper').listReplace(o.thumbnail, subst);
|
content.src = require('helper').listReplace(o.image, subst);
|
||||||
}
|
|
||||||
|
|
||||||
if (o.caption) {
|
|
||||||
caption = require('helper').listReplace(o.caption, subst);
|
|
||||||
|
|
||||||
if (!content) {
|
|
||||||
content = document.createTextNode(caption);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var p = document.createElement('p');
|
var p = document.createElement('p');
|
||||||
|
|
||||||
@ -178,8 +167,8 @@ define({
|
|||||||
link.href = require('helper').listReplace(o.href, subst);
|
link.href = require('helper').listReplace(o.href, subst);
|
||||||
link.appendChild(content);
|
link.appendChild(content);
|
||||||
|
|
||||||
if (caption && o.thumbnail) {
|
if (o.title) {
|
||||||
link.title = caption;
|
link.title = require('helper').listReplace(o.title, subst);
|
||||||
}
|
}
|
||||||
|
|
||||||
p.appendChild(link);
|
p.appendChild(link);
|
||||||
|
Loading…
Reference in New Issue
Block a user