feat(tabs): distinguish object and table data tabs

This commit is contained in:
zhangyc 2026-07-31 01:57:27 +08:00 committed by GitHub
parent 298223db8f
commit 4062f11a26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -449,7 +449,8 @@ function tabColorStyle(tab: QueryTab) {
function tabIconClass(tab: QueryTab) {
if (tab.mode === "mq") return "";
if (tab.mode === "data" || tab.mode === "mongo" || tab.mode === "vector" || tab.mode === "redis" || tab.mode === "hbase" || tab.mode === "objects" || tab.mode === "structure") return "text-emerald-600 dark:text-emerald-400";
if (tab.mode === "objects") return "text-amber-500 dark:text-amber-400";
if (tab.mode === "data" || tab.mode === "mongo" || tab.mode === "vector" || tab.mode === "redis" || tab.mode === "hbase" || tab.mode === "structure") return "text-emerald-600 dark:text-emerald-400";
return "text-blue-600 dark:text-blue-400";
}

View File

@ -23,6 +23,15 @@ describe("AppTabBar HBase presentation", () => {
it("uses the table icon in regular, pinned, and overflow tab surfaces", () => {
expect(tabBarSource).toContain('if (tab.mode === "data" || tab.mode === "mongo" || tab.mode === "redis" || tab.mode === "hbase") return Table2;');
expect(tabBarSource.match(/tab\.mode === 'hbase'/g)).toHaveLength(2);
expect(tabBarSource).toContain('tab.mode === "hbase" || tab.mode === "objects"');
expect(tabBarSource).toContain('tab.mode === "hbase" || tab.mode === "structure"');
});
});
describe("AppTabBar objects presentation", () => {
it("uses an amber icon color on regular, pinned, and overflow tab surfaces", () => {
expect(tabBarSource).toContain('if (tab.mode === "objects") return "text-amber-500 dark:text-amber-400";');
expect(tabBarSource).toContain('if (tab.mode === "objects") return TableProperties;');
expect(tabBarSource.match(/:class="tabIconClass\(tab\)"/g)).toHaveLength(2);
expect(tabBarSource.match(/tabMenuIcon\(tab\).*tabIconClass\(tab\)/g)).toHaveLength(2);
});
});