mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Loki config: add missing section title to max lines * Loki config: minor improvements to datasource test messages * Chore: remove new line * Loki: further improve error messages * Alerting Settings: Add missing tooltip * Update packages/grafana-ui/src/components/DataSourceSettings/AlertingSettings.tsx * Update alerting label and tooltip * Update packages/grafana-ui/src/components/DataSourceSettings/AlertingSettings.tsx Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com> * Alerting settings: Increase label width * Loki config: update success message --------- Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
59 lines
1.7 KiB
TypeScript
59 lines
1.7 KiB
TypeScript
import React from 'react';
|
|
|
|
import { DataSourcePluginOptionsEditorProps, DataSourceSettings } from '@grafana/data';
|
|
import { config } from '@grafana/runtime';
|
|
import { AlertingSettings, DataSourceHttpSettings, SecureSocksProxySettings } from '@grafana/ui';
|
|
|
|
import { LokiOptions } from '../types';
|
|
|
|
import { DerivedFields } from './DerivedFields';
|
|
import { MaxLinesField } from './MaxLinesField';
|
|
|
|
export type Props = DataSourcePluginOptionsEditorProps<LokiOptions>;
|
|
|
|
const makeJsonUpdater =
|
|
<T extends any>(field: keyof LokiOptions) =>
|
|
(options: DataSourceSettings<LokiOptions>, value: T): DataSourceSettings<LokiOptions> => {
|
|
return {
|
|
...options,
|
|
jsonData: {
|
|
...options.jsonData,
|
|
[field]: value,
|
|
},
|
|
};
|
|
};
|
|
|
|
const setMaxLines = makeJsonUpdater('maxLines');
|
|
const setDerivedFields = makeJsonUpdater('derivedFields');
|
|
|
|
export const ConfigEditor = (props: Props) => {
|
|
const { options, onOptionsChange } = props;
|
|
|
|
return (
|
|
<>
|
|
<DataSourceHttpSettings
|
|
defaultUrl={'http://localhost:3100'}
|
|
dataSourceConfig={options}
|
|
showAccessOptions={false}
|
|
onChange={onOptionsChange}
|
|
/>
|
|
|
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
|
)}
|
|
|
|
<AlertingSettings<LokiOptions> options={options} onOptionsChange={onOptionsChange} />
|
|
|
|
<MaxLinesField
|
|
value={options.jsonData.maxLines || ''}
|
|
onChange={(value) => onOptionsChange(setMaxLines(options, value))}
|
|
/>
|
|
|
|
<DerivedFields
|
|
value={options.jsonData.derivedFields}
|
|
onChange={(value) => onOptionsChange(setDerivedFields(options, value))}
|
|
/>
|
|
</>
|
|
);
|
|
};
|