grafana/public/app/features/alerting/components/ChannelSettings.tsx
Torkel Ödegaard cf2d557974
Alerts/InfoBox: Replaces all uses of InfoBox & FeatureInfoBox with Alert (#33352)
* Alerts/InfoBox: Replaces all uses of InfoBox & FeatureInfoBox with Alert

* Fixes some more stuff

* fixed border radius
2021-04-26 07:18:46 +02:00

37 lines
1.2 KiB
TypeScript

import React, { FC } from 'react';
import { Alert, CollapsableSection } from '@grafana/ui';
import { NotificationChannelOptions } from './NotificationChannelOptions';
import { NotificationSettingsProps } from './NotificationChannelForm';
import { NotificationChannelSecureFields, NotificationChannelType } from '../../../types';
interface Props extends NotificationSettingsProps {
selectedChannel: NotificationChannelType;
secureFields: NotificationChannelSecureFields;
resetSecureField: (key: string) => void;
}
export const ChannelSettings: FC<Props> = ({
control,
currentFormValues,
errors,
selectedChannel,
secureFields,
register,
resetSecureField,
}) => {
return (
<CollapsableSection label={`Optional ${selectedChannel.heading}`} isOpen={false}>
{selectedChannel.info !== '' && <Alert severity="info" title={selectedChannel.info ?? ''} />}
<NotificationChannelOptions
selectedChannelOptions={selectedChannel.options.filter((o) => !o.required)}
currentFormValues={currentFormValues}
register={register}
errors={errors}
control={control}
onResetSecureField={resetSecureField}
secureFields={secureFields}
/>
</CollapsableSection>
);
};