Skip to content

Commit

Permalink
Merge pull request #903 from layer5io/import-schema
Browse files Browse the repository at this point in the history
Remove DesignType from import schema
  • Loading branch information
aabidsofi19 authored Feb 3, 2025
2 parents 89ebe64 + 3b1276e commit 93b7025
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 121 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@
"billboard.js": "^3.14.3",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"re-resizable": "^6.10.3",
"react-draggable": "^4.4.6",
"moment": "^2.30.1",
"react-share": "^5.1.0"
}
}
154 changes: 35 additions & 119 deletions src/schemas/importDesign/schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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 93b7025

Please sign in to comment.