Bug 1427997 - make aboutdebugging TargetList title optional;r=ochameau
MozReview-Commit-ID: IMA9Sf4dagn
--- 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
})
));
}
}