From 76b22c20a83831d36c0d1367b814d3a9bc829913 Mon Sep 17 00:00:00 2001 From: aabidsofi19 Date: Sun, 2 Feb 2025 09:52:47 +0530 Subject: [PATCH] chore: update import schema Signed-off-by: aabidsofi19 --- src/schemas/importDesign/schema.tsx | 154 ++++++-------------------- src/schemas/importDesign/uiSchema.tsx | 2 +- 2 files changed, 36 insertions(+), 120 deletions(-) diff --git a/src/schemas/importDesign/schema.tsx b/src/schemas/importDesign/schema.tsx index d8dd15342..d33f2c113 100644 --- a/src/schemas/importDesign/schema.tsx +++ b/src/schemas/importDesign/schema.tsx @@ -5,157 +5,73 @@ const importDesignSchema = { type: 'string', title: 'Design file name', default: 'Untitled Design', - 'x-rjsf-grid-area': '6', + 'x-rjsf-grid-area': '12', description: 'Provide a name for your design file. This name will help you identify the file more easily. You can also change the name of your design after importing it.' }, - designType: { - title: 'Design type', - enum: ['Helm Chart', 'Kubernetes Manifest', 'Docker Compose', 'Meshery Design'], - 'x-rjsf-grid-area': '6', + // designType: { + // title: 'Design type', + // enum: ['Helm Chart', 'Kubernetes Manifest', 'Docker Compose', 'Meshery Design'], + // 'x-rjsf-grid-area': '6', + // description: + // "Select the type of design you are uploading. The 'Design Type' determines the format, structure, and content of the file you are uploading. Choose the appropriate design type that matches the nature of your file. Checkout https://docs.meshery.io/guides/configuration-management/creating-a-meshery-design to learn more about designs" + // }, + + uploadType: { + title: 'Upload method', + enum: ['File Upload', 'URL Import'], + default: 'URL Import', + 'x-rjsf-grid-area': '12', description: - "Select the type of design you are uploading. The 'Design Type' determines the format, structure, and content of the file you are uploading. Choose the appropriate design type that matches the nature of your file. Checkout https://docs.meshery.io/guides/configuration-management/creating-a-meshery-design to learn more about designs" + "Choose the method you prefer to upload your design file. Select 'File Upload' if you have the file on your local system, or 'URL Import' if you have the file hosted online." } }, + allOf: [ { if: { properties: { - designType: { - const: 'Helm Chart' + uploadType: { + const: 'File Upload' } } }, then: { properties: { - uploadType: { - title: 'Upload method', - enum: ['File Upload', 'URL Import'], - default: 'URL Import', - 'x-rjsf-grid-area': '12', - description: - "Choose the method you prefer to upload your Helm Chart design file. Select 'File Upload' if you have the file on your local system, or 'URL Import' if you have the file hosted online." + file: { + type: 'string', + format: 'file', + description: 'Browse the file from your file system', + 'x-rjsf-grid-area': '12' } }, - allOf: [ - { - if: { - properties: { - uploadType: { - const: 'File Upload' - } - } - }, - then: { - properties: { - file: { - type: 'string', - format: 'file', - description: 'Browse the Helm Chart file from your file system', - 'x-rjsf-grid-area': '12' - } - }, - required: ['file'] - } - }, - { - if: { - properties: { - uploadType: { - const: 'URL Import' - } - } - }, - then: { - properties: { - url: { - type: 'string', - format: 'uri', - title: 'URL', - description: - 'Provide the URL of the Helm Chart design file you want to import. This should be a direct URL to the file, for example: https://raw.github.com/your-design-file.yaml', - 'x-rjsf-grid-area': '12' - } - }, - required: ['url'] - } - } - ], - required: ['uploadType'] + required: ['file'] } }, { if: { properties: { - designType: { - not: { - const: 'Helm Chart' - } + uploadType: { + const: 'URL Import' } } }, then: { properties: { - uploadType: { - title: 'Upload method', - enum: ['File Upload', 'URL Import'], - default: 'URL Import', - 'x-rjsf-grid-area': '12', + url: { + type: 'string', + format: 'uri', + title: 'URL', description: - "Choose the method you prefer to upload your design file. Select 'File Upload' if you have the file on your local system, or 'URL Import' if you have the file hosted online." + 'Provide the URL of the file you want to import. This should be a direct URL to the file, for example: https://raw.github.com/your-design-file.yaml', + 'x-rjsf-grid-area': '12' } }, - allOf: [ - { - if: { - properties: { - uploadType: { - const: 'File Upload' - } - } - }, - then: { - properties: { - file: { - type: 'string', - format: 'file', - description: 'Browse the design file from your file system', - 'x-rjsf-grid-area': '12' - } - }, - required: ['file'] - } - }, - { - if: { - properties: { - uploadType: { - const: 'URL Import' - } - } - }, - then: { - properties: { - url: { - type: 'string', - format: 'uri', - title: 'URL', - description: - 'Provide the URL of the design file you want to import. This should be a direct URL to the file, for example: https://raw.github.com/your-design-file.yaml', - 'x-rjsf-grid-area': '12' - } - }, - required: ['url'] - } - } - ], - required: ['uploadType'] + required: ['url'] } - }, - { - required: ['designType'] } - ] + ], + required: ['uploadType', 'name'] }; export default importDesignSchema; diff --git a/src/schemas/importDesign/uiSchema.tsx b/src/schemas/importDesign/uiSchema.tsx index a2d409a1b..538272477 100644 --- a/src/schemas/importDesign/uiSchema.tsx +++ b/src/schemas/importDesign/uiSchema.tsx @@ -2,7 +2,7 @@ const importDesignUiSchema = { uploadType: { 'ui:widget': 'radio' }, - 'ui:order': ['name', 'designType', 'uploadType', 'file', 'url'] + 'ui:order': ['name', 'uploadType', 'file', 'url'] }; export default importDesignUiSchema;