From f459b360262138b3ce6498a6acc07f9bfea41d06 Mon Sep 17 00:00:00 2001 From: Alex Spencer <52186778+alexjonspencer1@users.noreply.github.com> Date: Thu, 13 Nov 2025 11:46:46 -0800 Subject: [PATCH] init: focus query feature --- packages/grafana-data/src/types/icon.ts | 2 + public/app/core/icons/cached.json | 2 + .../PanelDataPane/PanelDataQueriesTab.tsx | 52 ++++++++++++----- .../query/components/QueryEditorRow.tsx | 57 ++++++++++++++++++- .../query/components/QueryEditorRows.tsx | 46 ++++++++++++++- public/img/icons/unicons/compress-screen.svg | 1 + public/img/icons/unicons/expand-screen.svg | 1 + 7 files changed, 143 insertions(+), 18 deletions(-) create mode 100644 public/img/icons/unicons/compress-screen.svg create mode 100644 public/img/icons/unicons/expand-screen.svg diff --git a/packages/grafana-data/src/types/icon.ts b/packages/grafana-data/src/types/icon.ts index b49be0d5363..10f99af4e81 100644 --- a/packages/grafana-data/src/types/icon.ts +++ b/packages/grafana-data/src/types/icon.ts @@ -41,6 +41,7 @@ export const availableIconsIndex = { asserts: true, 'expand-arrows': true, 'expand-arrows-alt': true, + 'expand-screen': true, at: true, ai: true, backward: true, @@ -85,6 +86,7 @@ export const availableIconsIndex = { 'comments-alt': true, compass: true, 'compress-arrows': true, + 'compress-screen': true, copy: true, 'corner-up-left': true, 'corner-up-right': true, diff --git a/public/app/core/icons/cached.json b/public/app/core/icons/cached.json index e78419e6d72..7cee2c3605b 100644 --- a/public/app/core/icons/cached.json +++ b/public/app/core/icons/cached.json @@ -54,6 +54,7 @@ "unicons/comment-alt", "unicons/comment-alt-share", "unicons/comments-alt", + "unicons/compress-screen", "unicons/compass", "unicons/copy", "unicons/corner-down-right-alt", @@ -73,6 +74,7 @@ "unicons/exclamation-circle", "unicons/exclamation-triangle", "unicons/external-link-alt", + "unicons/expand-screen", "unicons/eye", "unicons/eye-slash", "unicons/file-alt", diff --git a/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx b/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx index 490084b24ff..484bfda39d3 100644 --- a/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx +++ b/public/app/features/dashboard-scene/panel-edit/PanelDataPane/PanelDataQueriesTab.tsx @@ -1,3 +1,6 @@ +import { css, cx } from '@emotion/css'; +import { useState } from 'react'; + import { CoreApp, DataSourceApi, DataSourceInstanceSettings, getDataSourceRef } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { t, Trans } from '@grafana/i18n'; @@ -13,7 +16,7 @@ import { SceneDataQuery, } from '@grafana/scenes'; import { DataQuery, DataSourceRef } from '@grafana/schema'; -import { Button, Stack, Tab } from '@grafana/ui'; +import { Button, Stack, Tab, useStyles2 } from '@grafana/ui'; import { addQuery } from 'app/core/utils/query'; import { getLastUsedDatasourceFromStorage } from 'app/features/dashboard/utils/dashboard'; import { storeLastUsedDataSourceInLocalStorage } from 'app/features/datasources/components/picker/utils'; @@ -91,7 +94,7 @@ export class PanelDataQueriesTab extends SceneObjectBase { // ensure all queries explicitly define a datasource const enrichedQueries = queries.map((q) => @@ -368,22 +375,28 @@ export function PanelDataQueriesTabRendered({ model }: SceneComponentProps - +
+ {!hasFocusedQuery && ( + + )} )} - {config.expressionsEnabled && model.isExpressionsSupported(dsSettings) && ( + {showExpressionButton && (