Skip to content

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

chore: calculate the unmatched databases (#17423)

ecmadao551f0e81d8e0
diff --git a/backend/api/v1/database_group_service.go b/backend/api/v1/database_group_service.go
index 97dc977e22..29cb279dd3 100644
--- a/backend/api/v1/database_group_service.go
+++ b/backend/api/v1/database_group_service.go
@@ -298,7 +298,7 @@ func convertStoreToV1DatabaseGroup(ctx context.Context, stores *store.Store, dat
return nil, connect.NewError(connect.CodeInternal, err)
}
- matches, unmatches, err := utils.GetMatchedAndUnmatchedDatabasesInDatabaseGroup(ctx, databaseGroup, databases)
+ matches, err := utils.GetMatchedDatabasesInDatabaseGroup(ctx, databaseGroup, databases)
if err != nil {
return nil, err
}
@@ -307,12 +307,5 @@ func convertStoreToV1DatabaseGroup(ctx context.Context, stores *store.Store, dat
Name: common.FormatDatabase(database.InstanceID, database.DatabaseName),
})
}
- if view == v1pb.DatabaseGroupView_DATABASE_GROUP_VIEW_FULL {
- for _, database := range unmatches {
- ret.UnmatchedDatabases = append(ret.UnmatchedDatabases, &v1pb.DatabaseGroup_Database{
- Name: common.FormatDatabase(database.InstanceID, database.DatabaseName),
- })
- }
- }
return ret, nil
}
diff --git a/backend/api/v1/plan_service.go b/backend/api/v1/plan_service.go
index 5a94947d3f..7f232c0305 100644
--- a/backend/api/v1/plan_service.go
+++ b/backend/api/v1/plan_service.go
@@ -1372,7 +1372,7 @@ func getPlanDeployment(ctx context.Context, s *store.Store, specs []*storepb.Pla
return nil, errors.Wrapf(err, "failed to get database group")
}
- matchedDatabases, _, err := utils.GetMatchedAndUnmatchedDatabasesInDatabaseGroup(ctx, databaseGroup, allDatabases)
+ matchedDatabases, err := utils.GetMatchedDatabasesInDatabaseGroup(ctx, databaseGroup, allDatabases)
if err != nil {
return nil, errors.Wrapf(err, "failed to get matched and unmatched databases in database group %q", id)
}
diff --git a/backend/api/v1/release_service_check.go b/backend/api/v1/release_service_check.go
index fe6bbdbd6d..dc585c67d4 100644
--- a/backend/api/v1/release_service_check.go
+++ b/backend/api/v1/release_service_check.go
@@ -85,7 +85,7 @@ func (s *ReleaseService) CheckRelease(ctx context.Context, req *connect.Request[
return nil, connect.NewError(connect.CodeInternal, err)
}
// Filter out databases that are matched with the database group.
- matches, _, err := utils.GetMatchedAndUnmatchedDatabasesInDatabaseGroup(ctx, existedDatabaseGroup, groupDatabases)
+ matches, err := utils.GetMatchedDatabasesInDatabaseGroup(ctx, existedDatabaseGroup, groupDatabases)
if err != nil {
return nil, err
}
diff --git a/backend/generated-go/v1/database_group_service.pb.go b/backend/generated-go/v1/database_group_service.pb.go
index bdae6978e9..cb661b2930 100644
--- a/backend/generated-go/v1/database_group_service.pb.go
+++ b/backend/generated-go/v1/database_group_service.pb.go
@@ -35,8 +35,6 @@ const (
DatabaseGroupView_DATABASE_GROUP_VIEW_BASIC DatabaseGroupView = 1
// Include everything.
DatabaseGroupView_DATABASE_GROUP_VIEW_FULL DatabaseGroupView = 2
- // Include matched databases.
- DatabaseGroupView_DATABASE_GROUP_VIEW_MATCHED DatabaseGroupView = 3
)
// Enum value maps for DatabaseGroupView.
@@ -45,13 +43,11 @@ var (
0: "DATABASE_GROUP_VIEW_UNSPECIFIED",
1: "DATABASE_GROUP_VIEW_BASIC",
2: "DATABASE_GROUP_VIEW_FULL",
- 3: "DATABASE_GROUP_VIEW_MATCHED",
}
DatabaseGroupView_value = map[string]int32{
"DATABASE_GROUP_VIEW_UNSPECIFIED": 0,
"DATABASE_GROUP_VIEW_BASIC": 1,
"DATABASE_GROUP_VIEW_FULL": 2,
- "DATABASE_GROUP_VIEW_MATCHED": 3,
}
)
@@ -475,10 +471,8 @@ type DatabaseGroup struct {
DatabaseExpr *expr.Expr `protobuf:"bytes,3,opt,name=database_expr,json=databaseExpr,proto3" json:"database_expr,omitempty"`
// The list of databases that match the database group condition.
MatchedDatabases []*DatabaseGroup_Database `protobuf:"bytes,4,rep,name=matched_databases,json=matchedDatabases,proto3" json:"matched_databases,omitempty"`
- // The list of databases that match the database group condition.
- UnmatchedDatabases []*DatabaseGroup_Database `protobuf:"bytes,5,rep,name=unmatched_databases,json=unmatchedDatabases,proto3" json:"unmatched_databases,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *DatabaseGroup) Reset() {
@@ -539,13 +533,6 @@ func (x *DatabaseGroup) GetMatchedDatabases() []*DatabaseGroup_Database {
return nil
}
-func (x *DatabaseGroup) GetUnmatchedDatabases() []*DatabaseGroup_Database {
- if x != nil {
- return x.UnmatchedDatabases
- }
- return nil
-}
-
type DatabaseGroup_Database struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The resource name of the database.
@@ -623,21 +610,19 @@ const file_v1_database_group_service_proto_rawDesc = "" +
"updateMask\"T\n" +
"\x1aDeleteDatabaseGroupRequest\x126\n" +
"\x04name\x18\x01 \x01(\tB\"\xe0A\x02\xfaA\x1c\n" +
- "\x1abytebase.com/DatabaseGroupR\x04name\"\x97\x03\n" +
+ "\x1abytebase.com/DatabaseGroupR\x04name\"\xbc\x02\n" +
"\rDatabaseGroup\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" +
"\x05title\x18\x02 \x01(\tR\x05title\x126\n" +
"\rdatabase_expr\x18\x03 \x01(\v2\x11.google.type.ExprR\fdatabaseExpr\x12U\n" +
- "\x11matched_databases\x18\x04 \x03(\v2#.bytebase.v1.DatabaseGroup.DatabaseB\x03\xe0A\x03R\x10matchedDatabases\x12Y\n" +
- "\x13unmatched_databases\x18\x05 \x03(\v2#.bytebase.v1.DatabaseGroup.DatabaseB\x03\xe0A\x03R\x12unmatchedDatabases\x1a\x1e\n" +
+ "\x11matched_databases\x18\x04 \x03(\v2#.bytebase.v1.DatabaseGroup.DatabaseB\x03\xe0A\x03R\x10matchedDatabases\x1a\x1e\n" +
"\bDatabase\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name:R\xeaAO\n" +
- "\x1abytebase.com/DatabaseGroup\x121projects/{project}/databaseGroups/{databaseGroup}*\x96\x01\n" +
+ "\x1abytebase.com/DatabaseGroup\x121projects/{project}/databaseGroups/{databaseGroup}*u\n" +
"\x11DatabaseGroupView\x12#\n" +
"\x1fDATABASE_GROUP_VIEW_UNSPECIFIED\x10\x00\x12\x1d\n" +
"\x19DATABASE_GROUP_VIEW_BASIC\x10\x01\x12\x1c\n" +
- "\x18DATABASE_GROUP_VIEW_FULL\x10\x02\x12\x1f\n" +
- "\x1bDATABASE_GROUP_VIEW_MATCHED\x10\x032\xdb\a\n" +
+ "\x18DATABASE_GROUP_VIEW_FULL\x10\x022\xdb\a\n" +
"\x14DatabaseGroupService\x12\xb5\x01\n" +
"\x12ListDatabaseGroups\x12&.bytebase.v1.ListDatabaseGroupsRequest\x1a'.bytebase.v1.ListDatabaseGroupsResponse\"N\xdaA\x06parent\x8a\xea0\x0fbb.projects.get\x90\xea0\x01\x82\xd3\xe4\x93\x02(\x12&/v1/{parent=projects/*}/databaseGroups\x12\xa2\x01\n" +
"\x10GetDatabaseGroup\x12$.bytebase.v1.GetDatabaseGroupRequest\x1a\x1a.bytebase.v1.DatabaseGroup\"L\xdaA\x04name\x8a\xea0\x0fbb.projects.get\x90\xea0\x01\x82\xd3\xe4\x93\x02(\x12&/v1/{name=projects/*/databaseGroups/*}\x12\xcf\x01\n" +
@@ -682,22 +667,21 @@ var file_v1_database_group_service_proto_depIdxs = []int32{
9, // 5: bytebase.v1.UpdateDatabaseGroupRequest.update_mask:type_name -> google.protobuf.FieldMask
10, // 6: bytebase.v1.DatabaseGroup.database_expr:type_name -> google.type.Expr
8, // 7: bytebase.v1.DatabaseGroup.matched_databases:type_name -> bytebase.v1.DatabaseGroup.Database
- 8, // 8: bytebase.v1.DatabaseGroup.unmatched_databases:type_name -> bytebase.v1.DatabaseGroup.Database
- 1, // 9: bytebase.v1.DatabaseGroupService.ListDatabaseGroups:input_type -> bytebase.v1.ListDatabaseGroupsRequest
- 3, // 10: bytebase.v1.DatabaseGroupService.GetDatabaseGroup:input_type -> bytebase.v1.GetDatabaseGroupRequest
- 4, // 11: bytebase.v1.DatabaseGroupService.CreateDatabaseGroup:input_type -> bytebase.v1.CreateDatabaseGroupRequest
- 5, // 12: bytebase.v1.DatabaseGroupService.UpdateDatabaseGroup:input_type -> bytebase.v1.UpdateDatabaseGroupRequest
- 6, // 13: bytebase.v1.DatabaseGroupService.DeleteDatabaseGroup:input_type -> bytebase.v1.DeleteDatabaseGroupRequest
- 2, // 14: bytebase.v1.DatabaseGroupService.ListDatabaseGroups:output_type -> bytebase.v1.ListDatabaseGroupsResponse
- 7, // 15: bytebase.v1.DatabaseGroupService.GetDatabaseGroup:output_type -> bytebase.v1.DatabaseGroup
- 7, // 16: bytebase.v1.DatabaseGroupService.CreateDatabaseGroup:output_type -> bytebase.v1.DatabaseGroup
- 7, // 17: bytebase.v1.DatabaseGroupService.UpdateDatabaseGroup:output_type -> bytebase.v1.DatabaseGroup
- 11, // 18: bytebase.v1.DatabaseGroupService.DeleteDatabaseGroup:output_type -> google.protobuf.Empty
- 14, // [14:19] is the sub-list for method output_type
- 9, // [9:14] is the sub-list for method input_type
- 9, // [9:9] is the sub-list for extension type_name
- 9, // [9:9] is the sub-list for extension extendee
- 0, // [0:9] is the sub-list for field type_name
+ 1, // 8: bytebase.v1.DatabaseGroupService.ListDatabaseGroups:input_type -> bytebase.v1.ListDatabaseGroupsRequest
+ 3, // 9: bytebase.v1.DatabaseGroupService.GetDatabaseGroup:input_type -> bytebase.v1.GetDatabaseGroupRequest
+ 4, // 10: bytebase.v1.DatabaseGroupService.CreateDatabaseGroup:input_type -> bytebase.v1.CreateDatabaseGroupRequest
+ 5, // 11: bytebase.v1.DatabaseGroupService.UpdateDatabaseGroup:input_type -> bytebase.v1.UpdateDatabaseGroupRequest
+ 6, // 12: bytebase.v1.DatabaseGroupService.DeleteDatabaseGroup:input_type -> bytebase.v1.DeleteDatabaseGroupRequest
+ 2, // 13: bytebase.v1.DatabaseGroupService.ListDatabaseGroups:output_type -> bytebase.v1.ListDatabaseGroupsResponse
+ 7, // 14: bytebase.v1.DatabaseGroupService.GetDatabaseGroup:output_type -> bytebase.v1.DatabaseGroup
+ 7, // 15: bytebase.v1.DatabaseGroupService.CreateDatabaseGroup:output_type -> bytebase.v1.DatabaseGroup
+ 7, // 16: bytebase.v1.DatabaseGroupService.UpdateDatabaseGroup:output_type -> bytebase.v1.DatabaseGroup
+ 11, // 17: bytebase.v1.DatabaseGroupService.DeleteDatabaseGroup:output_type -> google.protobuf.Empty
+ 13, // [13:18] is the sub-list for method output_type
+ 8, // [8:13] is the sub-list for method input_type
+ 8, // [8:8] is the sub-list for extension type_name
+ 8, // [8:8] is the sub-list for extension extendee
+ 0, // [0:8] is the sub-list for field type_name
}
func init() { file_v1_database_group_service_proto_init() }
diff --git a/backend/store/policy.go b/backend/store/policy.go
index 38fed8bac2..37a87d7516 100644
--- a/backend/store/policy.go
+++ b/backend/store/policy.go
@@ -204,11 +204,11 @@ func (s *Store) GetReviewConfigForDatabase(ctx context.Context, database *Databa
for _, v := range resources {
reviewConfig, err := s.getReviewConfigByResource(ctx, v.resourceType, v.resource)
if err != nil {
- slog.Debug("failed to get review config", slog.String("resource_type", string(v.resourceType)), slog.String("database", database.DatabaseName), log.BBError(err))
+ slog.Debug("failed to get review config", slog.String("resource_type", v.resourceType.String()), slog.String("database", database.DatabaseName), log.BBError(err))
continue
}
if reviewConfig == nil {
- slog.Debug("review config is empty", slog.String("resource_type", string(v.resourceType)), slog.String("database", database.DatabaseName), log.BBError(err))
+ slog.Debug("review config is empty", slog.String("resource_type", v.resourceType.String()), slog.String("database", database.DatabaseName), log.BBError(err))
continue
}
return reviewConfig, nil
diff --git a/backend/tests/grouping_change_test.go b/backend/tests/grouping_change_test.go
index 12ca482a77..80556a826d 100644
--- a/backend/tests/grouping_change_test.go
+++ b/backend/tests/grouping_change_test.go
@@ -21,9 +21,8 @@ import (
func TestCreateDatabaseGroup(t *testing.T) {
t.Parallel()
type testCasePrepareInstance struct {
- instanceTitle string
- matchedDatabasesName map[string]any
- unmatchedDatabaseName map[string]any
+ instanceTitle string
+ matchedDatabasesName map[string]any
}
testCases := []struct {
name string
@@ -42,7 +41,6 @@ func TestCreateDatabaseGroup(t *testing.T) {
"employee_01": nil,
"employee_02": nil,
},
- unmatchedDatabaseName: map[string]any{},
},
},
},
@@ -57,10 +55,6 @@ func TestCreateDatabaseGroup(t *testing.T) {
"employee_01": nil,
"employee_02": nil,
},
- unmatchedDatabaseName: map[string]any{
- "hello": nil,
- "world": nil,
- },
},
},
},
@@ -75,7 +69,6 @@ func TestCreateDatabaseGroup(t *testing.T) {
"employee_01": nil,
"employee_02": nil,
},
- unmatchedDatabaseName: map[string]any{},
},
{
instanceTitle: "TestCreateDatabaseGroups_AllMatched_ManyInstances_02",
@@ -84,7 +77,6 @@ func TestCreateDatabaseGroup(t *testing.T) {
"employee_03": nil,
"employee_04": nil,
},
- unmatchedDatabaseName: map[string]any{},
},
},
},
@@ -99,10 +91,6 @@ func TestCreateDatabaseGroup(t *testing.T) {
"employee_01": nil,
"employee_02": nil,
},
- unmatchedDatabaseName: map[string]any{
- "hello": nil,
- "world": nil,
- },
},
{
instanceTitle: "TestCreateDatabaseGroups_PartialMatched_ManyInstances_02",
@@ -111,10 +99,6 @@ func TestCreateDatabaseGroup(t *testing.T) {
"employee_03": nil,
"employee_04": nil,
},
- unmatchedDatabaseName: map[string]any{
- "hello": nil,
- "world": nil,
- },
},
},
},
@@ -156,10 +140,6 @@ func TestCreateDatabaseGroup(t *testing.T) {
err = ctl.createDatabaseV2(ctx, ctl.project, instance, nil, preCreateDatabase, "")
a.NoError(err)
}
- for preCreateDatabase := range prepareInstance.unmatchedDatabaseName {
- err = ctl.createDatabaseV2(ctx, ctl.project, instance, nil, preCreateDatabase, "")
- a.NoError(err)
- }
}
databaseGroupResp, err := ctl.databaseGroupServiceClient.CreateDatabaseGroup(ctx, connect.NewRequest(&v1pb.CreateDatabaseGroupRequest{
Parent: ctl.project.Name,
@@ -181,7 +161,7 @@ func TestCreateDatabaseGroup(t *testing.T) {
databaseGroup = databaseGroupResp.Msg
gotInstanceTitleToMatchedDatabases := make(map[string][]string)
- gotInstanceTitleToUnmatchedDatabases := make(map[string][]string)
+
for _, matchedDatabase := range databaseGroup.MatchedDatabases {
instanceResourceID := strings.Split(matchedDatabase.Name, "/")[1]
instanceTitle := instanceResourceID2InstanceTitle[instanceResourceID]
@@ -190,27 +170,13 @@ func TestCreateDatabaseGroup(t *testing.T) {
databaseName := strings.Split(matchedDatabase.Name, "/")[3]
gotInstanceTitleToMatchedDatabases[instanceTitle] = append(gotInstanceTitleToMatchedDatabases[instanceTitle], databaseName)
}
- for _, unmatchedDatabase := range databaseGroup.UnmatchedDatabases {
- instanceResourceID := strings.Split(unmatchedDatabase.Name, "/")[1]
- instanceTitle := instanceResourceID2InstanceTitle[instanceResourceID]
- a.NotEmpty(instanceTitle)
-
- databaseName := strings.Split(unmatchedDatabase.Name, "/")[3]
- gotInstanceTitleToUnmatchedDatabases[instanceTitle] = append(gotInstanceTitleToUnmatchedDatabases[instanceTitle], databaseName)
- }
for _, prepareInstance := range tc.prepareInstances {
gotMatchedDatabases := gotInstanceTitleToMatchedDatabases[prepareInstance.instanceTitle]
- gotUnmatchedDatabases := gotInstanceTitleToUnmatchedDatabases[prepareInstance.instanceTitle]
a.Equal(len(gotMatchedDatabases), len(prepareInstance.matchedDatabasesName))
- a.Equal(len(gotUnmatchedDatabases), len(prepareInstance.unmatchedDatabaseName))
-
for wantMatchedDatabase := range prepareInstance.matchedDatabasesName {
a.Contains(gotMatchedDatabases, wantMatchedDatabase)
}
- for wantUnmatchedDatabase := range prepareInstance.unmatchedDatabaseName {
- a.Contains(gotUnmatchedDatabases, wantUnmatchedDatabase)
- }
}
})
}
diff --git a/backend/utils/utils.go b/backend/utils/utils.go
index 487479ef2d..aaf081e429 100644
--- a/backend/utils/utils.go
+++ b/backend/utils/utils.go
@@ -172,25 +172,22 @@ func UpdateProjectPolicyFromGrantIssue(ctx context.Context, stores *store.Store,
return nil
}
-// GetMatchedAndUnmatchedDatabasesInDatabaseGroup returns the matched and unmatched databases in the given database group.
-func GetMatchedAndUnmatchedDatabasesInDatabaseGroup(ctx context.Context, databaseGroup *store.DatabaseGroupMessage, allDatabases []*store.DatabaseMessage) ([]*store.DatabaseMessage, []*store.DatabaseMessage, error) {
+// GetMatchedDatabasesInDatabaseGroup returns the matched databases in the given database group.
+func GetMatchedDatabasesInDatabaseGroup(ctx context.Context, databaseGroup *store.DatabaseGroupMessage, allDatabases []*store.DatabaseMessage) ([]*store.DatabaseMessage, error) {
var matches []*store.DatabaseMessage
- var unmatches []*store.DatabaseMessage
// DONOT check bb.feature.database-grouping for instance. The API here is read-only in the frontend, we need to show if the instance is matched but missing required license.
// The feature guard will works during issue creation.
for _, database := range allDatabases {
matched, err := CheckDatabaseGroupMatch(ctx, databaseGroup.Expression.Expression, database)
if err != nil {
- return nil, nil, err
+ return nil, err
}
if matched {
matches = append(matches, database)
- } else {
- unmatches = append(unmatches, database)
}
}
- return matches, unmatches, nil
+ return matches, nil
}
func CheckDatabaseGroupMatch(ctx context.Context, expression string, database *store.DatabaseMessage) (bool, error) {
diff --git a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue
index 654bc99816..fc37c3a634 100644
--- a/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue
+++ b/frontend/src/components/DatabaseGroup/MatchedDatabaseView.vue
@@ -16,17 +16,17 @@
v-model:expanded-names="state.collapseExpandedNames"
>
<NCollapseItem
- v-for="(item, i) in state.databaseMatchLists"
+ v-for="item in state.databaseMatchLists"
:key="item.name"
:title="item.title"
- :disabled="item.databaseNameList.length === 0"
+ :disabled="item.databaseList.length === 0"
:name="item.name"
>
- <template #header-extra>{{ item.databaseNameList.length }}</template>
+ <template #header-extra>{{ item.databaseList.length }}</template>
<div class="space-y-2 w-full max-h-[12rem] overflow-y-auto">
<div class="">
<div
- v-for="database in getDatabaseList(i)"
+ v-for="database in item.databaseList"
:key="database.name"
class="w-full flex flex-row justify-between items-center px-2 py-1 gap-x-2"
>
@@ -45,11 +45,11 @@
</div>
</div>
<NButton
- v-if="item.databaseNameList.length > item.index"
+ v-if="item.hasNext(item.token)"
size="small"
quaternary
:loading="item.loading"
- @click="() => loadMore(i)"
+ @click="() => loadMoreDatabase(item)"
>
{{ $t("common.load-more") }}
</NButton>
@@ -62,7 +62,7 @@
import type { ConnectError } from "@connectrpc/connect";
import { useDebounceFn } from "@vueuse/core";
import { NButton, NCollapse, NCollapseItem } from "naive-ui";
-import { watch, reactive } from "vue";
+import { watch, reactive, ref } from "vue";
import { useI18n } from "vue-i18n";
import { BBSpin } from "@/bbkit";
import { DatabaseV1Name, InstanceV1Name } from "@/components/v2";
@@ -70,20 +70,27 @@ import { EnvironmentV1Name } from "@/components/v2";
import type { ConditionGroupExpr } from "@/plugins/cel";
import { validateSimpleExpr } from "@/plugins/cel";
import { useDatabaseV1Store, useDBGroupStore } from "@/store";
-import { DEBOUNCE_SEARCH_DELAY, isValidDatabaseName } from "@/types";
-
-interface DatabaseMatchList {
- index: number;
+import {
+ DEBOUNCE_SEARCH_DELAY,
+ isValidDatabaseName,
+ type ComposedDatabase,
+} from "@/types";
+import { getDefaultPagination } from "@/utils";
+
+interface DatabaseMatchList<T> {
+ token: T;
loading: boolean;
- databaseNameList: string[];
+ databaseList: ComposedDatabase[];
name: "matched" | "unmatched";
title: string;
+ hasNext: (token: T) => boolean;
+ loadMore: (token: T) => Promise<{ databases: ComposedDatabase[]; token: T }>;
}
interface LocalState {
loading: boolean;
matchingError?: string;
- databaseMatchLists: DatabaseMatchList[];
+ databaseMatchLists: DatabaseMatchList<any>[];
collapseExpandedNames: string[];
}
@@ -93,23 +100,68 @@ const props = defineProps<{
}>();
const { t } = useI18n();
+const matchedDatabaseNameList = ref<string[]>([]);
+
+const loadMoreMatched = async (index: number) => {
+ const previous = index;
+ const next = previous + 20;
+
+ const databases = await Promise.all(
+ matchedDatabaseNameList.value
+ .slice(previous, next)
+ .map((name) => databaseStore.getOrFetchDatabaseByName(name))
+ );
+
+ return {
+ databases,
+ token: next,
+ };
+};
-const getInitialState = (): DatabaseMatchList[] => [
- {
- index: 0,
- loading: false,
- databaseNameList: [],
- title: t("database-group.matched-database"),
- name: "matched",
- },
- {
- index: 0,
- loading: false,
- databaseNameList: [],
- title: t("database-group.unmatched-database"),
- name: "unmatched",
- },
-];
+const loadMoreUnmatched = async (token: string) => {
+ let unmatched: ComposedDatabase[] = [];
+ let pageToken = token;
+ while (true) {
+ const { databases, nextPageToken } = await databaseStore.fetchDatabases({
+ pageToken,
+ pageSize: getDefaultPagination(),
+ parent: props.project,
+ });
+ pageToken = nextPageToken;
+ unmatched = databases.filter(
+ (db) => !matchedDatabaseNameList.value.includes(db.name)
+ );
+ if (unmatched.length > 0 || !pageToken) {
+ break;
+ }
+ }
+ return {
+ databases: unmatched,
+ token: pageToken,
+ };
+};
+
+const getMatched = (): DatabaseMatchList<number> => ({
+ token: 0,
+ loading: false,
+ databaseList: [],
+ title: t("database-group.matched-database"),
+ name: "matched",
+ hasNext: (token: number) => token < matchedDatabaseNameList.value.length,
+ loadMore: loadMoreMatched,
+});
+
+const getUnMatched = (): DatabaseMatchList<string> => ({
+ token: "",
+ loading: false,
+ databaseList: [],
+ title: t("database-group.unmatched-database"),
+ name: "unmatched",
+ hasNext: (token: string) => !!token,
+ loadMore: loadMoreUnmatched,
+});
+
+const getInitialState = () => [getMatched(), getUnMatched()];
const state = reactive<LocalState>({
loading: false,
@@ -120,35 +172,23 @@ const state = reactive<LocalState>({
const dbGroupStore = useDBGroupStore();
const databaseStore = useDatabaseV1Store();
-const getDatabaseList = (i: number) => {
- const { databaseNameList, index } = state.databaseMatchLists[i];
- return databaseNameList
- .slice(0, index)
- .map((databaseName) => databaseStore.getDatabaseByName(databaseName))
- .filter((database) => isValidDatabaseName(database.name));
-};
-
-const loadMore = async (i: number) => {
- state.databaseMatchLists[i].loading = true;
+const loadMoreDatabase = async <T,>(state: DatabaseMatchList<T>) => {
+ state.loading = true;
try {
- const previous = state.databaseMatchLists[i].index;
- const next = previous + 20;
-
- await Promise.all(
- state.databaseMatchLists[i].databaseNameList
- .slice(previous, next)
- .map((name) => databaseStore.getOrFetchDatabaseByName(name))
+ const { databases, token } = await state.loadMore(state.token);
+ state.token = token;
+ state.databaseList.push(
+ ...databases.filter((database) => isValidDatabaseName(database.name))
);
- state.databaseMatchLists[i].index = next;
} finally {
- state.databaseMatchLists[i].loading = false;
+ state.loading = false;
}
};
watch(
[
- () => state.databaseMatchLists[0].databaseNameList.length,
- () => state.databaseMatchLists[1].databaseNameList.length,
+ () => state.databaseMatchLists[0].databaseList.length,
+ () => state.databaseMatchLists[1].databaseList.length,
],
([matchedLength, unmatchedLength]) => {
state.collapseExpandedNames = [];
@@ -173,15 +213,16 @@ const updateDatabaseMatchingState = useDebounceFn(async () => {
state.loading = true;
try {
- const result = await dbGroupStore.fetchDatabaseGroupMatchList({
+ const matchedDatabaseList = await dbGroupStore.fetchDatabaseGroupMatchList({
projectName: props.project,
expr: props.expr,
});
state.matchingError = undefined;
- state.databaseMatchLists[0].databaseNameList = result.matchedDatabaseList;
- state.databaseMatchLists[1].databaseNameList = result.unmatchedDatabaseList;
- await Promise.all(state.databaseMatchLists.map((_, i) => loadMore(i)));
+ matchedDatabaseNameList.value = matchedDatabaseList;
+ await Promise.all(
+ state.databaseMatchLists.map((item) => loadMoreDatabase(item))
+ );
} catch (error) {
state.matchingError = (error as ConnectError).message;
state.databaseMatchLists = getInitialState();
diff --git a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue
index 35dc5f34a2..f4c79028b9 100644
--- a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue
+++ b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue
@@ -226,7 +226,7 @@ const loadTargetData = async () => {
const dbGroupPromises = dbGroupTargets.map((target) =>
dbGroupStore.getOrFetchDBGroupByName(target, {
- view: DatabaseGroupView.MATCHED,
+ view: DatabaseGroupView.FULL,
})
);
diff --git a/frontend/src/components/Plan/logic/plan-check.ts b/frontend/src/components/Plan/logic/plan-check.ts
index b24bc3901b..44f5614451 100644
--- a/frontend/src/components/Plan/logic/plan-check.ts
+++ b/frontend/src/components/Plan/logic/plan-check.ts
@@ -32,7 +32,7 @@ export const flattenTargetsOfSpec = (spec: Plan_Spec): string[] => {
if (isValidDatabaseGroupName(target)) {
const dbGroup = useDBGroupStore().getDBGroupByName(
target,
- DatabaseGroupView.MATCHED
+ DatabaseGroupView.FULL
);
return dbGroup?.matchedDatabases.map((db) => db.name);
}
diff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.ts
index a7395db2bf..8ba0e82c87 100644
--- a/frontend/src/composables/useExecuteSQL.ts
+++ b/frontend/src/composables/useExecuteSQL.ts
@@ -262,7 +262,7 @@ const useExecuteSQL = () => {
{
skipCache: false,
silent: true,
- view: DatabaseGroupView.MATCHED,
+ view: DatabaseGroupView.FULL,
}
);
for (const matchedDatabase of databaseGroup.matchedDatabases) {
diff --git a/frontend/src/store/modules/dbGroup.ts b/frontend/src/store/modules/dbGroup.ts
index c806fe5f13..a336b7d497 100644
--- a/frontend/src/store/modules/dbGroup.ts
+++ b/frontend/src/store/modules/dbGroup.ts
@@ -38,14 +38,7 @@ export const useDBGroupStore = defineStore("db-group", () => {
switch (view) {
case DatabaseGroupView.UNSPECIFIED:
case DatabaseGroupView.BASIC:
- views = [
- DatabaseGroupView.BASIC,
- DatabaseGroupView.MATCHED,
- DatabaseGroupView.FULL,
- ];
- break;
- case DatabaseGroupView.MATCHED:
- views = [DatabaseGroupView.MATCHED, DatabaseGroupView.FULL];
+ views = [DatabaseGroupView.BASIC, DatabaseGroupView.FULL];
break;
case DatabaseGroupView.FULL:
views = [DatabaseGroupView.FULL];
@@ -61,11 +54,7 @@ export const useDBGroupStore = defineStore("db-group", () => {
};
const removeDatabaseGroupCache = (name: string) => {
- const views = [
- DatabaseGroupView.BASIC,
- DatabaseGroupView.MATCHED,
- DatabaseGroupView.FULL,
- ];
+ const views = [DatabaseGroupView.BASIC, DatabaseGroupView.FULL];
for (const view of views) {
cacheByName.invalidateEntity([name, view]);
}
@@ -155,7 +144,6 @@ export const useDBGroupStore = defineStore("db-group", () => {
title: databaseGroup.title,
databaseExpr: databaseGroup.databaseExpr,
matchedDatabases: [],
- unmatchedDatabases: [],
});
const request = create(CreateDatabaseGroupRequestSchema, {
parent: projectName,
@@ -207,10 +195,7 @@ export const useDBGroupStore = defineStore("db-group", () => {
}) => {
const celexpr = await buildCELExpr(expr);
if (!celexpr) {
- return {
- matchedDatabaseList: [],
- unmatchedDatabaseList: [],
- };
+ return [];
}
const celStrings = await batchConvertParsedExprToCELString([celexpr]);
const expression = head(celStrings) || "true"; // Fallback to true.
@@ -229,10 +214,7 @@ export const useDBGroupStore = defineStore("db-group", () => {
validateOnly: true,
});
- return {
- matchedDatabaseList: result.matchedDatabases.map((item) => item.name),
- unmatchedDatabaseList: result.unmatchedDatabases.map((item) => item.name),
- };
+ return result.matchedDatabases.map((item) => item.name);
};
return {
diff --git a/frontend/src/types/proto-es/v1/database_group_service_pb.d.ts b/frontend/src/types/proto-es/v1/database_group_service_pb.d.ts
index 9ff4cb4886..2610ff1fda 100644
--- a/frontend/src/types/proto-es/v1/database_group_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/database_group_service_pb.d.ts
@@ -246,13 +246,6 @@ export declare type DatabaseGroup = Message<"bytebase.v1.DatabaseGroup"> & {
* @generated from field: repeated bytebase.v1.DatabaseGroup.Database matched_databases = 4;
*/
matchedDatabases: DatabaseGroup_Database[];
-
- /**
- * The list of databases that match the database group condition.
- *
- * @generated from field: repeated bytebase.v1.DatabaseGroup.Database unmatched_databases = 5;
- */
- unmatchedDatabases: DatabaseGroup_Database[];
};
/**
@@ -305,13 +298,6 @@ export enum DatabaseGroupView {
* @generated from enum value: DATABASE_GROUP_VIEW_FULL = 2;
*/
FULL = 2,
-
- /**
- * Include matched databases.
- *
- * @generated from enum value: DATABASE_GROUP_VIEW_MATCHED = 3;
- */
- MATCHED = 3,
}
/**
diff --git a/frontend/src/types/proto-es/v1/database_group_service_pb.js b/frontend/src/types/proto-es/v1/database_group_service_pb.js
index 65df7f9cdc..856b03ffef 100644
--- a/frontend/src/types/proto-es/v1/database_group_service_pb.js
+++ b/frontend/src/types/proto-es/v1/database_group_service_pb.js
@@ -15,7 +15,7 @@ import { file_v1_annotation } from "./annotation_pb";
* Describes the file v1/database_group_service.proto.
*/
export const file_v1_database_group_service = /*@__PURE__*/
- fileDesc("Ch92MS9kYXRhYmFzZV9ncm91cF9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSKeAQoZTGlzdERhdGFiYXNlR3JvdXBzUmVxdWVzdBIsCgZwYXJlbnQYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QSEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkSLAoEdmlldxgEIAEoDjIeLmJ5dGViYXNlLnYxLkRhdGFiYXNlR3JvdXBWaWV3ImoKGkxpc3REYXRhYmFzZUdyb3Vwc1Jlc3BvbnNlEjMKD2RhdGFiYXNlX2dyb3VwcxgBIAMoCzIaLmJ5dGViYXNlLnYxLkRhdGFiYXNlR3JvdXASFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJInkKF0dldERhdGFiYXNlR3JvdXBSZXF1ZXN0EjAKBG5hbWUYASABKAlCIuBBAvpBHAoaYnl0ZWJhc2UuY29tL0RhdGFiYXNlR3JvdXASLAoEdmlldxgCIAEoDjIeLmJ5dGViYXNlLnYxLkRhdGFiYXNlR3JvdXBWaWV3IrUBChpDcmVhdGVEYXRhYmFzZUdyb3VwUmVxdWVzdBIsCgZwYXJlbnQYASABKAlCHOB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zZV9ncm91cDI1L3YxL3tkYXRhYmFzZV9ncm91cC5uYW1lPXByb2plY3RzLyovZGF0YWJhc2VHcm91cHMvKn0SqwEKE0RlbGV0ZURhdGFiYXNlR3JvdXASJy5ieXRlYmFzZS52MS5EZWxldGVEYXRhYmFzZUdyb3VwUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSJT2kEEbmFtZYrqMBJiYi5wcm9qZWN0cy51cGRhdGWQ6jABmOowAYLT5JMCKComL3YxL3tuYW1lPXByb2plY3RzLyovZGF0YWJhc2VHcm91cHMvKn1CNlo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation]);
+ fileDesc("Ch92MS9kYXRhYmFzZV9ncm91cF9zZXJ2aWNlLnByb3RvEgtieXRlYmFzZS52MSKeAQoZTGlzdERhdGFiYXNlR3JvdXBzUmVxdWVzdBIsCgZwYXJlbnQYASABKAlCHOBBAvpBFgoUYnl0ZWJhc2UuY29tL1Byb2plY3QSEQoJcGFnZV9zaXplGAIgASgFEhIKCnBhZ2VfdG9rZW4YAyABKAkSLAoEdmlldxgEIAEoDjIeLmJ5dGViYXNlLnYxLkRhdGFiYXNlR3JvdXBWaWV3ImoKGkxpc3REYXRhYmFzZUdyb3Vwc1Jlc3BvbnNlEjMKD2RhdGFiYXNlX2dyb3VwcxgBIAMoCzIaLmJ5dGViYXNlLnYxLkRhdGFiYXNlR3JvdXASFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJInkKF0dldERhdGFiYXNlR3JvdXBSZXF1ZXN0EjAKBG5hbWUYASABKAlCIuBBAvpBHAoaYnl0ZWJhc2UuY29tL0RhdGFiYXNlR3JvdXASLAoEdmlldxgCIAEoDjIeLmJ5dGViYXNlLnYxLkRh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Byb2plY3RzLyovZGF0YWJhc2VHcm91cHMvKn0SqwEKE0RlbGV0ZURhdGFiYXNlR3JvdXASJy5ieXRlYmFzZS52MS5EZWxldGVEYXRhYmFzZUdyb3VwUmVxdWVzdBoWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eSJT2kEEbmFtZYrqMBJiYi5wcm9qZWN0cy51cGRhdGWQ6jABmOowAYLT5JMCKComL3YxL3tuYW1lPXByb2plY3RzLyovZGF0YWJhc2VHcm91cHMvKn1CNlo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation]);
/**
* Describes the message bytebase.v1.ListDatabaseGroupsRequest.
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index d2d9c65422..4144eff301 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -3774,7 +3774,6 @@ paths:
- DATABASE_GROUP_VIEW_UNSPECIFIED
- DATABASE_GROUP_VIEW_BASIC
- DATABASE_GROUP_VIEW_FULL
- - DATABASE_GROUP_VIEW_MATCHED
type: string
format: enum
responses:
@@ -3863,7 +3862,6 @@ paths:
- DATABASE_GROUP_VIEW_UNSPECIFIED
- DATABASE_GROUP_VIEW_BASIC
- DATABASE_GROUP_VIEW_FULL
- - DATABASE_GROUP_VIEW_MATCHED
type: string
format: enum
responses:
@@ -9796,12 +9794,6 @@ components:
items:
$ref: '#/components/schemas/DatabaseGroup_Database'
description: The list of databases that match the database group condition.
- unmatchedDatabases:
- readOnly: true
- type: array
- items:
- $ref: '#/components/schemas/DatabaseGroup_Database'
- description: The list of databases that match the database group condition.
DatabaseGroup_Database:
type: object
properties:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index a37f62f1c3..d44ba451df 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -5947,7 +5947,6 @@ Support variables: resource.environment_name: the environment resource id. Suppo
For example: resource.environment_name == &#34;test&#34; &amp;&amp; resource.database_name.startsWith(&#34;sample_&#34;) |
| matched_databases | [DatabaseGroup.Database](#bytebase-v1-DatabaseGroup-Database) | repeated | The list of databases that match the database group condition. |
-| unmatched_databases | [DatabaseGroup.Database](#bytebase-v1-DatabaseGroup-Database) | repeated | The list of databases that match the database group condition. |
@@ -6066,7 +6065,6 @@ The database group&#39;s `name` field is used to identify the database group to
| DATABASE_GROUP_VIEW_UNSPECIFIED | 0 | The default / unset value. The API will default to the BASIC view. |
| DATABASE_GROUP_VIEW_BASIC | 1 | Include basic information about the database group, but exclude the list of matched databases and unmatched databases. |
| DATABASE_GROUP_VIEW_FULL | 2 | Include everything. |
-| DATABASE_GROUP_VIEW_MATCHED | 3 | Include matched databases. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 54d355d667..305817182d 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -16954,13 +16954,6 @@ resource.environment_name == &#34;test&#34; &amp;&amp; resource.database_name.st
<td><p>The list of databases that match the database group condition. </p></td>
</tr>
- <tr>
- <td>unmatched_databases</td>
- <td><a href="#bytebase.v1.DatabaseGroup.Database">DatabaseGroup.Database</a></td>
- <td>repeated</td>
- <td><p>The list of databases that match the database group condition. </p></td>
- </tr>
-
</tbody>
</table>
@@ -17200,12 +17193,6 @@ The API will default to the BASIC view.</p></td>
<td><p>Include everything.</p></td>
</tr>
- <tr>
- <td>DATABASE_GROUP_VIEW_MATCHED</td>
- <td>3</td>
- <td><p>Include matched databases.</p></td>
- </tr>
-
</tbody>
</table>
diff --git a/proto/v1/v1/database_group_service.proto b/proto/v1/v1/database_group_service.proto
index 335a5abfc4..a57e146d39 100644
--- a/proto/v1/v1/database_group_service.proto
+++ b/proto/v1/v1/database_group_service.proto
@@ -164,9 +164,6 @@ enum DatabaseGroupView {
// Include everything.
DATABASE_GROUP_VIEW_FULL = 2;
-
- // Include matched databases.
- DATABASE_GROUP_VIEW_MATCHED = 3;
}
message DatabaseGroup {
@@ -202,7 +199,4 @@ message DatabaseGroup {
}
// The list of databases that match the database group condition.
repeated Database matched_databases = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // The list of databases that match the database group condition.
- repeated Database unmatched_databases = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
}