Skip to content

Commit

Permalink
feat(schema): remove design type from import file schema
Browse files Browse the repository at this point in the history
Signed-off-by: pranjalg1331 <[email protected]>
  • Loading branch information
pranjalg1331 committed Dec 7, 2024
1 parent fe9d911 commit 8484372
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 118 deletions.
140 changes: 23 additions & 117 deletions src/schemas/importDesign/schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,151 +9,57 @@ const importDesignSchema = {
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',
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 design 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 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'
}
},
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']
}
]
};
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/importDesign/uiSchema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 8484372

Please sign in to comment.