import { TOGGLE_FILTER } from '../constants/action-types'

const initialState = {
  'PingPong' : {
    operations: ['ping','pong'],
    enabled: false
  },
  'Subscriptions' : {
    operations: ['sub','unsub','nosub','ready'],
    enabled: true
  },
  'Collections' : {
    operations: ['added','removed', 'changed'],
    enabled: true
  },
  'Methods' : {
    operations: ['method','result', 'updated'],
    enabled: true
  },
  'Connect' : {
    operations: ['connect'],
    enabled: false
  }
};

export default function traces(state = initialState, action){
  switch(action.type){
    case TOGGLE_FILTER:
      return Object.assign({}, state, {
        [action.filter] : Object.assign({}, state[action.filter], {
          enabled : !state[action.filter].enabled
        })
      })
    default:
      return state
  }
}
@@ -298,17 +298,16 @@
 emoved',
- 
 'changed
@@ -384,17 +384,16 @@
 result',
- 
 'updated
@@ -461,16 +461,37 @@
 connect'
+,'connected','failed'
 %5D,%0A    e

add connected and failed ddp messages to connect filter