chore(trace-viewer): only show source tab when soureces are includes (#10338)
This commit is contained in:
parent
565ac910e7
commit
9485e62a00
|
|
@ -30,6 +30,7 @@ export type ContextEntry = {
|
|||
actions: trace.ActionTraceEvent[];
|
||||
events: trace.ActionTraceEvent[];
|
||||
objects: { [key: string]: any };
|
||||
hasSource: boolean;
|
||||
};
|
||||
|
||||
export type PageEntry = {
|
||||
|
|
@ -55,5 +56,6 @@ export function createEmptyContext(): ContextEntry {
|
|||
actions: [],
|
||||
events: [],
|
||||
objects: {},
|
||||
hasSource: false
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ export class TraceModel {
|
|||
traceEntry = entry;
|
||||
if (entry.filename.endsWith('.network'))
|
||||
networkEntry = entry;
|
||||
if (entry.filename.includes('src@'))
|
||||
this.contextEntry.hasSource = true;
|
||||
this._entries.set(entry.filename, entry);
|
||||
}
|
||||
this._snapshotStorage = new PersistentSnapshotStorage(this._entries);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ export const Workbench: React.FunctionComponent<{
|
|||
{ id: 'network', title: 'Network', count: networkCount, render: () => <NetworkTab action={selectedAction} /> },
|
||||
];
|
||||
|
||||
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1')
|
||||
if (contextEntry.hasSource)
|
||||
tabs.push({ id: 'source', title: 'Source', count: 0, render: () => <SourceTab action={selectedAction} /> });
|
||||
|
||||
return <div className='vbox workbench' onDragOver={event => { event.preventDefault(); setDragOver(true); }}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue