({fClose, fOnSubmit, initialName = ''}: IProps)
| 15 | } |
| 16 | |
| 17 | const UpdateClientDialog = ({fClose, fOnSubmit, initialName = ''}: IProps) => { |
| 18 | const [name, setName] = useState(initialName); |
| 19 | |
| 20 | const submitEnabled = name.length !== 0; |
| 21 | const submitAndClose = async () => { |
| 22 | await fOnSubmit(name); |
| 23 | fClose(); |
| 24 | }; |
| 25 | |
| 26 | return ( |
| 27 | <Dialog open={true} onClose={fClose} aria-labelledby="form-dialog-title" id="client-dialog"> |
| 28 | <DialogTitle id="form-dialog-title">Update a Client</DialogTitle> |
| 29 | <DialogContent> |
| 30 | <DialogContentText> |
| 31 | A client manages messages, clients, applications and users (with admin |
| 32 | permissions). |
| 33 | </DialogContentText> |
| 34 | <TextField |
| 35 | autoFocus |
| 36 | margin="dense" |
| 37 | className="name" |
| 38 | label="Name *" |
| 39 | type="text" |
| 40 | value={name} |
| 41 | onChange={(e) => setName(e.target.value)} |
| 42 | fullWidth |
| 43 | /> |
| 44 | </DialogContent> |
| 45 | <DialogActions> |
| 46 | <Button onClick={fClose}>Cancel</Button> |
| 47 | <Tooltip title={submitEnabled ? '' : 'name is required'}> |
| 48 | <div> |
| 49 | <Button |
| 50 | className="update" |
| 51 | disabled={!submitEnabled} |
| 52 | onClick={submitAndClose} |
| 53 | color="primary" |
| 54 | variant="contained"> |
| 55 | Update |
| 56 | </Button> |
| 57 | </div> |
| 58 | </Tooltip> |
| 59 | </DialogActions> |
| 60 | </Dialog> |
| 61 | ); |
| 62 | }; |
| 63 | |
| 64 | export default UpdateClientDialog; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…