-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove sensible data from frontend config #1
- Loading branch information
Showing
7 changed files
with
80 additions
and
18 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
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
var React = require('react'); | ||
var Mozaik = require('./core/components/Mozaik.jsx'); | ||
var React = require('react'); | ||
var Mozaik = require('./core/components/Mozaik.jsx'); | ||
var ConfigActions = require('./core/actions/ConfigActions'); | ||
|
||
require('./ext/collected'); | ||
|
||
var config = require('./../config'); | ||
|
||
React.render( | ||
<Mozaik config={config} />, | ||
<Mozaik />, | ||
document.getElementById('hotboard') | ||
); | ||
); | ||
|
||
ConfigActions.loadConfig(); |
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 @@ | ||
var Reflux = require('reflux'); | ||
|
||
var ConfigActions = Reflux.createActions([ | ||
'loadConfig' | ||
]); | ||
|
||
module.exports = ConfigActions; |
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 |
---|---|---|
@@ -1,10 +1,20 @@ | ||
var Reflux = require('reflux'); | ||
|
||
var HotBoardActions = Reflux.createActions([ | ||
var DashboardActions = Reflux.createActions([ | ||
'setDashboards', | ||
'previousDashboard', | ||
'nextDashboard', | ||
'startRotation' | ||
]); | ||
|
||
module.exports = HotBoardActions; | ||
DashboardActions.setDashboards.shouldEmit = function (dashboards) { | ||
// starts dashboard rotation if there is more | ||
// than one dashboard configured | ||
if (dashboards.length > 1) { | ||
DashboardActions.startRotation(); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
module.exports = DashboardActions; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var Reflux = require('reflux'); | ||
var ConfigActions = require('./../actions/ConfigActions'); | ||
var DashboardActions = require('./../actions/DashboardActions'); | ||
var request = require('superagent'); | ||
|
||
var ConfigStore = Reflux.createStore({ | ||
listenables: ConfigActions, | ||
|
||
loadConfig() { | ||
request.get('/config') | ||
.end((err, res) => { | ||
var config = res.body; | ||
|
||
this.trigger(res.body); | ||
|
||
DashboardActions.setDashboards(config.dashboards); | ||
}) | ||
; | ||
} | ||
}); | ||
|
||
module.exports = ConfigStore; |