Commit 7d0393ca authored by Paul Asmuth's avatar Paul Asmuth
Browse files

Merge branch 'cockpit' of github.com:fnordcorp/clickmatcher into cockpit

Conflicts:
	cm-cockpit/logjoin_stats.php
parents f6879dd5 c75821bb
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -34,10 +34,16 @@
    this.initUrl = function() {
      var url = this.getAttribute('data-url');

      if (this.hasAttribute('data-width')) {
        var size = this.getAttribute('data-width');
        if (size[size.length - 1] == "%") {
          var val = parseInt(size.substr(0, size.length -1), 10);

          url = url.replace(
        "%%width%%",  document.body.querySelector(".viewport").offsetWidth - 40);
      url = url.replace("%%from%%", this.getAttribute('data-from'));
      url = url.replace("%%until%%", this.getAttribute('data-until'));
            "%%width%%",  Math.round(this.parentNode.offsetWidth * (val / 100)));
        }
      }


      this.shadowRoot.querySelector("iframe").setAttribute("src", url);
    };
+18 −3
Original line number Diff line number Diff line
@@ -13,11 +13,26 @@
 */

function fn_format_timestamp($ts) {
  return "TS: " . $ts;
  $date = new DateTime();
  $date->setTimestamp(get_unix_timestamp(intval($ts)));
  return $date->format('Y-m-d H:i:s');
}

function fn_format_duration($ts) {
  return "DUR: " . $ts;
function get_unix_timestamp($ts) {
  //2100
  while ($ts > 4099680000) {
    $ts = $ts / 1000;
  }
  return $ts;
}

function fn_format_duration($ts, $seconds) {
  $dur = $ts / $seconds;
  if ($dur < 60) {
    return $dur . "s";
  } else {
    return $dur / 60 . "m";
  }
}

function fn_format_bytes($bytes) {