mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
remove alerting badge in BasicSettings component
This commit is contained in:
parent
fafb711d21
commit
fb33ff9028
@ -11,7 +11,6 @@ const setup = () => {
|
||||
isDefault: false,
|
||||
onDefaultChange: jest.fn(),
|
||||
onNameChange: jest.fn(),
|
||||
alertingSupported: false,
|
||||
};
|
||||
|
||||
return render(<BasicSettings {...props} />);
|
||||
|
@ -1,31 +1,19 @@
|
||||
import { css } from '@emotion/css';
|
||||
import React from 'react';
|
||||
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { InlineField, InlineSwitch, Input, Badge, useStyles2 } from '@grafana/ui';
|
||||
import { InlineField, InlineSwitch, Input } from '@grafana/ui';
|
||||
|
||||
export interface Props {
|
||||
dataSourceName: string;
|
||||
isDefault: boolean;
|
||||
onNameChange: (name: string) => void;
|
||||
onDefaultChange: (value: boolean) => void;
|
||||
alertingSupported: boolean;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export function BasicSettings({
|
||||
dataSourceName,
|
||||
isDefault,
|
||||
onDefaultChange,
|
||||
onNameChange,
|
||||
alertingSupported,
|
||||
disabled,
|
||||
}: Props) {
|
||||
export function BasicSettings({ dataSourceName, isDefault, onDefaultChange, onNameChange, disabled }: Props) {
|
||||
return (
|
||||
<>
|
||||
<AlertingEnabled enabled={alertingSupported} />
|
||||
|
||||
<div className="gf-form-group" aria-label="Datasource settings page basic settings">
|
||||
<div className="gf-form-inline">
|
||||
{/* Name */}
|
||||
@ -64,22 +52,3 @@ export function BasicSettings({
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export function AlertingEnabled({ enabled }: { enabled: boolean }) {
|
||||
const styles = useStyles2(getStyles);
|
||||
return (
|
||||
<div className={styles.badge}>
|
||||
{enabled ? (
|
||||
<Badge color="green" icon="check-circle" text="Alerting supported" />
|
||||
) : (
|
||||
<Badge color="orange" icon="exclamation-triangle" text="Alerting not supported" />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const getStyles = (theme: GrafanaTheme2) => ({
|
||||
badge: css`
|
||||
margin-bottom: ${theme.spacing(2)};
|
||||
`,
|
||||
});
|
||||
|
@ -113,10 +113,6 @@ export function EditDataSourceView({
|
||||
|
||||
const dsi = getDataSourceSrv()?.getInstanceSettings(dataSource.uid);
|
||||
|
||||
const hasAlertingEnabled = Boolean(dsi?.meta?.alerting ?? false);
|
||||
const isAlertManagerDatasource = dsi?.type === 'alertmanager';
|
||||
const alertingSupported = hasAlertingEnabled || isAlertManagerDatasource;
|
||||
|
||||
const onSubmit = async (e: React.MouseEvent<HTMLButtonElement> | React.FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
@ -162,7 +158,6 @@ export function EditDataSourceView({
|
||||
isDefault={dataSource.isDefault}
|
||||
onDefaultChange={onDefaultChange}
|
||||
onNameChange={onNameChange}
|
||||
alertingSupported={alertingSupported}
|
||||
disabled={readOnly || !hasWriteRights}
|
||||
/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user