mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Fixes under public/app/plugins * Fixes under public/app/plugins/datasource * Fixes under public/app/features * Fixes under public/app/features * Fixes under public/app/features * Fixes under public/app/components * Fix PanelNotSupported test * Fix one more warning * Fix warning in usePanelSave * Fix traceview empty response * Azure monitor fixes * More fixes * Fix tests for azure monitor * Fixes after merging master * Add comment for disabled rules * Fixes after merging master * Fixes after merging master * Adress review comments * Fix azure tests * Address review feedbacks
76 lines
2.4 KiB
TypeScript
76 lines
2.4 KiB
TypeScript
import React, { useEffect } from 'react';
|
|
import { Alert, DataSourceHttpSettings } from '@grafana/ui';
|
|
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
|
import { ElasticsearchOptions } from '../types';
|
|
import { defaultMaxConcurrentShardRequests, ElasticDetails } from './ElasticDetails';
|
|
import { LogsConfig } from './LogsConfig';
|
|
import { DataLinks } from './DataLinks';
|
|
import { config } from 'app/core/config';
|
|
|
|
export type Props = DataSourcePluginOptionsEditorProps<ElasticsearchOptions>;
|
|
export const ConfigEditor = (props: Props) => {
|
|
const { options, onOptionsChange } = props;
|
|
|
|
// Apply some defaults on initial render
|
|
useEffect(() => {
|
|
const esVersion = options.jsonData.esVersion || 5;
|
|
onOptionsChange({
|
|
...options,
|
|
jsonData: {
|
|
...options.jsonData,
|
|
timeField: options.jsonData.timeField || '@timestamp',
|
|
esVersion,
|
|
maxConcurrentShardRequests:
|
|
options.jsonData.maxConcurrentShardRequests || defaultMaxConcurrentShardRequests(esVersion),
|
|
logMessageField: options.jsonData.logMessageField || '',
|
|
logLevelField: options.jsonData.logLevelField || '',
|
|
},
|
|
});
|
|
// We can't enforce the eslint rule here because we only want to run this once.
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
|
|
return (
|
|
<>
|
|
{options.access === 'direct' && (
|
|
<Alert title="Deprecation Notice" severity="warning">
|
|
Browser access mode in the Elasticsearch datasource is deprecated and will be removed in a future release.
|
|
</Alert>
|
|
)}
|
|
|
|
<DataSourceHttpSettings
|
|
defaultUrl={'http://localhost:9200'}
|
|
dataSourceConfig={options}
|
|
showAccessOptions={true}
|
|
onChange={onOptionsChange}
|
|
sigV4AuthToggleEnabled={config.sigV4AuthEnabled}
|
|
/>
|
|
|
|
<ElasticDetails value={options} onChange={onOptionsChange} />
|
|
|
|
<LogsConfig
|
|
value={options.jsonData}
|
|
onChange={(newValue) =>
|
|
onOptionsChange({
|
|
...options,
|
|
jsonData: newValue,
|
|
})
|
|
}
|
|
/>
|
|
|
|
<DataLinks
|
|
value={options.jsonData.dataLinks}
|
|
onChange={(newValue) => {
|
|
onOptionsChange({
|
|
...options,
|
|
jsonData: {
|
|
...options.jsonData,
|
|
dataLinks: newValue,
|
|
},
|
|
});
|
|
}}
|
|
/>
|
|
</>
|
|
);
|
|
};
|