Skip to content

Commit 360cc66

Browse files
committed
refactor ResourceSchema: clean up unused format cell and improve error message
1 parent 75c654a commit 360cc66

File tree

1 file changed

+6
-20
lines changed
  • app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/resources/components

1 file changed

+6
-20
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/[id]/edit/resources/components/ResourceSchema.tsx

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const ResourceSchema = ({
5353
...newData[rowIndex],
5454
[field]: newValue,
5555
};
56-
56+
5757
setUpdatedData(newData);
5858
setSchema(newData);
5959
handleSave(newData);
@@ -109,29 +109,15 @@ export const ResourceSchema = ({
109109
{
110110
accessorKey: 'format',
111111
header: 'FORMAT',
112-
cell: (info: any) => {
113-
const rowIndex = info.row.index;
114-
const format = updatedData[rowIndex]?.format || '';
115-
return (
116-
<Select
117-
label="Resource List"
118-
labelHidden
119-
options={options}
120-
value={format}
121-
onChange={(e) => handleFieldChange('format', e, rowIndex)}
122-
name="Select format"
123-
/>
124-
);
125-
},
126112
},
127113
];
128114
};
129115

130116
const generateTableData = (updatedData: any[]) => {
131-
return updatedData.map((item: any) => ({
132-
fieldName: item.fieldName,
133-
description: item.description,
134-
format: item.format,
117+
return updatedData?.map((item: any) => ({
118+
fieldName: item?.fieldName,
119+
description: item?.description,
120+
format: item?.format,
135121
}));
136122
};
137123

@@ -146,7 +132,7 @@ export const ResourceSchema = ({
146132
hideSelection
147133
/>
148134
) : (
149-
<div className="mt-8 flex justify-center">Click on Reset Fields</div>
135+
<div className="mt-8 flex justify-center">Failed to Generate Schema</div>
150136
)}
151137
</div>
152138
</>

0 commit comments

Comments
 (0)