mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
bff1bd1026
## About the changes Adds optional support for specifying JSON templates for datadog message payload ![image](https://github.com/Unleash/unleash/assets/707867/eb7c838a-7abf-441e-972e-ddd7ada07efa) ### Important files <!-- PRs can contain a lot of changes, but not all changes are equally important. Where should a reviewer start looking to get an overview of the changes? Are any files particularly important? --> `frontend/src/component/integrations/IntegrationForm/IntegrationParameters/IntegrationParameter/IntegrationParameterEnableWithDropdown.tsx` - a new component comprising of a text field and a dropdown menu `src/lib/addons/datadog.ts` - Where the integration is taking place ## Discussion points <!-- Anything about the PR you'd like to discuss before it gets merged? Got any questions or doubts? --> - Should I have implemented the new component type as a specifiable addon parameter type in definitions? Felt a bit YAGNI/Premature - Would like input on naming and the new component etc
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import Webhook from './webhook';
|
|
import SlackAddon from './slack';
|
|
import TeamsAddon from './teams';
|
|
import DatadogAddon from './datadog';
|
|
import Addon from './addon';
|
|
import { LogProvider } from '../logger';
|
|
import SlackAppAddon from './slack-app';
|
|
import { IFlagResolver } from '../types';
|
|
|
|
export interface IAddonProviders {
|
|
[key: string]: Addon;
|
|
}
|
|
|
|
export const getAddons: (args: {
|
|
getLogger: LogProvider;
|
|
unleashUrl: string;
|
|
flagResolver: IFlagResolver;
|
|
}) => IAddonProviders = ({ getLogger, unleashUrl, flagResolver }) => {
|
|
const slackAppAddonEnabled = flagResolver.isEnabled('slackAppAddon');
|
|
|
|
const slackAddon = new SlackAddon({ getLogger, unleashUrl });
|
|
|
|
if (slackAppAddonEnabled) {
|
|
slackAddon.definition.deprecated =
|
|
'This integration is deprecated. Please try the new Slack App integration instead.';
|
|
}
|
|
|
|
const addons: Addon[] = [
|
|
new Webhook({ getLogger }),
|
|
slackAddon,
|
|
new TeamsAddon({ getLogger, unleashUrl }),
|
|
new DatadogAddon({ getLogger, unleashUrl, flagResolver }),
|
|
];
|
|
|
|
if (slackAppAddonEnabled) {
|
|
addons.push(new SlackAppAddon({ getLogger, unleashUrl }));
|
|
}
|
|
|
|
return addons.reduce((map, addon) => {
|
|
// eslint-disable-next-line no-param-reassign
|
|
map[addon.name] = addon;
|
|
return map;
|
|
}, {});
|
|
};
|