forked from grafana.jool/grafana-jool
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
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>
|
|
);
|
|
};
|
|
|