Commit 420acd42 authored by wenmo's avatar wenmo

数据源切换发生bug时容错

parent 94d69437
......@@ -41,21 +41,25 @@ const StudioMetaData = (props: any) => {
const res = showMetaDataTable(databaseId);
res.then((result) => {
let tables = result.datas;
for(let i=0;i<tables.length;i++){
tables[i].title=tables[i].name;
tables[i].key=tables[i].name;
tables[i].icon = <DatabaseOutlined />;
tables[i].children=tables[i].tables;
for(let j=0;j<tables[i].children.length;j++){
tables[i].children[j].title=tables[i].children[j].name;
tables[i].children[j].key=tables[i].name+'.'+tables[i].children[j].name;
tables[i].children[j].icon=<TableOutlined />;
tables[i].children[j].isLeaf=true;
tables[i].children[j].schema=tables[i].name;
tables[i].children[j].table=tables[i].children[j].name;
if(tables) {
for (let i = 0; i < tables.length; i++) {
tables[i].title = tables[i].name;
tables[i].key = tables[i].name;
tables[i].icon = <DatabaseOutlined/>;
tables[i].children = tables[i].tables;
for (let j = 0; j < tables[i].children.length; j++) {
tables[i].children[j].title = tables[i].children[j].name;
tables[i].children[j].key = tables[i].name + '.' + tables[i].children[j].name;
tables[i].children[j].icon = <TableOutlined/>;
tables[i].children[j].isLeaf = true;
tables[i].children[j].schema = tables[i].name;
tables[i].children[j].table = tables[i].children[j].name;
}
}
setTreeData(tables);
}else{
setTreeData([]);
}
setTreeData(tables);
});
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment