GraphDash是一个基于Web的仪表板,建立在图形及其元数据上。例如,如果您在目录中有两个图:
$ cd default_graph_dir
$ ls
graph.svg graph2.svg然后,您可以使用YAML格式创建两个元数据文件,您可以在其中配置如何显示图形:
$ cat graph.yaml
name: graph.svg
family: ' Category 1 '
title: ' *Real serious* graph '
text: |
The description
$ cat graph2.yaml
name: graph2.svg
family: ' Category 2 '
title: ' Another important graph '然后,您可以启动图形仪表板。您将获得一个不错的Web界面,显示图形,以及一个带有自动完成的搜索框。您可以轻松地导航和共享图形。
$ GraphDash --root .
* Running on http://0.0.0.0:5555/ (Press CTRL+C to quit)克隆并安装(在用户空间中):
git clone https://github.com/AmadeusITGroup/graphdash.git
cd graphdash
pip install --user .或使用Python软件包:
pip install --user graphdash对于用户空间安装,请确保您的$PATH包括~/.local/bin 。
$ GraphDash -r default_graph_dir
* Running on http://0.0.0.0:5555/ (Press CTRL+C to quit)仪表板可以使用YAML配置文件和-c/--conf Option:
$ cat docs/graphdash.yaml
root: ../default_graph_dir
title: " Example of title ;) "
subtitle: " Example of subtitle "
$ GraphDash -c docs/graphdash.yaml
* Running on http://0.0.0.0:5555/ (Press CTRL+C to quit)您可以生成配置文件的模板:
$ GraphDash -C template.yaml如果尚未在计算机上安装,请安装Gunicorn :
pip install --user gunicorn setproctitle # on Fedora you may need to install libffi-devel before由于您可以通过graphdash:app导入WebApp,因此可以与Gunicorn一起使用:
gunicorn -b 0.0.0.0:8888 --pid server.pid graphdash:app WebApp的配置文件可以使用CONF Environment变量设置。使用Gunicorn ,您可以将环境变量通过--env将环境变量传递给工人:
gunicorn -b 0.0.0.0:8888 --pid server.pid --env CONF=docs/graphdash.yaml graphdash:app但是您不应该自己使用这些命令,这就是GraphDashManage的目的!
GraphDashManage用于start , stop , restart Gunicorn服务graphdash:app 。它需要当前目录中的配置文件:
$ cat settings.sh
ALL_MODES=(
[ ' prod ' ]= " docs/graphdash.yaml "
[ ' test ' ]= " docs/graphdash.yaml "
)
ALL_PORTS=(
[ ' prod ' ]=1234
[ ' test ' ]=5678
)
WORKERS=3然后,您可以使用Gunicorn来管理多个GraphDash实例:
$ GraphDashManage start prod
[INFO] Listening at: http://0.0.0.0:1234
[INFO] Booting worker with pid: 30403
[INFO] Booting worker with pid: 30404
[INFO] Booting worker with pid: 30405
$ GraphDashManage start test
[INFO] Listening at: http://0.0.0.0:5678
...您可以生成设置模板:
$ GraphDashManage template > template.sh # to be moved to settings.sh 可能的条目(一切都是可选的):
root :图的根目录families :通往家庭元数据文件的路径(可选)title :WebApp的标题subtitle :WebApp的字幕placeholder :搜索字段中的默认文本header :顶部的可选消息(Markdown语法)footer :底部的可选消息(Markdown语法)showfamilynumbers :切换家庭编号的布尔值(默认为真)showgraphnumbers :切换图编号的布尔值(默认为true)theme :更改CSS主题(默认为黑暗)keep :自动完成的常用单词的比例logfile :更改WebApp的默认日志文件raw :加载时,查找所有图形并忽略元数据verbose :布尔值表示加载应用时的详细性debug :调试模式(启用grunt livereload,启用烧瓶调试模式)headless :无头模式(只有搜索可用,没有页面渲染)port :仅使用烧瓶开发服务器启动时,端口支持几个属性:
name :图路径title :该图的标题,建议用于显示目的(Markdown语法)family :图形所在的小节index :描述该图的关键字的可选列表(对搜索功能有用)text :图形的可选描述(Markdown语法)pretext :出现在图表前的可选消息(Markdown语法)file :原始数据的可选路径export :可将导出图的可选路径(例如,PNG文件)rank :用于更改图形顺序的整数,可选值(默认使用标题)showtitle :图形切换标题显示的布尔值(默认为false)labels :标签列表(例如'new' ),将在UI中呈现为彩色圆圈other :其他元数据未使用GraphDash使用,但可能需要其他内容阅读元数据请注意,如果丢失了name属性,则不会显示该图,并且无论如何将显示文本,就像博客条目一样。
您可以将.FAMILIES.yaml文件放在图形目录的根部。该文件可能包含家庭的元数据。它应该是yaml列表:
- family : chairs
rank : 0
- family : tables
rank : 1
text : This is a description
alias : This text will appear instead of "tables"
labels : new列表的每个元素都应包含:
family :家庭考虑rank :用于更改家庭订单的整数,可选值(默认使用姓名)text :家庭的可选描述(Markdown Syntax)alias :一个可选的名称,可能比URL中的名称更长(可用于构建不错的URL)labels :标签列表(如new ),将在UI中呈现为彩色圆圈可用的标签是new , update , bugfix , warning , error , ongoing , obsolete 。您可以提供其他标签,这些标签将带有默认颜色。对于自定义,您可以使用dict语法指定自己的标签:
labels :
- name : newlabel
color : white
text_color : black
text : " NEW LABEL "
tooltip : null 如果您想贡献,则需要Grunt才能从Sass/Coffee源文件中生成新的CSS/JS文件。
npm install --no-bin-links # may need to repeat
grunt可以使用源地图文件进行调试,以用于在调试工具中支持它们。如果不是,则Gruntfile.js可以使一个选项生成非筹集资产。
grunt --dev启用了debug模式后,Grunt将使用LiverLoad机制来重新加载浏览器,如果任何文件已更改(烧瓶调试模式也将重新加载服务器)。
GraphDash --debug & # or python -m graphdash
grunt watch如果您使用带有PID文件的Gunicorn ,则Grunt会自动将其重新加载,如果任何Python文件更改。
gunicorn -b 0.0.0.0:8888 --pid server.pid graphdash:app &
grunt watch您可以使用tox构建软件包并运行测试。
tox