Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: appengine/swarming/elements/res/imp/common/auth-signin.html

Issue 2204483002: Add UI to new botlist to show summary (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@bot-summary-api
Patch Set: Add docs Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 Copyright 2016 The LUCI Authors. All rights reserved. 2 Copyright 2016 The LUCI Authors. All rights reserved.
3 Use of this source code is governed under the Apache License, Version 2.0 3 Use of this source code is governed under the Apache License, Version 2.0
4 that can be found in the LICENSE file. 4 that can be found in the LICENSE file.
5 5
6 The `auth-signin` element displays sign-in/sign-out button, user email and 6 The `auth-signin` element displays sign-in/sign-out button, user email and
7 avatar. 7 avatar.
8 It has a google-signin/google-signin-aware element under the hood that handles 8 It has a google-signin/google-signin-aware element under the hood that handles
9 the actual OAuth logic. 9 the actual OAuth logic.
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 clientId: { 82 clientId: {
83 type: String, 83 type: String,
84 }, 84 },
85 profile: { 85 profile: {
86 type: Object, 86 type: Object,
87 readOnly: true 87 readOnly: true
88 }, 88 },
89 signedIn: { 89 signedIn: {
90 type: Boolean, 90 type: Boolean,
91 readOnly: true, 91 readOnly: true,
92 value: false 92 value: false,
93 notify: true,
93 } 94 }
94 }, 95 },
95 96
96 _onSignin: function(e) { 97 _onSignin: function(e) {
97 this._setSignedIn(true); 98 this._setSignedIn(true);
98 var user = gapi.auth2.getAuthInstance().currentUser.get(); 99 var user = gapi.auth2.getAuthInstance().currentUser.get();
99 var profile = user.getBasicProfile(); 100 var profile = user.getBasicProfile();
100 this._setProfile({ 101 this._setProfile({
101 email: profile.getEmail(), 102 email: profile.getEmail(),
102 imageUrl: profile.getImageUrl() 103 imageUrl: profile.getImageUrl()
103 }); 104 });
104 this.set("authResponse", user.getAuthResponse()); 105 this.set("authResponse", user.getAuthResponse());
106 this._setSignedIn(true);
105 this.fire("auth-signin"); 107 this.fire("auth-signin");
106 }, 108 },
107 109
108 _onSignout: function(e) { 110 _onSignout: function(e) {
109 this._setSignedIn(false); 111 this._setSignedIn(false);
110 this._setProfile(null); 112 this._setProfile(null);
111 }, 113 },
112 114
113 _makeHeader: function(authResponse) { 115 _makeHeader: function(authResponse) {
114 if (!authResponse) { 116 if (!authResponse) {
115 return {}; 117 return {};
116 } 118 }
117 return { 119 return {
118 "authorization": authResponse.token_type + " " + authResponse.access_t oken 120 "authorization": authResponse.token_type + " " + authResponse.access_t oken
119 }; 121 };
120 }, 122 },
121 123
122 signIn: function() { 124 signIn: function() {
123 this.$.aware.signIn(); 125 this.$.aware.signIn();
124 }, 126 },
125 127
126 signOut: function() { 128 signOut: function() {
127 this.$.aware.signOut(); 129 this.$.aware.signOut();
128 } 130 }
129 }); 131 });
130 </script> 132 </script>
131 </dom-module> 133 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698