You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2018/09/17 07:50:06 UTC

[kibble] 08/08: regen JS

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git

commit 7f5d0928a16fd2f6ffe8b655ca51f2376c078d77
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Sep 17 09:49:42 2018 +0200

    regen JS
---
 ui/js/kibble.v1.js | 272 ++++++++++++++++++-----------------------------------
 1 file changed, 92 insertions(+), 180 deletions(-)

diff --git a/ui/js/kibble.v1.js b/ui/js/kibble.v1.js
index c640fb7..1325acf 100644
--- a/ui/js/kibble.v1.js
+++ b/ui/js/kibble.v1.js
@@ -1,5 +1,5 @@
 // Generated by CoffeeScript 1.12.7
-var API, APIVERSION, Chart, HTML, Row, Widget, aSourceTypes, accountCallback, addSourceType, addSources, addorguser, addsources, affiliate, affiliation, affiliationWizard, altemail, app, badModal, bio, chartOnclick, chartToSvg, chartWrapperButtons, charts_donutchart, charts_gaugechart, charts_linechart, charts_linechart_stacked, charts_linked, charts_radarchart, ciexplorer, cog, comShow, comstat, copyCSS, currentSources, dataTable, datepicker, datepickers, defaultOrgChanged, deletesource [...]
+var API, APIVERSION, Chart, HTML, Row, Widget, aSourceTypes, accountCallback, addSourceType, addSources, addorguser, addsources, affiliate, affiliation, affiliationWizard, altemail, app, badModal, bio, chartOnclick, chartToSvg, chartWrapperButtons, charts_donutchart, charts_gaugechart, charts_linechart, charts_linechart_stacked, charts_linked, charts_radarchart, ciexplorer, cog, comShow, comstat, copyCSS, currentSources, dataTable, datepicker, datepickers, defaultOrgChanged, deletesource [...]
   indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
 
 signup = function(form) {
@@ -1462,6 +1462,10 @@ updateTimeseriesWidgets = function(range) {
       to: to,
       from: from
     });
+    updateWidgets('phonebook', null, {
+      to: to,
+      from: from
+    });
     updateWidgets('worldmap', null, {
       to: to,
       from: from
@@ -1656,7 +1660,7 @@ explorer = function(json, state) {
     updateWidgets('line', null, {
       source: source
     });
-    updateWidgets('contacts', null, {
+    updateWidgets('phonebook', null, {
       source: source
     });
     updateWidgets('top5', null, {
@@ -1702,7 +1706,7 @@ explorer = function(json, state) {
     updateWidgets('line', null, {
       author: author
     });
-    updateWidgets('contacts', null, {
+    updateWidgets('phonebook', null, {
       author: author
     });
     updateWidgets('top5', null, {
@@ -1842,7 +1846,7 @@ sourceexplorer = function(json, state) {
     updateWidgets('line', null, {
       source: source
     });
-    updateWidgets('contacts', null, {
+    updateWidgets('phonebook', null, {
       source: source
     });
     updateWidgets('top5', null, {
@@ -1861,7 +1865,7 @@ sourceexplorer = function(json, state) {
       source: source
     });
     return updateWidgets('jsondump', null, {
-      author: author
+      source: source
     });
   });
 };
@@ -1936,7 +1940,7 @@ mailexplorer = function(json, state) {
     updateWidgets('line', null, {
       source: source
     });
-    updateWidgets('contacts', null, {
+    updateWidgets('phonebook', null, {
       source: source
     });
     updateWidgets('top5', null, {
@@ -2112,7 +2116,7 @@ issueexplorer = function(json, state) {
     updateWidgets('line', null, {
       source: source
     });
-    updateWidgets('contacts', null, {
+    updateWidgets('phonebook', null, {
       source: source
     });
     updateWidgets('top5', null, {
@@ -2200,7 +2204,7 @@ forumexplorer = function(json, state) {
     updateWidgets('line', null, {
       source: source
     });
-    updateWidgets('contacts', null, {
+    updateWidgets('phonebook', null, {
       source: source
     });
     updateWidgets('top5', null, {
@@ -2288,7 +2292,7 @@ imexplorer = function(json, state) {
     updateWidgets('line', null, {
       source: source
     });
-    updateWidgets('contacts', null, {
+    updateWidgets('phonebook', null, {
       source: source
     });
     updateWidgets('top5', null, {
@@ -2377,7 +2381,7 @@ ciexplorer = function(json, state) {
     updateWidgets('line', null, {
       source: source
     });
-    updateWidgets('contacts', null, {
+    updateWidgets('phonebook', null, {
       source: source
     });
     updateWidgets('top5', null, {
@@ -2459,7 +2463,7 @@ multiviewexplorer = function(json, state) {
           updateWidgets('donut', null, x);
           updateWidgets('gauge', null, x);
           updateWidgets('line', null, x);
-          updateWidgets('contacts', null, x);
+          updateWidgets('phonebook', null, x);
           updateWidgets('top5', null, x);
           updateWidgets('factors', null, x);
           updateWidgets('trends', null, x);
@@ -2493,7 +2497,7 @@ subFilter = function() {
   updateWidgets('donut', null, x);
   updateWidgets('gauge', null, x);
   updateWidgets('line', null, x);
-  updateWidgets('contacts', null, x);
+  updateWidgets('phonebook', null, x);
   updateWidgets('top5', null, x);
   updateWidgets('factors', null, x);
   updateWidgets('trends', null, x);
@@ -2537,7 +2541,7 @@ pathFilter = function() {
   updateWidgets('donut', null, x);
   updateWidgets('gauge', null, x);
   updateWidgets('line', null, x);
-  updateWidgets('contacts', null, x);
+  updateWidgets('phonebook', null, x);
   updateWidgets('top5', null, x);
   updateWidgets('factors', null, x);
   updateWidgets('trends', null, x);
@@ -2631,7 +2635,7 @@ viewexplorer = function(json, state) {
     updateWidgets('donut', null, x);
     updateWidgets('gauge', null, x);
     updateWidgets('line', null, x);
-    updateWidgets('contacts', null, x);
+    updateWidgets('phonebook', null, x);
     updateWidgets('top5', null, x);
     updateWidgets('factors', null, x);
     updateWidgets('trends', null, x);
@@ -2790,7 +2794,7 @@ widgetexplorer = function(json, state) {
     updateWidgets('donut', null, x);
     updateWidgets('gauge', null, x);
     updateWidgets('line', null, x);
-    updateWidgets('contacts', null, x);
+    updateWidgets('phonebook', null, x);
     updateWidgets('top5', null, x);
     updateWidgets('factors', null, x);
     updateWidgets('trends', null, x);
@@ -3918,8 +3922,8 @@ setupPage = function(json, state) {
           case 'sourceadd':
             results1.push(widget.load(sourceadd));
             break;
-          case 'contacts':
-            results1.push(setupPhonebook(widget, child));
+          case 'phonebook':
+            results1.push(widget.load(phonebook));
             break;
           case 'preferences':
             results1.push(widget.load(preferences));
@@ -4078,166 +4082,79 @@ renderAccountInfo = function(json, state) {
   }
 };
 
-phonebook_cached = {};
-
-fetchPhonebook = function(args) {
-  var url, wargs;
-  if (args) {
-    wargs = JSON.stringify(args);
-    if (phonebook_cached[wargs]) {
-      renderPhonebook(phonebook_cached[wargs], args);
-      return;
-    }
-  }
-  args.widget.cog();
-  url = "people/";
-  return postJSON(url, args, args, renderPhonebook);
-};
-
-setupPhonebook = function(widget, w) {
-  return fetchPhonebook({
-    widget: widget,
-    w: w,
-    letter: 'a',
-    project: w.target || ""
-  });
-};
-
-renderPhonebook = function(json, state) {
-  var a, imgsrc, len, len1, letter, letters, li, people, person, q, rdiv, ref, row, tbl, u, ul, wargs;
-  wargs = JSON.stringify(state);
-  phonebook_cached[wargs] = json;
-  letters = "abcdefghijklmnopqrstuvwxyz".split("");
-  row = document.createElement('div');
-  row.setAttribute("class", "row");
-  rdiv = document.createElement('div');
-  rdiv.setAttribute("class", "col-md-12 col-sm-12 col-xs-12 text-center");
-  ul = document.createElement('ul');
-  ul.setAttribute("class", "pagination pagination-split");
-  for (q = 0, len = letters.length; q < len; q++) {
-    letter = letters[q];
-    li = document.createElement('li');
-    a = document.createElement('a');
-    a.setAttribute("href", "#");
-    a.addEventListener("click", function() {
-      state.letter = this.childNodes[0].data.toLowerCase();
-      return fetchPhonebook(state);
-    }, false);
-    a.appendChild(document.createTextNode(letter.toUpperCase()));
-    if (state.letter && letter === state.letter) {
-      li.setAttribute("class", "active");
-    }
-    li.appendChild(a);
-    ul.appendChild(li);
-  }
-  rdiv.appendChild(ul);
-  row.appendChild(rdiv);
-  state.widget.inject(row, true);
-  row = mk('table', {
-    "class": "display"
-  }, mk('thead', {}, mk('tr', {}, [mk('th', {}, 'Avatar'), mk('th', {}, 'Name'), mk('th', {}, 'Email')])));
-  people = [];
-  json.people.sort((function(_this) {
-    return function(a, b) {
-      if (a.name === b.name) {
-        return 0;
-      } else {
+phonebook = function(json, state) {
+  var i, id, idiv, item, items, left, obj, ref, results, right, rightInner, title;
+  items = [];
+  if (json.people) {
+    id = parseInt(Math.random() * 99999999).toString(16);
+    obj = new HTML('div', {
+      id: id
+    });
+    obj.innerText = "Found " + json.people.length + " contributors..";
+    obj.inject(new HTML('br'));
+    state.widget.inject(obj, true);
+    json.people.sort((function(_this) {
+      return function(a, b) {
+        if (a.name < b.name) {
+          return -1;
+        }
         if (a.name > b.name) {
           return 1;
-        } else {
-          return -1;
         }
+        return 0;
+      };
+    })(this));
+    ref = json.people;
+    results = [];
+    for (i in ref) {
+      item = ref[i];
+      if (i > 250) {
+        break;
       }
-    };
-  })(this));
-  a = 0;
-  ref = json.people;
-  for (u = 0, len1 = ref.length; u < len1; u++) {
-    person = ref[u];
-    a++;
-    imgsrc = document.createElement('img');
-    imgsrc.setAttribute("class", "img-circle img-responsive");
-    imgsrc.setAttribute("onshow", "this.src = 'https://secure.gravatar.com/avatar/" + person.md5 + ".png?d=identicon'");
-    people.push(["https://secure.gravatar.com/avatar/" + person.md5 + ".png?d=identicon", person.name, person.email]);
-  }
-  state.widget.inject(row);
-  return tbl = $(row).DataTable({
-    serverSide: true,
-    searching: false,
-    lengthMenu: [[25, 50, 100], [25, 50, 100]],
-    columnDefs: [
-      {
-        targets: 0,
-        data: "avatar",
-        render: function(data, type, full, meta) {
-          return '<img class="img-circle img-responsive" style="width: 24px; height: 24px;" src="' + full[0] + '"/>';
-        }
-      }, {
-        targets: 1,
-        data: "email",
-        render: function(data, type, full, meta) {
-          return '<a href="?page=people&email=' + full[2] + '">' + full[1] + "</a>";
-        }
+      idiv = new HTML('div', {
+        "class": "phonebook_entry"
+      });
+      left = new HTML('a', {
+        "class": "pull-left"
+      });
+      if (item.gravatar) {
+        left.inject(new HTML('img', {
+          "class": "img-circle img-reponsive",
+          src: "https://secure.gravatar.com/avatar/" + item.gravatar + ".png?d=identicon",
+          style: {
+            width: "32px",
+            height: "32px"
+          }
+        }));
       }
-    ],
-    ajax: function(data, callback, settings) {
-      var i, i1, out, ref1, ref2;
-      out = [];
-      for (i = i1 = ref1 = data.start, ref2 = data.start + data.length; ref1 <= ref2 ? i1 < ref2 : i1 > ref2; i = ref1 <= ref2 ? ++i1 : --i1) {
-        out.push(people[i]);
-      }
-      return setTimeout(function() {
-        return callback({
-          draw: data.draw,
-          data: out,
-          recordsTotal: people.length,
-          recordsFiltered: people.length
-        });
-      }, 50);
-    }
-  }, {
-    scrollY: 200,
-    scroller: {
-      loadingIndicator: true
+      right = new HTML('div', {
+        "class": "media event"
+      });
+      rightInner = new HTML('div', {
+        style: {
+          marginLeft: '10px',
+          width: '280px',
+          height: '24px',
+          display: 'inline-block',
+          overflow: 'hidden',
+          textOverflow: 'ellipsis'
+        }
+      });
+      right.inject(rightInner);
+      if (item.email) {
+        title = new HTML('a', {
+          "class": "title",
+          href: "contributors.html?page=biography&email=" + item.email
+        }, txt(item.name));
+        rightInner.inject(title);
+        rightInner.inject(' - ' + item.contributions + ' contribution' + (item.contributions !== 1 ? 's' : ''));
+      }
+      idiv.inject(left);
+      idiv.inject(right);
+      results.push(obj.inject(idiv));
     }
-  });
-
-  /*
-      card = document.createElement('div')
-      card.setAttribute("class", "col-md-3 col-sm-4 col-xs-12 profile_details")
-      well = document.createElement('div')
-      well.setAttribute("class", "well profile_view")
-      well.style.width = "100%"
-      card.appendChild(well)
-      
-      namecard = document.createElement('div')
-      namecard.setAttribute("class", "left col-xs-7")
-      img = document.createElement('div')
-      img.setAttribute("class", "right col-xs-5 text-center")
-      imgsrc = document.createElement('img')
-      imgsrc.setAttribute("class", "img-circle img-responsive")
-      imgsrc.setAttribute("src", "https://secure.gravatar.com/avatar/" + person.md5 + ".png?d=identicon")
-      img.appendChild(imgsrc)
-      well.appendChild(namecard)
-      well.appendChild(img)
-      a = document.createElement('a')
-      a.setAttribute('href', '?page=people&email=' + person.email)
-      name = document.createElement('h2')
-      name.appendChild(document.createTextNode(person.name))
-      a.appendChild(name)
-      namecard.appendChild(a)
-      namecard.appendChild(document.createTextNode(person.email))
-      groups = []
-      if person.tags
-          for tag in person.tags
-              if tag != '_untagged'
-                  groups.push(tag)
-      if groups.length > 0
-          namecard.appendChild(mk('br'))
-          namecard.appendChild(txt("Part of: " + groups.join(", ")))
-      
-      row.appendChild(card)
-   */
+    return results;
+  }
 };
 
 addsources = function(form) {
@@ -5300,13 +5217,8 @@ updateWidgets = function(type, target, eargs) {
         case 'widget':
           results.push(widget.load(publisher));
           break;
-        case 'contacts':
-          results.push(fetchPhonebook({
-            widget: widget,
-            w: w,
-            letter: 'a',
-            project: target
-          }));
+        case 'phonebook':
+          results.push(widget.load(phonebook));
           break;
         case 'repopicker':
           results.push(widget.load(explorer));
@@ -5388,10 +5300,10 @@ pubWidget = (function() {
 })();
 
 Widget = (function() {
-  function Widget(blocks, args1, pub) {
+  function Widget(blocks, args, pub) {
     var a, cldiv, i, li, t, tt, ul;
     this.blocks = blocks;
-    this.args = args1;
+    this.args = args;
     this.id = Math.floor(Math.random() * 1000000).toString(16);
     this.div = document.createElement('div');
     this.div.setAttribute("id", this.id);