Commit 17b05589e34860c0dd8d6a81d13f13421b1d9023
1 parent
b9d90810
Exists in
master
and in
4 other branches
Change agent csv content type and tiny html
Showing
2 changed files
with
6 additions
and
5 deletions
Show diff stats
app/main/routes.py
... | ... | @@ -127,13 +127,14 @@ def charge_agent_csv(agent_id): |
127 | 127 | line_string = ",".join(line) |
128 | 128 | csv_table.append(line_string) |
129 | 129 | resp = make_response("\n".join(csv_table)) |
130 | - resp.headers['Content-Type'] = 'text/csv' | |
130 | + resp.headers['Content-Type'] = 'text/plain;charset=utf8' | |
131 | 131 | return resp |
132 | 132 | |
133 | 133 | |
134 | 134 | @bp.route('/charge/agent/json/<agent_id>') |
135 | 135 | @role_required('service') |
136 | 136 | def charge_agent_json(agent_id): |
137 | - resp = make_response(json.dumps(db_mgr.charges_by_agent_stacked(agent_id))) | |
137 | + stacked_charges = db_mgr.charges_by_agent_stacked(agent_id) | |
138 | + resp = make_response(json.dumps(stacked_charges)) | |
138 | 139 | resp.headers['Content-Type'] = 'application/json' |
139 | 140 | return resp | ... | ... |
app/main/templates/agent.html
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | {% endblock %} |
6 | 6 | |
7 | 7 | {% block content %} |
8 | -<div id="charge_div"></div> | |
8 | +<div id="agent_projects_chart" class="charge_chart"></div> | |
9 | 9 | <table id="charge_table"> |
10 | 10 | <thead> |
11 | 11 | <tr> |
... | ... | @@ -45,7 +45,7 @@ |
45 | 45 | const y = d3.scaleLinear() |
46 | 46 | .range([height, 0]); |
47 | 47 | |
48 | - const svg = d3.select("#charge_div").append("svg") | |
48 | + const svg = d3.select("#agent_projects_chart").append("svg") | |
49 | 49 | .attr("id", "svg") |
50 | 50 | .attr("width", width + margin.left + margin.right) |
51 | 51 | .attr("height", height + margin.top + margin.bottom) |
... | ... | @@ -153,7 +153,7 @@ |
153 | 153 | // ---------------- |
154 | 154 | // Create a tooltip |
155 | 155 | // ---------------- |
156 | - var tooltip = d3.select("#charge_div") | |
156 | + var tooltip = d3.select("#agent_projects_chart") | |
157 | 157 | .append("div") |
158 | 158 | .style("opacity", 0) |
159 | 159 | .attr("class", "tooltip") | ... | ... |