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,13 +127,14 @@ def charge_agent_csv(agent_id): | ||
127 | line_string = ",".join(line) | 127 | line_string = ",".join(line) |
128 | csv_table.append(line_string) | 128 | csv_table.append(line_string) |
129 | resp = make_response("\n".join(csv_table)) | 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 | return resp | 131 | return resp |
132 | 132 | ||
133 | 133 | ||
134 | @bp.route('/charge/agent/json/<agent_id>') | 134 | @bp.route('/charge/agent/json/<agent_id>') |
135 | @role_required('service') | 135 | @role_required('service') |
136 | def charge_agent_json(agent_id): | 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 | resp.headers['Content-Type'] = 'application/json' | 139 | resp.headers['Content-Type'] = 'application/json' |
139 | return resp | 140 | return resp |
app/main/templates/agent.html
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | {% endblock %} | 5 | {% endblock %} |
6 | 6 | ||
7 | {% block content %} | 7 | {% block content %} |
8 | -<div id="charge_div"></div> | 8 | +<div id="agent_projects_chart" class="charge_chart"></div> |
9 | <table id="charge_table"> | 9 | <table id="charge_table"> |
10 | <thead> | 10 | <thead> |
11 | <tr> | 11 | <tr> |
@@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
45 | const y = d3.scaleLinear() | 45 | const y = d3.scaleLinear() |
46 | .range([height, 0]); | 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 | .attr("id", "svg") | 49 | .attr("id", "svg") |
50 | .attr("width", width + margin.left + margin.right) | 50 | .attr("width", width + margin.left + margin.right) |
51 | .attr("height", height + margin.top + margin.bottom) | 51 | .attr("height", height + margin.top + margin.bottom) |
@@ -153,7 +153,7 @@ | @@ -153,7 +153,7 @@ | ||
153 | // ---------------- | 153 | // ---------------- |
154 | // Create a tooltip | 154 | // Create a tooltip |
155 | // ---------------- | 155 | // ---------------- |
156 | - var tooltip = d3.select("#charge_div") | 156 | + var tooltip = d3.select("#agent_projects_chart") |
157 | .append("div") | 157 | .append("div") |
158 | .style("opacity", 0) | 158 | .style("opacity", 0) |
159 | .attr("class", "tooltip") | 159 | .attr("class", "tooltip") |