From 9a2a91e25adcbfc2cef4aab0618dd63dd5368a8e Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Thu, 15 Apr 2021 11:42:40 +0200 Subject: [PATCH] Bump cm-promql to v0.15.0 (#4054) * move @types deps to dev-deps Signed-off-by: Augustin Husson * bump cm-promql to v0.15.0 Signed-off-by: Augustin Husson * use the metricsNames in PromQLExtension & update the import path Signed-off-by: Augustin Husson Signed-off-by: someshkoli --- pkg/ui/react-app/package.json | 22 +++++++++---------- .../src/pages/graph/CMExpressionInput.tsx | 8 +++---- pkg/ui/react-app/yarn.lock | 8 +++---- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/pkg/ui/react-app/package.json b/pkg/ui/react-app/package.json index 6bf4a19088f..10c5232daf6 100644 --- a/pkg/ui/react-app/package.json +++ b/pkg/ui/react-app/package.json @@ -19,18 +19,8 @@ "@fortawesome/free-solid-svg-icons": "^5.15.2", "@fortawesome/react-fontawesome": "^0.1.14", "@reach/router": "^1.3.4", - "@types/jest": "^26.0.20", - "@types/jquery": "^3.5.5", - "@types/node": "^14.14.30", - "@types/reach__router": "^1.3.7", - "@types/react": "^17.0.2", - "@types/react-copy-to-clipboard": "^5.0.0", - "@types/react-dom": "^17.0.1", - "@types/react-resize-detector": "^4.0.2", - "@types/react-select": "^4.0.13", - "@types/sanitize-html": "^1.27.1", "bootstrap": "^4.6.0", - "codemirror-promql": "^0.14.1", + "codemirror-promql": "^0.15.0", "css.escape": "^1.5.1", "downshift": "^6.1.0", "enzyme-to-json": "^3.6.1", @@ -84,8 +74,18 @@ "@types/enzyme": "^3.10.8", "@types/enzyme-adapter-react-16": "^1.0.6", "@types/flot": "^0.0.31", + "@types/jest": "^26.0.20", + "@types/jquery": "^3.5.5", "@types/moment-timezone": "^0.5.30", + "@types/node": "^14.14.30", + "@types/reach__router": "^1.3.7", "@types/reactstrap": "^8.7.2", + "@types/react": "^17.0.2", + "@types/react-copy-to-clipboard": "^5.0.0", + "@types/react-dom": "^17.0.1", + "@types/react-resize-detector": "^4.0.2", + "@types/react-select": "^4.0.13", + "@types/sanitize-html": "^1.27.1", "@types/sinon": "^9.0.10", "@typescript-eslint/eslint-plugin": "^4.15.1", "@typescript-eslint/parser": "^4.15.1", diff --git a/pkg/ui/react-app/src/pages/graph/CMExpressionInput.tsx b/pkg/ui/react-app/src/pages/graph/CMExpressionInput.tsx index 6f6ee634a0b..50b0075e818 100644 --- a/pkg/ui/react-app/src/pages/graph/CMExpressionInput.tsx +++ b/pkg/ui/react-app/src/pages/graph/CMExpressionInput.tsx @@ -1,6 +1,5 @@ import React, { FC, useEffect, useRef } from 'react'; import { Button, InputGroup, InputGroupAddon, InputGroupText } from 'reactstrap'; - import { EditorView, highlightSpecialChars, keymap, ViewUpdate, placeholder } from '@codemirror/view'; import { EditorState, Prec, Compartment } from '@codemirror/state'; import { indentOnInput, syntaxTree } from '@codemirror/language'; @@ -11,13 +10,12 @@ import { closeBrackets, closeBracketsKeymap } from '@codemirror/closebrackets'; import { searchKeymap, highlightSelectionMatches } from '@codemirror/search'; import { commentKeymap } from '@codemirror/comment'; 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 { theme, promqlHighlighter } from './CMTheme'; - import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faSearch, faSpinner } from '@fortawesome/free-solid-svg-icons'; -import { CompleteStrategy, newCompleteStrategy } from 'codemirror-promql/complete'; +import { newCompleteStrategy } from 'codemirror-promql/cjs/complete'; import PathPrefixProps from '../../types/PathPrefixProps'; const promqlExtension = new PromQLExtension(); @@ -100,7 +98,7 @@ const CMExpressionInput: FC = ({ .setComplete({ completeStrategy: new HistoryCompleteStrategy( newCompleteStrategy({ - remote: { url: pathPrefix ? pathPrefix : '' }, + remote: { url: pathPrefix ? pathPrefix : '', cache: { initialMetricList: metricNames } }, }), queryHistory ), diff --git a/pkg/ui/react-app/yarn.lock b/pkg/ui/react-app/yarn.lock index 4591bbbb05e..1d12ae54a42 100644 --- a/pkg/ui/react-app/yarn.lock +++ b/pkg/ui/react-app/yarn.lock @@ -3575,10 +3575,10 @@ coa@^2.0.2: chalk "^2.4.1" q "^1.1.2" -codemirror-promql@^0.14.1: - version "0.14.1" - resolved "https://registry.yarnpkg.com/codemirror-promql/-/codemirror-promql-0.14.1.tgz#ea927f347effd7f28e4c1f87dcd8898d1681ea40" - integrity sha512-zAdvVrvehVToPBlwySVlTXCY3hzOMPgO1B0m7O6PBY5BUOYbNIDk+DSjrc7glUTwySUwkyWt/x7kDabGv4tXNg== +codemirror-promql@^0.15.0: + version "0.15.0" + resolved "https://registry.yarnpkg.com/codemirror-promql/-/codemirror-promql-0.15.0.tgz#dd6365ea5c2d18421d225cef12b74e64d8cab280" + integrity sha512-u5f6Narj8Kx79AHMPlr8vogGUhinZfsZVT00R7wStquDA3kRTvxfEBYK77UtWNNJshxC1B3EZnHzXN2K9RzVXw== dependencies: lezer-promql "^0.18.0" lru-cache "^6.0.0"