fix: resolve clippy, typecheck, and test failures in CI (#933)

This commit is contained in:
t8y2 2026-06-10 04:40:23 +08:00
parent d0bf6c3b53
commit 1be4c6afcc
9 changed files with 30 additions and 10 deletions

View File

@ -2556,7 +2556,7 @@ function openExternalUrl(url: string) {
</p>
</div>
</div>
<template v-if="form.db_type === 'h2'">
<template v-if="form.db_type === 'h2' || form.db_type === 'access'">
<div class="grid grid-cols-4 items-center gap-4">
<Label class="text-right">{{ t("connection.user") }}</Label>
<Input v-model="form.username" class="col-span-3" placeholder="sa" />

View File

@ -243,6 +243,7 @@ const collapsedItems = computed(() => [
<template v-if="toolbarCollapsed">
<LightDropdown
model-value=""
:items="collapsedItems"
:aria-label="t('common.more')"
:trigger-icon="Ellipsis"

View File

@ -1,6 +1,8 @@
import type { ConnectionConfig, DatabaseType } from "@/types/database";
import { uuid } from "@/lib/utils";
declare var process: { env: Record<string, string | undefined> } | undefined;
type PartialConnection = Omit<ConnectionConfig, "id">;
export type DataGripImportPayload = {

View File

@ -24,6 +24,10 @@ export type ActiveTabSidebarTarget =
connectionId: string;
database: string;
schema?: string;
}
| {
type: "saved-sql-file";
savedSqlId: string;
};
export function activeTabSidebarTarget(tab: QueryTab | undefined | null): ActiveTabSidebarTarget | null {
@ -56,6 +60,10 @@ export function activeTabSidebarTarget(tab: QueryTab | undefined | null): Active
return { type: "etcd-root", connectionId: tab.connectionId };
}
if (tab.savedSqlId) {
return { type: "saved-sql-file", savedSqlId: tab.savedSqlId };
}
if (tab.mode === "query") {
if (!tab.connectionId || !tab.database) return null;
return {
@ -100,6 +108,10 @@ export function matchesTarget(node: TreeNode, target: ActiveTabSidebarTarget): b
return node.type === "etcd-root" && node.connectionId === target.connectionId;
}
if (target.type === "saved-sql-file") {
return node.type === "saved-sql-file" && node.savedSqlId === target.savedSqlId;
}
return (
(node.type === "table" || node.type === "view") &&
node.connectionId === target.connectionId &&

View File

@ -31,9 +31,12 @@ export function sortSidebarTreeChildrenForParent(
}
if (parent.type === "connection") {
const savedSqlNodes = normalized.filter((child) => child.type === "saved-sql-root");
const userAdminNodes = normalized.filter((child) => child.type === "user-admin");
const regularChildren = normalized.filter((child) => child.type !== "user-admin");
const withConnectionUtilityOrder = (children: TreeNode[]) => [...children, ...userAdminNodes];
const regularChildren = normalized.filter(
(child) => child.type !== "user-admin" && child.type !== "saved-sql-root",
);
const withConnectionUtilityOrder = (children: TreeNode[]) => [...savedSqlNodes, ...children, ...userAdminNodes];
if (databaseType === "mongodb" || databaseType === "elasticsearch") {
return withConnectionUtilityOrder(sortByLabel(regularChildren));

View File

@ -13,10 +13,13 @@ const leafTypes: Set<TreeNodeType> = new Set([
"redis-db",
"mongo-collection",
"user-admin",
"saved-sql-file",
]);
const fullWidthLabelTypes: Set<TreeNodeType> = new Set(["table", "view", "mongo-collection"]);
const emptyContainerTypes: Set<TreeNodeType> = new Set(["saved-sql-root", "saved-sql-folder"]);
export function treeItemPaddingLeft(depth: number): string {
return `${depth * 16 + 8}px`;
}
@ -29,13 +32,8 @@ export function canTreeNodeExpand(type: TreeNodeType): boolean {
return !leafTypes.has(type);
}
export function canTreeNodeShowExpander({
type,
childCount: _childCount,
}: {
type: TreeNodeType;
childCount?: number;
}): boolean {
export function canTreeNodeShowExpander({ type, childCount }: { type: TreeNodeType; childCount?: number }): boolean {
if (!canTreeNodeExpand(type)) return false;
if (childCount === 0 && emptyContainerTypes.has(type)) return false;
return true;
}

View File

@ -17,6 +17,7 @@ const dataNodeTypes = new Set<TreeNodeType>(["table", "view"]);
const toggleLeafNodeTypes = new Set<TreeNodeType>(["redis-db", "mongo-collection", "user-admin"]);
const objectBrowserNodeTypes = new Set<TreeNodeType>(["database", "schema", "object-browser"]);
const sourceNodeTypes = new Set<TreeNodeType>(["procedure", "function", "sequence", "package", "package-body"]);
const savedSqlNodeTypes = new Set<TreeNodeType>(["saved-sql-file"]);
const tableChildGroupNodeTypes = new Set<TreeNodeType>([
"group-columns",
"group-indexes",
@ -64,6 +65,7 @@ export function treeNodeRowDoubleClickAction(
if (activation === "double") {
if (dataNodeTypes.has(type)) return "open-data";
if (sourceNodeTypes.has(type)) return "open-source";
if (savedSqlNodeTypes.has(type)) return "open-saved-sql";
if (toggleLeafNodeTypes.has(type)) return "toggle";
if (canOpenObjectBrowser && objectBrowserNodeTypes.has(type) && canExpand) return "open-object-browser-and-expand";
if (canOpenObjectBrowser && objectBrowserNodeTypes.has(type)) return "open-object-browser";

View File

@ -674,6 +674,7 @@ mod tests {
}
#[test]
#[allow(clippy::approx_constant)]
fn turso_value_float_parsed() {
let v = TursoValue { value_type: "float".to_string(), value: Some(serde_json::json!("3.14")) };
assert_eq!(turso_value_to_json(v), serde_json::json!(3.14));

View File

@ -31,6 +31,7 @@ export const BRIDGE_REQUIRED_TYPES = [
"sqlserver",
"oracle",
"elasticsearch",
"etcd",
"dameng",
"kingbase",
"highgo",