feat(meilisearch): add native document database support
This commit is contained in:
79 files changed
+1801
-170
No files matched your search
@@ -30,4 +30,27 @@ describe("DatabaseIcon", () => {
|
||||
expect(container.querySelector("img")?.getAttribute("src")).toBe("/icons/database/phoenix.svg");
|
||||
app.unmount();
|
||||
});
|
||||
|
||||
it("uses the Meilisearch asset", async () => {
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
const app = createApp(DatabaseIcon, { dbType: "meilisearch" });
|
||||
app.mount(container);
|
||||
await nextTick();
|
||||
|
||||
expect(container.querySelector("img")?.getAttribute("src")).toBe("/icons/database/meilisearch.svg");
|
||||
app.unmount();
|
||||
});
|
||||
|
||||
it("falls back to the generic icon when the database type is missing", async () => {
|
||||
const container = document.createElement("div");
|
||||
document.body.appendChild(container);
|
||||
const app = createApp(DatabaseIcon);
|
||||
app.mount(container);
|
||||
await nextTick();
|
||||
|
||||
expect(container.querySelector("img")).toBeNull();
|
||||
expect(container.querySelector("svg")).not.toBeNull();
|
||||
app.unmount();
|
||||
});
|
||||
});
|
||||
@@ -5,7 +5,7 @@ import { useTheme } from "@/composables/useTheme";
|
||||
import { webPath } from "@/lib/common/webPath";
|
||||
|
||||
const props = defineProps<{
|
||||
dbType: string;
|
||||
dbType?: string;
|
||||
}>();
|
||||
const { isDark } = useTheme();
|
||||
|
||||
@@ -27,6 +27,7 @@ const assetIcons: Record<string, string> = {
|
||||
tidb: "tidb",
|
||||
elasticsearch: "elasticsearch",
|
||||
easysearch: "easysearch",
|
||||
meilisearch: "meilisearch",
|
||||
oracle: "oracle",
|
||||
"oracle-10g": "oracle",
|
||||
"oracle-legacy": "oracle",
|
||||
@@ -110,7 +111,7 @@ const assetIcons: Record<string, string> = {
|
||||
dolt: "dolt",
|
||||
};
|
||||
|
||||
const normalizedType = computed(() => props.dbType.toLowerCase().replace(/[\s-]+/g, "_"));
|
||||
const normalizedType = computed(() => (props.dbType || "").toLowerCase().replace(/[\s-]+/g, "_"));
|
||||
const assetName = computed(() => assetIcons[normalizedType.value]);
|
||||
const useLightIconInDarkMode = computed(() => normalizedType.value === "easysearch" && isDark.value);
|
||||
const assetSrc = computed(() => {
|
||||
|
||||
Reference in new issue
Block a user