ButtonRow.tsx 947 B

12345678910111213141516171819202122232425262728293031323334
  1. import React, { FC } from 'react';
  2. import config from 'app/core/config';
  3. export interface Props {
  4. isReadOnly: boolean;
  5. onDelete: () => void;
  6. onSubmit: (event) => void;
  7. onTest: (event) => void;
  8. }
  9. const ButtonRow: FC<Props> = ({ isReadOnly, onDelete, onSubmit, onTest }) => {
  10. return (
  11. <div className="gf-form-button-row">
  12. {!isReadOnly && (
  13. <button type="submit" className="btn btn-primary" disabled={isReadOnly} onClick={event => onSubmit(event)}>
  14. Save &amp; Test
  15. </button>
  16. )}
  17. {isReadOnly && (
  18. <button type="submit" className="btn btn-success" onClick={onTest}>
  19. Test
  20. </button>
  21. )}
  22. <button type="submit" className="btn btn-danger" disabled={isReadOnly} onClick={onDelete}>
  23. Delete
  24. </button>
  25. <a className="btn btn-inverse" href={`${config.appSubUrl}/datasources`}>
  26. Back
  27. </a>
  28. </div>
  29. );
  30. };
  31. export default ButtonRow;