gecko-dev/devtools/client/aboutdebugging/components/target-list.js
Jan Keromnes b28f45e73c Bug 1257873 - Split Addons and Workers into separate Target classes in about:debugging. r=ochameau
--HG--
rename : devtools/client/aboutdebugging/components/target.js => devtools/client/aboutdebugging/components/worker-target.js
extra : histedit_source : 491a2f2466fca9d0a2a208264cee679ff1b57577
2016-03-18 09:08:00 -04:00

35 lines
1.0 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { createClass, DOM: dom } =
require("devtools/client/shared/vendor/react");
const Services = require("Services");
const Strings = Services.strings.createBundle(
"chrome://devtools/locale/aboutdebugging.properties");
const LocaleCompare = (a, b) => {
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
};
module.exports = createClass({
displayName: "TargetList",
render() {
let { client, debugDisabled, targetClass } = this.props;
let targets = this.props.targets.sort(LocaleCompare).map(target => {
return targetClass({ client, target, debugDisabled });
});
return dom.div({ id: this.props.id, className: "targets" },
dom.h4(null, this.props.name),
targets.length > 0 ?
targets :
dom.p(null, Strings.GetStringFromName("nothing"))
);
},
});