Skip to content

Commit ce8c220

Browse files
bmeurerDevtools-frontend LUCI CQ
authored andcommitted
[network] Always show "Open in Network panel" context menu item.
Previously we'd only show the "Reveal in Network panel" context menu item when we had an actual network request recorded for the resource. While this is technically correct, it leaves the developer wondering why the menu item isn't showing (the reasons are subtle). So with this CL we rename the item to "Open in Network panel", and always show it, but when there's no resource, we show it disabled and with a note "(missing request)" appended. Fixed: 372873222 Screenshot: https://i.imgur.com/elaOkCC.png Change-Id: I8bf64827145aca93bbd2a0def6c22b9e3149315f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5975683 Reviewed-by: Peter Müller <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]>
1 parent e4611e4 commit ce8c220

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

front_end/panels/network/NetworkPanel.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,18 @@ const UIStrings = {
147147
*/
148148
hitSToReloadAndCaptureFilmstrip: 'Hit {PH1} to reload and capture filmstrip.',
149149
/**
150-
*@description A context menu item in the Network Panel of the Network panel
150+
* @description A context menu item that is shown for resources in other panels
151+
* to open them in the Network panel.
151152
*/
152-
revealInNetworkPanel: 'Reveal in Network panel',
153+
openInNetworkPanel: 'Open in Network panel',
154+
/**
155+
* @description A context menu item that is shown for resources in other panels
156+
* to open them in the Network panel, but when there's no associated network
157+
* request. This context menu item is always disabled and only provided to give
158+
* the developer an idea of why they cannot open the resource in the Network
159+
* panel.
160+
*/
161+
openInNetworkPanelMissingRequest: 'Open in Network panel (missing request)',
153162
/**
154163
*@description Text in Network Panel that is displayed whilst the recording is in progress.
155164
*/
@@ -757,16 +766,22 @@ export class NetworkPanel extends UI.Panel.Panel implements
757766
TimelineUtils.NetworkRequest.TimelineNetworkRequest): void {
758767
const appendRevealItem = (request: SDK.NetworkRequest.NetworkRequest): void => {
759768
contextMenu.revealSection().appendItem(
760-
i18nString(UIStrings.revealInNetworkPanel),
769+
i18nString(UIStrings.openInNetworkPanel),
761770
() => UI.ViewManager.ViewManager.instance()
762771
.showView('network')
763772
.then(this.networkLogView.resetFilter.bind(this.networkLogView))
764773
.then(this.revealAndHighlightRequest.bind(this, request)),
765774
{jslogContext: 'reveal-in-network'});
766775
};
776+
const appendRevealItemMissingData = (): void => {
777+
contextMenu.revealSection().appendItem(i18nString(UIStrings.openInNetworkPanelMissingRequest), () => {}, {
778+
disabled: true,
779+
jslogContext: 'reveal-in-network',
780+
});
781+
};
767782
const appendRevealItemAndSelect = (request: TimelineUtils.NetworkRequest.TimelineNetworkRequest): void => {
768783
contextMenu.revealSection().appendItem(
769-
i18nString(UIStrings.revealInNetworkPanel),
784+
i18nString(UIStrings.openInNetworkPanel),
770785
() => UI.ViewManager.ViewManager.instance()
771786
.showView('network')
772787
.then(this.networkLogView.resetFilter.bind(this.networkLogView))
@@ -783,13 +798,17 @@ export class NetworkPanel extends UI.Panel.Panel implements
783798
if (target instanceof SDK.Resource.Resource) {
784799
if (target.request) {
785800
appendRevealItem(target.request);
801+
} else {
802+
appendRevealItemMissingData();
786803
}
787804
return;
788805
}
789806
if (target instanceof Workspace.UISourceCode.UISourceCode) {
790807
const resource = Bindings.ResourceUtils.resourceForURL(target.url());
791808
if (resource && resource.request) {
792809
appendRevealItem(resource.request);
810+
} else {
811+
appendRevealItemMissingData();
793812
}
794813
return;
795814
}

front_end/panels/timeline/components/NetworkRequestDetails.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class NetworkRequestDetails extends HTMLElement {
173173
return;
174174
}
175175
// Add a wrapper class here.
176-
// The main reason is the `Reveal in Network panel` option is handled by the context menu provider, which will
176+
// The main reason is the `Open in Network panel` option is handled by the context menu provider, which will
177177
// add this option for all supporting types. And there are a lot of context menu providers that support
178178
// `SDK.NetworkRequest.NetworkRequest`, for example `Override content` by PersistenceActions, but we so far just
179179
// want the one to reveal in network panel, so add a new class which will only be supported by Network panel.

front_end/panels/timeline/utils/NetworkRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function createTimelineNetworkRequest(syntheticNetworkRequest: Trace.Type
2222
}
2323

2424
// Add a wrapper class here.
25-
// The reason is the `Reveal in Network panel` option is handled by the context menu provider, which will add this
25+
// The reason is the `Open in Network panel` option is handled by the context menu provider, which will add this
2626
// option for all supporting types. And there are a lot of context menu providers that support
2727
// `SDK.NetworkRequest.NetworkRequest`, for example `Override content` by PersistenceActions, but we so far just want
2828
// the one to reveal in network panel, so add a new class which will only be supported by Network panel. Also we want to

0 commit comments

Comments
 (0)