BasicSettings.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React, { FC } from 'react';
  2. import { Label } from '@grafana/ui';
  3. import { Switch } from '../../../core/components/Switch/Switch';
  4. export interface Props {
  5. dataSourceName: string;
  6. isDefault: boolean;
  7. onNameChange: (name: string) => void;
  8. onDefaultChange: (value: boolean) => void;
  9. }
  10. const BasicSettings: FC<Props> = ({ dataSourceName, isDefault, onDefaultChange, onNameChange }) => {
  11. return (
  12. <div className="gf-form-group">
  13. <div className="gf-form-inline">
  14. <div className="gf-form max-width-30" style={{ marginRight: '3px' }}>
  15. <Label
  16. tooltip={
  17. 'The name is used when you select the data source in panels. The Default data source is ' +
  18. 'preselected in new panels.'
  19. }
  20. >
  21. Name
  22. </Label>
  23. <input
  24. className="gf-form-input max-width-23"
  25. type="text"
  26. value={dataSourceName}
  27. placeholder="Name"
  28. onChange={event => onNameChange(event.target.value)}
  29. required
  30. />
  31. </div>
  32. <Switch label="Default" checked={isDefault} onChange={event => onDefaultChange(event.target.checked)} />
  33. </div>
  34. </div>
  35. );
  36. };
  37. export default BasicSettings;