mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
1399b49c16
* Update TeamSettings.tsx * Update navModel.ts * Update ChangePasswordForm.tsx * Update UserProfileEditForm.tsx * Update DashboardImportPage.tsx * Update uploadDashboardDirective.ts * Update ImportDashboardForm.tsx * Update ImportDashboardOverview.tsx * Update validation.ts * Update PlaylistEditPage.tsx * ui text edits * text edits * Update buildCategories.ts * text edits * text edits * Fix formatting * Update test snapshots Co-authored-by: dsotirakis <sotirakis.dim@gmail.com>
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import React, { FC } from 'react';
|
|
import { InlineFormLabel, LegacyForms } from '@grafana/ui';
|
|
import { selectors } from '@grafana/e2e-selectors';
|
|
|
|
const { Input, Switch } = LegacyForms;
|
|
|
|
export interface Props {
|
|
dataSourceName: string;
|
|
isDefault: boolean;
|
|
onNameChange: (name: string) => void;
|
|
onDefaultChange: (value: boolean) => void;
|
|
}
|
|
|
|
const BasicSettings: FC<Props> = ({ dataSourceName, isDefault, onDefaultChange, onNameChange }) => {
|
|
return (
|
|
<div className="gf-form-group" aria-label="Datasource settings page basic settings">
|
|
<div className="gf-form-inline">
|
|
<div className="gf-form max-width-30" style={{ marginRight: '3px' }}>
|
|
<InlineFormLabel
|
|
tooltip={
|
|
'The name is used when you select the data source in panels. The default data source is ' +
|
|
'preselected in new panels.'
|
|
}
|
|
>
|
|
Name
|
|
</InlineFormLabel>
|
|
<Input
|
|
className="gf-form-input max-width-23"
|
|
type="text"
|
|
value={dataSourceName}
|
|
placeholder="Name"
|
|
onChange={(event) => onNameChange(event.target.value)}
|
|
required
|
|
aria-label={selectors.pages.DataSource.name}
|
|
/>
|
|
</div>
|
|
<Switch
|
|
label="Default"
|
|
checked={isDefault}
|
|
onChange={(event) => {
|
|
// @ts-ignore
|
|
onDefaultChange(event.target.checked);
|
|
}}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default BasicSettings;
|