ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject [1/2] ignite git commit: # GG-843 Added copy button.
Date Fri, 18 Sep 2015 10:42:30 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 f9ff56674 -> 865e0c402


# GG-843 Added copy button.


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

Branch: refs/heads/ignite-843
Commit: 15940366129aa4245464a8025117cd03228edb26
Parents: 7389486
Author: Andrey <anovikov@gridgain.com>
Authored: Fri Sep 18 17:42:07 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Fri Sep 18 17:42:07 2015 +0700

----------------------------------------------------------------------
 .../src/main/js/controllers/common-module.js    | 37 ++++++++++++++++++++
 .../src/main/js/views/settings/profile.jade     |  2 +-
 .../main/js/views/templates/agent-download.jade |  2 +-
 3 files changed, 39 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/15940366/modules/control-center-web/src/main/js/controllers/common-module.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/common-module.js b/modules/control-center-web/src/main/js/controllers/common-module.js
index 4b776a6..263003a 100644
--- a/modules/control-center-web/src/main/js/controllers/common-module.js
+++ b/modules/control-center-web/src/main/js/controllers/common-module.js
@@ -1422,6 +1422,43 @@ controlCenterModule.service('$preview', ['$timeout', '$interval', function
($tim
     }
 }]);
 
+controlCenterModule.service('ngCopy', ['$window', function ($window) {
+    var body = angular.element($window.document.body);
+
+    var textArea = angular.element('<textarea/>');
+
+    textArea.css({
+        position: 'fixed',
+        opacity: '0'
+    });
+
+    return function (toCopy) {
+        textArea.val(toCopy);
+
+        body.append(textArea);
+
+        textArea[0].select();
+
+        try {
+            if (!document.execCommand('copy'))
+                window.prompt("Copy to clipboard: Ctrl+C, Enter", toCopy);
+        } catch (err) {
+            window.prompt("Copy to clipboard: Ctrl+C, Enter", toCopy);
+        }
+
+        textArea.remove();
+    }
+}]).directive('ngClickCopy', ['ngCopy', function (ngCopy) {
+    return {
+        restrict: 'A',
+        link: function (scope, element, attrs) {
+            element.bind('click', function () {
+                ngCopy(attrs.ngClickCopy);
+            });
+        }
+    }
+}]);
+
 // Filter to decode name using map(value, label).
 controlCenterModule.filter('displayValue', function () {
     return function (v, m, dflt) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/15940366/modules/control-center-web/src/main/js/views/settings/profile.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/settings/profile.jade b/modules/control-center-web/src/main/js/views/settings/profile.jade
index b757b06..e1ea7fe 100644
--- a/modules/control-center-web/src/main/js/views/settings/profile.jade
+++ b/modules/control-center-web/src/main/js/views/settings/profile.jade
@@ -41,7 +41,7 @@ block container
                                 input.form-control(id='profile-email' type='email' ng-model='profileUser.email'
placeholder='you@domain.com' required)
                         .details-row
                             +lbl('Security token:')
-                            label(bs-tooltip data-title='The security token is used for authorization
of web agent') {{profileUser.token}}
+                            a(ng-click-copy='{{profileUser.token}}' bs-tooltip data-title='The
security token is used for authorization of web agent.<br/>Click to copy security token
to clipboard') {{profileUser.token}}
                             i.tipLabel.fa.fa-refresh(ng-click='generateToken()' bs-tooltip
data-title='Generate random security token')
                         .details-row
                             .advanced-options

http://git-wip-us.apache.org/repos/asf/ignite/blob/15940366/modules/control-center-web/src/main/js/views/templates/agent-download.jade
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/views/templates/agent-download.jade b/modules/control-center-web/src/main/js/views/templates/agent-download.jade
index 57dcba1..f60934f 100644
--- a/modules/control-center-web/src/main/js/views/templates/agent-download.jade
+++ b/modules/control-center-web/src/main/js/views/templates/agent-download.jade
@@ -38,5 +38,5 @@
                         | &nbsp;for more information.
             .modal-footer
                 label.labelField Security token:
-                label.labelField(bs-tooltip='' data-title='The security token is used for
authorization of web agent') {{user.token}}
+                a.labelField(ng-click-copy='{{user.token}}' bs-tooltip data-title='The security
token is used for authorization of web agent.<br/>Click to copy security token to clipboard')
{{user.token}}
                 button.btn.btn-primary(ng-click='downloadAgent()') Download zip


Mime
View raw message