2017-04-22 14:47:27 -07:00
|
|
|
import Ember from 'ember';
|
|
|
|
import connect from 'ember-redux/components/connect';
|
|
|
|
|
|
|
|
const { Component } = Ember;
|
2017-04-27 12:23:45 -07:00
|
|
|
const entities = ['datasets', 'metrics', 'flows']; // hardcoded here to maintain the sort order
|
2017-04-22 14:47:27 -07:00
|
|
|
/**
|
|
|
|
* Selector function that takes a Redux Store to extract
|
|
|
|
* state props for the browser-view
|
|
|
|
* @param {Object} browseData
|
|
|
|
* @return {Object}
|
|
|
|
*/
|
2017-04-27 11:49:31 -07:00
|
|
|
const stateToComputed = ({ browse: { browseData = {} } = {} }) => ({
|
2017-04-27 12:23:45 -07:00
|
|
|
browseData: entities.map(browseDatum =>
|
|
|
|
Object.assign(
|
|
|
|
{ entity: browseDatum }, // assigns key name to resulting object
|
|
|
|
browseData[browseDatum]
|
2017-04-27 11:49:31 -07:00
|
|
|
)
|
2017-04-27 12:23:45 -07:00
|
|
|
)
|
2017-04-27 11:49:31 -07:00
|
|
|
});
|
2017-04-22 14:47:27 -07:00
|
|
|
export default connect(stateToComputed)(Component.extend({}));
|