Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.9.0, 3.0.0-alpha2
    • Component/s: ui
    • Labels:
      None

      Description

      The legacy file browser displayed small chunks of a file in the browser itself. This was useful to users because they can quickly verify that their input or output is in the format they expect. We should bring back this functionality.

      1. HDFS-8678.01.patch
        3 kB
        Ravi Prakash
      2. HDFS-8678.02.patch
        3 kB
        Ravi Prakash
      3. HDFS-8678.03.patch
        3 kB
        Ravi Prakash

        Issue Links

          Activity

          Hide
          raviprak Ravi Prakash added a comment -

          This brings back the functionality for previewing files that was already present in the HTML (but commented out)

          Show
          raviprak Ravi Prakash added a comment - This brings back the functionality for previewing files that was already present in the HTML (but commented out)
          Hide
          hadoopqa Hadoop QA added a comment -



          +1 overall



          Vote Subsystem Runtime Comment
          0 pre-patch 0m 0s Pre-patch trunk compilation is healthy.
          +1 @author 0m 0s The patch does not contain any @author tags.
          +1 release audit 0m 16s The applied patch does not increase the total number of release audit warnings.
          +1 whitespace 0m 0s The patch has no lines that end in whitespace.
              0m 18s  



          Subsystem Report/Notes
          Patch URL http://issues.apache.org/jira/secure/attachment/12761979/HDFS-8678.01.patch
          Optional Tests  
          git revision trunk / 1f707ec
          Java 1.7.0_55
          uname Linux asf902.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Console output https://builds.apache.org/job/PreCommit-HDFS-Build/12642/console

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 pre-patch 0m 0s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. +1 release audit 0m 16s The applied patch does not increase the total number of release audit warnings. +1 whitespace 0m 0s The patch has no lines that end in whitespace.     0m 18s   Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12761979/HDFS-8678.01.patch Optional Tests   git revision trunk / 1f707ec Java 1.7.0_55 uname Linux asf902.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-HDFS-Build/12642/console This message was automatically generated.
          Hide
          raviprak Ravi Prakash added a comment -

          Here's a new patch which simplifies the alignment of the links

          Show
          raviprak Ravi Prakash added a comment - Here's a new patch which simplifies the alignment of the links
          Hide
          hadoopqa Hadoop QA added a comment -
          +1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 16s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          +1 whitespace 0m 0s Patch has no whitespace issues.
          +1 asflicense 0m 17s Patch does not generate ASF License warnings.
          0m 44s



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:2c91fd8
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12805912/HDFS-8678.02.patch
          JIRA Issue HDFS-8678
          Optional Tests asflicense
          uname Linux 6428874d5e1a 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision trunk / b4078bd
          modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs
          Console output https://builds.apache.org/job/PreCommit-HDFS-Build/15547/console
          Powered by Apache Yetus 0.2.0 http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 reexec 0m 16s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 whitespace 0m 0s Patch has no whitespace issues. +1 asflicense 0m 17s Patch does not generate ASF License warnings. 0m 44s Subsystem Report/Notes Docker Image:yetus/hadoop:2c91fd8 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12805912/HDFS-8678.02.patch JIRA Issue HDFS-8678 Optional Tests asflicense uname Linux 6428874d5e1a 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / b4078bd modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs Console output https://builds.apache.org/job/PreCommit-HDFS-Build/15547/console Powered by Apache Yetus 0.2.0 http://yetus.apache.org This message was automatically generated.
          Hide
          aw Allen Wittenauer added a comment -

          When I attempt to use this, I only get a link to view the tail of the file. A few thoughts:

          • It's good that viewing the file requires another action on the part of the user.
          • I wonder if it's possible to craft a payload that could take over the browser.
          • Why do I only get to see the tail and not the head? If I'm using something like CSV, the head of the file could be extremely important.
          Show
          aw Allen Wittenauer added a comment - When I attempt to use this, I only get a link to view the tail of the file. A few thoughts: It's good that viewing the file requires another action on the part of the user. I wonder if it's possible to craft a payload that could take over the browser. Why do I only get to see the tail and not the head? If I'm using something like CSV, the head of the file could be extremely important.
          Hide
          iudelsmann Ivo Udelsmann added a comment -

          Hello,

          After reading the previous comment I took the liberty of adding the functionality to "head" the file in the available patch. Unfortunately I'm not able to attach the patch I generated.

          I'm adding it to this comment since it is very short and could spare someone the time to implement it.

          Thank you.

          diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html
          index ad8c374..3700a5e 100644
          --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html
          +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html
          @@ -57,8 +57,17 @@
           	    <h4 class="modal-title" id="file-info-title">File information</h4>
           	  </div>
           	  <div class="modal-body" id="file-info-body">
          -	    <a id="file-info-download">Download</a>
          -        <!--<a id="file-info-preview" style="cursor:pointer">Tail the file (last 32K)</a>-->
          +	    <div class=row>
          +              <span class="col-xs-4">
          +                <a id="file-info-download">Download</a>
          +              </span>
          +              <span class="col-xs-4">
          +                <a id="file-info-preview-head" style="cursor:pointer">Head the file (first 32K)</a>
          +              </span>
          +              <span class="col-xs-4">
          +                <a id="file-info-preview-tail" style="cursor:pointer">Tail the file (last 32K)</a>
          +	      </span>
          +	    </div>
           	    <hr />
           	    <div class="panel panel-success" id="file-info-blockinfo-panel">
           	      <div class="panel-heading">
          diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js
          index 1739db2..3e276a9 100644
          --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js
          +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js
          @@ -192,13 +192,40 @@
                 var download_url = '/webhdfs/v1' + abs_path + '?op=OPEN';
          
                 $('#file-info-download').attr('href', download_url);
          -      $('#file-info-preview').click(function() {
          +
          +      var processPreview = function(url) {
          +        url += "&noredirect=true";
          +        $.ajax({
          +          type: 'GET',
          +          url: url,
          +          processData: false,
          +          crossDomain: true
          +        }).done(function(data) {
          +          url = data.Location;
          +          $.ajax({
          +            type: 'GET',
          +            url: url,
          +            processData: false,
          +            crossDomain: true
          +          }).complete(function(data) {
          +            $('#file-info-preview-body').val(data.responseText);
          +            $('#file-info-tail').show();
          +          }).error(function(jqXHR, textStatus, errorThrown) {
          +            show_err_msg("Couldn't preview the file. " + errorThrown);
          +          });
          +        }).error(function(jqXHR, textStatus, errorThrown) {
          +          show_err_msg("Couldn't find datanode to read file from. " + errorThrown);
          +        });
          +      }
          +
          +      $('#file-info-preview-tail').click(function() {
                   var offset = d.fileLength - TAIL_CHUNK_SIZE;
                   var url = offset > 0 ? download_url + '&offset=' + offset : download_url;
          -        $.get(url, function(t) {
          -          $('#file-info-preview-body').val(t);
          -          $('#file-info-tail').show();
          -        }, "text").error(network_error_handler(url));
          +        processPreview(url);
          +      });
          +      $('#file-info-preview-head').click(function() {
          +        var url = d.fileLength > TAIL_CHUNK_SIZE ? download_url + '&length=' + TAIL_CHUNK_SIZE : download_url;
          +        processPreview(url);
                 });
          
                 if (d.fileLength > 0) {
          
          Show
          iudelsmann Ivo Udelsmann added a comment - Hello, After reading the previous comment I took the liberty of adding the functionality to "head" the file in the available patch. Unfortunately I'm not able to attach the patch I generated. I'm adding it to this comment since it is very short and could spare someone the time to implement it. Thank you. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html index ad8c374..3700a5e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html @@ -57,8 +57,17 @@ <h4 class= "modal-title" id= "file-info-title" >File information</h4> </div> <div class= "modal-body" id= "file-info-body" > - <a id= "file-info-download" >Download</a> - <!--<a id= "file-info-preview" style= "cursor:pointer" >Tail the file (last 32K)</a>--> + <div class=row> + <span class= "col-xs-4" > + <a id= "file-info-download" >Download</a> + </span> + <span class= "col-xs-4" > + <a id= "file-info-preview-head" style= "cursor:pointer" >Head the file (first 32K)</a> + </span> + <span class= "col-xs-4" > + <a id= "file-info-preview-tail" style= "cursor:pointer" >Tail the file (last 32K)</a> + </span> + </div> <hr /> <div class= "panel panel-success" id= "file-info-blockinfo-panel" > <div class= "panel-heading" > diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js index 1739db2..3e276a9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js @@ -192,13 +192,40 @@ var download_url = '/webhdfs/v1' + abs_path + '?op=OPEN'; $('#file-info-download').attr('href', download_url); - $('#file-info-preview').click(function() { + + var processPreview = function(url) { + url += "&noredirect= true " ; + $.ajax({ + type: 'GET', + url: url, + processData: false , + crossDomain: true + }).done(function(data) { + url = data.Location; + $.ajax({ + type: 'GET', + url: url, + processData: false , + crossDomain: true + }).complete(function(data) { + $('#file-info-preview-body').val(data.responseText); + $('#file-info-tail').show(); + }).error(function(jqXHR, textStatus, errorThrown) { + show_err_msg( "Couldn't preview the file. " + errorThrown); + }); + }).error(function(jqXHR, textStatus, errorThrown) { + show_err_msg( "Couldn't find datanode to read file from. " + errorThrown); + }); + } + + $('#file-info-preview-tail').click(function() { var offset = d.fileLength - TAIL_CHUNK_SIZE; var url = offset > 0 ? download_url + '&offset=' + offset : download_url; - $.get(url, function(t) { - $('#file-info-preview-body').val(t); - $('#file-info-tail').show(); - }, "text" ).error(network_error_handler(url)); + processPreview(url); + }); + $('#file-info-preview-head').click(function() { + var url = d.fileLength > TAIL_CHUNK_SIZE ? download_url + '&length=' + TAIL_CHUNK_SIZE : download_url; + processPreview(url); }); if (d.fileLength > 0) {
          Hide
          hadoopqa Hadoop QA added a comment -
          -1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 0s Docker mode activated.
          -1 patch 0m 4s HDFS-8678 does not apply to trunk. Rebase required? Wrong Branch? See https://wiki.apache.org/hadoop/HowToContribute for help.



          Subsystem Report/Notes
          JIRA Issue HDFS-8678
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12805912/HDFS-8678.02.patch
          Console output https://builds.apache.org/job/PreCommit-HDFS-Build/17344/console
          Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 0s Docker mode activated. -1 patch 0m 4s HDFS-8678 does not apply to trunk. Rebase required? Wrong Branch? See https://wiki.apache.org/hadoop/HowToContribute for help. Subsystem Report/Notes JIRA Issue HDFS-8678 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12805912/HDFS-8678.02.patch Console output https://builds.apache.org/job/PreCommit-HDFS-Build/17344/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
          Hide
          raviprak Ravi Prakash added a comment -

          Thanks for your contribution Ivo! Attatching the patch file in your stead. It looks good to me. Allen?

          http://stackoverflow.com/questions/10604320/do-jquerys-val-and-prop-methods-html-escape-values says that we don't need to escape the contents of the file we have retrieved. I have no reason to distrust it

          Show
          raviprak Ravi Prakash added a comment - Thanks for your contribution Ivo! Attatching the patch file in your stead. It looks good to me. Allen? http://stackoverflow.com/questions/10604320/do-jquerys-val-and-prop-methods-html-escape-values says that we don't need to escape the contents of the file we have retrieved. I have no reason to distrust it
          Hide
          hadoopqa Hadoop QA added a comment -
          -1 overall



          Vote Subsystem Runtime Comment
          0 reexec 0m 21s Docker mode activated.
          +1 @author 0m 0s The patch does not contain any @author tags.
          -1 whitespace 0m 0s The patch 3 line(s) with tabs.
          +1 asflicense 0m 26s The patch does not generate ASF License warnings.
          1m 5s



          Subsystem Report/Notes
          Docker Image:yetus/hadoop:9560f25
          JIRA Issue HDFS-8678
          JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12835886/HDFS-8678.03.patch
          Optional Tests asflicense
          uname Linux 8bc395a8c8eb 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
          Build tool maven
          Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
          git revision trunk / 8a9388e
          whitespace https://builds.apache.org/job/PreCommit-HDFS-Build/17345/artifact/patchprocess/whitespace-tabs.txt
          modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs
          Console output https://builds.apache.org/job/PreCommit-HDFS-Build/17345/console
          Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 21s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 whitespace 0m 0s The patch 3 line(s) with tabs. +1 asflicense 0m 26s The patch does not generate ASF License warnings. 1m 5s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Issue HDFS-8678 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12835886/HDFS-8678.03.patch Optional Tests asflicense uname Linux 8bc395a8c8eb 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 8a9388e whitespace https://builds.apache.org/job/PreCommit-HDFS-Build/17345/artifact/patchprocess/whitespace-tabs.txt modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs Console output https://builds.apache.org/job/PreCommit-HDFS-Build/17345/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
          Hide
          aw Allen Wittenauer added a comment -

          We should probably move the block information to the bottom since it's not particularly useful to 99.9999% of the users. But we can do that as a follow-up if you want.

          +1

          Show
          aw Allen Wittenauer added a comment - We should probably move the block information to the bottom since it's not particularly useful to 99.9999% of the users. But we can do that as a follow-up if you want. +1
          Hide
          raviprak Ravi Prakash added a comment -

          Thanks Allen! Yeah! Let's do that in a follow up.

          I've committed this to trunk and branch-2. It will be available in 2.9.0

          Show
          raviprak Ravi Prakash added a comment - Thanks Allen! Yeah! Let's do that in a follow up. I've committed this to trunk and branch-2. It will be available in 2.9.0
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10914 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10914/)
          HDFS-8678. Bring back the feature to view chunks of files in the HDFS (raviprak: rev 625df87c7b8ec2787e743d845fadde5e73479dc1)

          • (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html
          • (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10914 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10914/ ) HDFS-8678 . Bring back the feature to view chunks of files in the HDFS (raviprak: rev 625df87c7b8ec2787e743d845fadde5e73479dc1) (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.html (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js

            People

            • Assignee:
              raviprak Ravi Prakash
              Reporter:
              raviprak Ravi Prakash
            • Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development