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