import { Query } from 'react-apollo' import Gallery from './Gallery' import Port from './Port' import Connection from './Connection' import InterfaceOption from './InterfaceOption' import { INTERFACES } from './InterfaceList' const InterfaceFormFields = props => { const { state, onChange } = props const toState = event => { let interfaces = state const ifaceSelected = event.target.checked const index = state.findIndex(iface => iface === event.target.value) if (ifaceSelected && index < 0) { interfaces = [...state, event.target.value] } if (!ifaceSelected && index >= 0) { interfaces = [...state.slice(0, index), ...state.slice(index + 1)] } onChange(interfaces) } return ( {({ data, loading, error }) => { if (loading) return

Loading interfaces

if (error) return

Error loading interfaces: {error.message}

const { interfaces } = data if (!interfaces.length) return

No interfaces found

return (
{interfaces.map(iface => ( ))}
) }}
) } const Interface = props => { const { workerScript, interfaceName, options, ports, connections } = props.data return (

{interfaceName}

Script:

{workerScript.path}

( ))} /> ( ))} /> ( ))} />
) } export default Interface export { InterfaceFormFields }