Skip to content

Commit

Permalink
chore: rename incoming webhooks to signals (#6415)
Browse files Browse the repository at this point in the history
  • Loading branch information
nunogois committed Mar 4, 2024
1 parent 4fc0a80 commit 6872933
Show file tree
Hide file tree
Showing 50 changed files with 777 additions and 875 deletions.
Expand Up @@ -108,10 +108,10 @@ const PremiumFeatures = {
url: 'https://docs.getunleash.io/reference/banners',
label: 'Banners',
},
'incoming-webhooks': {
signals: {
plan: FeaturePlan.ENTERPRISE,
url: 'https://docs.getunleash.io/reference/incoming-webhooks',
label: 'Incoming Webhooks',
url: 'https://docs.getunleash.io/reference/signals',
label: 'Signals',
},
actions: {
plan: FeaturePlan.ENTERPRISE,
Expand Down
41 changes: 0 additions & 41 deletions frontend/src/component/incomingWebhooks/IncomingWebhooks.tsx

This file was deleted.

This file was deleted.

Expand Up @@ -8,10 +8,10 @@ import { RequestIntegrationCard } from '../RequestIntegrationCard/RequestIntegra
import { OFFICIAL_SDKS } from './SDKs';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { useUiFlag } from 'hooks/useUiFlag';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';

interface IAvailableIntegrationsProps {
providers: AddonTypeSchema[];
onNewIncomingWebhook: () => void;
}

const StyledContainer = styled('div')(({ theme }) => ({
Expand Down Expand Up @@ -53,9 +53,9 @@ const StyledGrayContainer = styled('div')(({ theme }) => ({

export const AvailableIntegrations: VFC<IAvailableIntegrationsProps> = ({
providers,
onNewIncomingWebhook,
}) => {
const incomingWebhooksEnabled = useUiFlag('incomingWebhooks');
const { isEnterprise } = useUiConfig();
const signalsEnabled = useUiFlag('signals');

const customProviders = [JIRA_INFO];
const serverSdks = OFFICIAL_SDKS.filter((sdk) => sdk.type === 'server');
Expand Down Expand Up @@ -98,13 +98,13 @@ export const AvailableIntegrations: VFC<IAvailableIntegrationsProps> = ({
),
)}
<ConditionallyRender
condition={incomingWebhooksEnabled}
condition={isEnterprise() && signalsEnabled}
show={
<IntegrationCard
icon='webhook'
title='Incoming Webhooks'
description='Incoming Webhooks allow third-party services to send observable events to Unleash.'
onClick={onNewIncomingWebhook}
title='Signals'
description='Signal endpoints allow third-party services to send signals to Unleash.'
link='/integrations/signals'
/>
}
/>
Expand Down
Expand Up @@ -4,6 +4,10 @@ import { StyledCardsGrid } from '../IntegrationList.styles';
import { IntegrationCard } from '../IntegrationCard/IntegrationCard';
import { VFC } from 'react';
import { Typography, styled } from '@mui/material';
import { useSignalEndpoints } from 'hooks/api/getters/useSignalEndpoints/useSignalEndpoints';
import { useUiFlag } from 'hooks/useUiFlag';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';

const StyledConfiguredSection = styled('section')(({ theme }) => ({
display: 'flex',
Expand All @@ -23,6 +27,10 @@ export const ConfiguredIntegrations: VFC<ConfiguredIntegrationsProps> = ({
addons,
providers,
}) => {
const { signalEndpoints } = useSignalEndpoints();
const signalsEnabled = useUiFlag('signals');
const { isEnterprise } = useUiConfig();

const ref = useLoading(loading || false);

return (
Expand Down Expand Up @@ -65,6 +73,26 @@ export const ConfiguredIntegrations: VFC<ConfiguredIntegrationsProps> = ({
/>
);
})}
<ConditionallyRender
condition={
isEnterprise() && signalsEnabled
// && signalEndpoints.length > 0
}
show={
<IntegrationCard
variant='stacked'
icon='webhook'
title='Signals'
description={`${
signalEndpoints.length
} signal endpoint${
signalEndpoints.length === 1 ? '' : 's'
} configured`}
link='/integrations/signals'
configureActionText='View signal endpoints'
/>
}
/>
</StyledCardsGrid>
</StyledConfiguredSection>
);
Expand Down
Expand Up @@ -10,7 +10,10 @@ import type { AddonSchema } from 'openapi';
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';

type CardVariant = 'default' | 'stacked';

interface IIntegrationCardBaseProps {
variant?: CardVariant;
id?: string | number;
icon?: string;
title: string;
Expand All @@ -37,7 +40,9 @@ type IIntegrationCardProps =
| IIntegrationCardWithLinkProps
| IIntegrationCardWithOnClickProps;

const StyledCard = styled('div')(({ theme }) => ({
const StyledCard = styled('div', {
shouldForwardProp: (prop) => prop !== 'variant',
})<{ variant?: CardVariant }>(({ theme, variant = 'default' }) => ({
display: 'flex',
flexDirection: 'column',
padding: theme.spacing(3),
Expand All @@ -48,6 +53,24 @@ const StyledCard = styled('div')(({ theme }) => ({
':hover': {
backgroundColor: theme.palette.action.hover,
},
...(variant === 'stacked' && {
position: 'relative',
zIndex: 0,
'&:after': {
content: '""',
width: 'auto',
height: theme.spacing(0.75),
position: 'absolute',
zIndex: -1,
bottom: theme.spacing(-0.75),
left: theme.spacing(1),
right: theme.spacing(1),
borderBottomLeftRadius: `${theme.shape.borderRadiusMedium}px`,
borderBottomRightRadius: `${theme.shape.borderRadiusMedium}px`,
border: `1px solid ${theme.palette.divider}`,
boxShadow: theme.boxShadows.card,
},
}),
}));

const StyledLink = styled(Link)({
Expand Down Expand Up @@ -89,6 +112,7 @@ const StyledOpenInNewIcon = styled(OpenInNewIcon)(({ theme }) => ({
}));

export const IntegrationCard: VFC<IIntegrationCardProps> = ({
variant = 'default',
icon,
title,
description,
Expand All @@ -113,7 +137,7 @@ export const IntegrationCard: VFC<IIntegrationCardProps> = ({
};

const content = (
<StyledCard>
<StyledCard variant={variant}>
<StyledHeader>
<StyledTitle variant='h3' data-loading>
<IntegrationIcon name={icon as string} /> {title}
Expand Down

0 comments on commit 6872933

Please sign in to comment.