From cacd18c83dc0f1104a05f2002e90d271e5e8c566 Mon Sep 17 00:00:00 2001
From: Kalpesh Dhoke <38274099+kalpesh-d@users.noreply.github.com>
Date: Tue, 5 Mar 2024 19:29:42 +0530
Subject: [PATCH] fix: Disable unsupported generators for AsyncAPI V3 (#979)
(#982)
* fix: Disable unsupported generators for AsyncAPI V3 (#979)
* Refactored GeneratorModal for AsyncAPI V3 support and removed [TRACKING_LINK]
* fix lint errors
* fix warning
---------
Co-authored-by: samz
---
.../src/components/Modals/ConfirmModal.tsx | 21 +++++--
.../Modals/Generator/GeneratorModal.tsx | 59 ++++++++++++++-----
2 files changed, 60 insertions(+), 20 deletions(-)
diff --git a/apps/studio/src/components/Modals/ConfirmModal.tsx b/apps/studio/src/components/Modals/ConfirmModal.tsx
index f219cf7ee..d0bf9ade6 100644
--- a/apps/studio/src/components/Modals/ConfirmModal.tsx
+++ b/apps/studio/src/components/Modals/ConfirmModal.tsx
@@ -7,11 +7,13 @@ import type { ReactNode, FunctionComponent, PropsWithChildren } from 'react';
interface ConfirmModalProps {
title: ReactNode;
description?: ReactNode;
+ warning?: ReactNode;
+ link?: string;
confirmText?: ReactNode;
cancelText?: ReactNode;
confirmDisabled?: boolean;
cancelDisabled?: boolean;
- containerClassName? : string;
+ containerClassName?: string;
closeAfterSumbit?: boolean;
onSubmit?: () => void;
onCancel?: () => void;
@@ -20,6 +22,8 @@ interface ConfirmModalProps {
export const ConfirmModal: FunctionComponent> = ({
title,
description,
+ warning,
+ link,
confirmText = 'Save',
cancelText = 'Cancel',
confirmDisabled = true,
@@ -103,16 +107,23 @@ export const ConfirmModal: FunctionComponent{description}
)}
+ {warning && (
+
+ {warning}
+
+ )}
{children}
{onSubmit && (
{template && (
)}
- )[String(template)]?.schema : {}}
- supportedProtocols={template ? (templates as Record)[String(template)]?.supportedProtocols : []}
+ templateName={template}
+ template={template ? (templates as Record)[String(template)]?.schema : {}}
+ supportedProtocols={template ? (templates as Record)[String(template)]?.supportedProtocols : []}
setConfirmDisabled={setConfirmDisabled}
/>
@@ -152,9 +181,9 @@ export const GeneratorModal = create(() => {
{problem.title}
- {problem.validationErrors &&
+ {problem.validationErrors &&
problem.validationErrors.length &&
- problem.validationErrors.filter(error => error.message).length
+ problem.validationErrors.filter(error => error.message).length
? (
{problem.validationErrors.map(error => (