Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/stats/template/fileStats.html

Issue 29934561: #1537 - Remove stats processing from sitescripts (Closed) Base URL: https://hg.adblockplus.org/sitescripts
Patch Set: Created Nov. 2, 2018, 12:42 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sitescripts/stats/template/fileStats.html
===================================================================
deleted file mode 100644
--- a/sitescripts/stats/template/fileStats.html
+++ /dev/null
@@ -1,202 +0,0 @@
-<!--
- - This file is part of the Adblock Plus web scripts,
- - Copyright (C) 2006-present eyeo GmbH
- -
- - Adblock Plus is free software: you can redistribute it and/or modify
- - it under the terms of the GNU General Public License version 3 as
- - published by the Free Software Foundation.
- -
- - Adblock Plus is distributed in the hope that it will be useful,
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - GNU General Public License for more details.
- -
- - You should have received a copy of the GNU General Public License
- - along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
- -->
-
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta name="robots" content="noindex,nofollow" />
- <meta charset="utf-8">
- <link rel="stylesheet" type="text/css" href="../../../static/stats.css" />
- <link rel="stylesheet" type="text/css" href="../../../static/flags.css" />
- <link rel="stylesheet" type="text/css" href="../../../static/hours.css" />
- <title>Statistics for file {{fileName}} ({{month|monthname}})</title>
- <script type="text/javascript">
- document.addEventListener("click", function(event)
- {
- if (event.target.className == "showAllLink")
- {
- document.getElementById(event.target.getAttribute("data-hide")).style.display = "none";
- document.getElementById(event.target.getAttribute("data-show")).style.display = "";
- event.preventDefault();
- }
- }, false);
- </script>
- </head>
-
- <body style="margin-top: 0px">
- <a name="top">&nbsp;</a>
- <table class="block" width="100%">
- <tr>
- <td class="title" width="250">Statistics for file:</td>
- <td>{{url}}</td>
- </tr>
- <tr>
- <td class="title" width="250">Last update:</td>
- <td>{{now|formattime}}</td>
- </tr>
- <tr>
- <td class="title" width="250">Reported period:</td>
- <td>Month {{month|monthname}} (<a href="{{overview_url}}">To overview page</a>)</td>
- </tr>
- {%- if filter %}
- <tr>
- <td class="title" width="250">Filter:</td>
- <td>
- {%- if filter.field.filter %}
- {{filter.field.title}} only
- {%- else %}
- {{filter.field.coltitle}} is {{filter.value}}
- {%- endif %}
- (<a href="index.html">Remove filter</a>)</td>
- </tr>
- {%- endif %}
- </table>
-
- {%- macro row(name, value, params, special=False, emph=False, chart=True, filtered_url=None) %}
- <tr{% if special %} class="special"{% endif%}>
- <td{% if emph %} class="emph"{% endif%}>
- {%- if filtered_url %}
- <a href="{{filtered_url}}">
- {%- endif %}
-
- {%- if not special and params.field.name == "hour" -%}
- <div class="hour hour{{name|int % 12 + 1}}"></div> {{name}}
- {%- elif not special and params.field.name == "weekday" -%}
- {{name|weekday}}
- {%- elif not special and params.field.name == "country" -%}
- <div class="flag {{name}}"></div> {{name|countryname}} <div class="countrycode">{{name}}</div>
- {%- else -%}
- {{name}}
- {%- endif -%}
-
- {%- if filtered_url %}
- </a>
- {%- endif %}
- </td>
- <td align="right">{{value.hits}}</td>
- <td align="right">{{value.hits|percentage(params.totalhits)|round(precision=1)}}%</td>
- <td align="right">{{value.bandwidth|bytes}}</td>
- <td align="right">{{value.bandwidth|percentage(params.totalbandwidth)|round(precision=1)}}%</td>
- {%- if chart %}
- <td class="chart">
- <div class="hitsChart" style="width: {{value.hits|percentage(params.maxhits)|round(method='ceil')|int}}px;"></div><br />
- <div class="bandwidthChart" style="width: {{value.bandwidth|percentage(params.maxbandwidth)|round(method='ceil')|int}}px;"></div>
- </td>
- {%- else %}
- <td>&nbsp;</td>
- {%- endif %}
- </tr>
- {%- endmacro %}
-
- {# Using selectattr filter would be nice but servers don't have Jinja 2.7 yet #}
- {%- set filterFields = [] %}
- {%- for field in fields %}
- {%- if field.filter and field.name in data and "True" in data[field.name] %}
- {%- set dummy = filterFields.append(field) %}
- {%- endif %}
- {%- endfor %}
-
- <div id="quickLinks">
- {%- if filterFields|length > 0 %}
- <a href="#overview">Overview</a>
- {%- endif %}
-
- {%- for field in fields %}
- {%- if not field.filter and not field.hidden and field.name in data %}
- <a href="#{{field.name}}">{{field.title}}</a>
- {%- endif %}
- {%- endfor %}
- </div>
-
- {%- if filterFields|length > 0 %}
- {%- if filter %}
- {%- set params = {"totalhits": data.hits, "totalbandwidth": data.bandwidth, "field": {"name": None}} %}
- {%- else %}
- {%- set items = data.day|sortfield("day") %}
- {%- set params = {"totalhits": items|sumhits, "totalbandwidth": items|sumbandwidth, "field": {"name": None}} %}
- {%- endif %}
- <div id="overview" class="block_title">Overview</div>
- <div class="block">
- <table align="center">
- <tr>
- <th bgcolor="#ECECEC">Condition</th>
- <th bgcolor="#66DDEE" colspan="2">Hits</th>
- <th bgcolor="#2EA495" colspan="2">Bandwidth</th>
- </tr>
- {%- for field in filterFields %}
- {{row(field.title, data[field.name].True, params, chart=False,
- filtered_url=filtered_urls.get(field.name, {}).get("True", None))}}
- {%- endfor %}
- {{row("Total", {"hits": params.totalhits, "bandwidth": params.totalbandwidth}, params, special=True, emph=True, chart=False)}}
- </table>
- </div>
- {%- endif %}
-
- {%- for field in fields %}
- {%- if not field.filter and not field.hidden and field.name in data %}
- {%- set items = data[field.name]|sortfield(field) %}
- {%- set params = {"maxhits": items|maxhits, "maxbandwidth": items|maxbandwidth,
- "totalhits": items|sumhits, "totalbandwidth": items|sumbandwidth,
- "field": field} %}
- {%- set count = items|length %}
- <div id="{{field.name}}" class="block_title">{{field.title}}</div>
- <div class="block">
- <table align="center">
- <tr>
- <th bgcolor="#ECECEC">{{field.coltitle}}</th>
- <th bgcolor="#66DDEE" colspan="2">Hits</th>
- <th bgcolor="#2EA495" colspan="2">Bandwidth</th>
- </tr>
- {%- for name, value in items[0:field|defaultcount] %}
- {{row(name, value, params, special=name|isspecial(field),
- filtered_url=filtered_urls.get(field.name, {}).get(name, None))}}
- {%- endfor %}
- {%- if count > field|defaultcount %}
- <tr id="{{field.name}}_showAll" class="special">
- <td>
- Other
- <a href="#" class="showAllLink" data-hide="{{field.name}}_showAll" data-show="{{field.name}}_additionalItems">
- Show all
- </a>
- </td>
- <td align="right">{{items[field|defaultcount:]|sumhits}}</td>
- <td>&nbsp;</td>
- <td align="right">{{items[field|defaultcount:]|sumbandwidth|bytes}}</td>
- <td>&nbsp;</td>
- <td>&nbsp;</td>
- </tr>
- <tbody id="{{field.name}}_additionalItems" style="display: none;">
- {%- for name, value in items[field|defaultcount:] %}
- {{row(name, value, params, special=name|isspecial(field),
- filtered_url=filtered_urls.get(field.name, {}).get(name, None))}}
- {%- endfor %}
- </tbody>
- {%- endif %}
- {%- if field.showaverage %}
- {%- set avghits = (params.totalhits / count)|int %}
- {%- set avgbandwidth = (params.totalbandwidth / count)|int %}
- {{row("Average", {"hits": avghits, "bandwidth": avgbandwidth}, params, special=True, emph=True)}}
- {%- endif %}
- {%- if field.name == "day" and filterFields|length == 0 %}
- {{row("Total", {"hits": params.totalhits, "bandwidth": params.totalbandwidth}, params, special=True, emph=True, chart=False)}}
- {%- endif %}
- </table>
- </div>
- {%- endif %}
- {%- endfor %}
- </body>
-</html>

Powered by Google App Engine
This is Rietveld