Skip to content

Commit

Permalink
Merge mozilla-central to autoland
Browse files Browse the repository at this point in the history
  • Loading branch information
IrisHsiao committed May 12, 2017
2 parents 74b74d5 + 140ea4f commit 3aadf0e
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 263 deletions.
3 changes: 1 addition & 2 deletions devtools/client/netmonitor/src/components/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const {
} = require("devtools/client/shared/vendor/react");
const { connect } = require("devtools/client/shared/vendor/react-redux");
const Actions = require("../actions/index");
const { FILTER_SEARCH_DELAY, FILTER_FLAGS } = require("../constants");
const { FILTER_SEARCH_DELAY } = require("../constants");
const {
getDisplayedRequestsSummary,
getRequestFilterTypes,
Expand Down Expand Up @@ -109,7 +109,6 @@ const Toolbar = createClass({
placeholder: SEARCH_PLACE_HOLDER,
type: "filter",
onChange: setRequestFilterText,
autocompleteList: FILTER_FLAGS.map((item) => `${item}:`),
}),
button({
className: toggleButtonClassName.join(" "),
Expand Down
14 changes: 0 additions & 14 deletions devtools/client/netmonitor/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,6 @@ const HEADERS = [
}
];

const HEADER_FILTERS = HEADERS
.filter(h => h.canFilter)
.map(h => h.filterKey || h.name);

const FILTER_FLAGS = [
...HEADER_FILTERS,
"mime-type",
"larger-than",
"is",
"has-response-header",
"regexp",
];

const REQUESTS_WATERFALL = {
BACKGROUND_TICKS_MULTIPLE: 5, // ms
BACKGROUND_TICKS_SCALES: 3,
Expand All @@ -193,7 +180,6 @@ const general = {
EVENTS,
FILTER_SEARCH_DELAY: 200,
HEADERS,
FILTER_FLAGS,
SOURCE_EDITOR_SYNTAX_HIGHLIGHT_MAX_SIZE: 51200, // 50 KB in bytes
REQUESTS_WATERFALL,
};
Expand Down
17 changes: 16 additions & 1 deletion devtools/client/netmonitor/src/utils/filter-text-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,23 @@

"use strict";

const { FILTER_FLAGS } = require("../constants");
const { HEADERS } = require("../constants");
const { getFormattedIPAndPort } = require("./format-utils");
const HEADER_FILTERS = HEADERS
.filter(h => h.canFilter)
.map(h => h.filterKey || h.name);

const FILTER_FLAGS = [
...HEADER_FILTERS,
"set-cookie-domain",
"set-cookie-name",
"set-cookie-value",
"mime-type",
"larger-than",
"is",
"has-response-header",
"regexp",
];

/*
The function `parseFilters` is from:
Expand Down
1 change: 0 additions & 1 deletion devtools/client/netmonitor/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ let webpackConfig = {
"devtools/client/framework/menu": "devtools-modules/src/menu",
"devtools/client/framework/menu-item": path.join(__dirname, "../../client/framework/menu-item"),
"devtools/client/locales": path.join(__dirname, "../../client/locales/en-US"),
"devtools/client/shared/components/autocomplete-popup": path.join(__dirname, "../../client/shared/components/autocomplete-popup"),
"devtools/client/shared/components/reps/reps": path.join(__dirname, "../../client/shared/components/reps/reps"),
"devtools/client/shared/components/search-box": path.join(__dirname, "../../client/shared/components/search-box"),
"devtools/client/shared/components/splitter/draggable": path.join(__dirname, "../../client/shared/components/splitter/draggable"),
Expand Down
122 changes: 0 additions & 122 deletions devtools/client/shared/components/autocomplete-popup.js

This file was deleted.

1 change: 0 additions & 1 deletion devtools/client/shared/components/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ DIRS += [
]

DevToolsModules(
'autocomplete-popup.js',
'frame.js',
'h-split-box.js',
'notification-box.css',
Expand Down
87 changes: 6 additions & 81 deletions devtools/client/shared/components/search-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

"use strict";

const { DOM: dom, createClass, PropTypes, createFactory } = require("devtools/client/shared/vendor/react");
const { DOM: dom, createClass, PropTypes } = require("devtools/client/shared/vendor/react");
const KeyShortcuts = require("devtools/client/shared/key-shortcuts");
const AutocompletePopup = createFactory(require("devtools/client/shared/components/autocomplete-popup"));

/**
* A generic search box component for use across devtools
Expand All @@ -21,20 +20,12 @@ module.exports = createClass({
keyShortcut: PropTypes.string,
onChange: PropTypes.func,
placeholder: PropTypes.string,
type: PropTypes.string,
autocompleteList: PropTypes.array,
},

getDefaultProps() {
return {
autocompleteList: [],
};
type: PropTypes.string
},

getInitialState() {
return {
value: "",
focused: false,
value: ""
};
},

Expand Down Expand Up @@ -65,9 +56,7 @@ module.exports = createClass({

onChange() {
if (this.state.value !== this.refs.input.value) {
this.setState({
value: this.refs.input.value,
});
this.setState({ value: this.refs.input.value });
}

if (!this.props.delay) {
Expand All @@ -93,59 +82,8 @@ module.exports = createClass({
this.onChange();
},

onFocus() {
this.setState({ focused: true });
},

onBlur() {
this.setState({ focused: false });
},

onKeyDown(e) {
let { autocompleteList } = this.props;
let { autocomplete } = this.refs;

if (autocompleteList.length == 0) {
return;
}

switch (e.key) {
case "ArrowDown":
autocomplete.jumpBy(1);
break;
case "ArrowUp":
autocomplete.jumpBy(-1);
break;
case "PageDown":
autocomplete.jumpBy(5);
break;
case "PageUp":
autocomplete.jumpBy(-5);
break;
case "Enter":
case "Tab":
e.preventDefault();
autocomplete.select();
break;
case "Escape":
e.preventDefault();
this.onBlur();
break;
case "Home":
autocomplete.jumpToTop();
break;
case "End":
autocomplete.jumpToBottom();
break;
}
},

render() {
let {
type = "search",
placeholder,
autocompleteList
} = this.props;
let { type = "search", placeholder } = this.props;
let { value } = this.state;
let divClassList = ["devtools-searchbox", "has-clear-btn"];
let inputClassList = [`devtools-${type}input`];
Expand All @@ -158,27 +96,14 @@ module.exports = createClass({
dom.input({
className: inputClassList.join(" "),
onChange: this.onChange,
onFocus: this.onFocus,
onBlur: this.onBlur,
onKeyDown: this.onKeyDown,
placeholder,
ref: "input",
value,
value
}),
dom.button({
className: "devtools-searchinput-clear",
hidden: value == "",
onClick: this.onClearButtonClick
}),
autocompleteList.length > 0 && this.state.focused &&
AutocompletePopup({
list: autocompleteList,
filter: value,
ref: "autocomplete",
onItemSelected: (itemValue) => {
this.setState({ value: itemValue });
this.onChange();
}
})
);
}
Expand Down
Loading

0 comments on commit 3aadf0e

Please sign in to comment.