1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/* 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,
} = require("resource://devtools/client/shared/vendor/react.js");
const PropTypes = require("resource://devtools/client/shared/vendor/react-prop-types.js");
const dom = require("resource://devtools/client/shared/vendor/react-dom-factories.js");
const {
connect,
} = require("resource://devtools/client/shared/redux/visibility-handler-connect.js");
const Actions = require("resource://devtools/client/netmonitor/src/actions/index.js");
const {
getSelectedRequest,
} = require("resource://devtools/client/netmonitor/src/selectors/index.js");
// Components
loader.lazyGetter(this, "CustomRequestPanel", function () {
return createFactory(
require("resource://devtools/client/netmonitor/src/components/CustomRequestPanel.js")
);
});
loader.lazyGetter(this, "TabboxPanel", function () {
return createFactory(
require("resource://devtools/client/netmonitor/src/components/TabboxPanel.js")
);
});
const { div } = dom;
/**
* Network details panel component
*/
function NetworkDetailsBar({
connector,
activeTabId,
cloneSelectedRequest,
request,
selectTab,
sourceMapURLService,
toggleNetworkDetails,
openNetworkDetails,
openLink,
targetSearchResult,
}) {
if (!request) {
return null;
}
const newEditAndResendPref = Services.prefs.getBoolPref(
"devtools.netmonitor.features.newEditAndResend"
);
return div(
{ className: "network-details-bar" },
request.isCustom && !newEditAndResendPref
? CustomRequestPanel({
connector,
request,
})
: TabboxPanel({
activeTabId,
cloneSelectedRequest,
connector,
openLink,
request,
selectTab,
sourceMapURLService,
toggleNetworkDetails,
openNetworkDetails,
targetSearchResult,
})
);
}
NetworkDetailsBar.displayName = "NetworkDetailsBar";
NetworkDetailsBar.propTypes = {
connector: PropTypes.object.isRequired,
activeTabId: PropTypes.string,
cloneSelectedRequest: PropTypes.func.isRequired,
open: PropTypes.bool,
request: PropTypes.object,
selectTab: PropTypes.func.isRequired,
sourceMapURLService: PropTypes.object,
toggleNetworkDetails: PropTypes.func.isRequired,
openLink: PropTypes.func,
targetSearchResult: PropTypes.object,
};
module.exports = connect(
state => ({
activeTabId: state.ui.detailsPanelSelectedTab,
request: getSelectedRequest(state),
targetSearchResult: state.search.targetSearchResult,
}),
dispatch => ({
cloneSelectedRequest: () => dispatch(Actions.cloneSelectedRequest()),
selectTab: tabId => dispatch(Actions.selectDetailsPanelTab(tabId)),
toggleNetworkDetails: () => dispatch(Actions.toggleNetworkDetails()),
openNetworkDetails: open => dispatch(Actions.openNetworkDetails(open)),
})
)(NetworkDetailsBar);
|