- {spec.resources &&
- spec.resources?.length > 0 &&
- spec.resources?.map((resource, j) => (
-
-
- {t('Resource')}:
-
-
{resource?.type}
-
-
- {t('Resource Amount')}:
-
-
{resource?.request}
-
+
+
+ {stepSource &&
+ stepSource?.length > 0 &&
+ !rawType &&
+ stepSource?.map((spec, i) => {
+ return (
+
+
+
+
+
+
+
+
+ {spec.resources &&
+ spec.resources?.length > 0 &&
+ spec.resources?.map((resource, j) => (
+
+ ))}
+ {spec?.arguments && (
+
+
+
+ )}
- ))}
+ {isSelected(spec?.name) && (
+
+
+ {t('Parameters')}
+
+
+
+ )}
+
+
-
- )
- })}
-
-
-
-
+ )
+ })}
+
+
+
+
+
+
>
diff --git a/console/src/domain/job/utils.ts b/console/src/domain/job/utils.ts
new file mode 100644
index 0000000000..81eb32607e
--- /dev/null
+++ b/console/src/domain/job/utils.ts
@@ -0,0 +1,85 @@
+// @ts-nocheck
+
+const SPLITER = '@@@'
+
+function convertToRJSF(sourceJson) {
+ const schema = {
+ type: 'object',
+ properties: {},
+ }
+
+ const uiSchema = {}
+
+ const mapParamTypeToRJSFType = (paramType) => {
+ switch (paramType) {
+ case 'INT':
+ return 'integer'
+ case 'FLOAT':
+ return 'number'
+ case 'BOOL':
+ return 'boolean'
+ case 'STRING':
+ return 'string'
+ default:
+ return 'string' // Default to string if param_type is not recognized
+ }
+ }
+
+ const traverse = (obj, parentKey, parentIsMultiple) => {
+ if (typeof obj === 'object' && obj !== null) {
+ Object.keys(obj).forEach((key) => {
+ const currentKey = parentKey ? `${parentKey}${SPLITER}${key}` : key
+ const field = obj[key]
+
+ if (field) {
+ const rjsfField = {
+ type: mapParamTypeToRJSFType(field.type.param_type),
+ title: field.help,
+ default: field.default,
+ }
+
+ if (field.type.choices && field.type.choices?.length > 0) {
+ rjsfField.enum = field.type.choices
+ }
+
+ if (field.multiple || parentIsMultiple) {
+ rjsfField.type = 'array'
+ rjsfField.items = {
+ type: mapParamTypeToRJSFType(field.type.param_type),
+ default: field.default,
+ }
+
+ if (field.type.choices !== null && field.type.choices.length > 0) {
+ rjsfField.items.enum = field.type.choices
+ rjsfField.uniqueItems = true
+ }
+ }
+
+ schema.properties[currentKey] = rjsfField
+
+ if (field.hidden) {
+ delete uiSchema[currentKey]
+ // uiSchema[currentKey] = {
+ // ...uiSchema[currentKey],
+ // 'ui:widget': 'hidden',
+ // }
+ }
+
+ if (typeof field.type.name === 'object' && field.type.name !== null) {
+ traverse(field.type.name, currentKey, field.multiple)
+ }
+ }
+ })
+ }
+ }
+
+ sourceJson?.forEach((level1) => {
+ Object.entries(level1?.arguments ?? {}).forEach(([level2Name, level2]) => {
+ traverse(level2, [level1.job_name, level2Name].filter(Boolean).join(SPLITER))
+ })
+ })
+
+ return { schema, uiSchema }
+}
+
+export { convertToRJSF }
diff --git a/console/src/i18n/locales.ts b/console/src/i18n/locales.ts
index d7815e9341..0251b2909d 100644
--- a/console/src/i18n/locales.ts
+++ b/console/src/i18n/locales.ts
@@ -2232,8 +2232,16 @@ const locales0 = {
zh: '副本',
},
'Raw Type': {
- en: 'Edit',
- zh: '修改',
+ en: 'Advanced Setting',
+ zh: '高级配置',
+ },
+ 'Adjust Arguments': {
+ en: 'Adjust Arguments',
+ zh: '调整参数',
+ },
+ 'Parameters': {
+ en: 'Parameters',
+ zh: '参数',
},
'eval debug mode': {
en: 'Debug Mode',