Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: rename Position to Point (#4328)
Liu Jid381ea7ec0a9
diff --git a/frontend/src/components/SchemaDiagram/Canvas/Canvas.vue b/frontend/src/components/SchemaDiagram/Canvas/Canvas.vueindex 723a2f65ae..38f852bdab 100644--- a/frontend/src/components/SchemaDiagram/Canvas/Canvas.vue+++ b/frontend/src/components/SchemaDiagram/Canvas/Canvas.vue@@ -46,7 +46,7 @@ import normalizeWheel from "normalize-wheel";import { NButtonGroup, NButton } from "naive-ui";import Square2x2 from "~icons/heroicons-outline/squares-2x2";-import { Position } from "../types";+import { Point } from "../types";import { useDraggable, minmax, useSchemaDiagramContext } from "../common";import ZoomButton from "./ZoomButton.vue";import { fitView } from "./libs/fitView";@@ -57,7 +57,7 @@ const desktop = ref<Element>();const { tableList, rectOfTable, zoom, position, panning, events } =useSchemaDiagramContext();-const zoomCenter = ref<Position>({ x: 0.5, y: 0.5 });+const zoomCenter = ref<Point>({ x: 0.5, y: 0.5 });const ZOOM_RANGE = {max: 2, // 200%min: 0.05, // 5%@@ -80,7 +80,7 @@ const handleFitView = () => {};events.on("fit-view", handleFitView);-const handleZoom = (delta: number, center: Position = { x: 0.5, y: 0.5 }) => {+const handleZoom = (delta: number, center: Point = { x: 0.5, y: 0.5 }) => {if (!canvas.value) return "";const z = minmax(zoom.value + delta, ZOOM_RANGE.min, ZOOM_RANGE.max);diff --git a/frontend/src/components/SchemaDiagram/ER/ForeignKeyLine.vue b/frontend/src/components/SchemaDiagram/ER/ForeignKeyLine.vueindex 8e7341eeeb..88f71fdb54 100644--- a/frontend/src/components/SchemaDiagram/ER/ForeignKeyLine.vue+++ b/frontend/src/components/SchemaDiagram/ER/ForeignKeyLine.vue@@ -15,7 +15,7 @@import { computed, onMounted, ref } from "vue";import { TableMetadata } from "@/types/proto/store/database";-import { Position, Rect, Path, ForeignKey } from "../types";+import { Point, Rect, Path, ForeignKey } from "../types";import {segmentOverlap1D,SegmentOverlap1D,@@ -102,11 +102,11 @@ const pickPorts = (}};-const grow = (pos: Position, dir: Direction, length: number): Position => {+const grow = (pos: Point, dir: Direction, length: number): Point => {const x = dir === "LEFT" ? pos.x - length : pos.x + length;return { x, y: pos.y };};-const anchor = (rect: Rect, edge: Direction): Position => {+const anchor = (rect: Rect, edge: Direction): Point => {const x = edge === "LEFT" ? rect.x : rect.x + rect.width;const y = rect.y + rect.height / 2;return { x, y };diff --git a/frontend/src/components/SchemaDiagram/ER/libs/autoLayout/types.ts b/frontend/src/components/SchemaDiagram/ER/libs/autoLayout/types.tsindex f0f7e9c4d9..8a378acfdc 100644--- a/frontend/src/components/SchemaDiagram/ER/libs/autoLayout/types.ts+++ b/frontend/src/components/SchemaDiagram/ER/libs/autoLayout/types.ts@@ -1,11 +1,6 @@-import type {- Path,- Position,- Rect,- Size,-} from "@/components/SchemaDiagram/types";+import type { Path, Point, Rect, Size } from "@/components/SchemaDiagram/types";-export type GraphChildNodeItem = { id: string; size: Size; pos: Position };+export type GraphChildNodeItem = { id: string; size: Size; pos: Point };export type GraphNodeItem = {group: string;diff --git a/frontend/src/components/SchemaDiagram/SchemaDiagram.vue b/frontend/src/components/SchemaDiagram/SchemaDiagram.vueindex f2e17ee005..efcb34a331 100644--- a/frontend/src/components/SchemaDiagram/SchemaDiagram.vue+++ b/frontend/src/components/SchemaDiagram/SchemaDiagram.vue@@ -38,7 +38,7 @@ import {TableMetadata,} from "@/types/proto/store/database";import {- Position,+ Point,Rect,Size,SchemaDiagramContext,@@ -85,7 +85,7 @@ const tableList = computed(() => {});const initialized = ref(false);const zoom = ref(1);-const position = ref<Position>({ x: 0, y: 0 });+const position = ref<Point>({ x: 0, y: 0 });const panning = ref(false);const render = () => {diff --git a/frontend/src/components/SchemaDiagram/common/geometry.ts b/frontend/src/components/SchemaDiagram/common/geometry.tsindex 125cb65e5e..551135f68b 100644--- a/frontend/src/components/SchemaDiagram/common/geometry.ts+++ b/frontend/src/components/SchemaDiagram/common/geometry.ts@@ -1,6 +1,6 @@-import { Position, Rect } from "../types";+import { Point, Rect } from "../types";-export const pointsOfRect = (rect: Rect): Position[] => {+export const pointsOfRect = (rect: Rect): Point[] => {const { x, y, width, height } = rect;const nw = { x, y };const ne = { x: x + width, y };@@ -9,9 +9,9 @@ export const pointsOfRect = (rect: Rect): Position[] => {return [nw, ne, sw, se];};-export const calcBBox = (points: Position[]): Rect => {- const min: Position = { x: Number.MAX_VALUE, y: Number.MAX_VALUE };- const max: Position = { x: Number.MIN_VALUE, y: Number.MIN_VALUE };+export const calcBBox = (points: Point[]): Rect => {+ const min: Point = { x: Number.MAX_VALUE, y: Number.MAX_VALUE };+ const max: Point = { x: Number.MIN_VALUE, y: Number.MIN_VALUE };points.forEach(({ x, y }) => {if (x > max.x) max.x = x;if (y > max.y) max.y = y;diff --git a/frontend/src/components/SchemaDiagram/common/useDraggable.ts b/frontend/src/components/SchemaDiagram/common/useDraggable.tsindex 07a5487e6f..8c22175920 100644--- a/frontend/src/components/SchemaDiagram/common/useDraggable.ts+++ b/frontend/src/components/SchemaDiagram/common/useDraggable.ts@@ -1,7 +1,7 @@import { ref, unref } from "vue";import { MaybeRef, useEventListener } from "@vueuse/core";-import { Position } from "../types";+import { Point } from "../types";export type DraggableOptions = {exact?: boolean;@@ -15,8 +15,8 @@ export const useDraggable = (target: MaybeRef<Element | undefined>,options: DraggableOptions) => {- const startPointerPosition = ref<Position>();- const lastPointerPosition = ref<Position>();+ const startPointerPosition = ref<Point>();+ const lastPointerPosition = ref<Point>();const start = (e: PointerEvent) => {if (unref(options.exact) && e.target !== unref(target)) return;diff --git a/frontend/src/components/SchemaDiagram/types/context.ts b/frontend/src/components/SchemaDiagram/types/context.tsindex 9c909c3498..b725158acc 100644--- a/frontend/src/components/SchemaDiagram/types/context.ts+++ b/frontend/src/components/SchemaDiagram/types/context.ts@@ -6,7 +6,7 @@ import {SchemaMetadata,TableMetadata,} from "@/types/proto/store/database";-import { Position, Rect } from "./geometry";+import { Point, Rect } from "./geometry";import { EditStatus } from "./edit";// This is an abstract Schema Diagram context including states, methods and@@ -19,7 +19,7 @@ export type SchemaDiagramContext = {// Stateszoom: Ref<number>;- position: Ref<Position>;+ position: Ref<Point>;panning: Ref<boolean>;// Methodsdiff --git a/frontend/src/components/SchemaDiagram/types/geometry.ts b/frontend/src/components/SchemaDiagram/types/geometry.tsindex 8edf75aa6f..d028c027cb 100644--- a/frontend/src/components/SchemaDiagram/types/geometry.ts+++ b/frontend/src/components/SchemaDiagram/types/geometry.ts@@ -3,11 +3,11 @@ export type Size = {height: number;};-export type Position = {+export type Point = {x: number;y: number;};-export type Rect = Position & Size;+export type Rect = Point & Size;-export type Path = Position[];+export type Path = Point[];