-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(+semver: feature) Add processor watcher (#8)
Signed-off-by: Joshua Benjamin <[email protected]>
- Loading branch information
1 parent
2f14010
commit f7ea8f4
Showing
17 changed files
with
712 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import { operation, action } from './models'; | ||
|
||
type Props = { | ||
operation: operation; | ||
}; | ||
|
||
const actionRender = (action: action) => { | ||
switch (action.type) { | ||
case 'Join': | ||
return ( | ||
<div> | ||
{action.type} {action.topic}: {action.value} | ||
</div> | ||
); | ||
case 'Lookup': | ||
return ( | ||
<div> | ||
{action.type} {action.topic}({action.key}): {action.value} | ||
</div> | ||
); | ||
case 'SetState': | ||
return ( | ||
<div> | ||
{action.type} {action.topic}: {action.value} | ||
</div> | ||
); | ||
case 'GetState': | ||
return ( | ||
<div> | ||
{action.type} {action.topic}: {action.value} | ||
</div> | ||
); | ||
case 'Output': | ||
return ( | ||
<div> | ||
{action.type} {action.topic}({action.key}): {action.value} | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
export const Component: FunctionComponent<Props> = ({ operation }) => { | ||
return ( | ||
<div style={operationStyle}> | ||
input: "{operation.input.topic}": {operation.input.value} | ||
<ol> | ||
{operation.actions.map((action, index) => { | ||
return ( | ||
<li key={index} style={{ margin: '4px' }}> | ||
{actionRender(action)} | ||
</li> | ||
); | ||
})} | ||
</ol> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Component; | ||
|
||
const operationStyle: React.CSSProperties = { | ||
borderWidth: '2px', | ||
borderStyle: 'solid', | ||
borderColor: 'black', | ||
padding: '10px', | ||
margin: '5px', | ||
backgroundColor: 'white' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import OperationCard from './OperationCard'; | ||
import { ApolloError } from 'apollo-client'; | ||
import { operation } from './models'; | ||
|
||
export type Props = { | ||
loading: boolean; | ||
error?: ApolloError; | ||
operations: Array<operation>; | ||
}; | ||
|
||
export const Component: FunctionComponent<Props> = ({ loading, operations, error }) => { | ||
if (loading) { | ||
return <div style={{ width: '100%', height: '100%' }}>Loading</div>; | ||
} | ||
if (error) { | ||
return ( | ||
<div style={{ width: '100%', height: '100%' }}> | ||
{error.name} : {error.message} | ||
</div> | ||
); | ||
} | ||
return ( | ||
<ol> | ||
{operations.map((op, index) => { | ||
return ( | ||
<li key={index}> | ||
<OperationCard operation={op} /> | ||
</li> | ||
); | ||
})} | ||
</ol> | ||
); | ||
}; | ||
|
||
export default Component; |
Oops, something went wrong.