Prometheus, Loki: Update run queries button (#50005)

* Prometheus, Loki: Updare run queries button

* Update docs

* Update docs
pull/50110/head^2
Ivana Huckova 3 years ago committed by GitHub
parent 49112c8356
commit 9f6afb3475
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      docs/sources/datasources/loki.md
  2. 4
      docs/sources/datasources/prometheus.md
  3. 22
      public/app/plugins/datasource/loki/querybuilder/components/LokiQueryEditorSelector.tsx
  4. 22
      public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryEditorSelector.tsx

@ -63,7 +63,9 @@ The new field with the link shown in log details:
Loki query editor is separated into 3 distinct modes that you can switch between. See docs for each section below.
At the top of the editor there is `Run query` button that will run the query and `Explain | Builder | Code` tabs to switch between the editor modes. If the query editor is in Builder mode there are additional elements explained in the Builder section.
At the top of the editor, select `Run queries` to run a query. Select `Explain | Builder | Code` tabs to switch between the editor modes. If the query editor is in Builder mode, there are additional elements explained in the Builder section.
> **Note:** In Explore, to run Loki queries, select `Run query`.
Each mode is synchronized with the other modes, so you can switch between them without losing your work, although there are some limitations. Some more complex queries are not yet supported in the builder mode. If you try to switch from `Code` to `Builder` with such query, editor will show a popup explaining that you can lose some parts of the query, and you can decide if you still want to continue to `Builder` mode or not.

@ -47,7 +47,9 @@ Prometheus query editor is separated into 3 distinct modes that you can switch b
![Editor toolbar](/static/img/docs/prometheus/header-8-5.png 'Editor toolbar')
At the top of the editor there is `Run query` button that will run the query and `Explain | Builder | Code` tabs to switch between the editor modes. If the query editor is in Builder mode there are additional elements explained in the Builder section.
At the top of the editor, select `Run queries` to run a query. Select `Explain | Builder | Code` tabs to switch between the editor modes. If the query editor is in Builder mode, there are additional elements explained in the Builder section.
> **Note:** In Explore, to run Prometheus queries, select `Run query`.
Each mode is synchronized with the other modes, so you can switch between them without losing your work, although there are some limitations. Some more complex queries are not yet supported in the builder mode. If you try to switch from `Code` to `Builder` with such query, editor will show a popup explaining that you can lose some parts of the query, and you can decide if you still want to continue to `Builder` mode or not.

@ -1,6 +1,6 @@
import React, { SyntheticEvent, useCallback, useEffect, useState } from 'react';
import { LoadingState } from '@grafana/data';
import { CoreApp, LoadingState } from '@grafana/data';
import { EditorHeader, EditorRows, FlexItem, InlineSelect, Space } from '@grafana/experimental';
import { reportInteraction } from '@grafana/runtime';
import { Button, ConfirmModal } from '@grafana/ui';
@ -99,15 +99,17 @@ export const LokiQueryEditorSelector = React.memo<LokiQueryEditorProps>((props)
</>
)}
<FlexItem grow={1} />
<Button
variant={dataIsStale ? 'primary' : 'secondary'}
size="sm"
onClick={onRunQuery}
icon={data?.state === LoadingState.Loading ? 'fa fa-spinner' : undefined}
disabled={data?.state === LoadingState.Loading}
>
Run query
</Button>
{app !== CoreApp.Explore && (
<Button
variant={dataIsStale ? 'primary' : 'secondary'}
size="sm"
onClick={onRunQuery}
icon={data?.state === LoadingState.Loading ? 'fa fa-spinner' : undefined}
disabled={data?.state === LoadingState.Loading}
>
Run queries
</Button>
)}
<QueryEditorModeToggle mode={editorMode!} onChange={onEditorModeChange} />
</EditorHeader>
<Space v={0.5} />

@ -1,6 +1,6 @@
import React, { SyntheticEvent, useCallback, useEffect, useState } from 'react';
import { LoadingState } from '@grafana/data';
import { CoreApp, LoadingState } from '@grafana/data';
import { EditorHeader, EditorRows, FlexItem, InlineSelect, Space } from '@grafana/experimental';
import { reportInteraction } from '@grafana/runtime';
import { Button, ConfirmModal } from '@grafana/ui';
@ -107,15 +107,17 @@ export const PromQueryEditorSelector = React.memo<Props>((props) => {
<FeedbackLink feedbackUrl="https://github.com/grafana/grafana/discussions/47693" />
)}
<FlexItem grow={1} />
<Button
variant={dataIsStale ? 'primary' : 'secondary'}
size="sm"
onClick={onRunQuery}
icon={data?.state === LoadingState.Loading ? 'fa fa-spinner' : undefined}
disabled={data?.state === LoadingState.Loading}
>
Run query
</Button>
{app !== CoreApp.Explore && (
<Button
variant={dataIsStale ? 'primary' : 'secondary'}
size="sm"
onClick={onRunQuery}
icon={data?.state === LoadingState.Loading ? 'fa fa-spinner' : undefined}
disabled={data?.state === LoadingState.Loading}
>
Run queries
</Button>
)}
<QueryEditorModeToggle mode={editorMode} onChange={onEditorModeChange} />
</EditorHeader>
<Space v={0.5} />

Loading…
Cancel
Save