feat(plugins): add AI tools and consent-gated data access
This commit is contained in:
71 files changed
+4613
-129
No files matched your search
@@ -5,9 +5,8 @@ import { Check, ChevronDown, ChevronRight, Folder, Search } from "@lucide/vue";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import DatabaseIcon from "@/components/icons/DatabaseIcon.vue";
|
||||
import ConnectionIcon from "@/components/icons/ConnectionIcon.vue";
|
||||
import { buildConnectionPickerRows, connectionPickerSelectableRows } from "@/lib/connection/connectionPickerTree";
|
||||
import { connectionIconType } from "@/lib/connection/connectionPresentation";
|
||||
import { cn } from "@/lib/common/utils";
|
||||
import type { ConnectionConfig, SidebarLayout } from "@/types/database";
|
||||
|
||||
@@ -184,7 +183,7 @@ function handleKeydown(event: KeyboardEvent) {
|
||||
@click="selectConnection(row.id)"
|
||||
>
|
||||
<Check :class="cn('h-3.5 w-3.5 shrink-0', row.id === modelValue ? 'opacity-100' : 'opacity-0')" />
|
||||
<DatabaseIcon :db-type="connectionIconType(connectionById.get(row.id))" class="h-3.5 w-3.5 shrink-0" />
|
||||
<ConnectionIcon :connection="connectionById.get(row.id)" class="h-3.5 w-3.5 shrink-0" />
|
||||
<span class="min-w-0 flex-1 truncate">{{ row.label }}</span>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
Vendored
+16
-2
@@ -26,6 +26,13 @@ vi.mock("@/components/icons/DatabaseIcon.vue", () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("@/components/plugins/PluginIcon.vue", () => ({
|
||||
default: defineComponent({
|
||||
props: ["pluginId", "contributionId"],
|
||||
setup: (props) => () => h("span", { "data-plugin-id": props.pluginId, "data-contribution-id": props.contributionId }),
|
||||
}),
|
||||
}));
|
||||
|
||||
const mountedApps: App[] = [];
|
||||
|
||||
const connections: ConnectionConfig[] = [
|
||||
@@ -45,12 +52,12 @@ const layout: SidebarLayout = {
|
||||
order: [{ type: "group", id: "g1", children: [{ type: "connection", id: "c1" }] }],
|
||||
};
|
||||
|
||||
async function mountPicker() {
|
||||
async function mountPicker(extraConnections: ConnectionConfig[] = []) {
|
||||
const container = document.createElement("div");
|
||||
document.body.append(container);
|
||||
const app = createApp(ConnectionTreeSelect, {
|
||||
modelValue: "",
|
||||
connections,
|
||||
connections: [...connections, ...extraConnections],
|
||||
layout,
|
||||
placeholder: "Select connection",
|
||||
searchPlaceholder: "Search connections",
|
||||
@@ -82,6 +89,13 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe("ConnectionTreeSelect search collapse behavior", () => {
|
||||
it("passes plugin identity and provider logo metadata to the shared icon", async () => {
|
||||
await mountPicker([{ ...connections[0], id: "plugin", name: "Plugin", db_type: "plugin", plugin_id: "sample.plugin", plugin_connection_provider: "sample.connection" }]);
|
||||
const icon = document.body.querySelector('[data-picker-connection="plugin"] [data-plugin-id]');
|
||||
expect(icon?.getAttribute("data-plugin-id")).toBe("sample.plugin");
|
||||
expect(icon?.getAttribute("data-contribution-id")).toBe("sample.connection");
|
||||
});
|
||||
|
||||
it("ignores group clicks during search without changing the post-search state", async () => {
|
||||
await mountPicker();
|
||||
await setSearchText("Primary");
|
||||
|
||||
Reference in new issue
Block a user