Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Make memberList as required in DataSourceNew request

天舟8181809781a6
diff --git a/frontend/src/components/DataSourceNewForm.vue b/frontend/src/components/DataSourceNewForm.vue
index 3dec4734b5..fa5bea77f1 100644
--- a/frontend/src/components/DataSourceNewForm.vue
+++ b/frontend/src/components/DataSourceNewForm.vue
@@ -176,6 +176,7 @@ export default {
databaseId: props.databaseId
? props.databaseId
: ALL_DATABASE_PLACEHOLDER_ID,
+ memberList: [],
},
showPassword: false,
});
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vue
index 2c987fc3a9..d32c9895f6 100644
--- a/frontend/src/components/InstanceForm.vue
+++ b/frontend/src/components/InstanceForm.vue
@@ -270,6 +270,7 @@ const INIT_DATA_SOURCE: DataSourceNew = {
type: "RW",
username: "root",
databaseId: ALL_DATABASE_PLACEHOLDER_ID,
+ memberList: [],
};
interface LocalState {
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index 0655cb53a9..0c674d8712 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -357,6 +357,7 @@ export type DataSourceNew = {
databaseId: string;
username?: string;
password?: string;
+ memberList: DataSourceMemberNew[];
};
export type DataSourceMember = {
diff --git a/frontend/src/views/DatabaseNew.vue b/frontend/src/views/DatabaseNew.vue
index c486641a7b..5812cf63e9 100644
--- a/frontend/src/views/DatabaseNew.vue
+++ b/frontend/src/views/DatabaseNew.vue
@@ -308,6 +308,12 @@ export default {
databaseId: createdDatabase.id,
username: isEmpty(state.username) ? undefined : state.username,
password: isEmpty(state.passsword) ? undefined : state.passsword,
+ memberList: [
+ {
+ principalId: state.ownerId,
+ taskId: state.taskId,
+ },
+ ],
};
const createdDataSource = await store.dispatch(
"dataSource/createDataSource",
@@ -317,16 +323,6 @@ export default {
}
);
- // Add the owner to the data source.
- await store.dispatch("dataSource/createDataSourceMember", {
- instanceId: state.instanceId,
- dataSourceId: createdDataSource.id,
- newDataSourceMember: {
- principalId: state.ownerId,
- taskId: state.taskId,
- },
- });
-
router.push(
`/instance/${instanceSlug(createdDatabase.instance)}/db/${databaseSlug(
createdDatabase