Mercurial > roundup-cc > roundup-cc
comparison display_issues.py @ 20:3bb3d9a9f1b7
Filter by keywords and states.
Configuration via configuration file.
"No prio" grapf is displayed.
(./display_issues_demo.py is not yet dynamic, it needs all states)
author | Magnus Schieder <mschieder@intevation.de> |
---|---|
date | Mon, 22 Oct 2018 16:49:58 +0200 |
parents | adca5b3780d2 |
children | 89469aa41fe1 |
comparison
equal
deleted
inserted
replaced
19:8ffd584065a4 | 20:3bb3d9a9f1b7 |
---|---|
38 for item in array: | 38 for item in array: |
39 formated.append("{date : new Date('" + str(item) + "')}") | 39 formated.append("{date : new Date('" + str(item) + "')}") |
40 | 40 |
41 return ", ".join(formated) | 41 return ", ".join(formated) |
42 | 42 |
43 def get_webpage(graph=None): | 43 def get_webpage(status, keywords, graph=None): |
44 | 44 |
45 if graph is None: | 45 if graph is None: |
46 graph = os.path.dirname(os.path.realpath(__file__)) + '/graph.html' | 46 graph = os.path.dirname(os.path.realpath(__file__)) + '/graph.html' |
47 | 47 |
48 with open(graph, "r") as html_chart_file: | 48 with open(graph, "r") as html_chart_file: |
49 base_html_data = html_chart_file.read() | 49 base_html_data = html_chart_file.read() |
50 | 50 |
51 | |
51 base_html_data = (base_html_data | 52 base_html_data = (base_html_data |
53 .replace("status", status) | |
54 .replace("keywords", keywords) | |
52 .replace("var critical=[];", "var critical=[" + make_js_object_string(rcd.data_dict["critical"]) + "]") | 55 .replace("var critical=[];", "var critical=[" + make_js_object_string(rcd.data_dict["critical"]) + "]") |
53 .replace("var urgent=[];", "var urgent=[" + make_js_object_string(rcd.data_dict["urgent"]) + "]") | 56 .replace("var urgent=[];", "var urgent=[" + make_js_object_string(rcd.data_dict["urgent"]) + "]") |
54 .replace("var bug=[];", "var bug=[" + make_js_object_string(rcd.data_dict["bug"]) + "]") | 57 .replace("var bug=[];", "var bug=[" + make_js_object_string(rcd.data_dict["bug"]) + "]") |
55 .replace("var feature=[];", "var feature=[" + make_js_object_string(rcd.data_dict["feature"]) + "]") | 58 .replace("var feature=[];", "var feature=[" + make_js_object_string(rcd.data_dict["feature"]) + "]") |
56 .replace("var wish=[];", "var wish=[" + make_js_object_string(rcd.data_dict["wish"]) + "]") | 59 .replace("var wish=[];", "var wish=[" + make_js_object_string(rcd.data_dict["wish"]) + "]") |
60 .replace("var noPrio=[];", "var noPrio=[" + make_js_object_string(rcd.data_dict["noPrio"]) + "]") | |
57 .replace("var timestamp=[];", "var timestamp=[" + make_js_object_date(rcd.data_dict["date"]) + "]")) | 61 .replace("var timestamp=[];", "var timestamp=[" + make_js_object_date(rcd.data_dict["date"]) + "]")) |
58 | 62 |
59 return base_html_data | 63 return base_html_data |
60 | 64 |
61 def compile_db_stats_html(db_file, sql_select, graph=None): | 65 def compile_db_stats_html(db_file, sql_select, status="", keywords="", graph=None): |
62 | 66 |
63 con = None | 67 con = None |
64 cur = None | 68 cur = None |
65 | 69 |
66 try: | 70 try: |
73 rcd.data_dict["critical"].append(row[1]) | 77 rcd.data_dict["critical"].append(row[1]) |
74 rcd.data_dict["urgent"].append(row[2]) | 78 rcd.data_dict["urgent"].append(row[2]) |
75 rcd.data_dict["bug"].append(row[3]) | 79 rcd.data_dict["bug"].append(row[3]) |
76 rcd.data_dict["feature"].append(row[4]) | 80 rcd.data_dict["feature"].append(row[4]) |
77 rcd.data_dict["wish"].append(row[5]) | 81 rcd.data_dict["wish"].append(row[5]) |
82 rcd.data_dict["noPrio"].append(row[6]) | |
78 finally: | 83 finally: |
79 if cur: | 84 if cur: |
80 cur.close() | 85 cur.close() |
81 if con: | 86 if con: |
82 con.close() | 87 con.close() |
83 | 88 |
84 return get_webpage(graph) | 89 return get_webpage(status, keywords, graph) |
85 | 90 |
86 def render_webpage(content): | 91 def render_webpage(content): |
87 for line in content.split("\n"): | 92 for line in content.split("\n"): |
88 print(line) | 93 print(line) |
89 | 94 |
90 def render_db_stats_as_html(db_file, sql_select): | 95 def render_db_stats_as_html(db_file, sql_select, status="", keywords=""): |
91 render_webpage(compile_db_stats_html(db_file, sql_select)) | 96 render_webpage(compile_db_stats_html(db_file, sql_select, status, keywords)) |
92 | 97 |
93 if __name__ == '__main__': | 98 if __name__ == '__main__': |
94 cgitb.enable() | 99 cgitb.enable() |
95 #spit out HTML file directly, thus no need to give headers to the server | 100 #spit out HTML file directly, thus no need to give headers to the server |
96 #print("Content-Type: text/html") | 101 #print("Content-Type: text/html") |
97 #print() | 102 #print() |
98 | 103 |
99 render_db_stats_as_html("./demo1.db", rcd.SELECT_ALL) | 104 render_db_stats_as_html("./demo3.db", rcd.SELECT_ALL) |