Bug 1427997 - make aboutdebugging TargetList title optional;r=ochameau draft
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 05 Jan 2018 17:20:38 +0100
changeset 716377 f27e519f49c854af650849d9018e249eaecaaecb
parent 716376 5987554e6f682e2dab7c7a56e51ba5c3f4153cdf
child 745020 823f272c62cbf7dfc9f0f0882f45c601e4889adc
push id94417
push userjdescottes@mozilla.com
push dateFri, 05 Jan 2018 16:23:46 +0000
reviewersochameau
bugs1427997
milestone59.0a1
Bug 1427997 - make aboutdebugging TargetList title optional;r=ochameau MozReview-Commit-ID: IMA9Sf4dagn
devtools/client/aboutdebugging/components/TargetList.js
devtools/client/aboutdebugging/components/tabs/Panel.js
--- a/devtools/client/aboutdebugging/components/TargetList.js
+++ b/devtools/client/aboutdebugging/components/TargetList.js
@@ -22,29 +22,31 @@ const LocaleCompare = (a, b) => {
 class TargetList extends Component {
   static get propTypes() {
     return {
       client: PropTypes.instanceOf(DebuggerClient).isRequired,
       connect: PropTypes.object,
       debugDisabled: PropTypes.bool,
       error: PropTypes.node,
       id: PropTypes.string.isRequired,
+      // If a name is specified it will be displayed as a header before the target-list.
       name: PropTypes.string,
       sort: PropTypes.bool,
       targetClass: PropTypes.func.isRequired,
       targets: PropTypes.arrayOf(PropTypes.object).isRequired
     };
   }
 
   render() {
     let {
       client,
       connect,
       debugDisabled,
       error,
+      name,
       targetClass,
       targets,
       sort
     } = this.props;
 
     if (sort) {
       targets = targets.sort(LocaleCompare);
     }
@@ -56,14 +58,17 @@ class TargetList extends Component {
     if (error) {
       content = error;
     } else if (targets.length > 0) {
       content = dom.ul({ className: "target-list" }, targets);
     } else {
       content = dom.p(null, Strings.GetStringFromName("nothing"));
     }
 
-    return dom.div({ id: this.props.id, className: "targets" },
-      dom.h2(null, this.props.name), content);
+    return dom.div(
+            { id: this.props.id, className: "targets" },
+            name ? dom.h2(null, name) : null,
+            content
+           );
   }
 }
 
 module.exports = TargetList;
--- a/devtools/client/aboutdebugging/components/tabs/Panel.js
+++ b/devtools/client/aboutdebugging/components/tabs/Panel.js
@@ -90,17 +90,16 @@ class TabsPanel extends Component {
       id: id + "-header",
       name: Strings.GetStringFromName("tabs")
     }),
     dom.div({},
       TargetList({
         client,
         connect,
         id: "tabs",
-        name: Strings.GetStringFromName("tabs"),
         sort: false,
         targetClass: TabTarget,
         targets: tabs
       })
     ));
   }
 }