feat(oracle): add dblink completion, tree view and management
This commit is contained in:
25 files changed
+645
-13
No files matched your search
@@ -1008,6 +1008,8 @@ async function toggle(requestId = beginNavigationRequest()) {
|
||||
await connectionStore.loadDorisCatalogDatabases(node, treeLoadSearchOptions);
|
||||
} else if (node.type === "schema" && node.connectionId && hasTreeNodeDatabaseContext(node) && schemaNodeHasLoadableName(effectiveDatabaseTypeForConnection(connectionStore.getConfig(node.connectionId)), node.schema)) {
|
||||
await connectionStore.loadTables(node.connectionId, node.database, node.schema, treeLoadSearchOptions);
|
||||
} else if (node.type === "oracle-db-links") {
|
||||
await connectionStore.loadTreeNodeChildren(node, treeLoadSearchOptions);
|
||||
} else if (node.type === "linked-server-root" && node.connectionId) {
|
||||
await connectionStore.loadSqlServerLinkedServers(node.connectionId, treeLoadSearchOptions);
|
||||
} else if (node.type === "linked-server" && node.connectionId) {
|
||||
|
||||
@@ -39,6 +39,8 @@ import {
|
||||
CircleX,
|
||||
RefreshCw,
|
||||
} from "@lucide/vue";
|
||||
import OracleDatabaseLinksDialog from "@/components/objects/OracleDatabaseLinksDialog.vue";
|
||||
const showDatabaseLinks = ref(false);
|
||||
import { useConnectionStore } from "@/stores/connectionStore";
|
||||
import { useQueryStore } from "@/stores/queryStore";
|
||||
import { useSettingsStore } from "@/stores/settingsStore";
|
||||
@@ -361,6 +363,8 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
|
||||
return { icon: Braces, colorClass: "text-amber-500" };
|
||||
case "sequence":
|
||||
return { icon: ListTree, colorClass: "text-emerald-500" };
|
||||
case "oracle-db-links":
|
||||
case "oracle-db-link":
|
||||
case "synonym":
|
||||
return { icon: Link2, colorClass: "text-sky-500" };
|
||||
case "job":
|
||||
@@ -432,7 +436,7 @@ function displayLabel(node: TreeNode): string {
|
||||
// internationalized; those nodes may still contain the old Chinese text.
|
||||
if (node.type === "nacos-access-control") return t("nacos.accessControlSidebarLabel");
|
||||
if (node.type === "user-admin" || node.type === "dameng-users" || node.type === "dameng-roles" || node.type === "dameng-job-admin" || node.type === "meilisearch-system") return t(node.label);
|
||||
if (node.type === "linked-server-root") return t(node.label);
|
||||
if (node.type === "oracle-db-links" || node.type === "linked-server-root") return t(node.label);
|
||||
if (node.type === "saved-sql-root") return t(node.label);
|
||||
if (node.type === "mqtt-topic" && node.id.endsWith(":mqtt-topic:__console__")) return t(node.label);
|
||||
if (node.label === "tree.defaultDatabase") return t(node.label);
|
||||
@@ -821,7 +825,7 @@ const canExpand = computed(() => {
|
||||
return canTreeNodeShowExpander({
|
||||
type: activeNode.value.type,
|
||||
childCount: activeNode.value.children?.length ?? 0,
|
||||
explicitContainer: (activeNode.value.type === "package" && activeNode.value.children !== undefined) || activeNode.value.xuguTypeMembersExpandable === true,
|
||||
explicitContainer: activeNode.value.type === "oracle-db-links" || (activeNode.value.type === "package" && activeNode.value.children !== undefined) || activeNode.value.xuguTypeMembersExpandable === true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1454,14 +1458,27 @@ function onClick(event: MouseEvent) {
|
||||
selectSingleTreeNode(props.node);
|
||||
rowRef.value?.focus({ preventScroll: true });
|
||||
if (!shouldActivateTreeNodeOnSingleClick(props.node.type, settingsStore.editorSettings.sidebarActivation) && props.node.type !== "load-more") return;
|
||||
if (props.node.type === "oracle-db-link") {
|
||||
showDatabaseLinks.value = true;
|
||||
return;
|
||||
}
|
||||
treeRuntime.handleRowClick(props.node, event.detail);
|
||||
}
|
||||
|
||||
function onDoubleClick(event: MouseEvent) {
|
||||
if (props.node.type === "oracle-db-link" || props.node.type === "oracle-db-links") {
|
||||
showDatabaseLinks.value = true;
|
||||
return;
|
||||
}
|
||||
treeRuntime.handleRowDoubleClick(props.node, event);
|
||||
}
|
||||
|
||||
function onTreeItemContextMenu(event: MouseEvent) {
|
||||
if (props.node.type === "oracle-db-link" || props.node.type === "oracle-db-links") {
|
||||
event.preventDefault();
|
||||
showDatabaseLinks.value = true;
|
||||
return;
|
||||
}
|
||||
if (!connectionStore.selectedTreeNodeIds.includes(props.node.id)) selectSingleTreeNode(props.node);
|
||||
else connectionStore.selectedTreeNodeId = props.node.id;
|
||||
rowRef.value?.focus({ preventScroll: true });
|
||||
@@ -1469,6 +1486,11 @@ function onTreeItemContextMenu(event: MouseEvent) {
|
||||
}
|
||||
|
||||
function onKeydown(event: KeyboardEvent) {
|
||||
if ((props.node.type === "oracle-db-link" || props.node.type === "oracle-db-links") && event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
showDatabaseLinks.value = true;
|
||||
return;
|
||||
}
|
||||
treeRuntime.handleRowKeydown(props.node, event);
|
||||
}
|
||||
</script>
|
||||
@@ -1579,6 +1601,9 @@ function onKeydown(event: KeyboardEvent) {
|
||||
]"
|
||||
>{{ visibleLabel(node) }}</span
|
||||
>
|
||||
<button v-if="node.type === 'oracle-db-links'" class="ml-auto rounded p-0.5 text-muted-foreground hover:bg-muted" :aria-label="t('databaseLinks.manage')" :title="t('databaseLinks.manage')" @click.stop="showDatabaseLinks = true" @dblclick.stop>
|
||||
<TableProperties class="h-3.5 w-3.5" />
|
||||
</button>
|
||||
<span v-if="treeNodeSecondaryValue(node)" class="flex min-w-0 max-w-[55%] shrink items-center gap-1 text-xs text-muted-foreground" :title="node.type === 'elasticsearch-index' ? undefined : treeNodeSecondaryValue(node)">
|
||||
<Link2 v-if="node.type === 'elasticsearch-index'" class="h-3 w-3 shrink-0 text-sky-400" />
|
||||
<span class="min-w-0 truncate">{{ treeNodeSecondaryValue(node) }}</span>
|
||||
@@ -1718,6 +1743,15 @@ function onKeydown(event: KeyboardEvent) {
|
||||
</template>
|
||||
</LightTooltip>
|
||||
</div>
|
||||
<OracleDatabaseLinksDialog
|
||||
v-if="showDatabaseLinks && node.connectionId"
|
||||
v-model:open="showDatabaseLinks"
|
||||
:connection-id="node.connectionId"
|
||||
:database="node.database || ''"
|
||||
:name="node.type === 'oracle-db-link' ? node.label : undefined"
|
||||
:owner="node.schema"
|
||||
@changed="connectionStore.refreshOracleDatabaseLinks(node.connectionId)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in new issue
Block a user