<commit_before>/*
 * This file is part of Cockpit.
 *
 * Copyright (C) 2017 Red Hat, Inc.
 *
 * Cockpit is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * Cockpit is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
 */

var React = require("react");

var cockpit = require("cockpit");
var _ = cockpit.gettext;

var listingPattern = require("cockpit-components-listing.jsx");
var Listing = listingPattern.Listing;
var ListingRow = listingPattern.ListingRow;

/* Dialog body to show active Cockpit pages
 * Props:
 *  - iframes          iframe elements on page to list
 *  - selectionChanged callback when the select state changed, parameters: frame object, new value
 */
class ActivePagesDialogBody extends React.Component {
    render() {
        var self = this;
        var frames = self.props.iframes.map(function(frame) {
            var badge;
            if (frame.visible)
                badge = <span className="badge pull-right">{_("active")}</span>;
            var columns = [
                { name: frame.displayName, header: frame.visible },
                badge,
            ];
            var selectCallback;
            if (self.props.selectionChanged)
                selectCallback = self.props.selectionChanged.bind(self, frame);
            return (
                <ListingRow columns={columns}
                    rowId={frame.name}
                    selected={frame.selected}
                    selectChanged={selectCallback}
                />
            );
        });<commit_msg>shell: Add missing "key" props<commit_after>/*
 * This file is part of Cockpit.
 *
 * Copyright (C) 2017 Red Hat, Inc.
 *
 * Cockpit is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * Cockpit is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
 */

var React = require("react");

var cockpit = require("cockpit");
var _ = cockpit.gettext;

var listingPattern = require("cockpit-components-listing.jsx");
var Listing = listingPattern.Listing;
var ListingRow = listingPattern.ListingRow;

/* Dialog body to show active Cockpit pages
 * Props:
 *  - iframes          iframe elements on page to list
 *  - selectionChanged callback when the select state changed, parameters: frame object, new value
 */
class ActivePagesDialogBody extends React.Component {
    render() {
        var self = this;
        var frames = self.props.iframes.map(function(frame) {
            var badge;
            if (frame.visible)
                badge = <span className="badge pull-right">{_("active")}</span>;
            var columns = [
                { name: frame.displayName, header: frame.visible },
                badge,
            ];
            var selectCallback;
            if (self.props.selectionChanged)
                selectCallback = self.props.selectionChanged.bind(self, frame);
            return (
                <ListingRow key={frame.name} columns={columns}
                    rowId={frame.name}
                    selected={frame.selected}
                    selectChanged={selectCallback}
                />
            );
        });
{'fraction_non_alphanumeric': 0.08912093249150073, 'fraction_numerical': 0.0029140359397765905, 'mean_word_length': 2.412593206296603, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4605558', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1019, 'n_words': 395}