import LogGroups from '../components/LogGroups' ; import * as actions from '../actions/' ; import { StoreState } from '../types' ; import { connect , Dispatch } from 'react-redux' ; import { LogGroup , LogStream , Settings } from '../common-interfaces' ; import { connectCloudWatchLogs , getCloudWatchLogGroups , getCloudWatchLogStreams } from '../side-effect-functions' ; export function mapStateToProps ( { logGroups , settings } ) { return { logGroups : logGroups . logGroups , selectedName : logGroups . selectedName , lastModified : logGroups . lastModified , settings : settings . settings , } ; } export function mapDispatchToProps ( dispatch ) { return { FetchLogGroups : ( settings ) => dispatch ( actions . fetchLogGroups ( settings , ( callbackStart , callbackError , callbackEnd ) => getCloudWatchLogGroups ( connectCloudWatchLogs ( settings ) , callbackStart , callbackError , callbackEnd ) ) ) , SelectLogGroup : ( selectedName ) => dispatch ( actions . selectLogGroup ( selectedName ) ) , FetchLogStreams : ( settings , logGroupName ) => dispatch ( actions . fetchLogStreams ( settings , logGroupName , ( callbackStart , callbackError , callbackEnd ) => getCloudWatchLogStreams ( connectCloudWatchLogs ( settings ) , logGroupName , callbackStart , callbackError , callbackEnd ) ) ) , } ; } export default connect ( mapStateToProps , mapDispatchToProps ) ( LogGroups as any ) ;