Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 dc0257f8f -> ccb498802


AMBARI-19791 Log Search "Preview" should have a "Select for Copy" button 
(mgergely)

Change-Id: I6f59437dc5d6a13fb242c9c51fdc78eca9f0a4e3


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ccb49880
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ccb49880
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ccb49880

Branch: refs/heads/branch-2.5
Commit: ccb498802f3aebecfca331fc62f52638115ad72d
Parents: dc0257f
Author: Miklos Gergely <mgerg...@hortonworks.com>
Authored: Wed Feb 1 10:51:13 2017 +0100
Committer: Miklos Gergely <mgerg...@hortonworks.com>
Committed: Wed Feb 1 10:51:13 2017 +0100

----------------------------------------------------------------------
 .../webapp/scripts/views/tabs/LogFileView.js    | 47 +++++++++++++++-----
 1 file changed, 37 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ccb49880/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
----------------------------------------------------------------------
diff --git 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
index 57d4acd..c7e1cba 100644
--- 
a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
+++ 
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/tabs/LogFileView.js
@@ -352,16 +352,16 @@ define(['require',
                 });
             },
             getIdRowForTableLayout : function(){
-               var IdRow =  Backgrid.Row.extend({
-                                   render: function() {
-                                       IdRow.__super__.render.apply(this, 
arguments);
-                                       if (this.model.has("id")) {
-                                           this.$el.attr("data-id", 
this.model.get('id'));
-                                       }
-                                       return this;
-                                   }
-                               });
-               return IdRow;
+                var IdRow =  Backgrid.Row.extend({
+                    render: function() {
+                        IdRow.__super__.render.apply(this, arguments);
+                        if (this.model.has("id")) {
+                            this.$el.attr("data-id", this.model.get('id'));
+                        }
+                        return this;
+                    }
+                });
+            return IdRow;
             },
             renderTableLikeLogFile: function() {
                 var that = this;
@@ -821,6 +821,33 @@ define(['require',
                         click: function() {
                             that.onDialogClosed();
                         }
+                    },
+                    {
+                        id: "copyBtn",
+                        text: "Select for Copy",
+                        "class": "btn btn-default",
+                        click: function() {
+                            if ($('.logsContainer-clipboard').length != 0)
+                                return;
+                            
+                            var logElement = $(".logsContainer");
+                            var logElementRect = 
logElement[0].getBoundingClientRect();
+                            logElement.css("display", "none");
+                            
+                            var text = '';
+                            logElement.find('div').each(function(){
+                                text += this.innerText + '\n';
+                            });
+                            
+                            var textarea = $('<textarea 
class="logsContainer-clipboard"></textarea>');
+                            $(".logsDetail").append(textarea);
+                            textarea
+                            .text(text)
+                            .css('display', 'block')
+                            .width(logElementRect.width)
+                            .height(logElementRect.height)
+                            .select();
+                        }
                     }]
                 };
                 var dialog = that.dialog = new JBDialog(opts).render();

Reply via email to