-
Notifications
You must be signed in to change notification settings - Fork 484
Expand file tree
/
Copy pathNetworkSettings.tsx
More file actions
61 lines (51 loc) · 1.89 KB
/
Copy pathNetworkSettings.tsx
File metadata and controls
61 lines (51 loc) · 1.89 KB
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
/* 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/. */
import { PureComponent } from 'react';
import { Localized } from '@fluent/react';
import explicitConnect from 'firefox-profiler/utils/connect';
import { changeNetworkSearchString } from 'firefox-profiler/actions/profile-view';
import { getNetworkSearchString } from 'firefox-profiler/selectors/url-state';
import { PanelSearch } from './PanelSearch';
import type { ConnectedProps } from 'firefox-profiler/utils/connect';
import './NetworkSettings.css';
type StateProps = {
readonly searchString: string;
};
type DispatchProps = {
readonly changeNetworkSearchString: typeof changeNetworkSearchString;
};
type Props = ConnectedProps<{}, StateProps, DispatchProps>;
class NetworkSettingsImpl extends PureComponent<Props> {
_onSearch = (value: string) => {
this.props.changeNetworkSearchString(value);
};
override render() {
const { searchString } = this.props;
return (
<div className="networkSettings">
<div className="networkSettingsSpacer" />
<Localized
id="NetworkSettings--panel-search"
attrs={{ label: true, title: true }}
>
<PanelSearch
className="networkSettingsSearchField"
label="Filter Networks:"
title="Only display network requests that match a certain name"
currentSearchString={searchString}
onSearch={this._onSearch}
alsoFocusOnF={true}
/>
</Localized>
</div>
);
}
}
export const NetworkSettings = explicitConnect<{}, StateProps, DispatchProps>({
mapStateToProps: (state) => ({
searchString: getNetworkSearchString(state),
}),
mapDispatchToProps: { changeNetworkSearchString },
component: NetworkSettingsImpl,
});