mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fixing minor styling issues (#45236)
This commit is contained in:
parent
29d48a503c
commit
089d6d7f7a
@ -2,6 +2,7 @@ import React, { FormEvent } from 'react';
|
|||||||
import { Label, Tooltip, Input, Icon, useStyles2 } from '@grafana/ui';
|
import { Label, Tooltip, Input, Icon, useStyles2 } from '@grafana/ui';
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
import { Stack } from '@grafana/experimental';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
className?: string;
|
className?: string;
|
||||||
@ -20,17 +21,19 @@ export const MatcherFilter = ({ className, onFilterChange, defaultQueryString, q
|
|||||||
return (
|
return (
|
||||||
<div className={className}>
|
<div className={className}>
|
||||||
<Label>
|
<Label>
|
||||||
<Tooltip
|
<Stack gap={0.5}>
|
||||||
content={
|
<span>Search by label</span>
|
||||||
<div>
|
<Tooltip
|
||||||
Filter alerts using label querying, ex:
|
content={
|
||||||
<pre>{`{severity="critical", instance=~"cluster-us-.+"}`}</pre>
|
<div>
|
||||||
</div>
|
Filter alerts using label querying, ex:
|
||||||
}
|
<pre>{`{severity="critical", instance=~"cluster-us-.+"}`}</pre>
|
||||||
>
|
</div>
|
||||||
<Icon className={styles.icon} name="info-circle" size="xs" />
|
}
|
||||||
</Tooltip>
|
>
|
||||||
Search by label
|
<Icon className={styles.icon} name="info-circle" size="sm" />
|
||||||
|
</Tooltip>
|
||||||
|
</Stack>
|
||||||
</Label>
|
</Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { FormEvent, useState } from 'react';
|
import React, { FormEvent, useState } from 'react';
|
||||||
import { Button, Icon, Input, Label, RadioButtonGroup, Tooltip, useStyles } from '@grafana/ui';
|
import { Button, Field, Icon, Input, Label, RadioButtonGroup, Tooltip, useStyles } from '@grafana/ui';
|
||||||
import { DataSourceInstanceSettings, GrafanaTheme, SelectableValue } from '@grafana/data';
|
import { DataSourceInstanceSettings, GrafanaTheme, SelectableValue } from '@grafana/data';
|
||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
@ -9,6 +9,7 @@ import { useQueryParams } from 'app/core/hooks/useQueryParams';
|
|||||||
import { getFiltersFromUrlParams } from '../../utils/misc';
|
import { getFiltersFromUrlParams } from '../../utils/misc';
|
||||||
import { DataSourcePicker } from '@grafana/runtime';
|
import { DataSourcePicker } from '@grafana/runtime';
|
||||||
import { alertStateToReadable } from '../../utils/rules';
|
import { alertStateToReadable } from '../../utils/rules';
|
||||||
|
import { Stack } from '@grafana/experimental';
|
||||||
|
|
||||||
const ViewOptions: SelectableValue[] = [
|
const ViewOptions: SelectableValue[] = [
|
||||||
{
|
{
|
||||||
@ -87,8 +88,7 @@ const RulesFilter = () => {
|
|||||||
const searchIcon = <Icon name={'search'} />;
|
const searchIcon = <Icon name={'search'} />;
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.inputWidth}>
|
<Field className={styles.inputWidth} label="Search by data source">
|
||||||
<Label>Search by data source</Label>
|
|
||||||
<DataSourcePicker
|
<DataSourcePicker
|
||||||
key={dataSourceKey}
|
key={dataSourceKey}
|
||||||
alerting
|
alerting
|
||||||
@ -98,23 +98,29 @@ const RulesFilter = () => {
|
|||||||
onChange={handleDataSourceChange}
|
onChange={handleDataSourceChange}
|
||||||
onClear={clearDataSource}
|
onClear={clearDataSource}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Field>
|
||||||
<div className={cx(styles.flexRow, styles.spaceBetween)}>
|
<div className={cx(styles.flexRow, styles.spaceBetween)}>
|
||||||
<div className={styles.flexRow}>
|
<div className={styles.flexRow}>
|
||||||
<div className={styles.rowChild}>
|
<Field
|
||||||
<Label>
|
className={styles.rowChild}
|
||||||
<Tooltip
|
label={
|
||||||
content={
|
<Label>
|
||||||
<div>
|
<Stack gap={0.5}>
|
||||||
Filter rules and alerts using label querying, ex:
|
<span>Search by label</span>
|
||||||
<pre>{`{severity="critical", instance=~"cluster-us-.+"}`}</pre>
|
<Tooltip
|
||||||
</div>
|
content={
|
||||||
}
|
<div>
|
||||||
>
|
Filter rules and alerts using label querying, ex:
|
||||||
<Icon name="info-circle" className={styles.tooltip} />
|
<code>{`{severity="critical", instance=~"cluster-us-.+"}`}</code>
|
||||||
</Tooltip>
|
</div>
|
||||||
Search by label
|
}
|
||||||
</Label>
|
>
|
||||||
|
<Icon name="info-circle" size="sm" />
|
||||||
|
</Tooltip>
|
||||||
|
</Stack>
|
||||||
|
</Label>
|
||||||
|
}
|
||||||
|
>
|
||||||
<Input
|
<Input
|
||||||
key={queryStringKey}
|
key={queryStringKey}
|
||||||
className={styles.inputWidth}
|
className={styles.inputWidth}
|
||||||
@ -124,7 +130,7 @@ const RulesFilter = () => {
|
|||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
data-testid="search-query-input"
|
data-testid="search-query-input"
|
||||||
/>
|
/>
|
||||||
</div>
|
</Field>
|
||||||
<div className={styles.rowChild}>
|
<div className={styles.rowChild}>
|
||||||
<Label>State</Label>
|
<Label>State</Label>
|
||||||
<RadioButtonGroup options={stateOptions} value={alertState} onChange={handleAlertStateChange} />
|
<RadioButtonGroup options={stateOptions} value={alertState} onChange={handleAlertStateChange} />
|
||||||
@ -169,12 +175,8 @@ const getStyles = (theme: GrafanaTheme) => {
|
|||||||
container: css`
|
container: css`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-bottom: 1px solid ${theme.colors.border1};
|
|
||||||
padding-bottom: ${theme.spacing.sm};
|
padding-bottom: ${theme.spacing.sm};
|
||||||
|
margin-bottom: ${theme.spacing.sm};
|
||||||
& > div {
|
|
||||||
margin-bottom: ${theme.spacing.sm};
|
|
||||||
}
|
|
||||||
`,
|
`,
|
||||||
inputWidth: css`
|
inputWidth: css`
|
||||||
width: 340px;
|
width: 340px;
|
||||||
@ -191,11 +193,7 @@ const getStyles = (theme: GrafanaTheme) => {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
`,
|
`,
|
||||||
rowChild: css`
|
rowChild: css`
|
||||||
margin-right: ${theme.spacing.sm};
|
margin: 0 ${theme.spacing.sm} 0 0;
|
||||||
margin-top: ${theme.spacing.sm};
|
|
||||||
`,
|
|
||||||
tooltip: css`
|
|
||||||
margin: 0 ${theme.spacing.xs};
|
|
||||||
`,
|
`,
|
||||||
clearButton: css`
|
clearButton: css`
|
||||||
margin-top: ${theme.spacing.sm};
|
margin-top: ${theme.spacing.sm};
|
||||||
|
@ -7,6 +7,7 @@ import { getSilenceFiltersFromUrlParams } from '../../utils/misc';
|
|||||||
import { SilenceState } from 'app/plugins/datasource/alertmanager/types';
|
import { SilenceState } from 'app/plugins/datasource/alertmanager/types';
|
||||||
import { parseMatchers } from '../../utils/alertmanager';
|
import { parseMatchers } from '../../utils/alertmanager';
|
||||||
import { debounce, uniqueId } from 'lodash';
|
import { debounce, uniqueId } from 'lodash';
|
||||||
|
import { Stack } from '@grafana/experimental';
|
||||||
|
|
||||||
const stateOptions: SelectableValue[] = Object.entries(SilenceState).map(([key, value]) => ({
|
const stateOptions: SelectableValue[] = Object.entries(SilenceState).map(([key, value]) => ({
|
||||||
label: key,
|
label: key,
|
||||||
@ -45,19 +46,21 @@ export const SilencesFilter = () => {
|
|||||||
<Field
|
<Field
|
||||||
className={styles.rowChild}
|
className={styles.rowChild}
|
||||||
label={
|
label={
|
||||||
<span className={styles.fieldLabel}>
|
<Label>
|
||||||
<Tooltip
|
<Stack gap={0.5}>
|
||||||
content={
|
<span>Search by matchers</span>
|
||||||
<div>
|
<Tooltip
|
||||||
Filter silences by matchers using a comma separated list of matchers, ie:
|
content={
|
||||||
<pre>{`severity=critical, instance=~cluster-us-.+`}</pre>
|
<div>
|
||||||
</div>
|
Filter silences by matchers using a comma separated list of matchers, ie:
|
||||||
}
|
<pre>{`severity=critical, instance=~cluster-us-.+`}</pre>
|
||||||
>
|
</div>
|
||||||
<Icon name="info-circle" />
|
}
|
||||||
</Tooltip>{' '}
|
>
|
||||||
Search by matchers
|
<Icon name="info-circle" size="sm" />
|
||||||
</span>
|
</Tooltip>
|
||||||
|
</Stack>
|
||||||
|
</Label>
|
||||||
}
|
}
|
||||||
invalid={inputInvalid}
|
invalid={inputInvalid}
|
||||||
error={inputInvalid ? 'Query must use valid matcher syntax' : null}
|
error={inputInvalid ? 'Query must use valid matcher syntax' : null}
|
||||||
@ -72,11 +75,9 @@ export const SilencesFilter = () => {
|
|||||||
data-testid="search-query-input"
|
data-testid="search-query-input"
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
<Field className={styles.rowChild} label="State">
|
||||||
<div className={styles.rowChild}>
|
|
||||||
<Label>State</Label>
|
|
||||||
<RadioButtonGroup options={stateOptions} value={silenceState} onChange={handleSilenceStateChange} />
|
<RadioButtonGroup options={stateOptions} value={silenceState} onChange={handleSilenceStateChange} />
|
||||||
</div>
|
</Field>
|
||||||
{(queryString || silenceState) && (
|
{(queryString || silenceState) && (
|
||||||
<div className={styles.rowChild}>
|
<div className={styles.rowChild}>
|
||||||
<Button variant="secondary" icon="times" onClick={clearFilters}>
|
<Button variant="secondary" icon="times" onClick={clearFilters}>
|
||||||
|
@ -17,6 +17,7 @@ import { ActionIcon } from '../rules/ActionIcon';
|
|||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { expireSilenceAction } from '../../state/actions';
|
import { expireSilenceAction } from '../../state/actions';
|
||||||
import { SilenceDetails } from './SilenceDetails';
|
import { SilenceDetails } from './SilenceDetails';
|
||||||
|
import { Stack } from '@grafana/experimental';
|
||||||
|
|
||||||
export interface SilenceTableItem extends Silence {
|
export interface SilenceTableItem extends Silence {
|
||||||
silencedAlerts: AlertmanagerAlert[];
|
silencedAlerts: AlertmanagerAlert[];
|
||||||
@ -221,7 +222,7 @@ function useColumns(alertManagerSourceName: string) {
|
|||||||
label: 'Actions',
|
label: 'Actions',
|
||||||
renderCell: function renderActions({ data: silence }) {
|
renderCell: function renderActions({ data: silence }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<Stack gap={0.5}>
|
||||||
{silence.status.state === 'expired' ? (
|
{silence.status.state === 'expired' ? (
|
||||||
<Link href={makeAMLink(`/alerting/silence/${silence.id}/edit`, alertManagerSourceName)}>
|
<Link href={makeAMLink(`/alerting/silence/${silence.id}/edit`, alertManagerSourceName)}>
|
||||||
<ActionButton icon="sync">Recreate</ActionButton>
|
<ActionButton icon="sync">Recreate</ActionButton>
|
||||||
@ -239,10 +240,10 @@ function useColumns(alertManagerSourceName: string) {
|
|||||||
tooltip="edit"
|
tooltip="edit"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</Stack>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
size: '140px',
|
size: '147px',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return columns;
|
return columns;
|
||||||
|
Loading…
Reference in New Issue
Block a user