Instrument.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import gql from 'graphql-tag'
  2. import { Query, Mutation } from 'react-apollo'
  3. import InstrumentSubsystem from './InstrumentSubsystem'
  4. import Gallery from './Gallery'
  5. const instrumentSubsystems = [{
  6. name: 'Source',
  7. description: 'The commands in the SOURce subsystem are used to control the output of the power supply.',
  8. commands: [{
  9. id: '1',
  10. tag: 'Apply',
  11. name: 'Apply voltage and current',
  12. description: 'This command sets voltage and current levels on a specified channel with a single command message.',
  13. instrument: null,
  14. readString: null,
  15. writeString: '[SOURce:]APPLy {CH1|CH2|CH3}, <NRf+>, <NRf+>',
  16. parameters: ['channel']
  17. },
  18. {
  19. id: '1',
  20. tag: 'Output',
  21. name: 'Channel output state',
  22. description: 'This command sets the output state of the presently selected channel. The query form of this command returns the output state of the presently selected channel.',
  23. instrument: null,
  24. readString: '[SOURce:]CHANnel:OUTPut[:STATe]?',
  25. writeString: '[SOURce:]CHANnel:OUTPut[:STATe] <BOOL>',
  26. parameters: ['channel']
  27. }],
  28. parameters: [{ channel: ['CH1', 'CH2', 'CH3'] }],
  29. subsystems: []
  30. }]
  31. class Instrument extends React.Component {
  32. state = {
  33. id: this.props.instrument ? this.props.instrument.id : null,
  34. name: '',
  35. description: '',
  36. documents: [],
  37. interfaces: [],
  38. subsystems: []
  39. }
  40. toState = event => {
  41. this.setState({ [event.target.name]: event.target.value })
  42. }
  43. render() {
  44. return (
  45. <div>
  46. <h1>{this.state.name || 'Keithley 2230-3'}</h1>
  47. <p>{this.state.description || 'A really nice 3 output multimeter'}</p>
  48. <Gallery title='Documents' items={['Hallo']} />
  49. <Gallery title='Interfaces' items={['serial', 'usbtmc'].map(item => <div>{item}</div>)} />
  50. <Gallery title='Subsystems' items={instrumentSubsystems.map(instrumentSubsystem =>
  51. <InstrumentSubsystem instrumentSubsystem={instrumentSubsystem} />)} />
  52. </div>
  53. )
  54. }
  55. }
  56. export default Instrument