mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
* implement edit page * connectWithCleanup * remove angular related code * use loadingindicator * use the correct loading component * handle secureFields * fixed implementation of secure fields * Keep secureFields after rerendering the form * CollapsableSection and Page refactor * use checkbox instead of switch * fix comment * add cursor to section * Fixed issues after PR review * Fix issue with some settings being undefined * new reducer and start with test * algorithm to migrate secure fields * UX: Minor UI Tweaks * Added field around checkboxes, and missing required field * fixed test * tests for util * minor tweaks and changes * define as records * fix typ error * forward invalid to textarea and inputcontrol * merge formdata and redux data in test * fix issue with creating channel * do not figure out securefields in migration Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import React, { FC } from 'react';
|
|
import { CollapsableSection, InfoBox } 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 !== '' && <InfoBox>{selectedChannel.info}</InfoBox>}
|
|
<NotificationChannelOptions
|
|
selectedChannelOptions={selectedChannel.options.filter(o => !o.required)}
|
|
currentFormValues={currentFormValues}
|
|
register={register}
|
|
errors={errors}
|
|
control={control}
|
|
onResetSecureField={resetSecureField}
|
|
secureFields={secureFields}
|
|
/>
|
|
</CollapsableSection>
|
|
);
|
|
};
|