New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Bindings view in Hooks create page #730
Closed
arshadkazmi42
wants to merge
49
commits into
taskcluster:master
from
arshadkazmi42:bindings-hook-view
Closed
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
2936bca
Add Bindings view in Hooks create page
arshadkazmi42 641d42b
Create PulseBinding Component and use in PulseMessages and HookForm
arshadkazmi42 b8f864b
add static props in PulseBindings component
arshadkazmi42 f266cfc
Add binding to return from getDefinition
arshadkazmi42 5b9d224
Add bindings to payload
arshadkazmi42 f4984a0
Change routingKeyPattern to pattern for bindings in payload
arshadkazmi42 7776395
Change pattern to routingKeyPattern
arshadkazmi42 81ca99c
merge master
owlishDeveloper 19a54e6
Add Create Worker Type button. Add Editor view
owlishDeveloper d623a5a
Define the workertype creation form
owlishDeveloper 01ce1c8
Make the form functional
owlishDeveloper c9f2079
Cleanup
owlishDeveloper 09636fd
Correct the provider config part of the component state
owlishDeveloper 228f4f0
Change fetch query in webserver and change UI to render fetched values
arshadkazmi42 c9b3266
Rename worker type to worker pool
owlishDeveloper 1d3da94
Implement review suggestions. Styling changes
owlishDeveloper af8de5e
More suggestions
owlishDeveloper eb645b9
Use different icon for Save button
owlishDeveloper a409b74
Change field labels. Add some useful styling
owlishDeveloper 3d50fc2
Merge master
owlishDeveloper 879ab4f
Finish merging master
owlishDeveloper 34e753e
Finish merging master
owlishDeveloper 9f06ab0
Return Dashboard. Remove button spacing for now. Remove some styles
owlishDeveloper bd061c2
Change imports
owlishDeveloper 6d1929e
Replace FormLabel with ListSubheader. Ensure minimum width of the dro…
owlishDeveloper a9eeb15
Change name of a field. Change padding
owlishDeveloper 6a7878e
Use vertical spacing instead of indentation to organize the form fields
owlishDeveloper 9af784f
Add skeleton of worker-scanner tests
imbstack 3f681f7
Add another check to provisioner testing
imbstack 1cc3491
Add worker-scanner tests
imbstack bd28bd5
Parallelize coverage fetching
imbstack 0936543
Add tests for reporting workerpool errors
imbstack 3e35cea
Css cleanup, delete all bindings and save button enable fix
arshadkazmi42 a8980c3
Add minor changes
owlishDeveloper 645cac1
Worker manager updates (#831)
imbstack 9aa285d
Merge pull request #814 from owlishDeveloper/bug1542905-3
owlishDeveloper d28d642
Don't specify an explicit PORT for tc-web-ui
djmitche 949fbc5
Merge pull request #836 from djmitche/no-explicit-PORT-for-web-ui
djmitche 21fd0ef
Make setTimeout work with large timeout values (#838)
helfi92 989c444
Add Bindings view in Hooks create page
arshadkazmi42 3bbbb11
Create PulseBinding Component and use in PulseMessages and HookForm
arshadkazmi42 76a6f49
add static props in PulseBindings component
arshadkazmi42 019d25c
Add binding to return from getDefinition
arshadkazmi42 023761b
Add bindings to payload
arshadkazmi42 a31db51
Change routingKeyPattern to pattern for bindings in payload
arshadkazmi42 61a4307
Change pattern to routingKeyPattern
arshadkazmi42 16d71d2
Change fetch query in webserver and change UI to render fetched values
arshadkazmi42 badc0a3
Css cleanup, delete all bindings and save button enable fix
arshadkazmi42 bf4c6e0
Merge branch 'bindings-hook-view' of https://github.com/arshadkazmi42…
arshadkazmi42 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import Switch from '@material-ui/core/Switch'; | |
import FormGroup from '@material-ui/core/FormGroup'; | ||
import FormControlLabel from '@material-ui/core/FormControlLabel'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import Tooltip from '@material-ui/core/Tooltip'; | ||
import IconButton from '@material-ui/core/IconButton'; | ||
import Typography from '@material-ui/core/Typography'; | ||
import FlashIcon from 'mdi-react/FlashIcon'; | ||
|
@@ -91,6 +92,10 @@ const initialHook = { | |
fill: theme.palette.text.primary, | ||
}, | ||
}, | ||
plusIcon: { | ||
marginTop: 80, | ||
marginRight: 0, | ||
}, | ||
listItemButton: { | ||
...theme.mixins.listItemButton, | ||
}, | ||
|
@@ -115,6 +120,18 @@ const initialHook = { | |
subheader: { | ||
fontSize: theme.typography.pxToRem(16), | ||
}, | ||
bindingListItem: { | ||
paddingTop: 0, | ||
paddingBottom: 0, | ||
}, | ||
inputWrapper: { | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
}, | ||
inputList: { | ||
flex: 1, | ||
}, | ||
errorPanel: { | ||
maxHeight: '88vh', | ||
overflow: 'scroll', | ||
|
@@ -183,6 +200,9 @@ export default class HookForm extends Component { | |
hookLastFires: null, | ||
// eslint-disable-next-line react/no-unused-state | ||
previousHook: null, | ||
pattern: '#', | ||
pulseExchange: '', | ||
bindings: [], | ||
taskInput: '', | ||
triggerSchemaInput: '', | ||
triggerContextInput: '', | ||
|
@@ -446,6 +466,36 @@ export default class HookForm extends Component { | |
}); | ||
}; | ||
|
||
handleInputChange = ({ target: { name, value } }) => { | ||
this.setState({ [name]: value }); | ||
}; | ||
|
||
handleAddBinding = () => { | ||
const { pulseExchange, pattern } = this.state; | ||
const bindings = this.state.bindings.concat([ | ||
{ | ||
exchange: pulseExchange, | ||
pattern, | ||
}, | ||
]); | ||
|
||
this.setState({ | ||
pulseExchange: '', | ||
pattern: '#', | ||
bindings, | ||
}); | ||
}; | ||
|
||
handleDeleteBinding = ({ exchange, pattern }) => { | ||
const bindings = this.state.bindings.filter( | ||
binding => binding.exchange !== exchange || binding.pattern !== pattern | ||
); | ||
|
||
this.setState({ | ||
bindings, | ||
}); | ||
}; | ||
|
||
render() { | ||
const { | ||
actionLoading, | ||
|
@@ -458,6 +508,8 @@ export default class HookForm extends Component { | |
onDialogOpen, | ||
} = this.props; | ||
const { | ||
pattern, | ||
pulseExchange, | ||
scheduleTextField, | ||
taskInput, | ||
triggerSchemaInput, | ||
|
@@ -467,6 +519,7 @@ export default class HookForm extends Component { | |
validation, | ||
drawerOpen, | ||
drawerData, | ||
bindings, | ||
} = this.state; | ||
const isHookDirty = !equals(hook, this.props.hook); | ||
|
||
|
@@ -594,6 +647,76 @@ export default class HookForm extends Component { | |
</ListItem> | ||
</Fragment> | ||
)} | ||
<div className={classes.inputWrapper}> | ||
<List | ||
className={classes.inputList} | ||
subheader={ | ||
<ListSubheader className={classes.subheader}> | ||
Bindings | ||
</ListSubheader> | ||
}> | ||
<ListItem> | ||
<ListItemText | ||
primary={ | ||
<TextField | ||
required | ||
label="Pulse Exchange" | ||
name="pulseExchange" | ||
placeholder="exchange/<username>/some-exchange-name" | ||
onChange={this.handleInputChange} | ||
fullWidth | ||
value={pulseExchange} | ||
/> | ||
} | ||
/> | ||
</ListItem> | ||
<ListItem> | ||
<ListItemText | ||
primary={ | ||
<TextField | ||
required | ||
label="Routing Key Pattern" | ||
placeholder="#.some-interesting-key.#" | ||
name="pattern" | ||
onChange={this.handleInputChange} | ||
fullWidth | ||
value={pattern} | ||
/> | ||
} | ||
/> | ||
</ListItem> | ||
</List> | ||
<Tooltip title="Add Binding"> | ||
<IconButton | ||
className={classNames(classes.iconButton, classes.plusIcon)} | ||
onClick={this.handleAddBinding}> | ||
<PlusIcon /> | ||
</IconButton> | ||
</Tooltip> | ||
</div> | ||
<List> | ||
{bindings.map(binding => ( | ||
<ListItem | ||
className={classes.bindingListItem} | ||
key={`${binding.exchange}-${binding.routingKeyPattern}`}> | ||
<ListItemText | ||
disableTypography | ||
primary={ | ||
<Typography variant="body2"> | ||
<code>{binding.exchange}</code> with{' '} | ||
<code>{binding.pattern}</code> | ||
</Typography> | ||
} | ||
/> | ||
<IconButton | ||
className={classes.iconButton} | ||
name={binding} | ||
onClick={() => this.handleDeleteBinding(binding)}> | ||
<DeleteIcon /> | ||
</IconButton> | ||
</ListItem> | ||
))} | ||
</List> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<List> | ||
<ListItem> | ||
<ListItemText | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a lot of duplicated logic with
localhost:5080/pulse-messages
. I was thinking maybe we could create aPulseBindings
component that will take care of creatingcomponent/HookForm
andviews/PulseMessages
would then use that component and feed the appropriate props. Maybe something like:What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I was thinking the same, I was thinking of using existing
PulseMessages
but that does not seem to help.I didn't think of creating a new component.
This sounds good. Let me work on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks @arshadkazmi42.