Files
grafana/public/app/features/datasources/settings/ButtonRow.tsx

32 lines
849 B
TypeScript
Raw Normal View History

import React, { FC } from 'react';
2018-10-31 13:23:05 +01:00
export interface Props {
isReadOnly: boolean;
2018-10-31 14:28:16 +01:00
onDelete: () => void;
2018-10-31 13:23:05 +01:00
onSubmit: (event) => void;
onTest: (event) => void;
2018-10-31 13:23:05 +01:00
}
const ButtonRow: FC<Props> = ({ isReadOnly, onDelete, onSubmit, onTest }) => {
2018-10-31 13:23:05 +01:00
return (
<div className="gf-form-button-row">
<button type="submit" className="btn btn-success" disabled={isReadOnly} onClick={event => onSubmit(event)}>
Save &amp; Test
</button>
{isReadOnly && (
<button type="submit" className="btn btn-success" onClick={onTest}>
Test
</button>
)}
2018-10-31 14:28:16 +01:00
<button type="submit" className="btn btn-danger" disabled={isReadOnly} onClick={onDelete}>
2018-10-31 13:23:05 +01:00
Delete
</button>
<a className="btn btn-inverse" href="/datasources">
Back
</a>
</div>
);
};
export default ButtonRow;