context = window JamBlasterActions = @JamBlasterActions @JamBlasterTrackConfig = React.createClass({ mixins: [@ICheckMixin, @BonjourMixin, Reflux.listenTo(@AppStore, "onAppInit"), Reflux.listenTo(@JamBlasterStore, "onJamBlasterChanged")] beforeShow: () -> onAppInit: (@app) -> onJamBlasterChanged: (jamblasterState) -> @setState(jamblasterState) componentDidMount: () -> @checkboxes = [ {selector: 'input.track1Active', stateKey: 'track1Active'}, {selector: 'input.track2Active', stateKey: 'track2Active'}, {selector: 'input.micActive', stateKey: 'micActive'}, {selector: 'input.track1Phantom', stateKey: 'track1Phantom'}, {selector: 'input.track2Phantom', stateKey: 'track2Phantom'}, {selector: 'input.inputTypeTrack1', stateKey: 'inputTypeTrack1'}, {selector: 'input.inputTypeTrack2', stateKey: 'inputTypeTrack2'}, {selector: 'input.combined', stateKey: 'combined'}] @root = $(@getDOMNode()) @iCheckify() componentWillUpdate: (nextProp, nextState) -> pairedJamBlaster = nextState.pairedJamBlaster if pairedJamBlaster? nextState.combined = pairedJamBlaster.tracks?.combined nextState.track1Active = pairedJamBlaster.tracks?.track1Active nextState.track2Active = pairedJamBlaster.tracks?.track2Active nextState.inputTypeTrack1 = pairedJamBlaster.tracks?.inputTypeTrack1 nextState.inputTypeTrack2 = pairedJamBlaster.tracks?.inputTypeTrack2 nextState.track1Phantom = pairedJamBlaster.tracks?.track1Phantom nextState.track2Phantom = pairedJamBlaster.tracks?.track2Phantom nextState.micActive = pairedJamBlaster.tracks?.micActive nextState.track1Instrument = context.JK.convertClientInstrumentToServer(pairedJamBlaster.tracks?.track1Instrument) nextState.track2Instrument = context.JK.convertClientInstrumentToServer(pairedJamBlaster.tracks?.track2Instrument) componentDidUpdate: () -> @iCheckify() checkboxChanged: (e) -> checked = $(e.target).is(':checked') value = $(e.target).val() name = $(e.target).attr('name') console.log("checkbox changed: ", checked, value) if $(e.target).attr('type') == 'checkbox' state = {} state[name] = checked @setState(state) JamBlasterActions.updateAudio(name, checked) else state = {} value = value == 'line' state[name] = value @setState(state) JamBlasterActions.updateAudio(name, value) instrumentChanged: (key, e) -> value = $(e.target).val() state = {} state[key] = value @setState(state) JamBlasterActions.updateAudio(key, value) getInitialState: () -> { allJamBlasters: [], userJamBlasters: [], localJamBlasters: [] } convertToClientInstrument: (instrumentId) -> clientInstrumentId = null if instrumentId != null && instrumentId != '' clientInstrumentId = context.JK.instrument_id_to_instrument[instrumentId].client_id else clientInstrumentId = 10 clientInstrumentId render: () -> pairedJamBlaster = this.state.pairedJamBlaster hasPairedJamBlaster = pairedJamBlaster? masterDisabled = this.props.disabled if !hasPairedJamBlaster return `
Please wait as the JamBlaster reconfigures it's settings.