mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-26 01:23:18 +08:00
fix: show table list only if it’s bound with a connection
This commit is contained in:
@ -164,38 +164,39 @@ const ConnectionSidebar = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{tableSchemaLoadingState.isLoading ? (
|
{currentConnectionCtx &&
|
||||||
<div className="w-full h-12 flex flex-row justify-start items-center px-4 sticky top-0 border z-1 mb-4 mt-2 rounded-lg text-sm text-gray-600 dark:text-gray-400">
|
(tableSchemaLoadingState.isLoading ? (
|
||||||
<Icon.BiLoaderAlt className="w-4 h-auto animate-spin mr-1" />{" "}
|
<div className="w-full h-12 flex flex-row justify-start items-center px-4 sticky top-0 border z-1 mb-4 mt-2 rounded-lg text-sm text-gray-600 dark:text-gray-400">
|
||||||
{t("common.loading")}
|
<Icon.BiLoaderAlt className="w-4 h-auto animate-spin mr-1" />{" "}
|
||||||
</div>
|
{t("common.loading")}
|
||||||
) : (
|
|
||||||
tableList.length > 0 && (
|
|
||||||
<div className="w-full sticky top-0 z-1 my-4">
|
|
||||||
<Select
|
|
||||||
className="w-full px-4 py-3 !text-base"
|
|
||||||
value={
|
|
||||||
conversationStore.getConversationById(
|
|
||||||
conversationStore.currentConversationId
|
|
||||||
)?.tableName || ""
|
|
||||||
}
|
|
||||||
itemList={tableList.map((table) => {
|
|
||||||
return {
|
|
||||||
label:
|
|
||||||
table.name === ""
|
|
||||||
? t("connection.all-tables")
|
|
||||||
: table.name,
|
|
||||||
value: table.name,
|
|
||||||
};
|
|
||||||
})}
|
|
||||||
onValueChange={(tableName) =>
|
|
||||||
handleTableNameSelect(tableName)
|
|
||||||
}
|
|
||||||
placeholder={t("connection.select-table") || ""}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
) : (
|
||||||
)}
|
tableList.length > 0 && (
|
||||||
|
<div className="w-full sticky top-0 z-1 my-4">
|
||||||
|
<Select
|
||||||
|
className="w-full px-4 py-3 !text-base"
|
||||||
|
value={
|
||||||
|
conversationStore.getConversationById(
|
||||||
|
conversationStore.currentConversationId
|
||||||
|
)?.tableName || ""
|
||||||
|
}
|
||||||
|
itemList={tableList.map((table) => {
|
||||||
|
return {
|
||||||
|
label:
|
||||||
|
table.name === ""
|
||||||
|
? t("connection.all-tables")
|
||||||
|
: table.name,
|
||||||
|
value: table.name,
|
||||||
|
};
|
||||||
|
})}
|
||||||
|
onValueChange={(tableName) =>
|
||||||
|
handleTableNameSelect(tableName)
|
||||||
|
}
|
||||||
|
placeholder={t("connection.select-table") || ""}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
))}
|
||||||
<ConversationList />
|
<ConversationList />
|
||||||
</div>
|
</div>
|
||||||
<div className="sticky bottom-0 w-full flex flex-col justify-center bg-gray-100 dark:bg-zinc-700 backdrop-blur bg-opacity-60 pb-4 py-2">
|
<div className="sticky bottom-0 w-full flex flex-col justify-center bg-gray-100 dark:bg-zinc-700 backdrop-blur bg-opacity-60 pb-4 py-2">
|
||||||
|
Reference in New Issue
Block a user