12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import gql from 'graphql-tag'
- import { Query, Mutation } from 'react-apollo'
- import InstrumentSubsystem from './InstrumentSubsystem'
- import Gallery from './Gallery'
- const instrumentSubsystems = [{
- name: 'Source',
- description: 'The commands in the SOURce subsystem are used to control the output of the power supply.',
- commands: [{
- id: '1',
- tag: 'Apply',
- name: 'Apply voltage and current',
- description: 'This command sets voltage and current levels on a specified channel with a single command message.',
- instrument: null,
- readString: null,
- writeString: '[SOURce:]APPLy {CH1|CH2|CH3}, <NRf+>, <NRf+>',
- parameters: ['channel']
- },
- {
- id: '1',
- tag: 'Output',
- name: 'Channel output state',
- 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.',
- instrument: null,
- readString: '[SOURce:]CHANnel:OUTPut[:STATe]?',
- writeString: '[SOURce:]CHANnel:OUTPut[:STATe] <BOOL>',
- parameters: ['channel']
- }],
- parameters: [{ channel: ['CH1', 'CH2', 'CH3'] }],
- subsystems: []
- }]
- class Instrument extends React.Component {
- state = {
- id: this.props.instrument ? this.props.instrument.id : null,
- name: '',
- description: '',
- documents: [],
- interfaces: [],
- subsystems: []
- }
- toState = event => {
- this.setState({ [event.target.name]: event.target.value })
- }
- render() {
- return (
- <div>
- <h1>{this.state.name || 'Keithley 2230-3'}</h1>
- <p>{this.state.description || 'A really nice 3 output multimeter'}</p>
- <Gallery title='Documents' items={['Hallo']} />
- <Gallery title='Interfaces' items={['serial', 'usbtmc'].map(item => <div>{item}</div>)} />
- <Gallery title='Subsystems' items={instrumentSubsystems.map(instrumentSubsystem =>
- <InstrumentSubsystem instrumentSubsystem={instrumentSubsystem} />)} />
- </div>
- )
- }
- }
- export default Instrument
|