Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
feat(addon): #775 Get Search working in Activity Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
sarracini committed Jun 8, 2016
1 parent 57e3a72 commit 2454af2
Show file tree
Hide file tree
Showing 15 changed files with 1,204 additions and 153 deletions.
45 changes: 42 additions & 3 deletions common/action-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const am = new ActionManager([
"TOP_FRECENT_SITES_REQUEST",
"TOP_FRECENT_SITES_RESPONSE",
"RECEIVE_PLACES_CHANGES",
"RECEIVE_CURRENT_ENGINE",
"RECENT_BOOKMARKS_REQUEST",
"RECENT_BOOKMARKS_RESPONSE",
"RECEIVE_BOOKMARKS_CHANGES",
Expand All @@ -23,13 +24,21 @@ const am = new ActionManager([
"NOTIFY_HISTORY_DELETE",
"NOTIFY_HISTORY_DELETE_CANCELLED",
"NOTIFY_PERFORM_SEARCH",
"RECEIVE_CURRENT_ENGINE",
"SEARCH_STATE_REQUEST",
"SEARCH_STATE_RESPONSE",
"SEARCH_UISTRINGS_REQUEST",
"SEARCH_UISTRINGS_RESPONSE",
"SEARCH_SUGGESTIONS_REQUEST",
"SEARCH_SUGGESTIONS_RESPONSE",
"SEARCH_CYCLE_CURRENT_ENGINE_REQUEST",
"SEARCH_CYCLE_CURRENT_ENGINE_RESPONSE",
"NOTIFY_REMOVE_FORM_HISTORY_ENTRY",
"NOTIFY_MANAGE_ENGINES",
"NOTIFY_ROUTE_CHANGE",
"NOTIFY_PERFORMANCE",
"NOTIFY_USER_EVENT",
"NOTIFY_OPEN_WINDOW"
"NOTIFY_OPEN_WINDOW",
"NOTIFY_UPDATE_SEARCH_STRING"
]);

// This is a a set of actions that have sites in them,
Expand Down Expand Up @@ -116,6 +125,30 @@ function RequestSearchState() {
return RequestExpect("SEARCH_STATE_REQUEST", "SEARCH_STATE_RESPONSE");
}

function RequestSearchStrings() {
return RequestExpect("SEARCH_UISTRINGS_REQUEST", "SEARCH_UISTRINGS_RESPONSE");
}

function RequestSearchSuggestions(data) {
return RequestExpect("SEARCH_SUGGESTIONS_REQUEST", "SEARCH_SUGGESTIONS_RESPONSE", {data});
}

function NotifyRemoveFormHistory(data) {
return Notify("NOTIFY_REMOVE_FORM_HISTORY_ENTRY", data);
}

function NotifyCycleEngine(data) {
return Notify("SEARCH_CYCLE_CURRENT_ENGINE_REQUEST", data);
}

function NotifyManageEngines() {
return Notify("NOTIFY_MANAGE_ENGINES");
}

function NotifyUpdateSearchString(searchString) {
return Notify("NOTIFY_UPDATE_SEARCH_STRING", {searchString});
}

function RequestExperiments() {
return RequestExpect("EXPERIMENTS_REQUEST", "EXPERIMENTS_RESPONSE");
}
Expand Down Expand Up @@ -188,6 +221,8 @@ am.defineActions({
RequestMoreRecentLinks,
RequestHighlightsLinks,
RequestSearchState,
RequestSearchStrings,
RequestSearchSuggestions,
RequestExperiments,
NotifyBlockURL,
NotifyUnblockURL,
Expand All @@ -199,7 +234,11 @@ am.defineActions({
NotifyRouteChange,
NotifyPerf,
NotifyEvent,
NotifyOpenWindow
NotifyOpenWindow,
NotifyUpdateSearchString,
NotifyManageEngines,
NotifyRemoveFormHistory,
NotifyCycleEngine
});

module.exports = am;
2 changes: 2 additions & 0 deletions content-src/components/Base/Base.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const Base = React.createClass({

this.props.dispatch(actions.RequestSearchState());

this.props.dispatch(actions.RequestSearchStrings());

this.props.dispatch(actions.RequestExperiments());

this.props.dispatch(actions.NotifyPerf("BASE_MOUNTED"));
Expand Down
9 changes: 1 addition & 8 deletions content-src/components/NewTabPage/NewTabPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ const MAX_TOP_ACTIVITY_ITEMS = 10;
const PAGE_NAME = "NEW_TAB";

const NewTabPage = React.createClass({
onSearch(value) {
this.props.dispatch(actions.NotifyPerformSearch(value));
this.props.dispatch(actions.NotifyEvent({
event: "SEARCH",
page: PAGE_NAME
}));
},
getInitialState() {
return {
showSettingsMenu: false
Expand All @@ -48,7 +41,7 @@ const NewTabPage = React.createClass({
return (<main className="new-tab">
<div className="new-tab-wrapper">
<section>
<Search onSearch={this.onSearch} />
<Search/>
</section>

<Loader
Expand Down
Loading

0 comments on commit 2454af2

Please sign in to comment.