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 ///<reference path="../logdog-stream/logdog.ts" /> | 7 ///<reference path="../logdog-stream/logdog.ts" /> |
| 8 ///<reference path="../luci-operation/operation.ts" /> | 8 ///<reference path="../luci-operation/operation.ts" /> |
| 9 ///<reference path="../luci-sleep-promise/promise.ts" /> | 9 ///<reference path="../luci-sleep-promise/promise.ts" /> |
| 10 ///<reference path="../rpc/client.ts" /> | 10 ///<reference path="../rpc/client.ts" /> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 /** Represents control visibility in the View. */ | 44 /** Represents control visibility in the View. */ |
| 45 type Controls = { | 45 type Controls = { |
| 46 /** Are we completely finished loading stream data? */ | 46 /** Are we completely finished loading stream data? */ |
| 47 canSplit: boolean; | 47 canSplit: boolean; |
| 48 /** Are we currently split? */ | 48 /** Are we currently split? */ |
| 49 split: boolean; | 49 split: boolean; |
| 50 /** Show the bottom bar? */ | 50 /** Show the bottom bar? */ |
| 51 bottom: boolean; | 51 bottom: boolean; |
| 52 /** Is the content fully loaded? */ | 52 /** Is the content fully loaded? */ |
| 53 fullyLoaded: boolean; | 53 fullyLoaded: boolean; |
| 54 /** If not null, link to this URL for the log stream. */ | |
|
nodir
2017/05/03 15:36:52
null is not the same as undefined though
dnj
2017/05/03 15:40:43
Ah crap, used to be null, then decided undefined w
| |
| 55 logStreamUrl: string | undefined; | |
| 54 | 56 |
| 55 /** Text in the status bar. */ | 57 /** Text in the status bar. */ |
| 56 loadingState: LoadingState; | 58 loadingState: LoadingState; |
| 57 /** Stream status entries, or null for no status window. */ | 59 /** Stream status entries, or null for no status window. */ |
| 58 streamStatus: StreamStatusEntry[]; | 60 streamStatus: StreamStatusEntry[]; |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 /** A value for the "status-bar" element. */ | 63 /** A value for the "status-bar" element. */ |
| 62 type StatusBarValue = {value: string;}; | 64 type StatusBarValue = {value: string;}; |
| 63 | 65 |
| 64 /** | 66 /** |
| 65 * The underlying "logdog-stream-view" Polymer component | 67 * The underlying "logdog-stream-view" Polymer component |
| 66 * (see logdog-stream-view.html). | 68 * (see logdog-stream-view.html). |
| 67 * | 69 * |
| 68 * View will manipulate the view via modifications to Component. | 70 * View will manipulate the view via modifications to Component. |
| 69 */ | 71 */ |
| 70 type Component = { | 72 type Component = { |
| 71 /** Polymer accessor functions. Each member is an element w/ an ID. */ | 73 /** Polymer accessor functions. Each member is an element w/ an ID. */ |
| 72 $: { | 74 $: { |
| 73 client: luci.PolymerClient; mainView: HTMLElement; buttons: HTMLElement; | 75 client: luci.PolymerClient; mainView: HTMLElement; buttons: HTMLElement; |
| 74 streamStatus: HTMLElement; | 76 streamStatus: HTMLElement; |
| 75 logSplit: HTMLElement; | 77 logSplit: HTMLElement; |
| 76 logBottom: HTMLElement; | 78 logBottom: HTMLElement; |
| 77 logEnd: HTMLElement; | 79 logEnd: HTMLElement; |
| 78 logs: HTMLElement; | 80 logs: HTMLElement; |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 // Polymer properties. | 83 // Polymer properties. |
| 82 streams: string[]; | 84 streams: string[]; |
| 85 streamLinkUrl: string | undefined; | |
| 83 mobile: boolean; | 86 mobile: boolean; |
| 84 isSplit: boolean; | 87 isSplit: boolean; |
| 85 metadata: boolean; | 88 metadata: boolean; |
| 86 follow: boolean; | 89 follow: boolean; |
| 87 playing: boolean; | 90 playing: boolean; |
| 88 backfill: boolean; | 91 backfill: boolean; |
| 89 | 92 |
| 90 /** Polymer read-only setter functions. */ | 93 /** Polymer read-only setter functions. */ |
| 91 _setStatusBar(v: StatusBarValue|null): void; | 94 _setStatusBar(v: StatusBarValue|null): void; |
| 92 _setCanSplit(v: boolean): void; | 95 _setCanSplit(v: boolean): void; |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 } | 458 } |
| 456 return this.elementInViewport(anchor); | 459 return this.elementInViewport(anchor); |
| 457 } | 460 } |
| 458 | 461 |
| 459 | 462 |
| 460 updateControls(c: Controls) { | 463 updateControls(c: Controls) { |
| 461 this.comp._setCanSplit(c.canSplit); | 464 this.comp._setCanSplit(c.canSplit); |
| 462 this.comp._setIsSplit(c.split); | 465 this.comp._setIsSplit(c.split); |
| 463 this.comp._updateSplitVisible(c.split && this.renderedLogs); | 466 this.comp._updateSplitVisible(c.split && this.renderedLogs); |
| 464 this.comp._updateBottomVisible(c.bottom && this.renderedLogs); | 467 this.comp._updateBottomVisible(c.bottom && this.renderedLogs); |
| 468 this.comp.streamLinkUrl = c.logStreamUrl; | |
| 465 | 469 |
| 466 this.comp._setShowStreamingControls(this.renderedLogs && !c.fullyLoaded); | 470 this.comp._setShowStreamingControls(this.renderedLogs && !c.fullyLoaded); |
| 467 if (c.fullyLoaded) { | 471 if (c.fullyLoaded) { |
| 468 this.comp.playing = false; | 472 this.comp.playing = false; |
| 469 } | 473 } |
| 470 | 474 |
| 471 switch (c.loadingState) { | 475 switch (c.loadingState) { |
| 472 case LogDog.LoadingState.RESOLVING: | 476 case LogDog.LoadingState.RESOLVING: |
| 473 this.loadStatusBar('Resolving stream names...'); | 477 this.loadStatusBar('Resolving stream names...'); |
| 474 break; | 478 break; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 558 } | 562 } |
| 559 | 563 |
| 560 return ( | 564 return ( |
| 561 top < (window.pageYOffset + window.innerHeight) && | 565 top < (window.pageYOffset + window.innerHeight) && |
| 562 left < (window.pageXOffset + window.innerWidth) && | 566 left < (window.pageXOffset + window.innerWidth) && |
| 563 (top + height) > window.pageYOffset && | 567 (top + height) > window.pageYOffset && |
| 564 (left + width) > window.pageXOffset); | 568 (left + width) > window.pageXOffset); |
| 565 } | 569 } |
| 566 } | 570 } |
| 567 } | 571 } |
| OLD | NEW |