@@ -10382,7 +10382,34 @@ r.destroy();
10382
10382
});
10383
10383
}
10384
10384
};
10385
- }).directive("shortId", function() {
10385
+ }).directive("copyLoginToClipboard", [ "NotificationsService", function(e) {
10386
+ return {
10387
+ restrict: "E",
10388
+ replace: !0,
10389
+ scope: {
10390
+ clipboardText: "="
10391
+ },
10392
+ template: '<a href="" data-clipboard-text="">Copy Login Command</a>',
10393
+ link: function(t, n) {
10394
+ var a = new Clipboard(n.get(0));
10395
+ a.on("success", function() {
10396
+ e.addNotification({
10397
+ id: "copied_to_clipboard_toast_success",
10398
+ type: "warning",
10399
+ message: "Do not share the API token in your clipboard. A token is a form of a password."
10400
+ });
10401
+ }), a.on("error", function() {
10402
+ e.addNotification({
10403
+ id: "copied_to_clipboard_toast_error",
10404
+ type: "error",
10405
+ message: "Unable to copy."
10406
+ });
10407
+ }), n.on("$destroy", function() {
10408
+ a.destroy();
10409
+ });
10410
+ }
10411
+ };
10412
+ } ]).directive("shortId", function() {
10386
10413
return {
10387
10414
restrict: "E",
10388
10415
scope: {
@@ -15445,11 +15472,14 @@ type: "dom",
15445
15472
node: '<li><a href="about">About</a></li>'
15446
15473
}), e;
15447
15474
});
15448
- } ]), angular.module("openshiftConsole").run([ "extensionRegistry", "$rootScope", function(e, t) {
15475
+ } ]), angular.module("openshiftConsole").run([ "extensionRegistry", "$rootScope", "DataService", "AuthService", function(e, t, n, a ) {
15449
15476
e.add("nav-user-dropdown", function() {
15450
15477
var e = "Log out";
15451
15478
return t.user.fullName && t.user.fullName !== t.user.metadata.name && (e += " (" + t.user.metadata.name + ")"), [ {
15452
15479
type: "dom",
15480
+ node: "<li><copy-login-to-clipboard clipboard-text=\"'oc login " + n.openshiftAPIBaseUrl() + " --token=" + a.UserStore().getToken() + "'\"></copy-login-to-clipboard></li>"
15481
+ }, {
15482
+ type: "dom",
15453
15483
node: '<li><a href="logout">' + _.escape(e) + "</a></li>"
15454
15484
} ];
15455
15485
});
0 commit comments