[DRE-commits] [SCM] Tracking the Debian/Ruby wheezy transition branch, master, updated. 1fbb33be735c291cefbc0a15c3b0b0f9393b7678

Antonio Terceiro terceiro at softwarelivre.org
Sat Apr 2 19:14:45 UTC 2011


The following commit has been merged in the master branch:
commit 1fbb33be735c291cefbc0a15c3b0b0f9393b7678
Author: Antonio Terceiro <terceiro at softwarelivre.org>
Date:   Sat Apr 2 12:13:55 2011 -0700

    Change progress tracking widget to a chart
    
    Everybody loves charts.

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1c90635
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+details.html
+data.json*
diff --git a/Makefile b/Makefile
index b39d5bd..125247f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,13 @@
-all: wheezy_transition_data.js details.html
+all: details.html update
 
-wheezy_transition_data.js:
-	wget -q -O $@ http://pkg-ruby-extras.alioth.debian.org/cgi-bin/wheezy-transition-data
+update:
+	ruby retrieve.rb
 
 details.html:
 	wget -q -O $@ http://udd.debian.org/cgi-bin/ruby-transition.cgi
 
 clean:
-	$(RM) wheezy_transition_data.js details.html
+	$(RM) details.html
 
 reload:
 	$(MAKE) clean
diff --git a/index.html b/index.html
index 3777179..9b3cdb9 100644
--- a/index.html
+++ b/index.html
@@ -6,15 +6,11 @@
   </head>
   <body>
     <h1>Debian/Ruby Wheezy Transition</h1>
-    <div id='progressbar'>
-      <div id='progress-label'></div>
-      <div id='progress'>&nbsp;</div>
+    <div id='progress'>
     </div>
     <p>
     <ul>
-      <li>Binary packages using the new policy: <span id='done-count'>?</span></li>
-      <li>Binary packages using the old policy: <span id='pending-count'>?</span></li>
-      <li><a href='details.html'>See the details</a></li>
+      <li><a href='details.html'>See the details of the current state</a></li>
     </ul>
     </p>
     <p>
@@ -22,6 +18,7 @@
     <em>Data from <a href='http://udd.debian.org/'>UDD</a>, updated daily.</em>
     </p>
   </body>
-  <script src="wheezy_transition_data.js"></script>
+  <script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
+  <script src='jquery.flot.min.js'></script>
   <script src="progressbar.js"></script>
 </html>
diff --git a/progressbar.js b/progressbar.js
index f0ee520..0de484f 100644
--- a/progressbar.js
+++ b/progressbar.js
@@ -1,12 +1,40 @@
-var data = wheezy_transition_data;
-var progress = document.getElementById('progress');
-var progress_label = document.getElementById('progress-label')
 
-data.total = data.pending + data.done;
-var progress_percent = Math.floor(100.0 * parseFloat(data.done) / parseFloat(data.total)) + '%';
+$(function() {
+  $.getJSON('data.json', function(input) {
 
-progress.style.width = progress_percent;
-progress_label.innerHTML = progress_percent;
+    var pending = [];
+    var done = [];
+    var initial_date = Infinity;
+    var final_date = 0;
 
-document.getElementById('pending-count').innerHTML = data.pending;
-document.getElementById('done-count').innerHTML = data.done;
+    $.each(input, function(index, point) {
+      pending.push([point.date, point.pending]);
+      done.push([point.date, point.done]);
+      if (point.date < initial_date) { initial_date = point.date; }
+      if (point.date > final_date) { final_date = point.date; }
+    });
+
+    function to_date_string(date_as_number) {
+      var year = Math.floor(date_as_number / 10000);
+      var month = Math.floor(date_as_number % 10000 / 100);
+      var day = Math.floor(date_as_number % 100);
+      return year + "/" + month + "/" + day;
+    }
+
+    initial_date_label = to_date_string(initial_date);
+    final_date_label = to_date_string(final_date);
+
+    $.plot(
+      $('#progress'),
+      [
+        { label: "Pending", data: pending, color: "#a40000" },
+        { label: "Done", data: done, color: "#4e9a06" }
+      ],
+      {
+        series: { points: { show: true }, lines: { show: true } },
+        xaxis: { ticks: [[initial_date, initial_date_label], [final_date, final_date_label]] }
+      }
+    );
+
+  });
+});
diff --git a/retrieve.rb b/retrieve.rb
new file mode 100644
index 0000000..b338b43
--- /dev/null
+++ b/retrieve.rb
@@ -0,0 +1,17 @@
+require 'open-uri'
+require 'json'
+require 'fileutils'
+
+data = []
+
+if File.exists?('data.json')
+  FileUtils.cp('data.json', 'data.json~')
+  data = JSON.load(File.read('data.json'))
+end
+
+new_data = JSON.load(open('http://pkg-ruby-extras.alioth.debian.org/cgi-bin/wheezy-transition-data').read)
+data << new_data
+
+File.open('data.json', 'w') do |f|
+  f.write(data.to_json)
+end
diff --git a/style.css b/style.css
index 1ca05ca..e1f70bb 100644
--- a/style.css
+++ b/style.css
@@ -3,22 +3,7 @@ body {
   font-size: 14px;
 }
 
-#progressbar {
-  height: 40px;
-  border: 1px solid #555573;
-  background: #ef6969;
-  position: relative;
-}
 #progress {
-  width: 0%;
-  height: 100%; 
-  background: #4e9a06;
-}
-#progress-label {
-  z-index: 10;
-  position: absolute;
-  left: 50%;
-  font-weight: bold;
-  font-size: 32px;
-  color: white;
+  width: 600px;
+  height: 300px; 
 }

-- 
Tracking the Debian/Ruby wheezy transition



More information about the Pkg-ruby-extras-commits mailing list