From 8b56db24d169a5fc8f5953f755befc99f8f23313 Mon Sep 17 00:00:00 2001 From: Vitaly Pinchuk <146737590+vitPinchuk@users.noreply.github.com> Date: Thu, 8 Feb 2024 06:10:12 +0300 Subject: [PATCH] Add refresh function using Application Event Bus (#247) * ft - add refresh function to grafana context * fix update detail to 'Refresh dashboard.' for context.grafana.refresh * Update CHANGELOG.md --------- Co-authored-by: Mikhail Volkov --- CHANGELOG.md | 3 ++- src/components/EchartsPanel/EchartsPanel.tsx | 1 + src/constants/editor.ts | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index caf73d1..34c6e43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## 5.2.0 (2024-02-05) +## 5.2.0 (2024-02-07) ### Features / Enhancements @@ -9,6 +9,7 @@ - Update ESLint configuration and refactoring (#237) - Update dependencies and Actions (#238) - Add context parameter to non-visual mode (#245) +- Add refresh function using Application Event Bus (#247) ## 5.1.0 (2023-08-11) diff --git a/src/components/EchartsPanel/EchartsPanel.tsx b/src/components/EchartsPanel/EchartsPanel.tsx index bba9964..49d23ce 100644 --- a/src/components/EchartsPanel/EchartsPanel.tsx +++ b/src/components/EchartsPanel/EchartsPanel.tsx @@ -209,6 +209,7 @@ export const EchartsPanel: React.FC = ({ options, data, width, height, re locationService, notifySuccess, notifyError, + refresh: () => appEvents.publish({ type: 'variables-changed', payload: { refreshAll: true } }), }, panel: { data, diff --git a/src/constants/editor.ts b/src/constants/editor.ts index db7bf90..1b5a4a4 100644 --- a/src/constants/editor.ts +++ b/src/constants/editor.ts @@ -116,6 +116,11 @@ const EDITOR_BASE_CONTEXT_SUGGESTIONS: CodeEditorSuggestionItem[] = [ kind: CodeEditorSuggestionItemKind.Method, detail: 'Show error notification.', }, + { + label: 'context.grafana.refresh', + kind: CodeEditorSuggestionItemKind.Method, + detail: 'Refresh dashboard.', + }, /** * Echarts