mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 11:42:20 +08:00

* now with suggestions * using suggestions API * using variable suggestions * using variable suggestions * show variables * minor cleanup * add @alpha warning * Do not produce data variables if panel does not support queries Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
28 lines
735 B
TypeScript
28 lines
735 B
TypeScript
import React from 'react';
|
|
import { useAsyncDependency } from '../../utils/useAsyncDependency';
|
|
import { ErrorWithStack, LoadingPlaceholder } from '..';
|
|
import { CodeEditorProps } from './types';
|
|
|
|
export const CodeEditor: React.FC<CodeEditorProps> = props => {
|
|
const { loading, error, dependency } = useAsyncDependency(
|
|
import(/* webpackChunkName: "code-editor" */ './CodeEditor')
|
|
);
|
|
|
|
if (loading) {
|
|
return <LoadingPlaceholder text={''} />;
|
|
}
|
|
|
|
if (error) {
|
|
return (
|
|
<ErrorWithStack
|
|
title="Code editor failed to load"
|
|
error={error}
|
|
errorInfo={{ componentStack: error?.stack || '' }}
|
|
/>
|
|
);
|
|
}
|
|
|
|
const CodeEditor = dependency.default;
|
|
return <CodeEditor {...props} />;
|
|
};
|