ソースを参照

bug in interfacelist and interface.

Tomi Cvetic 6 年 前
コミット
981960575b
2 ファイル変更41 行追加8 行削除
  1. 1 1
      frontend/components/Interface.js
  2. 40 7
      frontend/components/InterfaceList.js

+ 1 - 1
frontend/components/Interface.js

@@ -70,7 +70,7 @@ const Interface = props => {
     <div>
       <h2>{interfaceName}</h2>
       <p>Script:</p>
-      <p>{workerScript}</p>
+      <p>{workerScript.path}</p>
       <Gallery
         title='ports'
         items={ports.map(port => (

+ 40 - 7
frontend/components/InterfaceList.js

@@ -5,19 +5,47 @@ import Interface from './Interface'
 const INTERFACES_FULL = gql`
   query INTERFACES_FULL {
     interfaces {
+      id
       interfaceName
-      workerScript
+      workerScript {
+        path
+        mtime
+        updated
+      }
+      workerProcess {
+        pid
+        killed
+        signalCode
+        exitCode
+        spawnfile
+        spawnargs
+      }
       ports {
         id
-        device
         interfaceName
+        host
+        device
         name
         description
       }
       connections {
         id
-        device
-        interfaceName
+        port {
+          id
+          interfaceName
+          host
+          device
+          name
+          description
+        }
+        workerProcess {
+          pid
+          killed
+          signalCode
+          exitCode
+          spawnfile
+          spawnargs
+        }
       }
       options {
         name
@@ -46,8 +74,10 @@ const INTERFACES = gql`
 const InterfaceList = props => (
   <Query query={INTERFACES_FULL}>
     {({ data }, loading, error) => {
+      if (loading) return <p>Loading interfaces...</p>
+      if (error) return <p>Error loading interfaces: {error.message}</p>
       if (!data) return <p>No interfaces found.</p>
-
+      console.log(interfaces)
       const { interfaces } = data
       return (
         <div>
@@ -55,8 +85,11 @@ const InterfaceList = props => (
           {loading ? (
             <p>Loading interfaces...</p>
           ) : (
-              interfaces && interfaces.map(iface => <Interface key={iface.interfaceName} data={iface} />)
-            )}
+            interfaces &&
+            interfaces.map(iface => (
+              <Interface key={iface.interfaceName} data={iface} />
+            ))
+          )}
         </div>
       )
     }}