grafana/public/app/plugins/datasource/loki/components/LokiQueryField.tsx
Hugo Häggmark 988b7c4dc3
Feat: Adds reconnect for failing datasource in Explore (#16226)
* Style: made outlined buttons and used it in Alert component

* Refactor: clean up state on load data source failure

* Refactor: test data source thunk created

* Refactor: move logic to changeDatasource and call that from intialize

* Refactor: move load explore datasources to own thunk

* Refactor: move logic to updateDatasourceInstanceAction

* Tests: reducer tests

* Test(Explore): Added tests and made thunkTester async

* Fix(Explore): Fixed so that we do not render StartPage if there is no StartPage

* Fix(Explore): Missed type in merge

* Refactor: Thunktester did not fail tests on async failures and prevented queires from running on datasource failures

* Feat: Fadein error alert to prevent flickering

* Feat: Refresh labels after reconnect

* Refactor: Move useLokiForceLabels into useLokiLabels from PR comments

* Feat: adds refresh metrics to Prometheus languageprovider

* Style: removes padding for connected datasources

* Chore: remove implicit anys
2019-04-01 07:38:00 +02:00

35 lines
1.1 KiB
TypeScript

import React, { FunctionComponent } from 'react';
import { LokiQueryFieldForm, LokiQueryFieldFormProps } from './LokiQueryFieldForm';
import { useLokiSyntax } from './useLokiSyntax';
const LokiQueryField: FunctionComponent<LokiQueryFieldFormProps> = ({
datasource,
datasourceStatus,
...otherProps
}) => {
const { isSyntaxReady, setActiveOption, refreshLabels, ...syntaxProps } = useLokiSyntax(
datasource.languageProvider,
datasourceStatus
);
return (
<LokiQueryFieldForm
datasource={datasource}
datasourceStatus={datasourceStatus}
syntaxLoaded={isSyntaxReady}
/**
* setActiveOption name is intentional. Because of the way rc-cascader requests additional data
* https://github.com/react-component/cascader/blob/master/src/Cascader.jsx#L165
* we are notyfing useLokiSyntax hook, what the active option is, and then it's up to the hook logic
* to fetch data of options that aren't fetched yet
*/
onLoadOptions={setActiveOption}
onLabelsRefresh={refreshLabels}
{...syntaxProps}
{...otherProps}
/>
);
};
export default LokiQueryField;