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: fix lots of issues (#6552)
boojack6072c6209b95
diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vueindex a1bd010c6d..ed8e254b1e 100644--- a/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupForm.vue@@ -23,7 +23,7 @@<div><p class="text-lg mb-2">{{ $t("common.environment") }}</p><EnvironmentSelect- :disabled="!isCreating"+ :disabled="!isCreating || disableEditDatabaseGroupFields":selected-id="state.environmentId"@select-environment-id="(environmentId) => {@@ -46,7 +46,7 @@<div v-if="resourceType === 'SCHEMA_GROUP'"><p class="text-lg mb-2">{{ $t("database-group.self") }}</p><DatabaseGroupSelect- :disabled="!isCreating"+ :disabled="!isCreating || disableEditDatabaseGroupFields":project-id="project.name":environment-id="state.environmentId || ''":selected-id="state.selectedDatabaseGroupId"@@ -98,7 +98,12 @@ import { Expr as CELExpr } from "@/types/proto/google/api/expr/v1alpha1/syntax";import ExprEditor from "./common/ExprEditor";import { ResourceType } from "./common/ExprEditor/context";import { DatabaseGroup, SchemaGroup } from "@/types/proto/v1/project_service";-import { ComposedProject, ResourceId, ValidatedMessage } from "@/types";+import {+ ComposedDatabaseGroup,+ ComposedProject,+ ResourceId,+ ValidatedMessage,+} from "@/types";import { convertCELStringToExpr } from "@/utils/databaseGroup/cel";import { useDBGroupStore } from "@/store";import { getErrorCode } from "@/utils/grpcweb";@@ -119,6 +124,7 @@ const props = defineProps<{project: ComposedProject;resourceType: ResourceType;databaseGroup?: DatabaseGroup | SchemaGroup;+ parentDatabaseGroup?: ComposedDatabaseGroup;}>();type LocalState = {@@ -149,11 +155,23 @@ const formatedResourceType = computed(() =>const isCreating = computed(() => props.databaseGroup === undefined);+const disableEditDatabaseGroupFields = computed(() => {+ return (+ props.resourceType === "SCHEMA_GROUP" &&+ props.parentDatabaseGroup !== undefined+ );+});+const resourceIdType = computed(() =>props.resourceType === "DATABASE_GROUP" ? "database-group" : "schema-group");onMounted(async () => {+ if (props.parentDatabaseGroup) {+ state.environmentId = props.parentDatabaseGroup.environment.uid;+ state.selectedDatabaseGroupId = props.parentDatabaseGroup.name;+ }+const databaseGroup = props.databaseGroup;if (!databaseGroup) {return;diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vueindex b30b00ff0f..af0f6612f1 100644--- a/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue+++ b/frontend/src/components/DatabaseGroup/DatabaseGroupPanel.vue@@ -15,6 +15,7 @@:project="project":resource-type="resourceType":database-group="props.databaseGroup"+ :parent-database-group="props.parentDatabaseGroup"/><template #footer><div class="w-full flex justify-between items-center">@@ -44,7 +45,11 @@ import { NButton, NDrawer, NDrawerContent, useDialog } from "naive-ui";import { ClientError } from "nice-grpc-common";import { computed, onMounted, ref } from "vue";import { useI18n } from "vue-i18n";-import { ComposedProject } from "@/types";+import {+ ComposedDatabaseGroup,+ ComposedProject,+ ComposedSchemaGroup,+} from "@/types";import { DatabaseGroup, SchemaGroup } from "@/types/proto/v1/project_service";import { Expr } from "@/types/proto/google/type/expr";import { stringifyDatabaseGroupExpr } from "@/utils/databaseGroup/cel";@@ -56,11 +61,15 @@ import {import { ResourceType } from "./common/ExprEditor/context";import DatabaseGroupForm from "./DatabaseGroupForm.vue";import { convertToCELString } from "@/plugins/cel/logic";+import { useRouter } from "vue-router";+import { projectV1Slug } from "@/utils";+import { getProjectNameAndDatabaseGroupNameAndSchemaGroupName } from "@/store/modules/v1/common";const props = defineProps<{project: ComposedProject;resourceType: ResourceType;databaseGroup?: DatabaseGroup | SchemaGroup;+ parentDatabaseGroup?: ComposedDatabaseGroup;}>();const emit = defineEmits<{@@ -68,6 +77,7 @@ const emit = defineEmits<{}>();const { t } = useI18n();+const router = useRouter();const dialog = useDialog();const environmentStore = useEnvironmentV1Store();const dbGroupStore = useDBGroupStore();@@ -146,11 +156,35 @@ const doDelete = () => {negativeText: t("common.cancel"),onPositiveClick: async () => {if (props.resourceType === "DATABASE_GROUP") {- await dbGroupStore.deleteDatabaseGroup(props.databaseGroup!.name);+ const databaseGroup = props.databaseGroup as DatabaseGroup;+ await dbGroupStore.deleteDatabaseGroup(databaseGroup.name);+ if (+ router.currentRoute.value.name === "workspace.database-group.detail"+ ) {+ router.push({+ name: "workspace.project.detail",+ params: {+ projectSlug: projectV1Slug(props.project),+ },+ hash: "#database-groups",+ });+ }} else if (props.resourceType === "SCHEMA_GROUP") {- await dbGroupStore.deleteSchemaGroup(props.databaseGroup!.name);- } else {- throw new Error("Unknown resource type");+ const schemaGroup = props.databaseGroup as ComposedSchemaGroup;+ await dbGroupStore.deleteSchemaGroup(schemaGroup.name);+ if (router.currentRoute.value.name === "workspace.table-group.detail") {+ const [projectName, databaseGroupName] =+ getProjectNameAndDatabaseGroupNameAndSchemaGroupName(+ schemaGroup.name+ );+ router.push({+ name: "workspace.database-group.detail",+ params: {+ projectName,+ databaseGroupName,+ },+ });+ }}emit("close");},diff --git a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vueindex e590c6533a..c55f444f9e 100644--- a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue+++ b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue@@ -159,7 +159,10 @@ const updateMatchingState = useDebounceFn(async () => {}for (const item of result.unmatchedDatabases) {const database = await databaseStore.getOrFetchDatabaseByName(item.name);- if (database) {+ if (+ database &&+ database.instanceEntity.environmentEntity.uid === props.environmentId+ ) {unmatchedDatabaseList.value.push(database);}}diff --git a/frontend/src/components/DatabaseGroup/SchemaGroupTable.vue b/frontend/src/components/DatabaseGroup/SchemaGroupTable.vueindex 35691932fe..474dc73312 100644--- a/frontend/src/components/DatabaseGroup/SchemaGroupTable.vue+++ b/frontend/src/components/DatabaseGroup/SchemaGroupTable.vue@@ -61,7 +61,7 @@ const clickSchemaGroup = ({ schemaGroup }: FormatedSchemaGroup) => {const [projectName, databaseGroupName, schemaGroupName] =getProjectNameAndDatabaseGroupNameAndSchemaGroupName(schemaGroup.name);router.push(- `/projects/${projectName}/database-groups/${databaseGroupName}/schema-groups/${schemaGroupName}`+ `/projects/${projectName}/database-groups/${databaseGroupName}/table-groups/${schemaGroupName}`);};diff --git a/frontend/src/components/DatabaseGroup/common/ExprEditor/ConditionGroup.vue b/frontend/src/components/DatabaseGroup/common/ExprEditor/ConditionGroup.vueindex c5a411f046..f5656b7140 100644--- a/frontend/src/components/DatabaseGroup/common/ExprEditor/ConditionGroup.vue+++ b/frontend/src/components/DatabaseGroup/common/ExprEditor/ConditionGroup.vue@@ -128,7 +128,6 @@ import {type ConditionGroupExpr,type LogicalOperator,StringOperatorList,- LogicalOperatorList,isConditionGroupExpr,isConditionExpr,} from "@/plugins/cel";@@ -180,7 +179,7 @@ const addCondition = () => {const addConditionGroup = () => {args.value.push({- operator: LogicalOperatorList[0],+ operator: "_&&_",args: [],});emit("update");diff --git a/frontend/src/components/v2/Model/DatabaseGroupName.vue b/frontend/src/components/v2/Model/DatabaseGroupName.vuenew file mode 100644index 0000000000..67f81fefbe--- /dev/null+++ b/frontend/src/components/v2/Model/DatabaseGroupName.vue@@ -0,0 +1,44 @@+<template>+ <component+ :is="link ? 'router-link' : tag"+ v-bind="bindings"+ class="inline-flex items-center gap-x-1"+ :class="link && !plain && 'normal-link'"+ >+ <span>{{ databaseGroup.databasePlaceholder }}</span>+ </component>+</template>++<script lang="ts" setup>+import { computed } from "vue";+import type { ComposedDatabaseGroup } from "@/types";++const props = withDefaults(+ defineProps<{+ databaseGroup: ComposedDatabaseGroup;+ tag?: string;+ link?: boolean;+ plain?: boolean;+ }>(),+ {+ tag: "span",+ link: true,+ plain: false,+ }+);++const bindings = computed(() => {+ const route = `/${props.databaseGroup.project.name}/database-groups/${props.databaseGroup.databaseGroupName}`;+ if (props.link) {+ return {+ to: route,+ activeClass: "",+ exactActiveClass: "",+ onClick: (e: MouseEvent) => {+ e.stopPropagation();+ },+ };+ }+ return {};+});+</script>diff --git a/frontend/src/plugins/cel/types/operator.ts b/frontend/src/plugins/cel/types/operator.tsindex db96cee23b..9dd6711fb5 100644--- a/frontend/src/plugins/cel/types/operator.ts+++ b/frontend/src/plugins/cel/types/operator.ts@@ -76,8 +76,8 @@ export const OperatorList: Record<Factor, Operator[]> = {]),// Database group related fields.- "resource.database_name": uniq(["_==_", "startsWith"]),- "resource.table_name": uniq(["_==_", "startsWith"]),+ "resource.database_name": uniq(["startsWith", "_==_"]),+ "resource.table_name": uniq(["startsWith", "_==_"]),};export const getOperatorListByFactor = (factor: Factor) => {diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.tsindex 06ace2c90e..1289e2a0fc 100644--- a/frontend/src/router/index.ts+++ b/frontend/src/router/index.ts@@ -968,8 +968,8 @@ const routes: Array<RouteRecordRaw> = [props: true,},{- path: "database-groups/:databaseGroupName/schema-groups/:schemaGroupName",- name: "workspace.database-group.schema-group.detail",+ path: "database-groups/:databaseGroupName/table-groups/:schemaGroupName",+ name: "workspace.database-group.table-group.detail",components: {content: () => import("../views/SchemaGroupDetail.vue"),leftSidebar: DashboardSidebar,diff --git a/frontend/src/store/modules/router.ts b/frontend/src/store/modules/router.tsindex f0fdccd81d..00546190e8 100644--- a/frontend/src/store/modules/router.ts+++ b/frontend/src/store/modules/router.ts@@ -208,9 +208,9 @@ export const useRouterStore = defineStore("router", {}{- // /projects/proj-nt-iq3z/database-groups/test/schema-groups/asd123+ // /projects/proj-nt-iq3z/database-groups/test/table-groups/asd123const schemaGroupDetailComponents = currentRoute.path.match(- "/projects/([0-9a-zA-Z_-]+)/database-groups/([0-9a-zA-Z_-]+)/schema-groups/([0-9a-zA-Z_-]+)"+ "/projects/([0-9a-zA-Z_-]+)/database-groups/([0-9a-zA-Z_-]+)/table-groups/([0-9a-zA-Z_-]+)") || ["/", undefined];if (schemaGroupDetailComponents.length === 4) {diff --git a/frontend/src/views/DatabaseGroupDetail.vue b/frontend/src/views/DatabaseGroupDetail.vueindex 0b0e9b1fbd..03f3797253 100644--- a/frontend/src/views/DatabaseGroupDetail.vue+++ b/frontend/src/views/DatabaseGroupDetail.vue@@ -18,7 +18,11 @@class="pt-2 pb-2.5 text-xl font-bold leading-6 text-main truncate flex items-center gap-x-3">{{ databaseGroupName }}- <BBBadge text="Group" :can-remove="false" class="text-xs" />+ <BBBadge+ text="Database Group"+ :can-remove="false"+ class="text-xs"+ /></h1></div></div>@@ -107,6 +111,7 @@:project="project":resource-type="editState.type":database-group="editState.databaseGroup"+ :parent-database-group="editState.parentDatabaseGroup"@close="editState.showConfigurePanel = false"/>@@ -145,6 +150,7 @@ interface EditDatabaseGroupState {showConfigurePanel: boolean;type: ResourceType;databaseGroup?: DatabaseGroup | SchemaGroup;+ parentDatabaseGroup?: ComposedDatabaseGroup;}const props = defineProps({@@ -206,6 +212,7 @@ const handleCreateSchemaGroup = () => {editState.type = "SCHEMA_GROUP";editState.databaseGroup = undefined;editState.showConfigurePanel = true;+ editState.parentDatabaseGroup = databaseGroup.value;};const handleEditSchemaGroup = (schemaGroup: SchemaGroup) => {diff --git a/frontend/src/views/SchemaGroupDetail.vue b/frontend/src/views/SchemaGroupDetail.vueindex 88108c9678..bd3a3a8896 100644--- a/frontend/src/views/SchemaGroupDetail.vue+++ b/frontend/src/views/SchemaGroupDetail.vue@@ -19,7 +19,11 @@class="pt-2 pb-2.5 text-xl font-bold leading-6 text-main truncate flex items-center gap-x-3">{{ schemaGroupName }}- <BBBadge text="Group" :can-remove="false" class="text-xs" />+ <BBBadge+ text="Schema Group"+ :can-remove="false"+ class="text-xs"+ /></h1></div></div>@@ -33,6 +37,12 @@><ProjectV1Name :project="project" hash="#database-groups" /></dd>+ <dd class="flex items-center text-sm md:mr-4">+ <span class="textlabel"+ >{{ $t("database-group.self") }} - </span+ >+ <DatabaseGroupName :database-group="schemaGroup?.databaseGroup" />+ </dd></dl></div>@@ -96,6 +106,7 @@ import { ConditionGroupExpr } from "@/plugins/cel";import DatabaseGroupPanel from "@/components/DatabaseGroup/DatabaseGroupPanel.vue";import ExprEditor from "@/components/DatabaseGroup/common/ExprEditor";import MatchedTableView from "@/components/DatabaseGroup/MatchedTableView.vue";+import DatabaseGroupName from "@/components/v2/Model/DatabaseGroupName.vue";interface LocalState {isLoaded: boolean;