remove alerting badge in BasicSettings component

This commit is contained in:
Taewoo Kim 2023-05-15 14:56:08 -04:00
parent fafb711d21
commit fb33ff9028
No known key found for this signature in database
GPG Key ID: 7C087A6608A0EF07
3 changed files with 2 additions and 39 deletions

View File

@ -11,7 +11,6 @@ const setup = () => {
isDefault: false,
onDefaultChange: jest.fn(),
onNameChange: jest.fn(),
alertingSupported: false,
};
return render(<BasicSettings {...props} />);

View File

@ -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)};
`,
});

View File

@ -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}
/>