Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: remove part of empty id (#15778)
boojack140fdb59e3fe
diff --git a/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDashboard.vue b/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDashboard.vueindex e7a7daf631..e0552b47ef 100644--- a/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDashboard.vue+++ b/frontend/src/components/Changelist/ChangelistDashboard/ChangelistDashboard.vue@@ -1,6 +1,6 @@<template><div class="flex flex-col gap-y-4">- <NavBar :disable-project-select="!!project" :allow-create="allowCreate" />+ <NavBar :allow-create="allowCreate" /><ChangelistDataTable:changelists="filteredChangelists":loading="isFetching"diff --git a/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue b/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vueindex 5a80b32e6e..049d9b5863 100644--- a/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue+++ b/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue@@ -157,14 +157,8 @@ import {ProjectSelect,ResourceIdField,} from "@/components/v2";-import {- pushNotification,- useChangelistStore,- useProjectV1Store,- useSheetV1Store,-} from "@/store";+import { pushNotification, useChangelistStore, useSheetV1Store } from "@/store";import type { ResourceId, ValidatedMessage } from "@/types";-import { isValidProjectName } from "@/types";import type { ComposedProject } from "@/types";import {Changelist,@@ -187,7 +181,7 @@ interface LocalState {}const props = defineProps<{- project?: ComposedProject;+ project: ComposedProject;disableProjectSelect?: boolean;}>();@@ -199,7 +193,7 @@ const state = reactive<LocalState>({});const title = ref("");-const projectName = ref<string | undefined>(props.project?.name);+const projectName = ref<string>(props.project.name);const isLoading = ref(false);const resourceId = ref("");const resourceIdField = ref<InstanceType<typeof ResourceIdField>>();@@ -213,9 +207,6 @@ const encodingOptions = computed(() =>const errors = asyncComputed(() => {const errors: string[] = [];- if (!isValidProjectName(projectName.value)) {- errors.push(t("changelist.error.project-is-required"));- }if (!title.value.trim()) {errors.push(t("changelist.error.name-is-required"));}@@ -233,13 +224,8 @@ const validateResourceId = async (return [];}- if (!projectName.value) return [];- const project = await useProjectV1Store().getOrFetchProjectByName(- projectName.value- );-try {- const name = `${project.name}/changelists/${resourceId}`;+ const name = `${projectName.value}/changelists/${resourceId}`;const maybeExistedChangelist =await useChangelistStore().getOrFetchChangelistByName(name,@@ -305,9 +291,6 @@ const doCreate = async () => {isLoading.value = true;try {- const project = await useProjectV1Store().getOrFetchProjectByName(- projectName.value!- );const createdSheets = await Promise.all(files.value.map(async (f) => {const { name, arrayBuffer } = f;@@ -318,7 +301,7 @@ const doCreate = async () => {const content = new TextDecoder(state.encoding).decode(arrayBuffer);setSheetStatement(sheet, content);const created = await useSheetV1Store().createSheet(- project.name,+ projectName.value,sheet);return created;@@ -331,7 +314,7 @@ const doCreate = async () => {);const created = await useChangelistStore().createChangelist({- parent: project.name,+ parent: projectName.value,changelist: Changelist.fromPartial({description: title.value,changes,@@ -346,7 +329,7 @@ const doCreate = async () => {});router.push(- `/${project.name}/changelists/${extractChangelistResourceName(+ `/${projectName.value}/changelists/${extractChangelistResourceName(created.name)}`);diff --git a/frontend/src/components/Changelist/ChangelistDashboard/NavBar.vue b/frontend/src/components/Changelist/ChangelistDashboard/NavBar.vueindex dd4fa11320..39e39c6126 100644--- a/frontend/src/components/Changelist/ChangelistDashboard/NavBar.vue+++ b/frontend/src/components/Changelist/ChangelistDashboard/NavBar.vue@@ -1,8 +1,5 @@<template><div class="flex flex-row items-center gap-x-2">- <div v-if="!disableProjectSelect" class="flex items-center justify-start">- <ProjectSelect v-model:project-name="projectName" :include-all="true" />- </div><SearchBoxv-model:value="filter.keyword"style="max-width: 100%"@@ -17,32 +14,12 @@<script setup lang="ts">import { NButton } from "naive-ui";-import { computed, watch } from "vue";-import { ProjectSelect, SearchBox } from "@/components/v2";-import { UNKNOWN_PROJECT_NAME, isValidProjectName } from "@/types";+import { SearchBox } from "@/components/v2";import { useChangelistDashboardContext } from "./context";defineProps<{- disableProjectSelect?: boolean;allowCreate: boolean;}>();-const { filter, showCreatePanel, events } = useChangelistDashboardContext();--const projectName = computed({- get() {- const { project } = filter.value;- if (project === "projects/-") return UNKNOWN_PROJECT_NAME;- return project;- },- set(name) {- if (!isValidProjectName(name)) {- filter.value.project = "projects/-";- } else {- filter.value.project = name;- }- },-});--watch(projectName, () => events.emit("refresh"));+const { filter, showCreatePanel } = useChangelistDashboardContext();</script>diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 7d7a1c33a1..d8f501e0e4 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -2508,7 +2508,6 @@"name": "Changelist name","name-placeholder": "My changelist","error": {- "project-is-required": "Project is required","name-is-required": "Changelist name is required","invalid-resource-id": "Invalid resource Id","nothing-changed": "Nothing changed",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 32e10501eb..b1ee343648 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -2508,7 +2508,6 @@"name": "Nombre de la lista de cambios","name-placeholder": "Mi lista de cambios","error": {- "project-is-required": "Se requiere proyecto","name-is-required": "El nombre de la lista de cambios es obligatorio","invalid-resource-id": "ID de recurso no válido","nothing-changed": "nada ha cambiado",@@ -2602,4 +2601,4 @@"last-visit": "Última visita","changelog-for-version": "Registro de cambios para {version}"}-}\ No newline at end of file+}diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 402add0ff2..b85ec65b1d 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -2508,7 +2508,6 @@"name": "リスト名の変更","name-placeholder": "私の変更リスト","error": {- "project-is-required": "項目を空にすることはできません","name-is-required": "変更リスト名を空にすることはできません","invalid-resource-id": "無効なリソース ID","nothing-changed": "変化なし",@@ -2602,4 +2601,4 @@"last-visit": "最終訪問","changelog-for-version": "{version} の変更履歴"}-}\ No newline at end of file+}diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex fd2d69e191..83484e63e9 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -2508,7 +2508,6 @@"name": "Tên danh sách thay đổi","name-placeholder": "Danh sách thay đổi của tôi","error": {- "project-is-required": "Dự án là bắt buộc","name-is-required": "Tên danh sách thay đổi là bắt buộc","invalid-resource-id": "ID tài nguyên không hợp lệ","nothing-changed": "Không có gì thay đổi",@@ -2602,4 +2601,4 @@"last-visit": "Lần truy cập cuối","changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"}-}\ No newline at end of file+}diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 9314c5c558..c8b76b806d 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -2508,7 +2508,6 @@"name": "变更列表名称","name-placeholder": "我的变更列表","error": {- "project-is-required": "项目不能为空","name-is-required": "变更列表名称不能为空","invalid-resource-id": "无效的资源 ID","nothing-changed": "无任何改变",@@ -2602,4 +2601,4 @@"last-visit": "上次访问","changelog-for-version": "{version} 的更新日志"}-}\ No newline at end of file+}diff --git a/frontend/src/store/modules/v1/issue.ts b/frontend/src/store/modules/v1/issue.tsindex 9ebd3371c1..ea8fec8808 100644--- a/frontend/src/store/modules/v1/issue.ts+++ b/frontend/src/store/modules/v1/issue.ts@@ -5,17 +5,14 @@ import type { WatchCallback } from "vue";import { ref, watch } from "vue";import { issueServiceClient } from "@/grpcweb";import type { ComposedIssue, IssueFilter } from "@/types";-import { isValidProjectName, PresetRoleType } from "@/types";+import { PresetRoleType } from "@/types";import type { ApprovalStep } from "@/types/proto/v1/issue_service";import {issueStatusToJSON,ApprovalNode_Type,ApprovalNode_GroupValue,} from "@/types/proto/v1/issue_service";-import {- extractProjectResourceName,- memberMapToRolesInProjectIAM,-} from "@/utils";+import { memberMapToRolesInProjectIAM } from "@/utils";import {shallowComposeIssue,type ComposeIssueConfig,@@ -99,14 +96,8 @@ export const useIssueV1Store = defineStore("issue_v1", () => {pageSize,pageToken,});-- const issues = resp.issues.filter((issue) => {- const proj = extractProjectResourceName(issue.name);- return isValidProjectName(`projects/${proj}`);- });-const composedIssues = await Promise.all(- issues.map((issue) => shallowComposeIssue(issue, composeIssueConfig))+ resp.issues.map((issue) => shallowComposeIssue(issue, composeIssueConfig)));return {nextPageToken: resp.nextPageToken,diff --git a/frontend/src/store/modules/v1/plan.ts b/frontend/src/store/modules/v1/plan.tsindex 44c010b29f..aa12a8c060 100644--- a/frontend/src/store/modules/v1/plan.ts+++ b/frontend/src/store/modules/v1/plan.ts@@ -3,7 +3,7 @@ import { orderBy } from "lodash-es";import { defineStore } from "pinia";import { planServiceClient } from "@/grpcweb";import { useUserStore } from "@/store";-import { EMPTY_ID, isValidProjectName, UNKNOWN_ID } from "@/types";+import { EMPTY_ID, UNKNOWN_ID } from "@/types";import { unknownUser } from "@/types";import type { Plan } from "@/types/proto/v1/plan_service";import {@@ -124,14 +124,8 @@ export const usePlanStore = defineStore("plan", () => {pageSize,pageToken,});-- const plans = resp.plans.filter((plan) => {- const proj = extractProjectResourceName(plan.name);- return isValidProjectName(`projects/${proj}`);- });-const composedPlans = await Promise.all(- plans.map((plan) => composePlan(plan))+ resp.plans.map((plan) => composePlan(plan)));return {nextPageToken: resp.nextPageToken,diff --git a/frontend/src/types/release.ts b/frontend/src/types/release.tsindex 0a85188306..5a5a007bd1 100644--- a/frontend/src/types/release.ts+++ b/frontend/src/types/release.ts@@ -1,10 +1,9 @@import { getProjectNameReleaseId } from "@/store/modules/v1/common";-import { EMPTY_ID, UNKNOWN_ID } from "./const";-import type { User } from "./proto/v1/user_service";+import { UNKNOWN_ID } from "./const";import { Release } from "./proto/v1/release_service";-import { emptyUser, unknownUser } from "./v1";+import type { User } from "./proto/v1/user_service";+import { unknownUser } from "./v1";import {- emptyProject,UNKNOWN_PROJECT_NAME,unknownProject,type ComposedProject,@@ -19,21 +18,6 @@ export interface ComposedRelease extends Release {export const UNKNOWN_RELEASE_NAME = `${UNKNOWN_PROJECT_NAME}/releases/${UNKNOWN_ID}`;-export const emptyRelease = (): ComposedRelease => {- const projectEntity = emptyProject();- const release = Release.fromJSON({- name: `${projectEntity.name}/releases/${EMPTY_ID}`,- uid: String(EMPTY_ID),- project: projectEntity.name,- });- return {- ...release,- project: projectEntity.name,- projectEntity,- creatorEntity: emptyUser(),- };-};-export const unknownRelease = (): ComposedRelease => {const projectEntity = unknownProject();const release = Release.fromJSON({diff --git a/frontend/src/types/v1/group.ts b/frontend/src/types/v1/group.tsindex ec88dc5256..f541e253f7 100644--- a/frontend/src/types/v1/group.ts+++ b/frontend/src/types/v1/group.ts@@ -1,22 +1,12 @@import { groupNamePrefix } from "@/store/modules/v1/common";-import { EMPTY_ID, UNKNOWN_ID } from "../const";+import { UNKNOWN_ID } from "../const";import { Group } from "../proto/v1/group_service";export const UNKNOWN_GROUP_NAME = `${groupNamePrefix}${UNKNOWN_ID}`;-export const emptyGroup = () => {- return Group.fromPartial({- name: `${groupNamePrefix}${EMPTY_ID}`,- title: "",- description: "",- members: [],- });-};-export const unknownGroup = () => {- return {- ...emptyGroup(),+ return Group.fromPartial({name: UNKNOWN_GROUP_NAME,title: "<<Unknown group>>",- };+ });};diff --git a/frontend/src/types/v1/projectWebhook.ts b/frontend/src/types/v1/projectWebhook.tsindex 4e95fbb3ce..a96722b9f5 100644--- a/frontend/src/types/v1/projectWebhook.ts+++ b/frontend/src/types/v1/projectWebhook.ts@@ -1,5 +1,4 @@import { t } from "@/plugins/i18n";-import { EMPTY_ID } from "../const";import {Activity_Type,Webhook,@@ -8,10 +7,7 @@ import {export const emptyProjectWebhook = () => {return Webhook.fromJSON({- name: `projects/${EMPTY_ID}/webhooks/${EMPTY_ID}`,type: Webhook_Type.SLACK,- title: "",- url: "",notificationTypes: [Activity_Type.TYPE_ISSUE_STATUS_UPDATE],});};diff --git a/frontend/src/utils/v1/changelog.ts b/frontend/src/utils/v1/changelog.tsindex 7d288840cb..59d3647963 100644--- a/frontend/src/utils/v1/changelog.ts+++ b/frontend/src/utils/v1/changelog.ts@@ -3,7 +3,7 @@ import Long from "long";import { t } from "@/plugins/i18n";import { useDBSchemaV1Store, useDatabaseV1Store } from "@/store";import type { ComposedDatabase } from "@/types";-import { EMPTY_ID, UNKNOWN_ID } from "@/types";+import { UNKNOWN_ID } from "@/types";import { type AffectedTable, EmptyAffectedTable } from "@/types";import { Changelog_Type } from "@/types/proto/v1/database_service";import { Changelog } from "@/types/proto/v1/database_service";@@ -31,7 +31,7 @@ export const isValidChangelogName = (name: string | undefined) => {return false;}const uid = extractChangelogUID(name);- return uid && uid !== String(EMPTY_ID) && uid !== String(UNKNOWN_ID);+ return uid && uid !== String(UNKNOWN_ID);};export const changelogLink = (changelog: Changelog): string => {