Prechádzať zdrojové kódy

Add a datagrepper chart to user profile pages.

Ralph Bean 8 rokov pred
rodič
commit
5a2117b06c

+ 3 - 0
pagure/default_config.py

@@ -21,6 +21,9 @@ SECRET_KEY = '<insert here your own key>'
 # url to the database server:
 DB_URL = 'sqlite:////var/tmp/pagure_dev.sqlite'
 
+# url to datagrepper (optional):
+#DATAGREPPER_URL = 'https://apps.fedoraproject.org/datagrepper'
+
 # The FAS group in which the admin of pagure are
 ADMIN_GROUP = 'sysadmin-main'
 

+ 4 - 0
pagure/static/pagure.css

@@ -178,6 +178,10 @@ header h1 span {
     border-spacing: 1em;
 }
 
+#user_graph {
+    min-height: 400px;
+}
+
 .project_link {
     border: 1px solid #CCCCCC;
     border-radius: 5px 5px 5px 5px;

+ 11 - 0
pagure/templates/user_info.html

@@ -27,6 +27,17 @@
       Joined {{ user.created | humanize }}
     </p>
 
+    {% if config.get('DATAGREPPER_URL') %}
+    <section class="project_list" id="user_graph">
+        <header>
+            <h2>Contributions</h2>
+        </header>
+        <a href="{{config.get('DATAGREPPER_URL')}}/raw?category=pagure&user={{username}}" target="_blank">
+          <img src="{{config.get('DATAGREPPER_URL')}}/charts/line?category=pagure&user={{username}}&split_on=users&delta=31536000&N=12&title=&width=600&height=200&style=light&fill=True" alt="User activity graph"/>
+        </a>
+    </section>
+    {% endif %}
+
     {{ render_repos(
             repos, total_page_repos, 'repopage', repopage,
             'Projects', repos_length, 'repos', hide=False) }}