Skip to content

Commit

Permalink
Update to Grafana 10.2.2 and Volkov labs packages (#250)
Browse files Browse the repository at this point in the history
* Update to Grafana 10.2.2 and Volkov labs packages

* Add suggestions for helper and after render editors

* Add context object to before content rendering

* Formatting

---------

Co-authored-by: asimonok <sashasimonok@gmail.com>
  • Loading branch information
mikhail-vl and asimonok authored Dec 25, 2023
1 parent 6e99009 commit e651bfb
Show file tree
Hide file tree
Showing 10 changed files with 346 additions and 66 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Changelog

## 4.3.0 (IN PROGRESS)
## 4.3.0 (2023-12-25)

### Features / Enhancements

- Update ESLint configuration and refactor (#239)
- Update Collapse from @volkovlabs/components (#239)
- Update Introduction video in README (#240)
- Add data render mode and passing selected data frame (#246)
- Update to Grafana 10.2.2 and Volkov labs packages (#247)

### Bug fixes

Expand Down
91 changes: 45 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"author": "Volkov Labs",
"dependencies": {
"@emotion/css": "^11.11.2",
"@grafana/data": "^10.2.1",
"@grafana/runtime": "^10.2.1",
"@grafana/schema": "^10.2.1",
"@grafana/ui": "^10.2.1",
"@grafana/data": "^10.2.2",
"@grafana/runtime": "^10.2.2",
"@grafana/schema": "^10.2.2",
"@grafana/ui": "^10.2.2",
"@types/highlight.js": "^10.1.0",
"@types/markdown-it": "^12.2.3",
"@volkovlabs/components": "^1.2.1",
"dayjs": "^1.11.10",
"handlebars": "^4.7.8",
"helper-date": "^1.0.1",
Expand All @@ -24,22 +25,21 @@
"@babel/core": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@babel/register": "^7.22.15",
"@grafana/e2e": "^10.2.1",
"@grafana/e2e-selectors": "^10.2.1",
"@grafana/e2e": "^10.2.2",
"@grafana/e2e-selectors": "^10.2.2",
"@grafana/eslint-config": "^6.0.1",
"@grafana/tsconfig": "^1.3.0-rc1",
"@swc/core": "^1.3.96",
"@swc/helpers": "^0.5.3",
"@swc/jest": "^0.2.29",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@types/jest": "^29.5.8",
"@types/lodash": "^4.14.201",
"@types/node": "^18.18.10",
"@types/react-beautiful-dnd": "^13.1.7",
"@types/uuid": "^9.0.7",
"@volkovlabs/components": "^1.1.0",
"@volkovlabs/eslint-config": "^1.2.1",
"@volkovlabs/eslint-config": "^1.2.2",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1",
"eslint-webpack-plugin": "^4.0.1",
Expand All @@ -48,7 +48,7 @@
"identity-obj-proxy": "3.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"replace-in-file-webpack-plugin": "^1.0.6",
"sass": "^1.69.5",
"sass-loader": "^13.3.2",
Expand Down
24 changes: 22 additions & 2 deletions src/components/CustomEditor/CustomEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ import { CodeEditor, CodeEditorSuggestionItem, CodeEditorSuggestionItemKind } fr
import type * as monacoType from 'monaco-editor/esm/vs/editor/editor.api';
import React, { useCallback, useMemo } from 'react';

import { CodeLanguage, EditorType, Format, HELPERS_EDITOR_SUGGESTIONS, TEST_IDS } from '../../constants';
import {
AFTER_RENDER_EDITOR_SUGGESTIONS,
CodeLanguage,
EditorType,
Format,
HELPERS_EDITOR_SUGGESTIONS,
TEST_IDS,
} from '../../constants';

/**
* Properties
Expand Down Expand Up @@ -64,6 +71,10 @@ export const CustomEditor: React.FC<Props> = ({ value, onChange, context, type =
return suggestions;
}

if (type === EditorType.AFTER_RENDER) {
return AFTER_RENDER_EDITOR_SUGGESTIONS.concat(suggestions);
}

return HELPERS_EDITOR_SUGGESTIONS.concat(suggestions);
}, [templateSrv, type]);

Expand All @@ -80,7 +91,7 @@ export const CustomEditor: React.FC<Props> = ({ value, onChange, context, type =
* Language
*/
const language = useMemo(() => {
if (type === EditorType.HELPERS) {
if (type === EditorType.HELPERS || type === EditorType.AFTER_RENDER) {
return CodeLanguage.JAVASCRIPT;
}

Expand Down Expand Up @@ -125,6 +136,15 @@ export const HelpersEditor: React.FC<StandardEditorProps> = (props) => (
<CustomEditor {...props} type={EditorType.HELPERS} />
);

/**
* After Render Editor
* @param props
* @constructor
*/
export const AfterRenderEditor: React.FC<StandardEditorProps> = (props) => (
<CustomEditor {...props} type={EditorType.AFTER_RENDER} />
);

/**
* Styles Editor
* @param props
Expand Down
Loading

0 comments on commit e651bfb

Please sign in to comment.