Title: [253165] trunk/Source/WebInspectorUI
Revision
253165
Author
[email protected]
Date
2019-12-05 12:33:09 -0800 (Thu, 05 Dec 2019)

Log Message

Web Inspector: Search: there should be some default content when there is no search string
https://bugs.webkit.org/show_bug.cgi?id=204631

Reviewed by Timothy Hatcher.

It's very odd to switch to the Search Tab and find it completely empty, especially if you've
never used it before.

Add basic "No Search String" and "No Search Results" text with a clickable help navigation
item that reveals and focuses the sidebar search input.

* UserInterface/Views/SearchSidebarPanel.js:
(WI.SearchSidebarPanel.prototype.showDefaultContentView): Added.
(WI.SearchSidebarPanel.prototype.performSearch):
(WI.SearchSidebarPanel.prototype._handleDefaultContentViewSearchNavigationItemClicked): Added.

* Localizations/en.lproj/localizedStrings.js:

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (253164 => 253165)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-12-05 20:23:32 UTC (rev 253164)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-12-05 20:33:09 UTC (rev 253165)
@@ -1,5 +1,25 @@
 2019-12-05  Devin Rousso  <[email protected]>
 
+        Web Inspector: Search: there should be some default content when there is no search string
+        https://bugs.webkit.org/show_bug.cgi?id=204631
+
+        Reviewed by Timothy Hatcher.
+
+        It's very odd to switch to the Search Tab and find it completely empty, especially if you've
+        never used it before.
+
+        Add basic "No Search String" and "No Search Results" text with a clickable help navigation
+        item that reveals and focuses the sidebar search input.
+
+        * UserInterface/Views/SearchSidebarPanel.js:
+        (WI.SearchSidebarPanel.prototype.showDefaultContentView): Added.
+        (WI.SearchSidebarPanel.prototype.performSearch):
+        (WI.SearchSidebarPanel.prototype._handleDefaultContentViewSearchNavigationItemClicked): Added.
+
+        * Localizations/en.lproj/localizedStrings.js:
+
+2019-12-05  Devin Rousso  <[email protected]>
+
         Web Inspector: move the "Add Breakpoint" context menu to be next to the blackboxing context menu item
         https://bugs.webkit.org/show_bug.cgi?id=204833
 

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (253164 => 253165)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2019-12-05 20:23:32 UTC (rev 253164)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2019-12-05 20:33:09 UTC (rev 253165)
@@ -784,6 +784,8 @@
 localizedStrings["No request, served from the memory cache."] = "No request, served from the memory cache.";
 localizedStrings["No response cookies."] = "No response cookies.";
 localizedStrings["No response headers"] = "No response headers";
+localizedStrings["No search results"] = "No search results";
+localizedStrings["No search string"] = "No search string";
 localizedStrings["Node"] = "Node";
 /* A submenu item of 'Break On' that breaks (pauses) before DOM node is removed */
 localizedStrings["Node Removed"] = "Node Removed";
@@ -857,6 +859,7 @@
 localizedStrings["Preserve Log"] = "Preserve Log";
 localizedStrings["Press %s to import a test or result file"] = "Press %s to import a test or result file";
 localizedStrings["Press %s to load a recording from file."] = "Press %s to load a recording from file.";
+localizedStrings["Press %s to see recent searches"] = "Press %s to see recent searches";
 localizedStrings["Press %s to start running the audit"] = "Press %s to start running the audit";
 localizedStrings["Press %s to stop editing"] = "Press %s to stop editing";
 localizedStrings["Pressed"] = "Pressed";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js (253164 => 253165)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js	2019-12-05 20:23:32 UTC (rev 253164)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SearchSidebarPanel.js	2019-12-05 20:33:09 UTC (rev 253165)
@@ -61,6 +61,22 @@
 
     // Public
 
+    showDefaultContentView()
+    {
+        let contentView = new WI.ContentView;
+
+        let contentPlaceholder = WI.createMessageTextView(this._searchQuerySetting.value ? WI.UIString("No search results") : WI.UIString("No search string"));
+        contentView.element.appendChild(contentPlaceholder);
+
+        let searchNavigationItem = new WI.ButtonNavigationItem("search", WI.UIString("Search Resource Content"), "Images/Search.svg", 15, 15);
+        searchNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._handleDefaultContentViewSearchNavigationItemClicked, this);
+
+        let importHelpElement = WI.createNavigationItemHelp(WI.UIString("Press %s to see recent searches"), searchNavigationItem);
+        contentPlaceholder.appendChild(importHelpElement);
+
+        this.contentBrowser.showContentView(contentView);
+    }
+
     closed()
     {
         super.closed();
@@ -97,8 +113,10 @@
         if (this._changedBanner)
             this._changedBanner.remove();
 
-        if (!searchQuery.length)
+        if (!searchQuery.length) {
+            this.showDefaultContentView();
             return;
+        }
 
         let createSearchingPlaceholder = () => {
             let searchingPlaceholder = WI.createMessageTextView("");
@@ -133,8 +151,12 @@
 
             --promiseCount;
             console.assert(promiseCount >= 0);
-            if (promiseCount === 0)
+            if (promiseCount === 0) {
                 this.updateEmptyContentPlaceholder(WI.UIString("No Search Results"));
+
+                if (!this.contentTreeOutline.children.length)
+                    this.showDefaultContentView();
+            }
         };
 
         let isCaseSensitive = !!this._searchInputSettings.caseSensitive.value;
@@ -445,4 +467,9 @@
 
         this.element.appendChild(this._changedBanner);
     }
+
+    _handleDefaultContentViewSearchNavigationItemClicked(event)
+    {
+        this.focusSearchField();
+    }
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to