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

Unified Diff: web/inc/logdog-stream-view/viewer.ts

Issue 2860453003: LogDog Viewer: Link back to source build. (Closed)
Patch Set: comments Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « web/inc/logdog-stream-view/view.ts ('k') | web/inc/logdog-stream/logdog.ts » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: web/inc/logdog-stream-view/viewer.ts
diff --git a/web/inc/logdog-stream-view/viewer.ts b/web/inc/logdog-stream-view/viewer.ts
index a1018a9655b5b16f8d7981b7cbbc5526b26eb8e5..418a1e5d9f3262c5050c2fd5d7d392816c0f1a5b 100644
--- a/web/inc/logdog-stream-view/viewer.ts
+++ b/web/inc/logdog-stream-view/viewer.ts
@@ -192,6 +192,8 @@ namespace LogDog {
/** Are we in the middle of rendering logs? */
private rendering = true;
+ private cachedLogStreamUrl: string|undefined = undefined;
+
private loadingStateValue: LoadingState = LoadingState.NONE;
private streamStatusValue: StreamStatusEntry[];
@@ -354,6 +356,7 @@ namespace LogDog {
split: this.isSplit,
bottom: !this.fetchedEndOfStream,
fullyLoaded: (this.fetchedFullStream && (!this.rendering)),
+ logStreamUrl: this.logStreamUrl,
loadingState: this.loadingState,
streamStatus: this.streamStatus,
});
@@ -632,12 +635,20 @@ namespace LogDog {
private get fetchedFullStream(): boolean {
return (this.fetchedEndOfStream && (!this.isSplit));
}
+
+ private get logStreamUrl(): string|undefined {
+ if (!this.cachedLogStreamUrl) {
+ this.cachedLogStreamUrl = this.provider.getLogStreamUrl();
+ }
+ return this.cachedLogStreamUrl;
+ }
}
/** Generic interface for a log provider. */
interface LogProvider {
setStreamStatusCallback(cb: StreamStatusCallback): void;
fetch(op: luci.Operation, l: Location): Promise<BufferedLogs>;
+ getLogStreamUrl(): string|undefined;
/** Will return null if this LogProvider doesn't support splitting. */
split(): SplitLogProvider|null;
@@ -748,6 +759,18 @@ namespace LogDog {
}
}
+ get descriptor() {
+ return this.fetcher.desc;
+ }
+
+ getLogStreamUrl(): string|undefined {
+ let desc = this.descriptor;
+ if (desc) {
+ return (desc.tags || {})['logdog.viewer_url'];
+ }
+ return undefined;
+ }
+
setStreamStatusCallback(cb: StreamStatusCallback) {
this.streamStatusCallback = cb;
}
@@ -1073,6 +1096,19 @@ namespace LogDog {
}
}
+ getLogStreamUrl(): string|undefined {
+ // Return the first log stream viewer URL. IF we have a shared prefix,
+ // this will always work. Otherwise, returning something is better than
+ // nothing, so if any of the base streams have a URL, we will return it.
+ for (let s of this.streams) {
+ let url = s.ls.getLogStreamUrl();
+ if (url) {
+ return url;
+ }
+ }
+ return undefined;
+ }
+
/**
* Implements LogProvider.next
*/
« no previous file with comments | « web/inc/logdog-stream-view/view.ts ('k') | web/inc/logdog-stream/logdog.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698