From patchwork Tue Aug 27 09:01:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stevan Radakovic X-Patchwork-Id: 19540 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C22CB2469A for ; Tue, 27 Aug 2013 09:01:31 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id f14sf3566893qak.6 for ; Tue, 27 Aug 2013 02:01:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:delivered-to:mime-version:to:from:subject :message-id:date:reply-to:sender:errors-to:precedence :x-original-sender:x-original-authentication-results:mailing-list :list-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=yYuYGn+F5WE0s2oApBufVxAwoLEZ4jQvX99aCGA7lgk=; b=hUnQU1b4j+Qoz2n7Ataur8+K0WWVraT7zVHLatKX6Lmsh9fZcmbz0j6YG06uGlImbC c0ar1XJniBkrBs+kOPE8kgR811YVutZRwfWUcWTmv0Lg/fX3Y8HtWIXQazckgm0ZGLQr 0ShFzXVYfH34eFg7Wq5OPFxG/kaZ4EKcnwODCx09njqGAtxYjV7DEhReje6JHCBAvIr9 K3ytpLELjVLxPoxflJFSTCrVP5sBqrLiJ5vAZwUFMdRPUoHdg35DoAR390b54/K4Niwp e95xj6aQCeUpCQEyU038CdQrtpnoV/RMxeEhwwXoeJEJI04L7gy8xPKmHbB9qZE6rO2y O/qQ== X-Received: by 10.236.103.134 with SMTP id f6mr6807643yhg.37.1377594090994; Tue, 27 Aug 2013 02:01:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.74.102 with SMTP id s6ls2663688qev.17.gmail; Tue, 27 Aug 2013 02:01:30 -0700 (PDT) X-Received: by 10.52.96.100 with SMTP id dr4mr15843553vdb.17.1377594090807; Tue, 27 Aug 2013 02:01:30 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id gq6si4625670veb.91.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Aug 2013 02:01:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id kw10so2982529vcb.1 for ; Tue, 27 Aug 2013 02:01:30 -0700 (PDT) X-Gm-Message-State: ALoCoQkx6WxZGfB0qmZx/5qrCwfHmhfKgPzJpaUpcmVK+OwFxT5G99JUll/IDJNwg3wMYESprgBN X-Received: by 10.52.232.165 with SMTP id tp5mr16056568vdc.11.1377594090474; Tue, 27 Aug 2013 02:01:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp282389vcz; Tue, 27 Aug 2013 02:01:29 -0700 (PDT) X-Received: by 10.180.126.97 with SMTP id mx1mr10695215wib.10.1377594089112; Tue, 27 Aug 2013 02:01:29 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id kd4si6405510wjc.30.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 27 Aug 2013 02:01:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1VEF9U-0003WE-CQ for ; Tue, 27 Aug 2013 09:01:28 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 52758E1572 for ; Tue, 27 Aug 2013 09:01:28 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-scheduler X-Launchpad-Branch: ~linaro-validation/lava-scheduler/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 254 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-scheduler/trunk] Rev 254: Fix bug #1213949. Reviewed by terceiro. Message-Id: <20130827090128.28328.90242.launchpad@ackee.canonical.com> Date: Tue, 27 Aug 2013 09:01:28 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: list X-Generated-By: Launchpad (canonical.com); Revision="16738"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 57ce661bc409627bd36c82e0d617d34caa570d9d X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: noreply@launchpad.net X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Merge authors: Stevan Radaković (stevanr) Related merge proposals: https://code.launchpad.net/~stevanr/lava-scheduler/fix-1213949/+merge/182096 proposed by: Stevan Radaković (stevanr) review: Approve - Milosz Wasilewski (mwasilew) review: Approve - Antonio Terceiro (terceiro) ------------------------------------------------------------ revno: 254 [merge] committer: Stevan Radakovic branch nick: trunk timestamp: Tue 2013-08-27 11:00:32 +0200 message: Fix bug #1213949. Reviewed by terceiro. modified: lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html lava_scheduler_app/templatetags/linenumbers.py --- lp:lava-scheduler https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk You are subscribed to branch lp:lava-scheduler. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription === modified file 'lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html' --- lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html 2013-07-30 10:15:36 +0000 +++ lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html 2013-08-26 13:08:40 +0000 @@ -42,11 +42,9 @@ var atBottom = w.attr('innerHeight') + w.scrollTop() >= s.attr('scrollHeight') && w.attr('innerHeight') > progressNode.attr('offsetHeight'); if (last_pre.attr('class') == cls) { - last_pre.append(document.createTextNode(d[2])); + append_to_section(last_pre, d); } else { - var newNode = $("
");
-              newNode.addClass('log_' + d[0]);
-              newNode.text(d[2]);
+              var newNode = create_new_section_node(d);
               newNode.insertBefore(progressNode);
           }
           if (atBottom) {
@@ -62,6 +60,114 @@
     }
   });
 }
+
+append_to_section = function (element, data) {
+
+    current_table = $("#logfile_content table:last");
+    data_arr = data[2].replace(/\r\n/, "\n").split("\n");
+    line_number = get_current_section_number()[1];
+
+    if (data_arr[data_arr.length-1] == "") {
+        data_arr.pop();
+    }
+
+    for (var i in data_arr) {
+        line_number++;
+        name = "L_" + section_number + "_" + line_number;
+        display = section_number + "." + line_number;
+
+        link_node = $("", {
+            href: "#" + name,
+            html: display
+        });
+
+        section_line = $("
", { + class: "line", + }).append($("", { + name: name, + })).append(link_node); + + $(current_table).find("td:first").append(section_line); + + line_node = $("
", { + id: name, + class: "line" + }).html(" " + data_arr[i]); + element.append(line_node); + } +} + +create_new_section_node = function(data) { + + section_number++; + data_arr = data[2].split("\n"); + if (data_arr[data_arr.length-1] == "") { + data_arr.pop(); + } + + section_node = $(""); + for (var i in data_arr) { + name = "L_" + section_number + "_" + i; + if (i == 0) { + display = "Section " + section_number; + } else { + display = section_number + "." + i; + } + + link_node = $("", { + href: "#" + name, + html: display + }); + + section_node.append($("
", { + class: "line", + }).append($("", { + name: name, + })).append(link_node)); + } + + text_element = $("
", {
+                  class: "log_" + data[0],
+              });
+    for (var i in data_arr) {
+        var id = "L_" + section_number + "_" + i;
+        text_element.append($("
", { + id: id, + class: "line" + + }).html(" " + data_arr[i])); + } + + var text_node = $("", { + class: "code", + }).append($("
",{ + class: "container", + }).append(text_element)); + + var node = $("") + .append($("") + .append(section_node) + .append(text_node) + ); + + return node; +} + +get_current_section_number = function() { + + last_div = $("#logfile_content div:last"); + + if ($(last_div).attr("id")) { + div_id_arr = $(last_div).attr("id").split('_'); + return [div_id_arr[1], div_id_arr[2]]; + } + + return [-1, -1]; +} + +var section_line_number = get_current_section_number(); +var section_number = section_line_number[0]; + $(document).ready(function () { pollTimer = setTimeout(poll, 1000); }); === modified file 'lava_scheduler_app/templatetags/linenumbers.py' --- lava_scheduler_app/templatetags/linenumbers.py 2013-07-30 10:15:36 +0000 +++ lava_scheduler_app/templatetags/linenumbers.py 2013-08-26 13:08:40 +0000 @@ -18,7 +18,10 @@ ret = "
" for i in range(0, len(text.splitlines())): name = "L_%s_%s" % (prefix, i) - display = "Section %s.%s" % (prefix, i) + if (i == 0): + display = "Section %s" % (prefix) + else: + display = "%s.%s" % (prefix, i) ret += "
\ %s
" % (name, name, display)