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

35 lines
957 B
TypeScript
Raw Normal View History

import React, { FC } from 'react';
import config from 'app/core/config';
2018-10-31 13:23:05 +01:00
export interface Props {
isReadOnly: boolean;
2018-10-31 14:28:16 +01:00
onDelete: () => void;
onSubmit: (event: any) => void;
onTest: (event: any) => 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">
{!isReadOnly && (
<button type="submit" className="btn btn-primary" 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={`${config.appSubUrl}/datasources`}>
2018-10-31 13:23:05 +01:00
Back
</a>
</div>
);
};
export default ButtonRow;