InstrumentSubsystem.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import gql from 'graphql-tag'
  2. import { Query, Mutation } from 'react-apollo'
  3. import Gallery from './Gallery'
  4. import InstrumentCommand from './InstrumentCommand'
  5. import InstrumentParameter from './InstrumentParameter'
  6. const InstrumentSubsystemFormFields = props => {
  7. const { state, onChange } = props
  8. return (
  9. <fieldset>
  10. <label htmlFor='name'>Name</label>
  11. <input type='text' name='name' id='name' placeholder='Name' value={state.name} onChange={onChange} />
  12. <label htmlFor='description'>Name</label>
  13. <textarea name='description' id='description' placeholder='Description' value={state.description} onChange={onChange} />
  14. </fieldset>
  15. )
  16. }
  17. const InstrumentSubsystem = props => {
  18. const { subsystem } = props
  19. return subsystem ? (
  20. <div>
  21. <h1>{subsystem.name}</h1>
  22. <p>{subsystem.description}</p>
  23. <Gallery title='Commands' items={subsystem.commands.map(command =>
  24. <InstrumentCommand command={command} />)} />
  25. <Gallery title='Parameters' items={subsystem.parameters.map(parameter =>
  26. <InstrumentParameter parameter={parameter} />)} />
  27. <Gallery title='Subsystems' items={subsystem.subsystems.map(childSubsystem =>
  28. <InstrumentSubsystem subsystem={childSubsystem} />)} />
  29. </div>
  30. ) : (
  31. <p>No data found.</p>
  32. )
  33. }
  34. export default InstrumentSubsystem
  35. export { InstrumentSubsystemFormFields }