Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Returns the empty resource if passing the EMPTY_ID for key lookup
天舟7b881dcc5379
diff --git a/frontend/src/store/modules/dataSource.ts b/frontend/src/store/modules/dataSource.tsindex 22be1dff5c..f2dc48dfaa 100644--- a/frontend/src/store/modules/dataSource.ts+++ b/frontend/src/store/modules/dataSource.ts@@ -14,6 +14,8 @@ import {Database,Instance,DataSourcePatch,+ EMPTY_ID,+ empty,} from "../../types";function convert(@@ -91,6 +93,10 @@ const getters = {dataSourceById: (state: DataSourceState) => (dataSourceId: DataSourceId): DataSource => {+ if (dataSourceId == EMPTY_ID) {+ return empty("DATA_SOURCE") as DataSource;+ }+return (state.dataSourceById.get(dataSourceId) ||(unknown("DATA_SOURCE") as DataSource)diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.tsindex dfff831a93..c088ea8a18 100644--- a/frontend/src/store/modules/database.ts+++ b/frontend/src/store/modules/database.ts@@ -16,6 +16,8 @@ import {DataSourceMember,Project,ProjectId,+ EMPTY_ID,+ empty,} from "../../types";function convert(@@ -159,6 +161,10 @@ const getters = {databaseId: DatabaseId,instanceId?: InstanceId): Database => {+ if (databaseId == EMPTY_ID) {+ return empty("DATABASE") as Database;+ }+if (instanceId) {const list = state.databaseListByInstanceId.get(instanceId) || [];return (diff --git a/frontend/src/store/modules/environment.ts b/frontend/src/store/modules/environment.tsindex abc50e661c..300bbcbeb5 100644--- a/frontend/src/store/modules/environment.ts+++ b/frontend/src/store/modules/environment.ts@@ -10,6 +10,8 @@ import {EnvironmentPatch,BatchUpdate,PrincipalId,+ empty,+ EMPTY_ID,} from "../../types";function convert(environment: ResourceObject, rootGetters: any): Environment {@@ -46,6 +48,10 @@ const getters = {environmentById: (state: EnvironmentState) => (environmentId: EnvironmentId): Environment => {+ if (environmentId == EMPTY_ID) {+ return empty("ENVIRONMENT") as Environment;+ }+for (const environment of state.environmentList) {if (environment.id == environmentId) {return environment;diff --git a/frontend/src/store/modules/instance.ts b/frontend/src/store/modules/instance.tsindex 4725612fcd..3ee59ee896 100644--- a/frontend/src/store/modules/instance.ts+++ b/frontend/src/store/modules/instance.ts@@ -11,6 +11,8 @@ import {unknown,InstancePatch,RowStatus,+ empty,+ EMPTY_ID,} from "../../types";function convert(@@ -108,6 +110,10 @@ const getters = {instanceById: (state: InstanceState) => (instanceId: InstanceId): Instance => {+ if (instanceId == EMPTY_ID) {+ return empty("INSTANCE") as Instance;+ }+return (state.instanceById.get(instanceId) || (unknown("INSTANCE") as Instance));diff --git a/frontend/src/store/modules/issue.ts b/frontend/src/store/modules/issue.tsindex 45d97af56a..9407181681 100644--- a/frontend/src/store/modules/issue.ts+++ b/frontend/src/store/modules/issue.ts@@ -15,6 +15,7 @@ import {IssueStatusPatch,Pipeline,empty,+ EMPTY_ID,} from "../../types";function convert(@@ -100,6 +101,10 @@ const getters = {},issueById: (state: IssueState) => (issueId: IssueId): Issue => {+ if (issueId == EMPTY_ID) {+ return empty("ISSUE") as Issue;+ }+return state.issueById.get(issueId) || (unknown("ISSUE") as Issue);},};diff --git a/frontend/src/store/modules/member.ts b/frontend/src/store/modules/member.tsindex 430aa6953f..b5b1aec0e4 100644--- a/frontend/src/store/modules/member.ts+++ b/frontend/src/store/modules/member.ts@@ -8,6 +8,8 @@ import {ResourceObject,PrincipalId,unknown,+ empty,+ EMPTY_ID,} from "../../types";function convert(member: ResourceObject, rootGetters: any): Member {@@ -34,6 +36,10 @@ const getters = {return state.memberList;},memberByPrincipalId: (state: MemberState) => (id: PrincipalId): Member => {+ if (id == EMPTY_ID) {+ return empty("MEMBER") as Member;+ }+return (state.memberList.find((item) => item.principalId == id) ||(unknown("MEMBER") as Member)diff --git a/frontend/src/store/modules/principal.ts b/frontend/src/store/modules/principal.tsindex d129303d29..f5981d4121 100644--- a/frontend/src/store/modules/principal.ts+++ b/frontend/src/store/modules/principal.ts@@ -10,6 +10,8 @@ import {ResourceObject,UserPatch,unknown,+ empty,+ EMPTY_ID,} from "../../types";import { isDevOrDemo, randomString } from "../../utils";@@ -54,6 +56,10 @@ const getters = {principalById: (state: PrincipalState) => (principalId: PrincipalId): Principal => {+ if (principalId == EMPTY_ID) {+ return empty("PRINCIPAL") as Principal;+ }+return (state.principalList.find((item) => item.id == principalId) ||(unknown("PRINCIPAL") as Principal)diff --git a/frontend/src/store/modules/project.ts b/frontend/src/store/modules/project.tsindex dc353b7dcf..50f688efc0 100644--- a/frontend/src/store/modules/project.ts+++ b/frontend/src/store/modules/project.ts@@ -15,6 +15,8 @@ import {PrincipalId,ResourceIdentifier,RowStatus,+ EMPTY_ID,+ empty,} from "../../types";function convert(@@ -136,6 +138,10 @@ const getters = {},projectById: (state: ProjectState) => (projectId: ProjectId): Project => {+ if (projectId == EMPTY_ID) {+ return empty("PROJECT") as Project;+ }+return state.projectById.get(projectId) || (unknown("PROJECT") as Project);},};diff --git a/frontend/src/store/modules/task.ts b/frontend/src/store/modules/task.tsindex a63e34ba09..1dfdff4818 100644--- a/frontend/src/store/modules/task.ts+++ b/frontend/src/store/modules/task.ts@@ -12,6 +12,8 @@ import {unknown,PipelineId,Pipeline,+ Database,+ empty,} from "../../types";const state: () => TaskState = () => ({});@@ -28,9 +30,13 @@ function convertPartial(task.attributes.updaterId);- const database = rootGetters["database/databaseById"](- (task.relationships!.database.data as ResourceIdentifier).id- );+ let database: Database = empty("DATABASE") as Database;+ // For create database task, there is no database id.+ if (task.relationships!.database.data) {+ database = rootGetters["database/databaseById"](+ (task.relationships!.database.data as ResourceIdentifier).id+ );+ }const stepList: Step[] = [];for (const item of includedList || []) {