1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import gql from 'graphql-tag'
- import { Query } from 'react-apollo'
- import Interface from './Interface'
- const INTERFACE_LIST = gql`
- query INTERFACE_LIST {
- interfaces {
- interfaceName
- workerScript
- ports {
- id
- device
- interfaceName
- name
- description
- }
- connections {
- id
- device
- interfaceName
- }
- options {
- name
- type
- description
- values
- }
- }
- }
- `
- const InterfaceList = props => (
- <Query query={INTERFACE_LIST}>
- {({ data }, loading, error) => {
- if (!data) return <p>No interfaces found.</p>
- const { interfaces } = data
- return (
- <div>
- <h1>Interface List</h1>
- {loading ? (
- <p>Loading interfaces...</p>
- ) : (
- interfaces && interfaces.map(iface => <Interface key={iface.interfaceName} data={iface} />)
- )}
- </div>
- )
- }}
- </Query>
- )
- export default InterfaceList
- export { INTERFACE_LIST }
|