forked from mirrors/gecko-dev
MozReview-Commit-ID: GtAe9ggiCeA --HG-- rename : devtools/client/netmonitor/filter-predicates.js => devtools/client/netmonitor/utils/filter-predicates.js rename : devtools/client/netmonitor/l10n.js => devtools/client/netmonitor/utils/l10n.js rename : devtools/client/netmonitor/prefs.js => devtools/client/netmonitor/utils/prefs.js rename : devtools/client/netmonitor/request-utils.js => devtools/client/netmonitor/utils/request-utils.js rename : devtools/client/netmonitor/sort-predicates.js => devtools/client/netmonitor/utils/sort-predicates.js extra : rebase_source : a543be5c81e3552f831c1c26107d5109fc90fc96
126 lines
3.6 KiB
JavaScript
126 lines
3.6 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 {
|
|
createFactory,
|
|
PropTypes,
|
|
} = require("devtools/client/shared/vendor/react");
|
|
const { connect } = require("devtools/client/shared/vendor/react-redux");
|
|
const Actions = require("../../actions/index");
|
|
const { Filters } = require("../../utils/filter-predicates");
|
|
const { L10N } = require("../../utils/l10n");
|
|
const { getSelectedRequest } = require("../../selectors/index");
|
|
|
|
// Components
|
|
const Tabbar = createFactory(require("devtools/client/shared/components/tabs/tabbar"));
|
|
const TabPanel = createFactory(require("devtools/client/shared/components/tabs/tabs").TabPanel);
|
|
const CookiesPanel = createFactory(require("./cookies-panel"));
|
|
const HeadersPanel = createFactory(require("./headers-panel"));
|
|
const ParamsPanel = createFactory(require("./params-panel"));
|
|
const PreviewPanel = createFactory(require("./preview-panel"));
|
|
const ResponsePanel = createFactory(require("./response-panel"));
|
|
const SecurityPanel = createFactory(require("./security-panel"));
|
|
const TimingsPanel = createFactory(require("./timings-panel"));
|
|
|
|
const HEADERS_TITLE = L10N.getStr("netmonitor.tab.headers");
|
|
const COOKIES_TITLE = L10N.getStr("netmonitor.tab.cookies");
|
|
const PARAMS_TITLE = L10N.getStr("netmonitor.tab.params");
|
|
const RESPONSE_TITLE = L10N.getStr("netmonitor.tab.response");
|
|
const TIMINGS_TITLE = L10N.getStr("netmonitor.tab.timings");
|
|
const SECURITY_TITLE = L10N.getStr("netmonitor.tab.security");
|
|
const PREVIEW_TITLE = L10N.getStr("netmonitor.tab.preview");
|
|
|
|
/*
|
|
* Tabbox panel component
|
|
* Display the network request details
|
|
*/
|
|
function TabboxPanel({
|
|
activeTabId,
|
|
cloneSelectedRequest,
|
|
request,
|
|
selectTab,
|
|
toolbox,
|
|
}) {
|
|
if (!request) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
Tabbar({
|
|
activeTabId,
|
|
onSelect: selectTab,
|
|
renderOnlySelected: true,
|
|
showAllTabsMenu: true,
|
|
toolbox,
|
|
},
|
|
TabPanel({
|
|
id: "headers",
|
|
title: HEADERS_TITLE,
|
|
},
|
|
HeadersPanel({ request, cloneSelectedRequest }),
|
|
),
|
|
TabPanel({
|
|
id: "cookies",
|
|
title: COOKIES_TITLE,
|
|
},
|
|
CookiesPanel({ request }),
|
|
),
|
|
TabPanel({
|
|
id: "params",
|
|
title: PARAMS_TITLE,
|
|
},
|
|
ParamsPanel({ request }),
|
|
),
|
|
TabPanel({
|
|
id: "response",
|
|
title: RESPONSE_TITLE,
|
|
},
|
|
ResponsePanel({ request }),
|
|
),
|
|
TabPanel({
|
|
id: "timings",
|
|
title: TIMINGS_TITLE,
|
|
},
|
|
TimingsPanel({ request }),
|
|
),
|
|
request.securityState && request.securityState !== "insecure" &&
|
|
TabPanel({
|
|
id: "security",
|
|
title: SECURITY_TITLE,
|
|
},
|
|
SecurityPanel({ request }),
|
|
),
|
|
Filters.html(request) &&
|
|
TabPanel({
|
|
id: "preview",
|
|
title: PREVIEW_TITLE,
|
|
},
|
|
PreviewPanel({ request }),
|
|
),
|
|
)
|
|
);
|
|
}
|
|
|
|
TabboxPanel.displayName = "TabboxPanel";
|
|
|
|
TabboxPanel.propTypes = {
|
|
activeTabId: PropTypes.string,
|
|
cloneSelectedRequest: PropTypes.func.isRequired,
|
|
request: PropTypes.object,
|
|
selectTab: PropTypes.func.isRequired,
|
|
toolbox: PropTypes.object.isRequired,
|
|
};
|
|
|
|
module.exports = connect(
|
|
(state) => ({
|
|
activeTabId: state.ui.detailsPanelSelectedTab,
|
|
request: getSelectedRequest(state),
|
|
}),
|
|
(dispatch) => ({
|
|
cloneSelectedRequest: () => dispatch(Actions.cloneSelectedRequest()),
|
|
selectTab: (tabId) => dispatch(Actions.selectDetailsPanelTab(tabId)),
|
|
}),
|
|
)(TabboxPanel);
|