Skip to content

Commit 7b56133

Browse files
committed
Handle arrays
Signed-off-by: David Gageot <[email protected]>
1 parent bbbc3ac commit 7b56133

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/extension/ui/src/components/tile/ConfigEditor.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ const ConfigEditor = ({
8989
const edited = localConfig[key] !== flattenedConfig[key];
9090
const propertyType = schema.rootSchema.properties[key].type;
9191

92+
let label = key
93+
if (propertyType === "array") {
94+
label += ' (comma separated)';
95+
}
96+
if (requiredAttributes.includes(key)) {
97+
label += ' (required)';
98+
}
99+
92100
return (
93101
<Stack
94102
key={key}
@@ -101,7 +109,7 @@ const ConfigEditor = ({
101109
<TextField
102110
fullWidth
103111
size="small"
104-
label={`${key} ${requiredAttributes.includes(key) ? ' (required)' : ''}`}
112+
label={label}
105113
value={localConfig[key]}
106114
type={propertyType === 'integer' ? 'number' : 'text'}
107115
onChange={(e) =>
@@ -169,6 +177,8 @@ function sanitizeConfig(config: { [key: string]: any; }, catalogItem: CatalogIte
169177
return [key, parseInt(value) || 0];
170178
case "boolean":
171179
return [key, (value as string).toLowerCase() === "true"];
180+
case "array":
181+
return [key, (value as string).split(",").map((item) => item.trim())];
172182
default:
173183
return [key, value];
174184
}

0 commit comments

Comments
 (0)