forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1411161 - Adds an initial react/redux template for loading an Eve…
…nts View in the inspector sidebar. r=pbro
- Loading branch information
1 parent
c50ffac
commit da3c839
Showing
15 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* 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 { createEnum } = require("devtools/client/shared/enum"); | ||
|
||
createEnum([ | ||
|
||
// Update the entire events state with the new list of events. | ||
"UPDATE_EVENTS", | ||
|
||
], module.exports); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- | ||
# vim: set filetype=python: | ||
# 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/. | ||
|
||
DevToolsModules( | ||
'index.js', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* 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 { | ||
DOM: dom, | ||
PureComponent, | ||
} = require("devtools/client/shared/vendor/react"); | ||
const { connect } = require("devtools/client/shared/vendor/react-redux"); | ||
|
||
class EventsApp extends PureComponent { | ||
static get propTypes() { | ||
return {}; | ||
} | ||
|
||
render() { | ||
return dom.div( | ||
{ | ||
id: "events-container", | ||
} | ||
); | ||
} | ||
} | ||
|
||
module.exports = connect(state => state)(EventsApp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- | ||
# vim: set filetype=python: | ||
# 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/. | ||
|
||
DevToolsModules( | ||
'EventsApp.js', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* 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, createElement } = require("devtools/client/shared/vendor/react"); | ||
const { Provider } = require("devtools/client/shared/vendor/react-redux"); | ||
|
||
const EventsApp = createFactory(require("./components/EventsApp")); | ||
|
||
const { LocalizationHelper } = require("devtools/shared/l10n"); | ||
const INSPECTOR_L10N = | ||
new LocalizationHelper("devtools/client/locales/inspector.properties"); | ||
|
||
class EventsView { | ||
|
||
constructor(inspector, window) { | ||
this.document = window.document; | ||
this.inspector = inspector; | ||
this.store = inspector.store; | ||
|
||
this.init(); | ||
} | ||
|
||
init() { | ||
if (!this.inspector) { | ||
return; | ||
} | ||
|
||
let eventsApp = EventsApp({}); | ||
|
||
let provider = createElement(Provider, { | ||
id: "eventsview", | ||
key: "eventsview", | ||
store: this.store, | ||
title: INSPECTOR_L10N.getStr("inspector.sidebar.eventsViewTitle") | ||
}, eventsApp); | ||
|
||
// Expose the provider to let inspector.js use it in setupSidebar. | ||
this.provider = provider; | ||
} | ||
|
||
destroy() { | ||
this.document = null; | ||
this.inspector = null; | ||
this.store = null; | ||
} | ||
|
||
} | ||
|
||
module.exports = EventsView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- | ||
# vim: set filetype=python: | ||
# 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/. | ||
|
||
DIRS += [ | ||
'actions', | ||
'components', | ||
'reducers', | ||
] | ||
|
||
DevToolsModules( | ||
'events.js', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* 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 INITIAL_EVENTS = []; | ||
|
||
let reducers = { | ||
|
||
}; | ||
|
||
module.exports = function (events = INITIAL_EVENTS, action) { | ||
let reducer = reducers[action.type]; | ||
if (!reducer) { | ||
return events; | ||
} | ||
return reducer(events, action); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* 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"; | ||
|
||
exports.events = require("./events"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- | ||
# vim: set filetype=python: | ||
# 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/. | ||
|
||
DevToolsModules( | ||
'events.js', | ||
'index.js', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ DIRS += [ | |
'changes', | ||
'components', | ||
'computed', | ||
'events', | ||
'extensions', | ||
'flexbox', | ||
'fonts', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters