Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion ui/src/components/details/thread_slice_details_tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ export class ThreadSliceDetailsPanel implements TrackEventDetailsPanel {
{
title: 'Slice',
description: slice.name,
buttons: this.renderContextButton(slice),
buttons: [
this.renderOpenInDefaultWorkspaceButton(),
this.renderContextButton(slice),
],
},
m(
GridLayout,
Expand Down Expand Up @@ -549,6 +552,27 @@ export class ThreadSliceDetailsPanel implements TrackEventDetailsPanel {
);
}

// Shown only when the selected slice is in a non-default workspace and the same
// track also exists in the default workspace: switches to the default
// workspace and scrolls to the slice there.
private renderOpenInDefaultWorkspaceButton(): m.Children {
const {workspaces, selection} = this.trace;
if (workspaces.currentWorkspace === workspaces.defaultWorkspace) return;
const sel = selection.selection;
if (sel.kind !== 'track_event') return;
if (workspaces.defaultWorkspace.getTrackByUri(sel.trackUri) === undefined) {
return;
}
return m(Button, {
label: 'Open in default workspace',
icon: Icons.GoTo,
onclick: () => {
workspaces.switchWorkspace(workspaces.defaultWorkspace);
selection.scrollToSelection('focus');
},
});
}

private renderContextButton(sliceInfo: SliceDetails): m.Children {
const contextMenuItems = getSliceContextMenuItems(sliceInfo);
if (contextMenuItems.length > 0) {
Expand Down