0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-24 22:41:28 -05:00

refactor(console): remove webhook creation limit (#3903)

This commit is contained in:
Xiao Yijun 2023-05-26 10:44:41 +08:00 committed by GitHub
parent b160452c71
commit d369e0c863
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 1 additions and 63 deletions

View file

@ -1,11 +1,6 @@
import { type Hook } from '@logto/schemas';
import { webhookLimit } from '@logto/shared/universal';
import { Trans, useTranslation } from 'react-i18next';
import Modal from 'react-modal';
import ConfirmModal from '@/components/ConfirmModal';
import TextLink from '@/components/TextLink';
import { contactEmail, contactEmailLink } from '@/consts';
import * as modalStyles from '@/scss/modal.module.scss';
import CreateForm from './CreateForm';
@ -13,33 +8,9 @@ import CreateForm from './CreateForm';
type Props = {
isOpen: boolean;
onClose: (createdHook?: Hook) => void;
existingHooksCount: number;
};
function CreateFormModal({ isOpen, onClose, existingHooksCount }: Props) {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const shouldBlockCreation = existingHooksCount >= webhookLimit;
if (shouldBlockCreation) {
return (
<ConfirmModal
isOpen={isOpen}
cancelButtonText="general.got_it"
onCancel={() => {
onClose();
}}
>
<Trans
components={{
a: <TextLink to={contactEmailLink} />,
}}
>
{t('webhooks.create_form.block_description', { link: contactEmail })}
</Trans>
</ConfirmModal>
);
}
function CreateFormModal({ isOpen, onClose }: Props) {
return (
<Modal
shouldCloseOnOverlayClick

View file

@ -140,7 +140,6 @@ function Webhooks() {
}}
widgets={
<CreateFormModal
existingHooksCount={data?.length ?? 0}
isOpen={isCreateNew}
onClose={(createdHook?: Hook) => {
if (createdHook) {

View file

@ -37,8 +37,6 @@ const webhooks = {
create_webhook: 'Webhook erstellen',
missing_event_error: 'Sie müssen mindestens ein Ereignis auswählen.',
https_format_error: 'HTTPS-Format erforderlich aus Sicherheitsgründen.',
block_description:
'Die aktuelle Version unterstützt nur bis zu drei Webhooks. Wenn Sie zusätzliche Webhooks benötigen, senden Sie bitte eine E-Mail an unser Support-Team unter <a>{{link}}</a> und wir helfen Ihnen gerne weiter.',
},
webhook_created: 'Der Webhook {{name}} wurde erfolgreich erstellt.',
};

View file

@ -36,8 +36,6 @@ const webhooks = {
create_webhook: 'Create webhook',
missing_event_error: 'You have to select at least one event.',
https_format_error: 'HTTPS format required for security reasons.',
block_description:
'The current version supports only up to three webhooks. If you require additional webhooks, please email our support team at <a>{{link}}</a> and we will be happy to assist you.',
},
webhook_created: 'The webhook {{name}} has been successfully created.',
};

View file

@ -37,8 +37,6 @@ const webhooks = {
create_webhook: 'Crear webhook',
missing_event_error: 'Debe seleccionar al menos un evento.',
https_format_error: 'Se requiere formato HTTPS por motivos de seguridad.',
block_description:
'La versión actual admite hasta tres webhooks. Si necesita webhooks adicionales, envíe un correo electrónico a nuestro equipo de soporte a <a>{{link}}</a> y estaremos encantados de ayudarle.',
},
webhook_created: 'El webhook {{name}} se ha creado correctamente.',
};

View file

@ -37,8 +37,6 @@ const webhooks = {
create_webhook: 'Créer un webhook',
missing_event_error: 'Vous devez sélectionner au moins un événement.',
https_format_error: 'Format HTTPS requis pour des raisons de sécurité.',
block_description:
"La version actuelle prend en charge jusqu'à trois webhooks. Si vous avez besoin de webhooks supplémentaires, veuillez envoyer un e-mail à notre équipe d'assistance <a>{{link}}</a> et nous serons heureux de vous aider.",
},
webhook_created: 'Le webhook {{name}} a été créé avec succès.',
};

View file

@ -36,8 +36,6 @@ const webhooks = {
create_webhook: 'Crea webhook',
missing_event_error: 'Devi selezionare almeno un evento.',
https_format_error: 'Richiesto formato HTTPS per motivi di sicurezza.',
block_description:
"La versione corrente supporta solo fino a tre webhook. Se hai bisogno di ulteriori webhook, ti preghiamo di inviare un'email al nostro team di supporto su <a>{{link}}</a> e saremo lieti di assisterti.",
},
webhook_created: 'Il webhook {{name}} è stato creato con successo.',
};

View file

@ -36,8 +36,6 @@ const webhooks = {
create_webhook: 'Webhookを作成する',
missing_event_error: '少なくとも1つのイベントを選択する必要があります。',
https_format_error: 'セキュリティ上の理由からHTTPS形式が必要です。',
block_description:
'現在のバージョンでは、最大3個の Webhook にしか対応していません。追加の webhook が必要な場合は、サポートチーム <a>{{link}}</a> までご連絡ください。',
},
webhook_created: 'Webhook {{name}}が正常に作成されました。',
};

View file

@ -36,8 +36,6 @@ const webhooks = {
create_webhook: 'Webhook 생성',
missing_event_error: '하나 이상의 이벤트를 선택해야 합니다.',
https_format_error: '보안 상의 이유로 HTTPS 형식이 필요합니다.',
block_description:
'현재 버전은 최대 세 개의 웹훅만 지원합니다. 추가 웹훅이 필요한 경우 지원팀 <a>{{link}}</a>에 문의하시기 바랍니다.',
},
webhook_created: 'Webhook {{name}}가 성공적으로 생성되었습니다.',
};

View file

@ -37,8 +37,6 @@ const webhooks = {
create_webhook: 'Utwórz webhook',
missing_event_error: 'Musisz wybrać przynajmniej jedno zdarzenie.',
https_format_error: 'Wymagany format HTTPS ze względu na bezpieczeństwo.',
block_description:
'Aktualna wersja obsługuje tylko do trzech webhooków. Jeśli potrzebujesz dodatkowych webhooków, wyślij e-mail do naszego zespołu pomocy technicznej na adres <a>{{link}}</a>, a chętnie Ci pomożemy.',
},
webhook_created: 'Webhook {{name}} został pomyślnie utworzony.',
};

View file

@ -36,8 +36,6 @@ const webhooks = {
create_webhook: 'Criar webhook',
missing_event_error: 'Você precisa selecionar pelo menos um evento.',
https_format_error: 'Formato HTTPS necessário por motivos de segurança.',
block_description:
'A versão atual suporta apenas até três webhooks. Se você precisar de webhooks adicionais, envie um e-mail para nossa equipe de suporte em <a>{{link}}</a> e teremos prazer em ajudá-lo.',
},
webhook_created: 'O webhook {{name}foi criado com sucesso.',
};

View file

@ -37,8 +37,6 @@ const webhooks = {
create_webhook: 'Criar webhook',
missing_event_error: 'Você deve selecionar pelo menos um evento.',
https_format_error: 'Formato HTTPS exigido por motivos de segurança.',
block_description:
'A versão atual suporta apenas até três webhooks. Se você precisar de webhooks adicionais, envie um e-mail para nossa equipe de suporte em <a>{{link}}</a> e ficaremos felizes em ajudá-lo.',
},
webhook_created: 'O webhook {{name}} foi criado com sucesso.',
};

View file

@ -37,8 +37,6 @@ const webhooks = {
create_webhook: 'Создать вебхук',
missing_event_error: 'Вы должны выбрать как минимум одно событие.',
https_format_error: 'Требуется формат HTTPS по соображениям безопасности.',
block_description:
'Текущая версия поддерживает только до трех вебхуков. Если вам нужны дополнительные вебхуки, напишите нашей службе поддержки по адресу <a>{{link}}</a>, и мы с удовольствием вам поможем.',
},
webhook_created: 'Вебхук {{name}} был успешно создан.',
};

View file

@ -36,8 +36,6 @@ const webhooks = {
create_webhook: 'Webhook Oluştur',
missing_event_error: 'En az bir olay seçmeniz gerekiyor.',
https_format_error: 'Güvenliği nedeniyle HTTPS biçimi gereklidir.',
block_description:
'Geçerli sürüm üç adede kadar webhooks destekler. Ek webhooks gerekiyorsa, lütfen <a>{{link}}</a> e-posta ile destek ekibimize başvurun, yardımcı olmaktan memnuniyet duyarız.',
},
webhook_created: 'Webhook {{name}} başarıyla oluşturuldu.',
};

View file

@ -33,8 +33,6 @@ const webhooks = {
create_webhook: '创建Webhook',
missing_event_error: '您必须至少选择一个事件。',
https_format_error: 'HTTPS格式为安全性所必须。',
block_description:
'当前版本仅支持最多三个Webhook。如果你需要额外的Webhook请通过<a>{{link}}</a>向我们的支持团队发送电子邮件,我们将很乐意提供帮助。',
},
webhook_created: 'Webhook {{name}} 已成功创建。',
};

View file

@ -34,8 +34,6 @@ const webhooks = {
create_webhook: '創建 Webhook',
missing_event_error: '您必須至少選擇一個事件。',
https_format_error: '出於安全原因,需要 HTTPS 格式。',
block_description:
'目前版本僅支持三條 Webhook。 如果需要額外的 Webhook請發送電子郵件至我們的支持團隊 <a>{{link}}</a>,我們將樂意為你提供協助。',
},
webhook_created: 'Webhook {{name}} 成功創建。',
};

View file

@ -34,8 +34,6 @@ const webhooks = {
create_webhook: '創建 webhook',
missing_event_error: '您需要選擇至少一個事件。',
https_format_error: 'HTTPS 格式要求為了安全原因。',
block_description:
'目前版本僅支持三條 Webhook。 如果需要額外的 Webhook請發送電子郵件至我們的支持團隊 <a>{{link}}</a>,我們將樂意為你提供協助。',
},
webhook_created: 'Webhook {{name}} 已成功創建。',
};

View file

@ -1 +0,0 @@
export const webhookLimit = 3;

View file

@ -1,3 +1,2 @@
export * from './database/index.js';
export * from './utils/index.js';
export * from './constants.js';