Skip to content

Commit

Permalink
Revert of [DevTools] Show icon in top toolbar when Node target is ava…
Browse files Browse the repository at this point in the history
…ilable (patchset #3 id:40001 of https://codereview.chromium.org/2890973002/ )

Reason for revert:
See issue 727517

Original issue's description:
> [DevTools] Show icon in top toolbar when Node target is available
>
> Clicking on it opens dedicated Node frontend.
>
> BUG=706916
>
> Review-Url: https://codereview.chromium.org/2890973002
> Cr-Commit-Position: refs/heads/master@{#472739}
> Committed: https://chromium.googlesource.com/chromium/src/+/ad3ffab411cc396ffb20c1d35dcff6de038f14b4

[email protected]
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=706916

Review-Url: https://codereview.chromium.org/2932703002
Cr-Commit-Position: refs/heads/master@{#478017}
  • Loading branch information
dgozman authored and Commit Bot committed Jun 8, 2017
1 parent 514aac9 commit 6b26576
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 78 deletions.
2 changes: 0 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ all_devtools_files = [
"front_end/main/GCActionDelegate.js",
"front_end/main/Main.js",
"front_end/main/module.json",
"front_end/main/nodeIcon.css",
"front_end/main/remoteDebuggingTerminatedScreen.css",
"front_end/main/renderingOptions.css",
"front_end/main/RenderingOptions.js",
Expand Down Expand Up @@ -819,7 +818,6 @@ devtools_image_files = [
"front_end/Images/ic_warning_black_18dp.svg",
"front_end/Images/navigationControls.png",
"front_end/Images/navigationControls_2x.png",
"front_end/Images/nodeIcon.png",
"front_end/Images/popoverArrows.png",
"front_end/Images/profileGroupIcon.png",
"front_end/Images/profileIcon.png",
Expand Down
Binary file removed front_end/Images/nodeIcon.png
Binary file not shown.
31 changes: 0 additions & 31 deletions front_end/main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,37 +728,6 @@ Main.Main.MainMenuItem = class {
}
};

/**
* @implements {UI.ToolbarItem.Provider}
*/
Main.Main.NodeIndicator = class {
constructor() {
var element = createElement('div');
var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'main/nodeIcon.css');
this._element = shadowRoot.createChild('div', 'node-icon');
element.addEventListener('click', () => InspectorFrontendHost.openNodeFrontend(), false);
this._button = new UI.ToolbarItem(element);
this._button.setTitle(Common.UIString('Open dedicated DevTools for Node.js'));
SDK.targetManager.addEventListener(SDK.TargetManager.Events.AvailableNodeTargetsChanged, this._update, this);
this._button.setVisible(false);
this._update();
}

_update() {
this._element.classList.toggle('inactive', !SDK.targetManager.availableNodeTargetsCount());
if (SDK.targetManager.availableNodeTargetsCount())
this._button.setVisible(true);
}

/**
* @override
* @return {?UI.ToolbarItem}
*/
item() {
return this._button;
}
};

Main.NetworkPanelIndicator = class {
constructor() {
// TODO: we should not access network from other modules.
Expand Down
8 changes: 0 additions & 8 deletions front_end/main/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,6 @@
"location": "main-toolbar-left",
"order": 100
},
{
"type": "@UI.ToolbarItem.Provider",
"className": "Main.Main.NodeIndicator",
"order": 2,
"location": "main-toolbar-left",
"condition": "!nodeFrontend"
},
{
"type": "@UI.ToolbarItem.Provider",
"className": "Main.Main.WarningErrorCounter",
Expand Down Expand Up @@ -448,7 +441,6 @@
],
"resources": [
"errorWarningCounter.css",
"nodeIcon.css",
"remoteDebuggingTerminatedScreen.css",
"renderingOptions.css",
"targetCrashedScreen.css"
Expand Down
23 changes: 0 additions & 23 deletions front_end/main/nodeIcon.css

This file was deleted.

23 changes: 10 additions & 13 deletions front_end/sdk/TargetManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,9 @@ SDK.TargetManager = class extends Common.Object {
_connectAndCreateMainTarget() {
if (Runtime.queryParam('nodeFrontend')) {
var target = new SDK.Target(
this, 'main', Common.UIString('Node.js'), SDK.Target.Capability.Target, this._createMainConnection.bind(this),
this, 'main', Common.UIString('Node'), SDK.Target.Capability.Target, this._createMainConnection.bind(this),
null);
target.setInspectedURL('Node.js');
target.setInspectedURL('Node');
this._childTargetManagers.set(target, new SDK.ChildTargetManager(this, target));
Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSFromFrontend);
return;
Expand Down Expand Up @@ -410,15 +410,13 @@ SDK.ChildTargetManager = class {
if (Runtime.experiments.isEnabled('autoAttachToCrossProcessSubframes'))
this._targetAgent.setAttachToFrames(true);

if (!parentTarget.parentTarget()) {
if (!parentTarget.parentTarget())
this._targetAgent.setDiscoverTargets(true);
if (Runtime.queryParam('nodeFrontend')) {
InspectorFrontendHost.setDevicesUpdatesEnabled(true);
InspectorFrontendHost.events.addEventListener(
InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged, this._devicesDiscoveryConfigChanged, this);
} else {
this._targetAgent.setRemoteLocations([{host: 'localhost', port: 9229}]);
}

if (Runtime.queryParam('nodeFrontend') && !this._parentTarget.parentTarget()) {
InspectorFrontendHost.setDevicesUpdatesEnabled(true);
InspectorFrontendHost.events.addEventListener(
InspectorFrontendHostAPI.Events.DevicesDiscoveryConfigChanged, this._devicesDiscoveryConfigChanged, this);
}
}

Expand All @@ -431,8 +429,7 @@ SDK.ChildTargetManager = class {
for (var address of config.networkDiscoveryConfig) {
var parts = address.split(':');
var port = parseInt(parts[1], 10);
if (parts[0] && port)
locations.push({host: parts[0], port: port});
locations.push({host: parts[0] || 'localhost', port: port || 9229});
}
this._targetAgent.setRemoteLocations(locations);
}
Expand Down Expand Up @@ -516,7 +513,7 @@ SDK.ChildTargetManager = class {
attachedToTarget(targetInfo, waitingForDebugger) {
var targetName = '';
if (targetInfo.type === 'node') {
targetName = Common.UIString('Node.js: %s', targetInfo.url);
targetName = Common.UIString('Node: %s', targetInfo.url);
} else if (targetInfo.type !== 'iframe') {
var parsedURL = targetInfo.url.asParsedURL();
targetName =
Expand Down
29 changes: 28 additions & 1 deletion front_end/sources/ThreadsSidebarPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ Sources.ThreadsSidebarPane = class extends UI.VBox {
this._list = new UI.ListControl(this._items, this, UI.ListMode.NonViewport);
this.contentElement.appendChild(this._list.element);

this._availableNodeTargetsElement = this.contentElement.createChild('div', 'hidden available-node-targets');

UI.context.addFlavorChangeListener(SDK.Target, this._targetFlavorChanged, this);

SDK.targetManager.addEventListener(
SDK.TargetManager.Events.AvailableNodeTargetsChanged, this._availableNodeTargetsChanged, this);
this._availableNodeTargetsChanged();

SDK.targetManager.observeModels(SDK.DebuggerModel, this);
}

Expand All @@ -25,7 +32,27 @@ Sources.ThreadsSidebarPane = class extends UI.VBox {
*/
static shouldBeShown() {
var minJSTargets = Runtime.queryParam('nodeFrontend') ? 1 : 2;
return SDK.targetManager.models(SDK.DebuggerModel).length >= minJSTargets;
if (SDK.targetManager.models(SDK.DebuggerModel).length >= minJSTargets)
return true;
return !!SDK.targetManager.availableNodeTargetsCount();
}

_availableNodeTargetsChanged() {
var count = SDK.targetManager.availableNodeTargetsCount();
if (!count) {
this._availableNodeTargetsElement.classList.add('hidden');
return;
}
this._availableNodeTargetsElement.removeChildren();
this._availableNodeTargetsElement.createTextChild(
count === 1 ? Common.UIString('Node instance available.') :
Common.UIString('%d Node instances available.', count));
var link = this._availableNodeTargetsElement.createChild('span', 'link');
link.textContent = Common.UIString('Connect');
link.addEventListener('click', () => {
InspectorFrontendHost.openNodeFrontend();
}, false);
this._availableNodeTargetsElement.classList.remove('hidden');
}

/**
Expand Down
14 changes: 14 additions & 0 deletions front_end/sources/threadsSidebarPane.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
* found in the LICENSE file.
*/

.available-node-targets {
height: 22px;
display: flex;
align-items: center;
justify-content: flex-start;
padding-left: 20px;
border-top: 1px solid #eee;
font-style: italic;
}

.available-node-targets > span {
margin-left: 5px;
}

.thread-item {
padding: 3px 8px 3px 20px;
position: relative;
Expand Down

0 comments on commit 6b26576

Please sign in to comment.