Spaces:
Running
Running
Xianbao QIAN
commited on
Commit
•
16bec5a
1
Parent(s):
afa132e
models - pop up page
Browse files- src/app/page.tsx +24 -3
src/app/page.tsx
CHANGED
@@ -210,10 +210,31 @@ export default function Home() {
|
|
210 |
const orgTotalPages = Math.ceil(sortedOrgData.length / orgPageSize);
|
211 |
|
212 |
const handleModelChildrenClick = (model: ModelData, type: 'direct' | 'all') => {
|
|
|
|
|
213 |
setSelectedModel(model);
|
214 |
setSelectedModelChildrenType(type);
|
215 |
-
|
216 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
};
|
218 |
|
219 |
const handleOrgModelsClick = (org: string) => {
|
@@ -385,7 +406,7 @@ export default function Home() {
|
|
385 |
</h2>
|
386 |
{selectedModelChildren.length > 0 ? (
|
387 |
<Table
|
388 |
-
data={selectedModelChildren.map((child) => ({ model: child }))}
|
389 |
columns={[{ key: 'model', label: 'Model' }]}
|
390 |
pageSize={modalPageSize}
|
391 |
currentPage={modelChildrenPage}
|
|
|
210 |
const orgTotalPages = Math.ceil(sortedOrgData.length / orgPageSize);
|
211 |
|
212 |
const handleModelChildrenClick = (model: ModelData, type: 'direct' | 'all') => {
|
213 |
+
console.log('Model data:', model);
|
214 |
+
console.log('Children type:', type);
|
215 |
setSelectedModel(model);
|
216 |
setSelectedModelChildrenType(type);
|
217 |
+
let children;
|
218 |
+
if (type === 'direct') {
|
219 |
+
children = model.direct_children || [];
|
220 |
+
} else {
|
221 |
+
children = model.all_children || [];
|
222 |
+
}
|
223 |
+
console.log('Children:', children);
|
224 |
+
|
225 |
+
// Handle Vector data structure
|
226 |
+
if (children && typeof children === 'object' && 'get' in children && 'length' in children) {
|
227 |
+
const vectorChildren = [];
|
228 |
+
for (let i = 0; i < children.length; i++) {
|
229 |
+
vectorChildren.push(children.get(i));
|
230 |
+
}
|
231 |
+
setSelectedModelChildren(vectorChildren);
|
232 |
+
} else if (Array.isArray(children)) {
|
233 |
+
setSelectedModelChildren(children);
|
234 |
+
} else {
|
235 |
+
console.error('Unexpected children data structure:', children);
|
236 |
+
setSelectedModelChildren([]);
|
237 |
+
}
|
238 |
};
|
239 |
|
240 |
const handleOrgModelsClick = (org: string) => {
|
|
|
406 |
</h2>
|
407 |
{selectedModelChildren.length > 0 ? (
|
408 |
<Table
|
409 |
+
data={selectedModelChildren.map((child, index) => ({ id: index, model: child }))}
|
410 |
columns={[{ key: 'model', label: 'Model' }]}
|
411 |
pageSize={modalPageSize}
|
412 |
currentPage={modelChildrenPage}
|