use the metricsNames in PromQLExtension & update the import path

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
This commit is contained in:
Augustin Husson 2021-04-13 22:13:47 +02:00
parent 7071b94a07
commit bfc022fdf4
1 changed files with 3 additions and 3 deletions

View File

@ -11,15 +11,15 @@ import { closeBrackets, closeBracketsKeymap } from '@codemirror/closebrackets';
import { searchKeymap, highlightSelectionMatches } from '@codemirror/search'; import { searchKeymap, highlightSelectionMatches } from '@codemirror/search';
import { commentKeymap } from '@codemirror/comment'; import { commentKeymap } from '@codemirror/comment';
import { lintKeymap } from '@codemirror/lint'; import { lintKeymap } from '@codemirror/lint';
import { PromQLExtension } from 'codemirror-promql'; import { PromQLExtension, CompleteStrategy } from 'codemirror-promql';
import { autocompletion, completionKeymap, CompletionContext, CompletionResult } from '@codemirror/autocomplete'; import { autocompletion, completionKeymap, CompletionContext, CompletionResult } from '@codemirror/autocomplete';
import { theme, promqlHighlighter } from './CMTheme'; import { theme, promqlHighlighter } from './CMTheme';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faSearch, faSpinner, faGlobeEurope } from '@fortawesome/free-solid-svg-icons'; import { faSearch, faSpinner, faGlobeEurope } from '@fortawesome/free-solid-svg-icons';
import MetricsExplorer from './MetricsExplorer'; import MetricsExplorer from './MetricsExplorer';
import { CompleteStrategy, newCompleteStrategy } from 'codemirror-promql/complete';
import { usePathPrefix } from '../../contexts/PathPrefixContext'; import { usePathPrefix } from '../../contexts/PathPrefixContext';
import { newCompleteStrategy } from 'codemirror-promql/cjs/complete';
const promqlExtension = new PromQLExtension(); const promqlExtension = new PromQLExtension();
@ -102,7 +102,7 @@ const CMExpressionInput: FC<CMExpressionInputProps> = ({
.setComplete({ .setComplete({
completeStrategy: new HistoryCompleteStrategy( completeStrategy: new HistoryCompleteStrategy(
newCompleteStrategy({ newCompleteStrategy({
remote: { url: pathPrefix }, remote: { url: pathPrefix, cache: { initialMetricList: metricNames } },
}), }),
queryHistory queryHistory
), ),