Web Inspector: no way to filter out all console messages or all evaluations/results
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 23:53:03 +0000 (23:53 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 23:53:03 +0000 (23:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=167035
<rdar://problem/30023523>

Reviewed by Timothy Hatcher.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView):
(WI.LogContentView.prototype.didAppendConsoleMessageView):
(WI.LogContentView.prototype._markScopeBarItemUnread):
(WI.LogContentView.prototype._markScopeBarItemForMessageLevelUnread): Added.
(WI.LogContentView.prototype._previousMessageRepeatCountUpdated):
(WI.LogContentView.prototype._messageSourceBarSelectionDidChange):
(WI.LogContentView.prototype._scopeBarSelectionDidChange):
(WI.LogContentView.prototype._filterMessageElements):
(WI.LogContentView.prototype.performSearch):
* UserInterface/Views/LogContentView.css:
(.log-scope-bar > li.unread.evaluations::before): Added.

* UserInterface/Views/ConsoleCommandView.js:
(WI.ConsoleCommandView):
Drive-by: remove unnecessary super-class extends.
* Localizations/en.lproj/localizedStrings.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243260 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Views/ConsoleCommandView.js
Source/WebInspectorUI/UserInterface/Views/LogContentView.css
Source/WebInspectorUI/UserInterface/Views/LogContentView.js

index 4aad850..cf18fff 100644 (file)
@@ -1,3 +1,30 @@
+2019-03-20  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: no way to filter out all console messages or all evaluations/results
+        https://bugs.webkit.org/show_bug.cgi?id=167035
+        <rdar://problem/30023523>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/LogContentView.js:
+        (WI.LogContentView):
+        (WI.LogContentView.prototype.didAppendConsoleMessageView):
+        (WI.LogContentView.prototype._markScopeBarItemUnread):
+        (WI.LogContentView.prototype._markScopeBarItemForMessageLevelUnread): Added.
+        (WI.LogContentView.prototype._previousMessageRepeatCountUpdated):
+        (WI.LogContentView.prototype._messageSourceBarSelectionDidChange):
+        (WI.LogContentView.prototype._scopeBarSelectionDidChange):
+        (WI.LogContentView.prototype._filterMessageElements):
+        (WI.LogContentView.prototype.performSearch):
+        * UserInterface/Views/LogContentView.css:
+        (.log-scope-bar > li.unread.evaluations::before): Added.
+
+        * UserInterface/Views/ConsoleCommandView.js:
+        (WI.ConsoleCommandView):
+        Drive-by: remove unnecessary super-class extends.
+
+        * Localizations/en.lproj/localizedStrings.js:
+
 2019-03-20  Nikita Vasilyev  <nvasilyev@apple.com>
 
         Web Inspector: Styles: enabledProperties don't get invalidated after removing property
index f066b06..135eae9 100644 (file)
@@ -432,6 +432,7 @@ localizedStrings["Errors:"] = "Errors:";
 localizedStrings["Estimated energy impact."] = "Estimated energy impact.";
 localizedStrings["Eval Code"] = "Eval Code";
 localizedStrings["Evaluate JavaScript"] = "Evaluate JavaScript";
+localizedStrings["Evaluations"] = "Evaluations";
 localizedStrings["Event"] = "Event";
 localizedStrings["Event Breakpoint\u2026"] = "Event Breakpoint\u2026";
 localizedStrings["Event Dispatched"] = "Event Dispatched";
index 8326a55..e2ae5aa 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WI.ConsoleCommandView = class ConsoleCommandView extends WI.Object
+WI.ConsoleCommandView = class ConsoleCommandView
 {
     constructor(commandText, className)
     {
-        super();
-
         this._commandText = commandText;
         this._className = className || "";
     }
index aca9090..a9efbc3 100644 (file)
     visibility: hidden;
 }
 
+.log-scope-bar > li.unread.evaluations > .indicator {
+    background-color: darkgrey;
+}
+
 .log-scope-bar > li.unread.errors > .indicator {
     background-color: hsl(0, 95%, 72%);
 }
index 1645e28..8a62933 100644 (file)
@@ -84,6 +84,7 @@ WI.LogContentView = class LogContentView extends WI.ContentView
 
         let scopeBarItems = [
             new WI.ScopeBarItem(WI.LogContentView.Scopes.All, WI.UIString("All"), {exclusive: true}),
+            new WI.ScopeBarItem(WI.LogContentView.Scopes.Evaluations, WI.UIString("Evaluations"), {className: "evaluations"}),
             new WI.ScopeBarItem(WI.LogContentView.Scopes.Errors, WI.UIString("Errors"), {className: "errors"}),
             new WI.ScopeBarItem(WI.LogContentView.Scopes.Warnings, WI.UIString("Warnings"), {className: "warnings"}),
             new WI.ScopeBarItem(WI.LogContentView.Scopes.Logs, WI.UIString("Logs"), {className: "logs"}),
@@ -225,14 +226,13 @@ WI.LogContentView = class LogContentView extends WI.ContentView
         let target = messageView.message ? messageView.message.target : WI.runtimeManager.activeExecutionContext.target;
         target.connection.runAfterPendingDispatches(this._clearFocusableChildren.bind(this));
 
-        if (type && type !== WI.ConsoleMessage.MessageType.EndGroup) {
-            console.assert(messageView.message instanceof WI.ConsoleMessage);
-            if (!(messageView.message instanceof WI.ConsoleCommandResultMessage))
-                this._markScopeBarItemUnread(messageView.message.level);
+        if (messageView instanceof WI.ConsoleCommandView || messageView.message instanceof WI.ConsoleCommandResultMessage)
+            this._markScopeBarItemUnread(WI.LogContentView.Scopes.Evaluations);
+        else
+            this._markScopeBarItemForMessageLevelUnread(messageView.message.level);
 
-            console.assert(messageView.element instanceof Element);
-            this._filterMessageElements([messageView.element]);
-        }
+        console.assert(messageView.element instanceof Element);
+        this._filterMessageElements([messageView.element]);
     }
 
     get supportsSearch() { return true; }
@@ -422,17 +422,22 @@ WI.LogContentView = class LogContentView extends WI.ContentView
         return undefined;
     }
 
-    _markScopeBarItemUnread(level)
+    _markScopeBarItemUnread(scope)
     {
-        let messageLevel = this._scopeFromMessageLevel(level);
-        if (!messageLevel)
-            return;
-
-        let item = this._scopeBar.item(messageLevel);
+        let item = this._scopeBar.item(scope);
         if (item && !item.selected && !this._scopeBar.item(WI.LogContentView.Scopes.All).selected)
             item.element.classList.add("unread");
     }
 
+    _markScopeBarItemForMessageLevelUnread(level)
+    {
+        let scope = this._scopeFromMessageLevel(level);
+        if (!scope)
+            return;
+
+        this._markScopeBarItemUnread(scope);
+    }
+
     _messageAdded(event)
     {
         let message = event.data.message;
@@ -452,7 +457,7 @@ WI.LogContentView = class LogContentView extends WI.ContentView
     _previousMessageRepeatCountUpdated(event)
     {
         if (this._logViewController.updatePreviousMessageRepeatCount(event.data.count) && this._lastMessageView)
-            this._markScopeBarItemUnread(this._lastMessageView.message.level);
+            this._markScopeBarItemForMessageLevelUnread(this._lastMessageView.message.level);
     }
 
     _handleContextMenuEvent(event)
@@ -823,25 +828,24 @@ WI.LogContentView = class LogContentView extends WI.ContentView
 
     _messageSourceBarSelectionDidChange(event)
     {
-        let selectedItem = this._messageSourceBar.selectedItems[0];
-        if (selectedItem.id === WI.LogContentView.Scopes.AllChannels) {
-            for (let item of this._messageSourceBar.items)
-                item.element.classList.remove("unread");
-        } else
-            selectedItem.element.classList.remove("unread");
+        let items = this._messageSourceBar.selectedItems;
+        if (items.some((item) => item.id === WI.LogContentView.Scopes.AllChannels))
+            items = this._messageSourceBar.items;
+
+        for (let item of items)
+            item.element.classList.remove("unread");
 
         this._filterMessageElements(this._allMessageElements());
     }
 
     _scopeBarSelectionDidChange(event)
     {
-        let selectedItem = this._scopeBar.selectedItems[0];
+        let items = this._scopeBar.selectedItems;
+        if (items.some((item) => item.id === WI.LogContentView.Scopes.All))
+            items = this._scopeBar.items;
 
-        if (selectedItem.id === WI.LogContentView.Scopes.All) {
-            for (let item of this._scopeBar.items)
-                item.element.classList.remove("unread");
-        } else
-            selectedItem.element.classList.remove("unread");
+        for (let item of items)
+            item.element.classList.remove("unread");
 
         this._filterMessageElements(this._allMessageElements());
     }
@@ -849,8 +853,10 @@ WI.LogContentView = class LogContentView extends WI.ContentView
     _filterMessageElements(messageElements)
     {
         messageElements.forEach(function(messageElement) {
-            let visible = messageElement.__commandView instanceof WI.ConsoleCommandView || messageElement.__message instanceof WI.ConsoleCommandResultMessage;
-            if (!visible)
+            let visible = false;
+            if (messageElement.__commandView instanceof WI.ConsoleCommandView || messageElement.__message instanceof WI.ConsoleCommandResultMessage)
+                visible = this._scopeBar.selectedItems.some((item) => item.id === WI.LogContentView.Scopes.Evaluations || item.id === WI.LogContentView.Scopes.All);
+            else
                 visible = this._messageShouldBeVisible(messageElement.__message);
 
             let classList = messageElement.classList;
@@ -1087,7 +1093,7 @@ WI.LogContentView = class LogContentView extends WI.ContentView
                 this._highlightRanges(message, matchRanges);
 
             let classList = message.classList;
-            if (!isEmptyObject(matchRanges) || message.__commandView instanceof WI.ConsoleCommandView || message.__message instanceof WI.ConsoleCommandResultMessage)
+            if (!isEmptyObject(matchRanges))
                 classList.remove(WI.LogContentView.FilteredOutBySearchStyleClassName);
             else
                 classList.add(WI.LogContentView.FilteredOutBySearchStyleClassName);
@@ -1180,15 +1186,17 @@ WI.LogContentView = class LogContentView extends WI.ContentView
 
 WI.LogContentView.Scopes = {
     All: "log-all",
+    Debugs: "log-debugs",
     Errors: "log-errors",
-    Warnings: "log-warnings",
-    Logs: "log-logs",
+    Evaluations: "log-evaluations",
     Infos: "log-infos",
-    Debugs: "log-debugs",
+    Logs: "log-logs",
+    Warnings: "log-warnings",
+
     AllChannels: "log-all-channels",
     Media: "log-media",
-    WebRTC: "log-webrtc",
     MediaSource: "log-mediasource",
+    WebRTC: "log-webrtc",
 };
 
 WI.LogContentView.ItemWrapperStyleClassName = "console-item";