meshviewer/README.md

329 lines
11 KiB
Markdown
Raw Normal View History

2017-02-12 18:01:19 +00:00
# Meshviewer
[![Build Status](https://img.shields.io/travis/ffrgb/meshviewer/develop.svg?style=flat-square)](https://travis-ci.org/ffrgb/meshviewer)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/ffrgb/meshviewer/develop.svg?style=flat-square)](https://scrutinizer-ci.com/g/ffrgb/meshviewer/?branch=develop)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg?style=flat-square)](https://www.gnu.org/licenses/agpl-3.0)
2015-04-01 15:49:12 +00:00
2017-02-12 18:01:19 +00:00
Web-app to visualize nodes and links on a map for Freifunk open mesh network.
2015-04-01 15:07:04 +00:00
2017-02-12 18:01:19 +00:00
#### Main differences to https://github.com/ffnord/meshviewer
_Some similar features might have been implemented/merged_
- Map layer modes (Allow to set a default layer based on time combined with a stylesheet)
- Updates for selected node or list (incl. image stats cache-breaker)
2017-02-01 21:13:06 +00:00
- Node filter is implemented
2017-02-12 18:01:19 +00:00
- Zoom level for a node (`nodeZoom`) - Zoom level 22 available, but it is to close for a click
2016-05-22 20:35:23 +00:00
- Formatted Code
2017-02-06 23:27:58 +00:00
- Translation support - https://crowdin.com/project/meshviewer - Contact us for new languages
2017-02-12 18:01:19 +00:00
- Currently available: en, de & fr
2016-05-22 20:35:23 +00:00
- Grunt inline for some css and js - less requests
2017-02-12 18:01:19 +00:00
- Icon font with needed icons only
- Upgrade to Grunt v1.x (Tested with Node.js 4/6 LTS, 7 on Linux, 7 OSX & W**)
- Moved css and some js inline
- Remove bower in favour of npm/yarn
2017-02-12 18:01:19 +00:00
- Load only moment.js without languages (Languages are included in translations)
2017-02-06 23:27:58 +00:00
- Remove unneeded components (es6-shim, tablesort, numeraljs, leaflet-providers, jshashes)
2017-02-12 18:01:19 +00:00
- RBush v2 - performance boost in last versions (Positions labels and clients on the map)
2016-05-22 20:35:23 +00:00
- Remove ruby dependency
2016-05-26 16:39:26 +00:00
- FixedCenter is required
2017-02-12 18:01:19 +00:00
- Rewrite scss, sass-lint and variables for easy customization/adjustments
- Improved cross browser/device support THX@BrowserStack
- Leaflet with patch to avoid IE/Edge crashes
2017-02-12 18:01:19 +00:00
- Yarn package manager in favor of npm (npm still works)
- Configurable reverse geocoding server
2017-02-12 18:01:19 +00:00
- [A lot more in the commit history](https://github.com/ffrgb/meshviewer/commits/develop)
## Demo:
2015-04-11 11:48:16 +00:00
2017-02-12 18:01:19 +00:00
Embedded: https://regensburg.freifunk.net/netz/karte/<br>
Standalone: https://regensburg.freifunk.net/meshviewer/
2017-02-12 18:01:19 +00:00
## Known instances
2017-02-12 18:01:19 +00:00
| Community | Instance | Repo GitHub |
| --- | --- | --- |
| Freifunk Bremen | https://map.bremen.freifunk.net/ | [FreifunkBremen/meshviewer-ffrgb](https://github.com/FreifunkBremen/meshviewer-ffrgb) |
2015-04-01 15:07:04 +00:00
2017-02-12 18:01:19 +00:00
## Dependencies
2015-03-29 00:09:21 +00:00
2017-02-12 18:01:19 +00:00
- yarn (npm fallback)
2015-03-29 12:49:59 +00:00
- grunt-cli
2015-03-29 00:09:21 +00:00
2017-02-12 18:01:19 +00:00
### Installing dependencies
2015-03-29 00:09:21 +00:00
2017-02-12 18:01:19 +00:00
_npm is still possible to use, but yarn is much faster https://yarnpkg.com/_
2015-04-25 16:23:20 +00:00
Install yarn package-manager:
Chosse your OS and install yarn https://yarnpkg.com/en/docs/install
2015-04-25 16:23:20 +00:00
Execute these commands on your server as a normal user to prepare the dependencies:
2017-02-12 18:01:19 +00:00
```bash
git clone https://github.com/ffrgb/meshviewer.git
cd meshviewer
yarn
# Only needed when no global grunt is installed
yarn global add grunt-cli
```
2015-03-29 01:46:10 +00:00
2017-02-12 18:01:19 +00:00
## Building
2016-05-22 20:35:23 +00:00
Just run the following command from the meshviewer directory:
2017-02-12 18:01:19 +00:00
```bash
grunt
```
This will generate `build/` containing all required files.
## Development
Use `grunt serve` for development.
## Support/Help
2017-02-12 18:01:19 +00:00
- IRC on irc.hackint.org
- [#freifunkRGB](irc://irc.hackint.org/freifunkRGB)
- [#meshviewer](irc://irc.hackint.org/meshviewer) (development-channel)
- Feel free to open an [issue](https://github.com/ffrgb/meshviewer/issues/new) for a problem or an idea.
2015-04-20 22:10:29 +00:00
2017-02-12 18:01:19 +00:00
## Customize style
2015-04-20 22:10:29 +00:00
2017-02-12 18:01:19 +00:00
Start your development and edit files in `scss/custom/`. Additional information in file comments.
2017-02-12 18:01:19 +00:00
## Configure
2017-02-12 18:01:19 +00:00
Change `config.json`to match your community.
2017-02-12 18:01:19 +00:00
### dataPath (string/array)
2015-04-20 22:10:29 +00:00
2016-05-22 20:35:23 +00:00
`dataPath` can be either a string containing the address of a Nodes.json v2 compatible backend (e.g. ffmap backend) or an array containing multiple addresses.
2016-02-03 18:18:37 +00:00
Don't forget the trailing slash!
Also, proxying the data through a webserver will allow GZip and thus will greatly reduce bandwidth consumption.
It may help with firewall problems too.
2015-04-20 22:10:29 +00:00
2017-02-12 18:01:19 +00:00
### siteName (string)
2015-04-20 22:10:29 +00:00
Change this to match your communities' name. It will be used in various places.
2015-03-29 01:46:10 +00:00
2017-02-12 18:01:19 +00:00
### maxAge (integer)
2015-04-26 11:12:11 +00:00
Nodes being online for less than maxAge days are considered "new". Likewise,
2015-09-30 15:38:02 +00:00
nodes being offline for more than than maxAge days are considered "lost".
2015-04-26 11:12:11 +00:00
2017-02-12 18:01:19 +00:00
### maxAgeAlert (integer)
2017-02-01 23:47:54 +00:00
Nodes being offline for more than than maxAge days are considered "lost".
Lost will be splitted in alert and lost.
2017-02-12 18:01:19 +00:00
### nodeZoom (integer)
2016-06-23 02:15:54 +00:00
Max level to be applied by clicking a node or open a node. With value `18` near by buildings and streets should be visible.
Interesting if one of configured map provider has zoom-level under `18`.
2017-02-12 18:01:19 +00:00
### labelZoom (integer)
Min. level for node labels shown on the map. Labels aren't shown in first zoom levels and need performance.
2017-02-12 18:01:19 +00:00
### clientZoom (integer)
Min. level to set starting layer for client dots on map.
2017-02-12 18:01:19 +00:00
### nodeInfobox
2017-02-12 18:01:19 +00:00
#### contact (bool, optional)
Setting this to `false` will hide contact information for nodes.
2017-02-12 18:01:19 +00:00
#### hardwareUsage (bool, optional)
Setting this to `false` will hide bars of memory usage and load avg for nodes.
2017-02-12 18:01:19 +00:00
### mapLayers (List)
2015-07-07 14:36:19 +00:00
2017-01-07 02:06:54 +00:00
A list of objects describing map layers. Each object has at least `name`, `url` and `config` properties. [Example layers and configuration](http://leaflet-extras.github.io/leaflet-providers/preview/) (map against config.json).
2015-07-07 14:36:19 +00:00
2017-02-12 18:01:19 +00:00
#### mode (string, optional)
2017-01-07 02:00:37 +00:00
2017-01-31 03:45:27 +00:00
Allows to load a additional style for a night mode or similar use case. Possible are inline style or link.
Inline avoids re-rendering and maybe issues with label-layer update. Important are class "css-mode mode-name" and media "not".
_Default is night.css inline in index.html_
```html
<link rel="stylesheet" class="css-mode mode-name" media="not" href="mode-name.css">
```
or
```html
<style class="css-mode mode-name" media="not">
<inline src="mode-name.css" />
</style>
```
2017-01-07 02:00:37 +00:00
2017-02-12 18:01:19 +00:00
#### start (integer, optional)
2017-01-07 02:00:37 +00:00
Start a time range to put this mapLayer on first position.
2017-02-12 18:01:19 +00:00
#### end (integer, optional)
2017-01-07 02:00:37 +00:00
End a time range for first map. Stops sort this mapLayer.
2017-02-12 18:01:19 +00:00
### fixedCenter (array[array, array])
Choose a rectangle that must be displayed on the map. Set 2 Locations and everything between will displayed.
Examples for `fixedCenter`:
2017-02-12 18:01:19 +00:00
```json
// Set a visible frame
"fixedCenter": [
[
49.3522,
11.7752
],
[
48.7480,
12.8917
]
],
```
2017-02-12 18:01:19 +00:00
### nodeInfos (array, optional)
2016-03-08 19:07:20 +00:00
This option allows to show node statistics depending on following case-sensitive parameters:
- `name` header of statistics segment in infobox
- `href` absolute or relative URL to statistics image
- `image` `(required)` absolute or relative URL to image,
can be the same like `href`
- `title` for the image
To insert current variables in either `href`, `image` or `title`
2017-01-28 14:33:13 +00:00
you can use the case-sensitive template string `{NODE_ID}`, `{NODE_NAME}`, `{LOCALE}` and `{TIME}` as cache-breaker.
Examples for `nodeInfos`:
2017-02-12 18:01:19 +00:00
```json
"nodeInfos": [
{
"name": "Clientstatistik",
"href": "stats/dashboard/db/node-byid?var-nodeid={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}",
"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}"
}
]
```
2016-02-03 18:18:37 +00:00
In order to have statistics images available, you have to set up an instance of each [Prometheus](http://prometheus.io/) and [Grafana](http://grafana.org/).
2017-02-12 18:01:19 +00:00
### globalInfos (array, optional)
This option allows to show global statistics on statistics page depending on following case-sensitive parameters:
- `name` header of statistics segment in infobox
- `href` absolute or relative URL to statistics image
- `image` `(required)` absolute or relative URL to image,
can be the same like `href`
- `title` for the image
In contrast to `nodeInfos` there is no template substitution in `href`, `image` or `title`.
2016-02-03 18:18:37 +00:00
Examples for `globalInfos` using Grafana server rendering:
2017-02-12 18:01:19 +00:00
```json
"globalInfos": [
{
"name": "Wochenstatistik",
"href": "stats/render/render/dashboard-solo/db/global?panelId=1&fullscreen&theme=light&width=600&height=300",
"image": "nodes/globalGraph.png",
"title": "Bild mit Wochenstatistik"
}
]
```
2017-02-12 18:01:19 +00:00
### linkInfos (array, optional)
2016-03-08 19:07:20 +00:00
This option allows to show link statistics depending on the following case-sensitive parameters:
- `name` header of statistics segment in infobox
2016-03-08 19:07:20 +00:00
- `href` absolute or relative URL to statistics image
- `image` `(required)` absolute or relative URL to image,
2016-03-08 19:07:20 +00:00
can be the same like `href`
- `title` for the image
2016-03-08 19:07:20 +00:00
To insert the source or target variable in either `href`, `image` or `title`
2017-02-01 21:04:04 +00:00
you can use the case-sensitive template strings `{SOURCE_ID}`, `{TARGET_ID}`, `{SOURCE_NAME}`, `{TARGET_NAME}`, `{LOCALE}` and `{TIME}` as cache-breaker.
2016-03-08 19:07:20 +00:00
2017-02-12 18:01:19 +00:00
```json
"linkInfos": [
{
"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"
}
]
```
2016-03-08 19:07:20 +00:00
2017-02-12 18:01:19 +00:00
### siteNames (array, optional)
In this array name definitions for site statistics and node info can be saved. This requires one object for each site code. This object must contain:
- `site` the site code
- `name` the defined written name for this site code
If neither `siteNames` nor `showSites` are set, site statistics and node info won't be displayed
Example for `siteNames`:
2017-02-12 18:01:19 +00:00
```json
"siteNames": [
{
"site": "ffrgb",
"name": "Regensburg"
},
{
"site": "ffrgb-dummy",
"name": "Regensburg Test"
}
],
```
2017-01-28 14:33:13 +00:00
2017-02-12 18:01:19 +00:00
### supportedLocale (array)
2017-01-28 14:33:13 +00:00
Add supported locale (with matching language file in locales/*.json) and it will be matched against the browser language setting. Fallback is the first language in the array.
Example for `supportedLocale`:
2017-02-12 18:01:19 +00:00
```json
"supportedLocale": [
"en",
"de",
"fr"
]
```
2017-02-12 18:01:19 +00:00
### cacheBreaker (string)
Will be replaced in every build to avoid missing or outdated language strings, because language.json isn't up to date.
_Fixed value (y0z)._
2016-06-03 20:08:12 +00:00
## Sponsoring / Supporting
2017-02-12 18:01:19 +00:00
- [BrowserStack](https://www.browserstack.com/) for providing an awesome testing service for hundreds of browsers
- [Travis CI](https://travis-ci.org/) for building meshviewer on every push and pull request
- [Scrutinizer CI](https://scrutinizer-ci.com/g/ffrgb/meshviewer/) for testing code quality on every push and pull request
- [Crowdin](https://crowdin.com/) for providing an easy non-developer translation environment
2016-06-03 20:08:12 +00:00
2017-02-12 18:01:19 +00:00
These tools need a lot of infrastructure and provide a free account for open source software.