feat(trace viewer): show baseURL in Metadata pane

This commit is contained in:
Simon Knott 2024-07-25 10:58:20 +02:00
parent bdbe4795f1
commit 87d9e75878
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC
7 changed files with 20 additions and 0 deletions

View file

@ -109,6 +109,7 @@ export class Tracing extends SdkObject implements InstrumentationListener, Snaps
this._contextCreatedEvent.browserName = context._browser.options.name;
this._contextCreatedEvent.channel = context._browser.options.channel;
this._contextCreatedEvent.options = context._options;
this._contextCreatedEvent.baseURL = context._options.baseURL;
}
}

View file

@ -24,6 +24,7 @@ export type ContextEntry = {
startTime: number;
endTime: number;
browserName: string;
baseURL?: string;
channel?: string;
platform?: string;
wallTime: number;

View file

@ -85,6 +85,7 @@ export class TraceModernizer {
this._version = event.version;
contextEntry.origin = event.origin;
contextEntry.browserName = event.browserName;
contextEntry.baseURL = event.baseURL;
contextEntry.channel = event.channel;
contextEntry.title = event.title;
contextEntry.platform = event.platform;

View file

@ -73,6 +73,14 @@
overflow: hidden;
}
a.call-value {
text-decoration: none;
}
a.call-value:hover {
text-decoration: underline;
}
.call-value::before {
content: '\00a0';
}

View file

@ -25,6 +25,12 @@ export const MetadataView: React.FunctionComponent<{
if (!model)
return <></>;
return <div className='metadata-view vbox'>
{model.baseURL && (
<>
<div className='call-section' style={{ paddingTop: 2 }}>Time</div>
<div className='call-line'>baseURL:<a className='call-value string' href={model.baseURL} title={model.baseURL} target="_blank">{model.baseURL}</a></div>
</>
)}
<div className='call-section' style={{ paddingTop: 2 }}>Time</div>
{!!model.wallTime && <div className='call-line'>start time:<span className='call-value datetime' title={new Date(model.wallTime).toLocaleString()}>{new Date(model.wallTime).toLocaleString()}</span></div>}
<div className='call-line'>duration:<span className='call-value number' title={msToString(model.endTime - model.startTime)}>{msToString(model.endTime - model.startTime)}</span></div>

View file

@ -59,6 +59,7 @@ export class MultiTraceModel {
readonly startTime: number;
readonly endTime: number;
readonly browserName: string;
readonly baseURL?: string;
readonly channel?: string;
readonly platform?: string;
readonly wallTime?: number;
@ -83,6 +84,7 @@ export class MultiTraceModel {
const libraryContext = contexts.find(context => context.origin === 'library');
this.browserName = libraryContext?.browserName || '';
this.baseURL = libraryContext?.baseURL;
this.sdkLanguage = libraryContext?.sdkLanguage;
this.channel = libraryContext?.channel;
this.testIdAttributeName = libraryContext?.testIdAttributeName;

View file

@ -43,6 +43,7 @@ export type ContextCreatedTraceEvent = {
options: BrowserContextEventOptions,
sdkLanguage?: Language,
testIdAttributeName?: string,
baseURL?: string,
};
export type ScreencastFrameTraceEvent = {