Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 6 |
| 7 <link rel="import" href="../../inc/bower_components/polymer/polymer.html"> | 7 <link rel="import" href="../../inc/bower_components/polymer/polymer.html"> |
| 8 | 8 |
| 9 <link rel="import" href="../../inc/bower_components/paper-styles/default-theme.h tml"> | 9 <link rel="import" href="../../inc/bower_components/paper-styles/default-theme.h tml"> |
| 10 <link rel="import" href="../../inc/bower_components/paper-styles/typography.html "> | 10 <link rel="import" href="../../inc/bower_components/paper-styles/typography.html "> |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 <template> | 26 <template> |
| 27 <style> | 27 <style> |
| 28 :host { | 28 :host { |
| 29 @apply(--paper-font-common-base); | 29 @apply(--paper-font-common-base); |
| 30 } | 30 } |
| 31 | 31 |
| 32 #banner { | 32 #banner { |
| 33 background-color: #FAFAFA; | 33 background-color: #FAFAFA; |
| 34 overflow: hidden; | 34 overflow: hidden; |
| 35 vertical-align: center; | 35 border-color: lightcoral; |
| 36 border-width: 0px 0px 2px 0px; | |
| 37 border-style: solid; | |
| 36 } | 38 } |
| 37 | 39 |
| 38 .banner-content { | 40 .banner-content { |
| 39 width: auto; | 41 width: auto; |
| 40 display: inline-block; | 42 display: inline-block; |
| 41 padding-left: 5px; | 43 padding-left: 5px; |
| 42 padding-right: 5px; | 44 padding-right: 5px; |
| 43 overflow: hidden; | 45 overflow: hidden; |
| 44 } | 46 } |
| 45 | 47 |
| 46 .banner-content h1 { | 48 .banner-content h1 { |
| 47 font-size: 18px; | 49 font-size: 18px; |
| 48 } | 50 } |
| 49 | 51 |
| 50 #auth-bubble { | 52 #auth-bubble { |
| 51 float: right; | 53 float: right; |
| 52 display: inline-block; | 54 display: inline-block; |
| 53 border: solid #AAAAAA; | 55 border: none; |
| 54 border-radius: 5px; | |
| 55 border-width: 1px; | |
| 56 padding: 2px; | |
| 57 margin-left: auto; | |
| 58 margin-right: 0; | |
| 59 } | 56 } |
| 60 </style> | 57 </style> |
| 61 | 58 |
| 62 <div> | 59 <div> |
| 63 <div id="banner"> | 60 <div id="banner"> |
| 64 <span class="banner-content"> | 61 <span class="banner-content"> |
| 65 <h1><a href="/">LogDog</a> | 62 <h1><a href="/">LogDog</a> |
| 66 <template is="dom-if" if="{{_hasStreams}}"> | 63 <template is="dom-if" if="{{_hasStreams}}"> |
| 67 : [[streams]] | 64 : [[streams]] |
| 68 </template> | 65 </template> |
| 69 <template is="dom-if" if="{{!_hasStreams}}"> | 66 <template is="dom-if" if="{{!_hasStreams}}"> |
| 70 (No Streams Provided) | 67 (No Streams Provided) |
| 71 </template> | 68 </template> |
| 72 </h1> | 69 </h1> |
| 73 </span> | 70 </span> |
| 74 <template is="dom-if" if="{{clientId}}"> | 71 <template is="dom-if" if="{{clientId}}"> |
| 75 <span id="auth-bubble"> | 72 <span id="auth-bubble"> |
| 76 <auth-signin | 73 <auth-signin |
| 77 client-id="[[clientId]]"></auth-signin> | 74 client-id="[[clientId]]"></auth-signin> |
| 78 </span> | 75 </span> |
| 79 </template> | 76 </template> |
| 80 </div> | 77 </div> |
| 81 | 78 |
| 82 <template is="dom-if" if="{{_hasStreams}}"> | 79 <logdog-stream-view |
| 83 <logdog-stream-view | 80 id="streamView" |
| 84 id="view" | 81 host="[[host]]" |
| 85 host="[[host]]" | 82 mobile="[[mobile]]" |
| 86 streams="[[streams]]"></logdog-stream-view> | 83 metadata="[[metadata]]" |
| 87 </template> | 84 toolbar-anchor="{{banner}}" |
| 85 toolbarAnchor="{{banner}}" | |
| 86 streams="[[streams]]"></logdog-stream-view> | |
| 88 </div> | 87 </div> |
| 89 </template> | 88 </template> |
| 90 | 89 |
| 91 </dom-module> | 90 </dom-module> |
| 92 | 91 |
| 93 <script> | 92 <script> |
| 94 Polymer({ | 93 Polymer({ |
| 95 is: "logdog-view", | 94 is: "logdog-view", |
| 96 properties: { | 95 properties: { |
| 97 host: { | 96 host: { |
| 98 type: String, | 97 type: String, |
| 99 notify: true, | 98 notify: true, |
| 99 value: null, | |
| 100 }, | 100 }, |
| 101 | |
| 101 clientId: { | 102 clientId: { |
| 102 type: String, | 103 type: String, |
| 103 nofity: true, | 104 value: null, |
| 104 }, | 105 }, |
| 105 accessToken: { | 106 |
| 106 type: String, | 107 streams: { |
| 107 notify: true, | 108 type: Array, |
| 109 value: [], | |
| 108 readOnly: true, | 110 readOnly: true, |
| 109 }, | 111 }, |
| 110 streams: { | 112 |
| 111 type: Array, | 113 metadata: { |
| 112 notify: true, | 114 type: String, |
| 115 value: false, | |
| 113 readOnly: true, | 116 readOnly: true, |
| 114 }, | 117 }, |
| 115 | 118 |
| 119 mobile: { | |
| 120 type: Boolean, | |
| 121 value: false, | |
| 122 }, | |
| 123 | |
| 116 _hasStreams: { | 124 _hasStreams: { |
| 117 computed: '_arrayHasElements(streams)', | 125 computed: '_arrayHasElements(streams)', |
| 118 }, | 126 }, |
| 119 }, | 127 }, |
| 120 | 128 |
| 121 attached: function() { | 129 ready: function() { |
| 130 // Test if we're mobile. | |
| 131 this.mobile = false; | |
| 132 if ( window.matchMedia ) { | |
| 133 this.mobile = window.matchMedia( | |
| 134 "only screen and (max-width: 760px)").maches; | |
|
Ryan Tseng
2016/12/06 03:38:11
matches?
| |
| 135 } | |
| 136 | |
| 122 // Parse the stream names from the "s" query parameter. | 137 // Parse the stream names from the "s" query parameter. |
| 123 var queryString = window.location.search.replace(/^\?/, ""); | 138 var queryString = window.location.search.replace(/^\?/, ""); |
| 124 var streams = logdog.getQueryValues(queryString, "s"). | 139 var streams = logdog.getQueryValues(queryString, "s"). |
| 125 map(logdog.correctStreamPath); | 140 map(logdog.correctStreamPath); |
| 126 this._setStreams(streams); | 141 this._setStreams(streams); |
| 142 | |
| 143 // Parse the metadata option. | |
| 144 this._setMetadata(!!logdog.getQueryValue(queryString, "m", false)); | |
|
Ryan Tseng
2016/12/06 03:38:11
!!?
| |
| 127 }, | 145 }, |
| 128 | 146 |
| 129 _onSignin: function(e) { | 147 _onSignin: function(e) { |
| 130 this._setAccessToken(e.detail.access_token); | 148 this._setAccessToken(e.detail.access_token); |
| 131 }, | 149 }, |
| 132 _onSignout: function(e) { | 150 _onSignout: function(e) { |
| 133 this._setAccessToken(null); | 151 this._setAccessToken(null); |
| 134 }, | 152 }, |
| 135 | 153 |
| 136 _arrayHasElements: function(v) { | 154 _arrayHasElements: function(v) { |
| 137 return (v && v.length); | 155 return (v && v.length); |
| 138 }, | 156 }, |
| 139 }); | 157 }); |
| 140 | 158 |
| 141 (function(i,s,o,g,r,a,m){i['CrDXObject']=r;i[r]=i[r]||function(){ | 159 (function(i,s,o,g,r,a,m){i['CrDXObject']=r;i[r]=i[r]||function(){ |
| 142 (i[r].q=i[r].q||[]).push(arguments)},a=s.createElement(o), | 160 (i[r].q=i[r].q||[]).push(arguments)},a=s.createElement(o), |
| 143 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m ) | 161 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m ) |
| 144 })(window,document,'script','https://storage.googleapis.com/crdx-feedback.apps pot.com/feedback.js','crdx'); | 162 })(window,document,'script','https://storage.googleapis.com/crdx-feedback.apps pot.com/feedback.js','crdx'); |
| 145 | 163 |
| 146 crdx('setFeedbackButtonLink', 'https://bugs.chromium.org/p/chromium/issues/ent ry?components=Infra>Platform>LogDog&labels=Infra-DX'); | 164 crdx('setFeedbackButtonLink', 'https://bugs.chromium.org/p/chromium/issues/ent ry?components=Infra>Platform>LogDog&labels=Infra-DX'); |
| 147 </script> | 165 </script> |
| OLD | NEW |