Skip to content

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

feat: list worksheets api (#21062)

ecmadao0703218ec415
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 5b0e5b3986..d2033fdbd4 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -7279,6 +7279,45 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.Worksheet'
+ /bytebase.v1.WorksheetService/ListWorksheets:
+ post:
+ tags:
+ - bytebase.v1.WorksheetService
+ summary: ListWorksheets
+ description: |-
+ List worksheets.
+ This is used for listing worksheets in a project, or across all projects by using `projects/-`.
+ Permissions required: bb.worksheets.list
+ operationId: bytebase.v1.WorksheetService.ListWorksheets
+ parameters:
+ - name: Connect-Protocol-Version
+ in: header
+ required: true
+ schema:
+ $ref: '#/components/schemas/connect-protocol-version'
+ - name: Connect-Timeout-Ms
+ in: header
+ schema:
+ $ref: '#/components/schemas/connect-timeout-header'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ListWorksheetsRequest'
+ required: true
+ responses:
+ default:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/connect.error'
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ListWorksheetsResponse'
/bytebase.v1.WorksheetService/SearchWorksheets:
post:
tags:
@@ -14502,6 +14541,67 @@ components:
title: ListWorkloadIdentitiesResponse
additionalProperties: false
description: Response message for listing workload identities.
+ bytebase.v1.ListWorksheetsRequest:
+ type: object
+ properties:
+ parent:
+ type: string
+ title: parent
+ description: |-
+ The parent resource of the worksheets.
+ Format: projects/{project}
+ Use "projects/-" to list worksheets across all projects.
+ filter:
+ type: string
+ title: filter
+ description: |-
+ To filter the list result.
+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+ Supported filter:
+ - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.
+
+ For example:
+ creator == "users/{email}"
+ creator != "users/{email}"
+ pageSize:
+ type: integer
+ title: page_size
+ format: int32
+ description: |-
+ The maximum number of worksheets to return. The service may return fewer than
+ this value.
+ If unspecified, at most 10 worksheets will be returned.
+ The maximum value is 1000; values above 1000 will be coerced to 1000.
+ pageToken:
+ type: string
+ title: page_token
+ description: |-
+ A page token, received from a previous `ListWorksheets` call.
+ Provide this to retrieve the subsequent page.
+
+ When paginating, all other parameters provided to `ListWorksheets` must match
+ the call that provided the page token.
+ title: ListWorksheetsRequest
+ additionalProperties: false
+ bytebase.v1.ListWorksheetsResponse:
+ type: object
+ properties:
+ worksheets:
+ type: array
+ items:
+ $ref: '#/components/schemas/bytebase.v1.Worksheet'
+ title: worksheets
+ description: The worksheets from the specified parent.
+ nextPageToken:
+ type: string
+ title: next_page_token
+ description: |-
+ A token to retrieve next page of worksheets.
+ Pass this value in the page_token field in the subsequent call to
+ `ListWorksheets` method to retrieve the next page of worksheets.
+ title: ListWorksheetsResponse
+ additionalProperties: false
bytebase.v1.ListWorkspacesRequest:
type: object
title: ListWorkspacesRequest
diff --git a/backend/api/v1/worksheet_service.go b/backend/api/v1/worksheet_service.go
index 27c4cbde5f..87258859c0 100644
--- a/backend/api/v1/worksheet_service.go
+++ b/backend/api/v1/worksheet_service.go
@@ -127,6 +127,76 @@ func (s *WorksheetService) GetWorksheet(
return connect.NewResponse(v1pbWorksheet), nil
}
+// ListWorksheets returns a list of worksheets.
+func (s *WorksheetService) ListWorksheets(
+ ctx context.Context,
+ req *connect.Request[v1pb.ListWorksheetsRequest],
+) (*connect.Response[v1pb.ListWorksheetsResponse], error) {
+ request := req.Msg
+ if request.PageSize < 0 {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("page size must be non-negative: %d", request.PageSize))
+ }
+
+ projectID, err := common.GetProjectID(request.Parent)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInvalidArgument, err)
+ }
+ projectIDs := []string{projectID}
+ workspaceID := common.GetWorkspaceIDFromContext(ctx)
+ if projectID == "-" {
+ projectIDs = nil
+ }
+
+ user, ok := GetUserFromContext(ctx)
+ if !ok {
+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("user not found"))
+ }
+
+ offset, err := parseLimitAndOffset(&pageSize{
+ token: request.PageToken,
+ limit: int(request.PageSize),
+ maximum: 1000,
+ })
+ if err != nil {
+ return nil, err
+ }
+ limitPlusOne := offset.limit + 1
+
+ filterQ, err := store.GetListWorksheetFilter(request.Filter)
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInvalidArgument, err)
+ }
+
+ worksheetList, err := s.store.ListWorkSheets(ctx, &store.FindWorkSheetMessage{
+ ProjectIDs: projectIDs,
+ Workspace: workspaceID,
+ PrincipalEmail: user.Email,
+ FilterQ: filterQ,
+ Limit: &limitPlusOne,
+ Offset: &offset.offset,
+ })
+ if err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to list worksheets: %v", err))
+ }
+
+ var nextPageToken string
+ if len(worksheetList) == limitPlusOne {
+ worksheetList = worksheetList[:offset.limit]
+ if nextPageToken, err = offset.getNextPageToken(); err != nil {
+ return nil, connect.NewError(connect.CodeInternal, errors.Wrapf(err, "failed to get next page token"))
+ }
+ }
+
+ v1pbWorksheets := make([]*v1pb.Worksheet, 0, len(worksheetList))
+ for _, worksheet := range worksheetList {
+ v1pbWorksheets = append(v1pbWorksheets, convertToAPIWorksheetMessage(worksheet))
+ }
+ return connect.NewResponse(&v1pb.ListWorksheetsResponse{
+ Worksheets: v1pbWorksheets,
+ NextPageToken: nextPageToken,
+ }), nil
+}
+
// SearchWorksheets returns a list of worksheets based on the search filters.
func (s *WorksheetService) SearchWorksheets(
ctx context.Context,
diff --git a/backend/common/permission/permission.go b/backend/common/permission/permission.go
index 4a252c64dd..44676acf7a 100644
--- a/backend/common/permission/permission.go
+++ b/backend/common/permission/permission.go
@@ -150,6 +150,7 @@ const (
WorkloadIdentitiesUndelete Permission = "bb.workloadIdentities.undelete"
WorkloadIdentitiesUpdate Permission = "bb.workloadIdentities.update"
WorksheetsGet Permission = "bb.worksheets.get"
+ WorksheetsList Permission = "bb.worksheets.list"
WorksheetsManage Permission = "bb.worksheets.manage"
WorkspacesGetIamPolicy Permission = "bb.workspaces.getIamPolicy"
WorkspacesSetIamPolicy Permission = "bb.workspaces.setIamPolicy"
diff --git a/backend/common/permission/permission.yaml b/backend/common/permission/permission.yaml
index 9e373eef01..6003cebf70 100644
--- a/backend/common/permission/permission.yaml
+++ b/backend/common/permission/permission.yaml
@@ -131,6 +131,7 @@ permissions:
- bb.users.update
- bb.users.updateEmail
- bb.worksheets.get
+ - bb.worksheets.list
- bb.worksheets.manage
- bb.workloadIdentities.create
- bb.workloadIdentities.delete
diff --git a/backend/generated-go/v1/v1connect/worksheet_service.connect.go b/backend/generated-go/v1/v1connect/worksheet_service.connect.go
index d9d9fb5648..a4b9c77d63 100644
--- a/backend/generated-go/v1/v1connect/worksheet_service.connect.go
+++ b/backend/generated-go/v1/v1connect/worksheet_service.connect.go
@@ -40,6 +40,9 @@ const (
// WorksheetServiceGetWorksheetProcedure is the fully-qualified name of the WorksheetService's
// GetWorksheet RPC.
WorksheetServiceGetWorksheetProcedure = "/bytebase.v1.WorksheetService/GetWorksheet"
+ // WorksheetServiceListWorksheetsProcedure is the fully-qualified name of the WorksheetService's
+ // ListWorksheets RPC.
+ WorksheetServiceListWorksheetsProcedure = "/bytebase.v1.WorksheetService/ListWorksheets"
// WorksheetServiceSearchWorksheetsProcedure is the fully-qualified name of the WorksheetService's
// SearchWorksheets RPC.
WorksheetServiceSearchWorksheetsProcedure = "/bytebase.v1.WorksheetService/SearchWorksheets"
@@ -69,6 +72,10 @@ type WorksheetServiceClient interface {
// - the sheet is shared with them with PROJECT_READ and PROJECT_WRITE visibility, and they have bb.projects.get permission on the project.
// Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)
GetWorksheet(context.Context, *connect.Request[v1.GetWorksheetRequest]) (*connect.Response[v1.Worksheet], error)
+ // List worksheets.
+ // This is used for listing worksheets in a project, or across all projects by using `projects/-`.
+ // Permissions required: bb.worksheets.list
+ ListWorksheets(context.Context, *connect.Request[v1.ListWorksheetsRequest]) (*connect.Response[v1.ListWorksheetsResponse], error)
// Search for worksheets.
// This is used for finding my worksheets or worksheets shared by other people.
// The sheet accessibility is the same as GetWorksheet().
@@ -118,6 +125,12 @@ func NewWorksheetServiceClient(httpClient connect.HTTPClient, baseURL string, op
connect.WithSchema(worksheetServiceMethods.ByName("GetWorksheet")),
connect.WithClientOptions(opts...),
),
+ listWorksheets: connect.NewClient[v1.ListWorksheetsRequest, v1.ListWorksheetsResponse](
+ httpClient,
+ baseURL+WorksheetServiceListWorksheetsProcedure,
+ connect.WithSchema(worksheetServiceMethods.ByName("ListWorksheets")),
+ connect.WithClientOptions(opts...),
+ ),
searchWorksheets: connect.NewClient[v1.SearchWorksheetsRequest, v1.SearchWorksheetsResponse](
httpClient,
baseURL+WorksheetServiceSearchWorksheetsProcedure,
@@ -155,6 +168,7 @@ func NewWorksheetServiceClient(httpClient connect.HTTPClient, baseURL string, op
type worksheetServiceClient struct {
createWorksheet *connect.Client[v1.CreateWorksheetRequest, v1.Worksheet]
getWorksheet *connect.Client[v1.GetWorksheetRequest, v1.Worksheet]
+ listWorksheets *connect.Client[v1.ListWorksheetsRequest, v1.ListWorksheetsResponse]
searchWorksheets *connect.Client[v1.SearchWorksheetsRequest, v1.SearchWorksheetsResponse]
updateWorksheet *connect.Client[v1.UpdateWorksheetRequest, v1.Worksheet]
updateWorksheetOrganizer *connect.Client[v1.UpdateWorksheetOrganizerRequest, v1.WorksheetOrganizer]
@@ -172,6 +186,11 @@ func (c *worksheetServiceClient) GetWorksheet(ctx context.Context, req *connect.
return c.getWorksheet.CallUnary(ctx, req)
}
+// ListWorksheets calls bytebase.v1.WorksheetService.ListWorksheets.
+func (c *worksheetServiceClient) ListWorksheets(ctx context.Context, req *connect.Request[v1.ListWorksheetsRequest]) (*connect.Response[v1.ListWorksheetsResponse], error) {
+ return c.listWorksheets.CallUnary(ctx, req)
+}
+
// SearchWorksheets calls bytebase.v1.WorksheetService.SearchWorksheets.
func (c *worksheetServiceClient) SearchWorksheets(ctx context.Context, req *connect.Request[v1.SearchWorksheetsRequest]) (*connect.Response[v1.SearchWorksheetsResponse], error) {
return c.searchWorksheets.CallUnary(ctx, req)
@@ -209,6 +228,10 @@ type WorksheetServiceHandler interface {
// - the sheet is shared with them with PROJECT_READ and PROJECT_WRITE visibility, and they have bb.projects.get permission on the project.
// Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)
GetWorksheet(context.Context, *connect.Request[v1.GetWorksheetRequest]) (*connect.Response[v1.Worksheet], error)
+ // List worksheets.
+ // This is used for listing worksheets in a project, or across all projects by using `projects/-`.
+ // Permissions required: bb.worksheets.list
+ ListWorksheets(context.Context, *connect.Request[v1.ListWorksheetsRequest]) (*connect.Response[v1.ListWorksheetsResponse], error)
// Search for worksheets.
// This is used for finding my worksheets or worksheets shared by other people.
// The sheet accessibility is the same as GetWorksheet().
@@ -254,6 +277,12 @@ func NewWorksheetServiceHandler(svc WorksheetServiceHandler, opts ...connect.Han
connect.WithSchema(worksheetServiceMethods.ByName("GetWorksheet")),
connect.WithHandlerOptions(opts...),
)
+ worksheetServiceListWorksheetsHandler := connect.NewUnaryHandler(
+ WorksheetServiceListWorksheetsProcedure,
+ svc.ListWorksheets,
+ connect.WithSchema(worksheetServiceMethods.ByName("ListWorksheets")),
+ connect.WithHandlerOptions(opts...),
+ )
worksheetServiceSearchWorksheetsHandler := connect.NewUnaryHandler(
WorksheetServiceSearchWorksheetsProcedure,
svc.SearchWorksheets,
@@ -290,6 +319,8 @@ func NewWorksheetServiceHandler(svc WorksheetServiceHandler, opts ...connect.Han
worksheetServiceCreateWorksheetHandler.ServeHTTP(w, r)
case WorksheetServiceGetWorksheetProcedure:
worksheetServiceGetWorksheetHandler.ServeHTTP(w, r)
+ case WorksheetServiceListWorksheetsProcedure:
+ worksheetServiceListWorksheetsHandler.ServeHTTP(w, r)
case WorksheetServiceSearchWorksheetsProcedure:
worksheetServiceSearchWorksheetsHandler.ServeHTTP(w, r)
case WorksheetServiceUpdateWorksheetProcedure:
@@ -317,6 +348,10 @@ func (UnimplementedWorksheetServiceHandler) GetWorksheet(context.Context, *conne
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.WorksheetService.GetWorksheet is not implemented"))
}
+func (UnimplementedWorksheetServiceHandler) ListWorksheets(context.Context, *connect.Request[v1.ListWorksheetsRequest]) (*connect.Response[v1.ListWorksheetsResponse], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.WorksheetService.ListWorksheets is not implemented"))
+}
+
func (UnimplementedWorksheetServiceHandler) SearchWorksheets(context.Context, *connect.Request[v1.SearchWorksheetsRequest]) (*connect.Response[v1.SearchWorksheetsResponse], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.WorksheetService.SearchWorksheets is not implemented"))
}
diff --git a/backend/generated-go/v1/worksheet_service.pb.go b/backend/generated-go/v1/worksheet_service.pb.go
index 3f41d9de7a..29ddb0cd52 100644
--- a/backend/generated-go/v1/worksheet_service.pb.go
+++ b/backend/generated-go/v1/worksheet_service.pb.go
@@ -78,7 +78,7 @@ func (x Worksheet_Visibility) Number() protoreflect.EnumNumber {
// Deprecated: Use Worksheet_Visibility.Descriptor instead.
func (Worksheet_Visibility) EnumDescriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{10, 0}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{12, 0}
}
type CreateWorksheetRequest struct {
@@ -182,6 +182,151 @@ func (x *GetWorksheetRequest) GetName() string {
return ""
}
+type ListWorksheetsRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The parent resource of the worksheets.
+ // Format: projects/{project}
+ // Use "projects/-" to list worksheets across all projects.
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ // To filter the list result.
+ // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+ //
+ // Supported filter:
+ // - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.
+ //
+ // For example:
+ // creator == "users/{email}"
+ // creator != "users/{email}"
+ Filter string `protobuf:"bytes,2,opt,name=filter,proto3" json:"filter,omitempty"`
+ // The maximum number of worksheets to return. The service may return fewer than
+ // this value.
+ // If unspecified, at most 10 worksheets will be returned.
+ // The maximum value is 1000; values above 1000 will be coerced to 1000.
+ PageSize int32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+ // A page token, received from a previous `ListWorksheets` call.
+ // Provide this to retrieve the subsequent page.
+ //
+ // When paginating, all other parameters provided to `ListWorksheets` must match
+ // the call that provided the page token.
+ PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListWorksheetsRequest) Reset() {
+ *x = ListWorksheetsRequest{}
+ mi := &file_v1_worksheet_service_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListWorksheetsRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListWorksheetsRequest) ProtoMessage() {}
+
+func (x *ListWorksheetsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_worksheet_service_proto_msgTypes[2]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ListWorksheetsRequest.ProtoReflect.Descriptor instead.
+func (*ListWorksheetsRequest) Descriptor() ([]byte, []int) {
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *ListWorksheetsRequest) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+func (x *ListWorksheetsRequest) GetFilter() string {
+ if x != nil {
+ return x.Filter
+ }
+ return ""
+}
+
+func (x *ListWorksheetsRequest) GetPageSize() int32 {
+ if x != nil {
+ return x.PageSize
+ }
+ return 0
+}
+
+func (x *ListWorksheetsRequest) GetPageToken() string {
+ if x != nil {
+ return x.PageToken
+ }
+ return ""
+}
+
+type ListWorksheetsResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The worksheets from the specified parent.
+ Worksheets []*Worksheet `protobuf:"bytes,1,rep,name=worksheets,proto3" json:"worksheets,omitempty"`
+ // A token to retrieve next page of worksheets.
+ // Pass this value in the page_token field in the subsequent call to
+ // `ListWorksheets` method to retrieve the next page of worksheets.
+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *ListWorksheetsResponse) Reset() {
+ *x = ListWorksheetsResponse{}
+ mi := &file_v1_worksheet_service_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *ListWorksheetsResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ListWorksheetsResponse) ProtoMessage() {}
+
+func (x *ListWorksheetsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_worksheet_service_proto_msgTypes[3]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ListWorksheetsResponse.ProtoReflect.Descriptor instead.
+func (*ListWorksheetsResponse) Descriptor() ([]byte, []int) {
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *ListWorksheetsResponse) GetWorksheets() []*Worksheet {
+ if x != nil {
+ return x.Worksheets
+ }
+ return nil
+}
+
+func (x *ListWorksheetsResponse) GetNextPageToken() string {
+ if x != nil {
+ return x.NextPageToken
+ }
+ return ""
+}
+
type UpdateWorksheetRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The worksheet to update.
@@ -204,7 +349,7 @@ type UpdateWorksheetRequest struct {
func (x *UpdateWorksheetRequest) Reset() {
*x = UpdateWorksheetRequest{}
- mi := &file_v1_worksheet_service_proto_msgTypes[2]
+ mi := &file_v1_worksheet_service_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -216,7 +361,7 @@ func (x *UpdateWorksheetRequest) String() string {
func (*UpdateWorksheetRequest) ProtoMessage() {}
func (x *UpdateWorksheetRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_worksheet_service_proto_msgTypes[2]
+ mi := &file_v1_worksheet_service_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -229,7 +374,7 @@ func (x *UpdateWorksheetRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateWorksheetRequest.ProtoReflect.Descriptor instead.
func (*UpdateWorksheetRequest) Descriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{2}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{4}
}
func (x *UpdateWorksheetRequest) GetWorksheet() *Worksheet {
@@ -255,7 +400,7 @@ type BatchUpdateWorksheetOrganizerRequest struct {
func (x *BatchUpdateWorksheetOrganizerRequest) Reset() {
*x = BatchUpdateWorksheetOrganizerRequest{}
- mi := &file_v1_worksheet_service_proto_msgTypes[3]
+ mi := &file_v1_worksheet_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -267,7 +412,7 @@ func (x *BatchUpdateWorksheetOrganizerRequest) String() string {
func (*BatchUpdateWorksheetOrganizerRequest) ProtoMessage() {}
func (x *BatchUpdateWorksheetOrganizerRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_worksheet_service_proto_msgTypes[3]
+ mi := &file_v1_worksheet_service_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -280,7 +425,7 @@ func (x *BatchUpdateWorksheetOrganizerRequest) ProtoReflect() protoreflect.Messa
// Deprecated: Use BatchUpdateWorksheetOrganizerRequest.ProtoReflect.Descriptor instead.
func (*BatchUpdateWorksheetOrganizerRequest) Descriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{3}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{5}
}
func (x *BatchUpdateWorksheetOrganizerRequest) GetRequests() []*UpdateWorksheetOrganizerRequest {
@@ -299,7 +444,7 @@ type BatchUpdateWorksheetOrganizerResponse struct {
func (x *BatchUpdateWorksheetOrganizerResponse) Reset() {
*x = BatchUpdateWorksheetOrganizerResponse{}
- mi := &file_v1_worksheet_service_proto_msgTypes[4]
+ mi := &file_v1_worksheet_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -311,7 +456,7 @@ func (x *BatchUpdateWorksheetOrganizerResponse) String() string {
func (*BatchUpdateWorksheetOrganizerResponse) ProtoMessage() {}
func (x *BatchUpdateWorksheetOrganizerResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_worksheet_service_proto_msgTypes[4]
+ mi := &file_v1_worksheet_service_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -324,7 +469,7 @@ func (x *BatchUpdateWorksheetOrganizerResponse) ProtoReflect() protoreflect.Mess
// Deprecated: Use BatchUpdateWorksheetOrganizerResponse.ProtoReflect.Descriptor instead.
func (*BatchUpdateWorksheetOrganizerResponse) Descriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{4}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{6}
}
func (x *BatchUpdateWorksheetOrganizerResponse) GetWorksheetOrganizers() []*WorksheetOrganizer {
@@ -355,7 +500,7 @@ type UpdateWorksheetOrganizerRequest struct {
func (x *UpdateWorksheetOrganizerRequest) Reset() {
*x = UpdateWorksheetOrganizerRequest{}
- mi := &file_v1_worksheet_service_proto_msgTypes[5]
+ mi := &file_v1_worksheet_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -367,7 +512,7 @@ func (x *UpdateWorksheetOrganizerRequest) String() string {
func (*UpdateWorksheetOrganizerRequest) ProtoMessage() {}
func (x *UpdateWorksheetOrganizerRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_worksheet_service_proto_msgTypes[5]
+ mi := &file_v1_worksheet_service_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -380,7 +525,7 @@ func (x *UpdateWorksheetOrganizerRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateWorksheetOrganizerRequest.ProtoReflect.Descriptor instead.
func (*UpdateWorksheetOrganizerRequest) Descriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{5}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{7}
}
func (x *UpdateWorksheetOrganizerRequest) GetOrganizer() *WorksheetOrganizer {
@@ -418,7 +563,7 @@ type WorksheetOrganizer struct {
func (x *WorksheetOrganizer) Reset() {
*x = WorksheetOrganizer{}
- mi := &file_v1_worksheet_service_proto_msgTypes[6]
+ mi := &file_v1_worksheet_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -430,7 +575,7 @@ func (x *WorksheetOrganizer) String() string {
func (*WorksheetOrganizer) ProtoMessage() {}
func (x *WorksheetOrganizer) ProtoReflect() protoreflect.Message {
- mi := &file_v1_worksheet_service_proto_msgTypes[6]
+ mi := &file_v1_worksheet_service_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -443,7 +588,7 @@ func (x *WorksheetOrganizer) ProtoReflect() protoreflect.Message {
// Deprecated: Use WorksheetOrganizer.ProtoReflect.Descriptor instead.
func (*WorksheetOrganizer) Descriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{6}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{8}
}
func (x *WorksheetOrganizer) GetWorksheet() string {
@@ -478,7 +623,7 @@ type DeleteWorksheetRequest struct {
func (x *DeleteWorksheetRequest) Reset() {
*x = DeleteWorksheetRequest{}
- mi := &file_v1_worksheet_service_proto_msgTypes[7]
+ mi := &file_v1_worksheet_service_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -490,7 +635,7 @@ func (x *DeleteWorksheetRequest) String() string {
func (*DeleteWorksheetRequest) ProtoMessage() {}
func (x *DeleteWorksheetRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_worksheet_service_proto_msgTypes[7]
+ mi := &file_v1_worksheet_service_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -503,7 +648,7 @@ func (x *DeleteWorksheetRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteWorksheetRequest.ProtoReflect.Descriptor instead.
func (*DeleteWorksheetRequest) Descriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{7}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{9}
}
func (x *DeleteWorksheetRequest) GetName() string {
@@ -540,7 +685,7 @@ type SearchWorksheetsRequest struct {
func (x *SearchWorksheetsRequest) Reset() {
*x = SearchWorksheetsRequest{}
- mi := &file_v1_worksheet_service_proto_msgTypes[8]
+ mi := &file_v1_worksheet_service_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -552,7 +697,7 @@ func (x *SearchWorksheetsRequest) String() string {
func (*SearchWorksheetsRequest) ProtoMessage() {}
func (x *SearchWorksheetsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_worksheet_service_proto_msgTypes[8]
+ mi := &file_v1_worksheet_service_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -565,7 +710,7 @@ func (x *SearchWorksheetsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SearchWorksheetsRequest.ProtoReflect.Descriptor instead.
func (*SearchWorksheetsRequest) Descriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{8}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{10}
}
func (x *SearchWorksheetsRequest) GetParent() string {
@@ -592,7 +737,7 @@ type SearchWorksheetsResponse struct {
func (x *SearchWorksheetsResponse) Reset() {
*x = SearchWorksheetsResponse{}
- mi := &file_v1_worksheet_service_proto_msgTypes[9]
+ mi := &file_v1_worksheet_service_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -604,7 +749,7 @@ func (x *SearchWorksheetsResponse) String() string {
func (*SearchWorksheetsResponse) ProtoMessage() {}
func (x *SearchWorksheetsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_worksheet_service_proto_msgTypes[9]
+ mi := &file_v1_worksheet_service_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -617,7 +762,7 @@ func (x *SearchWorksheetsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SearchWorksheetsResponse.ProtoReflect.Descriptor instead.
func (*SearchWorksheetsResponse) Descriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{9}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{11}
}
func (x *SearchWorksheetsResponse) GetWorksheets() []*Worksheet {
@@ -665,7 +810,7 @@ type Worksheet struct {
func (x *Worksheet) Reset() {
*x = Worksheet{}
- mi := &file_v1_worksheet_service_proto_msgTypes[10]
+ mi := &file_v1_worksheet_service_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -677,7 +822,7 @@ func (x *Worksheet) String() string {
func (*Worksheet) ProtoMessage() {}
func (x *Worksheet) ProtoReflect() protoreflect.Message {
- mi := &file_v1_worksheet_service_proto_msgTypes[10]
+ mi := &file_v1_worksheet_service_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -690,7 +835,7 @@ func (x *Worksheet) ProtoReflect() protoreflect.Message {
// Deprecated: Use Worksheet.ProtoReflect.Descriptor instead.
func (*Worksheet) Descriptor() ([]byte, []int) {
- return file_v1_worksheet_service_proto_rawDescGZIP(), []int{10}
+ return file_v1_worksheet_service_proto_rawDescGZIP(), []int{12}
}
func (x *Worksheet) GetName() string {
@@ -781,12 +926,24 @@ var File_v1_worksheet_service_proto protoreflect.FileDescriptor
const file_v1_worksheet_service_proto_rawDesc = "" +
"\n" +
- "\x1av1/worksheet_service.proto\x12\vbytebase.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\"p\n" +
+ "\x1av1/worksheet_service.proto\x12\vbytebase.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\"p\n" +
"\x16CreateWorksheetRequest\x12\x1b\n" +
"\x06parent\x18\x01 \x01(\tB\x03\xe0A\x02R\x06parent\x129\n" +
"\tworksheet\x18\x02 \x01(\v2\x16.bytebase.v1.WorksheetB\x03\xe0A\x02R\tworksheet\".\n" +
"\x13GetWorksheetRequest\x12\x17\n" +
- "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"\x90\x01\n" +
+ "\x04name\x18\x01 \x01(\tB\x03\xe0A\x02R\x04name\"\xa1\x01\n" +
+ "\x15ListWorksheetsRequest\x124\n" +
+ "\x06parent\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
+ "\x14bytebase.com/ProjectR\x06parent\x12\x16\n" +
+ "\x06filter\x18\x02 \x01(\tR\x06filter\x12\x1b\n" +
+ "\tpage_size\x18\x03 \x01(\x05R\bpageSize\x12\x1d\n" +
+ "\n" +
+ "page_token\x18\x04 \x01(\tR\tpageToken\"x\n" +
+ "\x16ListWorksheetsResponse\x126\n" +
+ "\n" +
+ "worksheets\x18\x01 \x03(\v2\x16.bytebase.v1.WorksheetR\n" +
+ "worksheets\x12&\n" +
+ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x90\x01\n" +
"\x16UpdateWorksheetRequest\x129\n" +
"\tworksheet\x18\x01 \x01(\v2\x16.bytebase.v1.WorksheetB\x03\xe0A\x02R\tworksheet\x12;\n" +
"\vupdate_mask\x18\x02 \x01(\v2\x1a.google.protobuf.FieldMaskR\n" +
@@ -836,10 +993,12 @@ const file_v1_worksheet_service_proto_rawDesc = "" +
"\x16VISIBILITY_UNSPECIFIED\x10\x00\x12\x10\n" +
"\fPROJECT_READ\x10\x01\x12\x11\n" +
"\rPROJECT_WRITE\x10\x02\x12\v\n" +
- "\aPRIVATE\x10\x032\xa3\t\n" +
+ "\aPRIVATE\x10\x032\xce\n" +
+ "\n" +
"\x10WorksheetService\x12\x9c\x01\n" +
"\x0fCreateWorksheet\x12#.bytebase.v1.CreateWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"L\xdaA\x10parent,worksheet\x90\xea0\x02\x82\xd3\xe4\x93\x02/:\tworksheet\"\"/v1/{parent=projects/*}/worksheets\x12\x7f\n" +
- "\fGetWorksheet\x12 .bytebase.v1.GetWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"5\xdaA\x04name\x90\xea0\x02\x82\xd3\xe4\x93\x02$\x12\"/v1/{name=projects/*/worksheets/*}\x12\xa2\x01\n" +
+ "\fGetWorksheet\x12 .bytebase.v1.GetWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"5\xdaA\x04name\x90\xea0\x02\x82\xd3\xe4\x93\x02$\x12\"/v1/{name=projects/*/worksheets/*}\x12\xa8\x01\n" +
+ "\x0eListWorksheets\x12\".bytebase.v1.ListWorksheetsRequest\x1a#.bytebase.v1.ListWorksheetsResponse\"M\xdaA\x06parent\x8a\xea0\x12bb.worksheets.list\x90\xea0\x01\x82\xd3\xe4\x93\x02$\x12\"/v1/{parent=projects/*}/worksheets\x12\xa2\x01\n" +
"\x10SearchWorksheets\x12$.bytebase.v1.SearchWorksheetsRequest\x1a%.bytebase.v1.SearchWorksheetsResponse\"A\xdaA\x06parent\x90\xea0\x02\x82\xd3\xe4\x93\x02.:\x01*\")/v1/{parent=projects/*}/worksheets:search\x12\xab\x01\n" +
"\x0fUpdateWorksheet\x12#.bytebase.v1.UpdateWorksheetRequest\x1a\x16.bytebase.v1.Worksheet\"[\xdaA\x15worksheet,update_mask\x90\xea0\x02\x82\xd3\xe4\x93\x029:\tworksheet2,/v1/{worksheet.name=projects/*/worksheets/*}\x12\xd5\x01\n" +
"\x18UpdateWorksheetOrganizer\x12,.bytebase.v1.UpdateWorksheetOrganizerRequest\x1a\x1f.bytebase.v1.WorksheetOrganizer\"j\xdaA\x15organizer,update_mask\x90\xea0\x02\x82\xd3\xe4\x93\x02H:\torganizer2;/v1/{organizer.worksheet=projects/*/worksheets/*}/organizer\x12\xbb\x01\n" +
@@ -860,55 +1019,60 @@ func file_v1_worksheet_service_proto_rawDescGZIP() []byte {
}
var file_v1_worksheet_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_v1_worksheet_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
+var file_v1_worksheet_service_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_v1_worksheet_service_proto_goTypes = []any{
(Worksheet_Visibility)(0), // 0: bytebase.v1.Worksheet.Visibility
(*CreateWorksheetRequest)(nil), // 1: bytebase.v1.CreateWorksheetRequest
(*GetWorksheetRequest)(nil), // 2: bytebase.v1.GetWorksheetRequest
- (*UpdateWorksheetRequest)(nil), // 3: bytebase.v1.UpdateWorksheetRequest
- (*BatchUpdateWorksheetOrganizerRequest)(nil), // 4: bytebase.v1.BatchUpdateWorksheetOrganizerRequest
- (*BatchUpdateWorksheetOrganizerResponse)(nil), // 5: bytebase.v1.BatchUpdateWorksheetOrganizerResponse
- (*UpdateWorksheetOrganizerRequest)(nil), // 6: bytebase.v1.UpdateWorksheetOrganizerRequest
- (*WorksheetOrganizer)(nil), // 7: bytebase.v1.WorksheetOrganizer
- (*DeleteWorksheetRequest)(nil), // 8: bytebase.v1.DeleteWorksheetRequest
- (*SearchWorksheetsRequest)(nil), // 9: bytebase.v1.SearchWorksheetsRequest
- (*SearchWorksheetsResponse)(nil), // 10: bytebase.v1.SearchWorksheetsResponse
- (*Worksheet)(nil), // 11: bytebase.v1.Worksheet
- (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask
- (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp
- (*emptypb.Empty)(nil), // 14: google.protobuf.Empty
+ (*ListWorksheetsRequest)(nil), // 3: bytebase.v1.ListWorksheetsRequest
+ (*ListWorksheetsResponse)(nil), // 4: bytebase.v1.ListWorksheetsResponse
+ (*UpdateWorksheetRequest)(nil), // 5: bytebase.v1.UpdateWorksheetRequest
+ (*BatchUpdateWorksheetOrganizerRequest)(nil), // 6: bytebase.v1.BatchUpdateWorksheetOrganizerRequest
+ (*BatchUpdateWorksheetOrganizerResponse)(nil), // 7: bytebase.v1.BatchUpdateWorksheetOrganizerResponse
+ (*UpdateWorksheetOrganizerRequest)(nil), // 8: bytebase.v1.UpdateWorksheetOrganizerRequest
+ (*WorksheetOrganizer)(nil), // 9: bytebase.v1.WorksheetOrganizer
+ (*DeleteWorksheetRequest)(nil), // 10: bytebase.v1.DeleteWorksheetRequest
+ (*SearchWorksheetsRequest)(nil), // 11: bytebase.v1.SearchWorksheetsRequest
+ (*SearchWorksheetsResponse)(nil), // 12: bytebase.v1.SearchWorksheetsResponse
+ (*Worksheet)(nil), // 13: bytebase.v1.Worksheet
+ (*fieldmaskpb.FieldMask)(nil), // 14: google.protobuf.FieldMask
+ (*timestamppb.Timestamp)(nil), // 15: google.protobuf.Timestamp
+ (*emptypb.Empty)(nil), // 16: google.protobuf.Empty
}
var file_v1_worksheet_service_proto_depIdxs = []int32{
- 11, // 0: bytebase.v1.CreateWorksheetRequest.worksheet:type_name -> bytebase.v1.Worksheet
- 11, // 1: bytebase.v1.UpdateWorksheetRequest.worksheet:type_name -> bytebase.v1.Worksheet
- 12, // 2: bytebase.v1.UpdateWorksheetRequest.update_mask:type_name -> google.protobuf.FieldMask
- 6, // 3: bytebase.v1.BatchUpdateWorksheetOrganizerRequest.requests:type_name -> bytebase.v1.UpdateWorksheetOrganizerRequest
- 7, // 4: bytebase.v1.BatchUpdateWorksheetOrganizerResponse.worksheet_organizers:type_name -> bytebase.v1.WorksheetOrganizer
- 7, // 5: bytebase.v1.UpdateWorksheetOrganizerRequest.organizer:type_name -> bytebase.v1.WorksheetOrganizer
- 12, // 6: bytebase.v1.UpdateWorksheetOrganizerRequest.update_mask:type_name -> google.protobuf.FieldMask
- 11, // 7: bytebase.v1.SearchWorksheetsResponse.worksheets:type_name -> bytebase.v1.Worksheet
- 13, // 8: bytebase.v1.Worksheet.create_time:type_name -> google.protobuf.Timestamp
- 13, // 9: bytebase.v1.Worksheet.update_time:type_name -> google.protobuf.Timestamp
- 0, // 10: bytebase.v1.Worksheet.visibility:type_name -> bytebase.v1.Worksheet.Visibility
- 1, // 11: bytebase.v1.WorksheetService.CreateWorksheet:input_type -> bytebase.v1.CreateWorksheetRequest
- 2, // 12: bytebase.v1.WorksheetService.GetWorksheet:input_type -> bytebase.v1.GetWorksheetRequest
- 9, // 13: bytebase.v1.WorksheetService.SearchWorksheets:input_type -> bytebase.v1.SearchWorksheetsRequest
- 3, // 14: bytebase.v1.WorksheetService.UpdateWorksheet:input_type -> bytebase.v1.UpdateWorksheetRequest
- 6, // 15: bytebase.v1.WorksheetService.UpdateWorksheetOrganizer:input_type -> bytebase.v1.UpdateWorksheetOrganizerRequest
- 4, // 16: bytebase.v1.WorksheetService.BatchUpdateWorksheetOrganizer:input_type -> bytebase.v1.BatchUpdateWorksheetOrganizerRequest
- 8, // 17: bytebase.v1.WorksheetService.DeleteWorksheet:input_type -> bytebase.v1.DeleteWorksheetRequest
- 11, // 18: bytebase.v1.WorksheetService.CreateWorksheet:output_type -> bytebase.v1.Worksheet
- 11, // 19: bytebase.v1.WorksheetService.GetWorksheet:output_type -> bytebase.v1.Worksheet
- 10, // 20: bytebase.v1.WorksheetService.SearchWorksheets:output_type -> bytebase.v1.SearchWorksheetsResponse
- 11, // 21: bytebase.v1.WorksheetService.UpdateWorksheet:output_type -> bytebase.v1.Worksheet
- 7, // 22: bytebase.v1.WorksheetService.UpdateWorksheetOrganizer:output_type -> bytebase.v1.WorksheetOrganizer
- 5, // 23: bytebase.v1.WorksheetService.BatchUpdateWorksheetOrganizer:output_type -> bytebase.v1.BatchUpdateWorksheetOrganizerResponse
- 14, // 24: bytebase.v1.WorksheetService.DeleteWorksheet:output_type -> google.protobuf.Empty
- 18, // [18:25] is the sub-list for method output_type
- 11, // [11:18] is the sub-list for method input_type
- 11, // [11:11] is the sub-list for extension type_name
- 11, // [11:11] is the sub-list for extension extendee
- 0, // [0:11] is the sub-list for field type_name
+ 13, // 0: bytebase.v1.CreateWorksheetRequest.worksheet:type_name -> bytebase.v1.Worksheet
+ 13, // 1: bytebase.v1.ListWorksheetsResponse.worksheets:type_name -> bytebase.v1.Worksheet
+ 13, // 2: bytebase.v1.UpdateWorksheetRequest.worksheet:type_name -> bytebase.v1.Worksheet
+ 14, // 3: bytebase.v1.UpdateWorksheetRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 8, // 4: bytebase.v1.BatchUpdateWorksheetOrganizerRequest.requests:type_name -> bytebase.v1.UpdateWorksheetOrganizerRequest
+ 9, // 5: bytebase.v1.BatchUpdateWorksheetOrganizerResponse.worksheet_organizers:type_name -> bytebase.v1.WorksheetOrganizer
+ 9, // 6: bytebase.v1.UpdateWorksheetOrganizerRequest.organizer:type_name -> bytebase.v1.WorksheetOrganizer
+ 14, // 7: bytebase.v1.UpdateWorksheetOrganizerRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 13, // 8: bytebase.v1.SearchWorksheetsResponse.worksheets:type_name -> bytebase.v1.Worksheet
+ 15, // 9: bytebase.v1.Worksheet.create_time:type_name -> google.protobuf.Timestamp
+ 15, // 10: bytebase.v1.Worksheet.update_time:type_name -> google.protobuf.Timestamp
+ 0, // 11: bytebase.v1.Worksheet.visibility:type_name -> bytebase.v1.Worksheet.Visibility
+ 1, // 12: bytebase.v1.WorksheetService.CreateWorksheet:input_type -> bytebase.v1.CreateWorksheetRequest
+ 2, // 13: bytebase.v1.WorksheetService.GetWorksheet:input_type -> bytebase.v1.GetWorksheetRequest
+ 3, // 14: bytebase.v1.WorksheetService.ListWorksheets:input_type -> bytebase.v1.ListWorksheetsRequest
+ 11, // 15: bytebase.v1.WorksheetService.SearchWorksheets:input_type -> bytebase.v1.SearchWorksheetsRequest
+ 5, // 16: bytebase.v1.WorksheetService.UpdateWorksheet:input_type -> bytebase.v1.UpdateWorksheetRequest
+ 8, // 17: bytebase.v1.WorksheetService.UpdateWorksheetOrganizer:input_type -> bytebase.v1.UpdateWorksheetOrganizerRequest
+ 6, // 18: bytebase.v1.WorksheetService.BatchUpdateWorksheetOrganizer:input_type -> bytebase.v1.BatchUpdateWorksheetOrganizerRequest
+ 10, // 19: bytebase.v1.WorksheetService.DeleteWorksheet:input_type -> bytebase.v1.DeleteWorksheetRequest
+ 13, // 20: bytebase.v1.WorksheetService.CreateWorksheet:output_type -> bytebase.v1.Worksheet
+ 13, // 21: bytebase.v1.WorksheetService.GetWorksheet:output_type -> bytebase.v1.Worksheet
+ 4, // 22: bytebase.v1.WorksheetService.ListWorksheets:output_type -> bytebase.v1.ListWorksheetsResponse
+ 12, // 23: bytebase.v1.WorksheetService.SearchWorksheets:output_type -> bytebase.v1.SearchWorksheetsResponse
+ 13, // 24: bytebase.v1.WorksheetService.UpdateWorksheet:output_type -> bytebase.v1.Worksheet
+ 9, // 25: bytebase.v1.WorksheetService.UpdateWorksheetOrganizer:output_type -> bytebase.v1.WorksheetOrganizer
+ 7, // 26: bytebase.v1.WorksheetService.BatchUpdateWorksheetOrganizer:output_type -> bytebase.v1.BatchUpdateWorksheetOrganizerResponse
+ 16, // 27: bytebase.v1.WorksheetService.DeleteWorksheet:output_type -> google.protobuf.Empty
+ 20, // [20:28] is the sub-list for method output_type
+ 12, // [12:20] is the sub-list for method input_type
+ 12, // [12:12] is the sub-list for extension type_name
+ 12, // [12:12] is the sub-list for extension extendee
+ 0, // [0:12] is the sub-list for field type_name
}
func init() { file_v1_worksheet_service_proto_init() }
@@ -923,7 +1087,7 @@ func file_v1_worksheet_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_worksheet_service_proto_rawDesc), len(file_v1_worksheet_service_proto_rawDesc)),
NumEnums: 1,
- NumMessages: 11,
+ NumMessages: 13,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/generated-go/v1/worksheet_service.pb.gw.go b/backend/generated-go/v1/worksheet_service.pb.gw.go
index 7b0bf221b5..1db5b0b32d 100644
--- a/backend/generated-go/v1/worksheet_service.pb.gw.go
+++ b/backend/generated-go/v1/worksheet_service.pb.gw.go
@@ -119,6 +119,59 @@ func local_request_WorksheetService_GetWorksheet_0(ctx context.Context, marshale
return msg, metadata, err
}
+var filter_WorksheetService_ListWorksheets_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
+
+func request_WorksheetService_ListWorksheets_0(ctx context.Context, marshaler runtime.Marshaler, client WorksheetServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListWorksheetsRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WorksheetService_ListWorksheets_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := client.ListWorksheets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_WorksheetService_ListWorksheets_0(ctx context.Context, marshaler runtime.Marshaler, server WorksheetServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq ListWorksheetsRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WorksheetService_ListWorksheets_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ msg, err := server.ListWorksheets(ctx, &protoReq)
+ return msg, metadata, err
+}
+
func request_WorksheetService_SearchWorksheets_0(ctx context.Context, marshaler runtime.Marshaler, client WorksheetServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq SearchWorksheetsRequest
@@ -438,6 +491,26 @@ func RegisterWorksheetServiceHandlerServer(ctx context.Context, mux *runtime.Ser
}
forward_WorksheetService_GetWorksheet_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_WorksheetService_ListWorksheets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.WorksheetService/ListWorksheets", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/worksheets"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_WorksheetService_ListWorksheets_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_WorksheetService_ListWorksheets_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodPost, pattern_WorksheetService_SearchWorksheets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -612,6 +685,23 @@ func RegisterWorksheetServiceHandlerClient(ctx context.Context, mux *runtime.Ser
}
forward_WorksheetService_GetWorksheet_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodGet, pattern_WorksheetService_ListWorksheets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.WorksheetService/ListWorksheets", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/worksheets"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_WorksheetService_ListWorksheets_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_WorksheetService_ListWorksheets_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
mux.Handle(http.MethodPost, pattern_WorksheetService_SearchWorksheets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -703,6 +793,7 @@ func RegisterWorksheetServiceHandlerClient(ctx context.Context, mux *runtime.Ser
var (
pattern_WorksheetService_CreateWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "worksheets"}, ""))
pattern_WorksheetService_GetWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "worksheets", "name"}, ""))
+ pattern_WorksheetService_ListWorksheets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "worksheets"}, ""))
pattern_WorksheetService_SearchWorksheets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "worksheets"}, "search"))
pattern_WorksheetService_UpdateWorksheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "worksheets", "worksheet.name"}, ""))
pattern_WorksheetService_UpdateWorksheetOrganizer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3, 2, 4}, []string{"v1", "projects", "worksheets", "organizer.worksheet", "organizer"}, ""))
@@ -713,6 +804,7 @@ var (
var (
forward_WorksheetService_CreateWorksheet_0 = runtime.ForwardResponseMessage
forward_WorksheetService_GetWorksheet_0 = runtime.ForwardResponseMessage
+ forward_WorksheetService_ListWorksheets_0 = runtime.ForwardResponseMessage
forward_WorksheetService_SearchWorksheets_0 = runtime.ForwardResponseMessage
forward_WorksheetService_UpdateWorksheet_0 = runtime.ForwardResponseMessage
forward_WorksheetService_UpdateWorksheetOrganizer_0 = runtime.ForwardResponseMessage
diff --git a/backend/generated-go/v1/worksheet_service_equal.pb.go b/backend/generated-go/v1/worksheet_service_equal.pb.go
index 7eadb19fe5..1c65391ded 100644
--- a/backend/generated-go/v1/worksheet_service_equal.pb.go
+++ b/backend/generated-go/v1/worksheet_service_equal.pb.go
@@ -37,6 +37,49 @@ func (x *GetWorksheetRequest) Equal(y *GetWorksheetRequest) bool {
return true
}
+func (x *ListWorksheetsRequest) Equal(y *ListWorksheetsRequest) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.Parent != y.Parent {
+ return false
+ }
+ if x.Filter != y.Filter {
+ return false
+ }
+ if x.PageSize != y.PageSize {
+ return false
+ }
+ if x.PageToken != y.PageToken {
+ return false
+ }
+ return true
+}
+
+func (x *ListWorksheetsResponse) Equal(y *ListWorksheetsResponse) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if len(x.Worksheets) != len(y.Worksheets) {
+ return false
+ }
+ for i := 0; i < len(x.Worksheets); i++ {
+ if !x.Worksheets[i].Equal(y.Worksheets[i]) {
+ return false
+ }
+ }
+ if x.NextPageToken != y.NextPageToken {
+ return false
+ }
+ return true
+}
+
func (x *UpdateWorksheetRequest) Equal(y *UpdateWorksheetRequest) bool {
if x == y {
return true
diff --git a/backend/generated-go/v1/worksheet_service_grpc.pb.go b/backend/generated-go/v1/worksheet_service_grpc.pb.go
index 79a20197ec..d56b3e7dd2 100644
--- a/backend/generated-go/v1/worksheet_service_grpc.pb.go
+++ b/backend/generated-go/v1/worksheet_service_grpc.pb.go
@@ -22,6 +22,7 @@ const _ = grpc.SupportPackageIsVersion9
const (
WorksheetService_CreateWorksheet_FullMethodName = "/bytebase.v1.WorksheetService/CreateWorksheet"
WorksheetService_GetWorksheet_FullMethodName = "/bytebase.v1.WorksheetService/GetWorksheet"
+ WorksheetService_ListWorksheets_FullMethodName = "/bytebase.v1.WorksheetService/ListWorksheets"
WorksheetService_SearchWorksheets_FullMethodName = "/bytebase.v1.WorksheetService/SearchWorksheets"
WorksheetService_UpdateWorksheet_FullMethodName = "/bytebase.v1.WorksheetService/UpdateWorksheet"
WorksheetService_UpdateWorksheetOrganizer_FullMethodName = "/bytebase.v1.WorksheetService/UpdateWorksheetOrganizer"
@@ -45,6 +46,10 @@ type WorksheetServiceClient interface {
// - the sheet is shared with them with PROJECT_READ and PROJECT_WRITE visibility, and they have bb.projects.get permission on the project.
// Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)
GetWorksheet(ctx context.Context, in *GetWorksheetRequest, opts ...grpc.CallOption) (*Worksheet, error)
+ // List worksheets.
+ // This is used for listing worksheets in a project, or across all projects by using `projects/-`.
+ // Permissions required: bb.worksheets.list
+ ListWorksheets(ctx context.Context, in *ListWorksheetsRequest, opts ...grpc.CallOption) (*ListWorksheetsResponse, error)
// Search for worksheets.
// This is used for finding my worksheets or worksheets shared by other people.
// The sheet accessibility is the same as GetWorksheet().
@@ -99,6 +104,16 @@ func (c *worksheetServiceClient) GetWorksheet(ctx context.Context, in *GetWorksh
return out, nil
}
+func (c *worksheetServiceClient) ListWorksheets(ctx context.Context, in *ListWorksheetsRequest, opts ...grpc.CallOption) (*ListWorksheetsResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(ListWorksheetsResponse)
+ err := c.cc.Invoke(ctx, WorksheetService_ListWorksheets_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *worksheetServiceClient) SearchWorksheets(ctx context.Context, in *SearchWorksheetsRequest, opts ...grpc.CallOption) (*SearchWorksheetsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SearchWorksheetsResponse)
@@ -165,6 +180,10 @@ type WorksheetServiceServer interface {
// - the sheet is shared with them with PROJECT_READ and PROJECT_WRITE visibility, and they have bb.projects.get permission on the project.
// Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)
GetWorksheet(context.Context, *GetWorksheetRequest) (*Worksheet, error)
+ // List worksheets.
+ // This is used for listing worksheets in a project, or across all projects by using `projects/-`.
+ // Permissions required: bb.worksheets.list
+ ListWorksheets(context.Context, *ListWorksheetsRequest) (*ListWorksheetsResponse, error)
// Search for worksheets.
// This is used for finding my worksheets or worksheets shared by other people.
// The sheet accessibility is the same as GetWorksheet().
@@ -205,6 +224,9 @@ func (UnimplementedWorksheetServiceServer) CreateWorksheet(context.Context, *Cre
func (UnimplementedWorksheetServiceServer) GetWorksheet(context.Context, *GetWorksheetRequest) (*Worksheet, error) {
return nil, status.Error(codes.Unimplemented, "method GetWorksheet not implemented")
}
+func (UnimplementedWorksheetServiceServer) ListWorksheets(context.Context, *ListWorksheetsRequest) (*ListWorksheetsResponse, error) {
+ return nil, status.Error(codes.Unimplemented, "method ListWorksheets not implemented")
+}
func (UnimplementedWorksheetServiceServer) SearchWorksheets(context.Context, *SearchWorksheetsRequest) (*SearchWorksheetsResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SearchWorksheets not implemented")
}
@@ -277,6 +299,24 @@ func _WorksheetService_GetWorksheet_Handler(srv interface{}, ctx context.Context
return interceptor(ctx, in, info, handler)
}
+func _WorksheetService_ListWorksheets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ListWorksheetsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(WorksheetServiceServer).ListWorksheets(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: WorksheetService_ListWorksheets_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(WorksheetServiceServer).ListWorksheets(ctx, req.(*ListWorksheetsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _WorksheetService_SearchWorksheets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SearchWorksheetsRequest)
if err := dec(in); err != nil {
@@ -382,6 +422,10 @@ var WorksheetService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetWorksheet",
Handler: _WorksheetService_GetWorksheet_Handler,
},
+ {
+ MethodName: "ListWorksheets",
+ Handler: _WorksheetService_ListWorksheets_Handler,
+ },
{
MethodName: "SearchWorksheets",
Handler: _WorksheetService_SearchWorksheets_Handler,
diff --git a/backend/store/worksheet.go b/backend/store/worksheet.go
index 63df565e01..f54d9ad203 100644
--- a/backend/store/worksheet.go
+++ b/backend/store/worksheet.go
@@ -56,8 +56,10 @@ type WorkSheetMessage struct {
// FindWorkSheetMessage is the API message for finding sheets.
type FindWorkSheetMessage struct {
- // Required field
- ProjectIDs []string
+ // Either ProjectIDs or Workspace is required.
+ ProjectIDs []string
+ Workspace string
+
PrincipalEmail string
ResourceID *string
@@ -66,6 +68,9 @@ type FindWorkSheetMessage struct {
LoadFull bool
FilterQ *qb.Query
+
+ Limit *int
+ Offset *int
}
// PatchWorkSheetMessage is the message to patch a sheet.
@@ -97,7 +102,7 @@ func (s *Store) GetWorkSheet(ctx context.Context, find *FindWorkSheetMessage) (*
// ListWorkSheets returns a list of sheets.
func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage) ([]*WorkSheetMessage, error) {
- if len(find.ProjectIDs) == 0 {
+ if len(find.ProjectIDs) == 0 && find.Workspace == "" {
return nil, errors.Errorf("empty project filter")
}
statementField := fmt.Sprintf("LEFT(worksheet.statement, %d)", common.MaxSheetSize)
@@ -120,12 +125,15 @@ func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage)
OCTET_LENGTH(worksheet.statement),
COALESCE(worksheet_organizer.payload, '{}')
FROM worksheet
- LEFT JOIN worksheet_organizer ON worksheet_organizer.worksheet = worksheet.resource_id AND worksheet_organizer.principal = '%s'
- WHERE TRUE`, statementField, find.PrincipalEmail))
+ LEFT JOIN worksheet_organizer ON worksheet_organizer.worksheet = worksheet.resource_id AND worksheet_organizer.principal = ?
+ WHERE TRUE`, statementField), find.PrincipalEmail)
+ if find.Workspace != "" {
+ q.And("EXISTS (SELECT 1 FROM project WHERE project.resource_id = worksheet.project AND project.workspace = ? AND project.deleted = FALSE)", find.Workspace)
+ }
if len(find.ProjectIDs) == 1 {
q.And("worksheet.project = ?", find.ProjectIDs[0])
- } else {
+ } else if len(find.ProjectIDs) > 1 {
q.And("worksheet.project = ANY(?)", find.ProjectIDs)
}
@@ -137,6 +145,14 @@ func (s *Store) ListWorkSheets(ctx context.Context, find *FindWorkSheetMessage)
q.And("worksheet.resource_id = ?", *v)
}
+ q.Space("ORDER BY worksheet.updated_at DESC, worksheet.resource_id DESC")
+ if v := find.Limit; v != nil {
+ q.Space("LIMIT ?", *v)
+ }
+ if v := find.Offset; v != nil {
+ q.Space("OFFSET ?", *v)
+ }
+
query, args, err := q.ToSQL()
if err != nil {
return nil, errors.Wrapf(err, "failed to build sql")
@@ -491,3 +507,72 @@ func GetListSheetFilter(ctx context.Context, s *Store, caller string, filter str
}
return qb.Q().Space("(?)", q), nil
}
+
+func GetListWorksheetFilter(filter string) (*qb.Query, error) {
+ if filter == "" {
+ return nil, nil
+ }
+
+ e, err := cel.NewEnv()
+ if err != nil {
+ return nil, errors.New("failed to create cel env")
+ }
+ ast, iss := e.Parse(filter)
+ if iss != nil {
+ return nil, errors.Errorf("failed to parse filter %v, error: %v", filter, iss.String())
+ }
+
+ var getFilter func(expr celast.Expr) (*qb.Query, error)
+ getFilter = func(expr celast.Expr) (*qb.Query, error) {
+ if expr.Kind() != celast.CallKind {
+ return nil, errors.Errorf("unexpected expr kind %v", expr.Kind())
+ }
+ q := qb.Q()
+ functionName := expr.AsCall().FunctionName()
+ switch functionName {
+ case celoperators.LogicalOr:
+ for _, arg := range expr.AsCall().Args() {
+ qq, err := getFilter(arg)
+ if err != nil {
+ return nil, err
+ }
+ q.Or("?", qq)
+ }
+ return qb.Q().Space("(?)", q), nil
+ case celoperators.LogicalAnd:
+ for _, arg := range expr.AsCall().Args() {
+ qq, err := getFilter(arg)
+ if err != nil {
+ return nil, err
+ }
+ q.And("?", qq)
+ }
+ return qb.Q().Space("(?)", q), nil
+ case celoperators.Equals, celoperators.NotEquals:
+ variable, value := getVariableAndValueFromExpr(expr)
+ if variable != "creator" {
+ return nil, errors.Errorf("unsupported variable %q", variable)
+ }
+ creator, ok := value.(string)
+ if !ok {
+ return nil, errors.Errorf("invalid creator value %q", value)
+ }
+ creatorEmail := strings.TrimPrefix(creator, "users/")
+ if creatorEmail == "" {
+ return nil, errors.New("invalid empty creator identifier")
+ }
+ if functionName == celoperators.Equals {
+ return qb.Q().Space("worksheet.creator = ?", creatorEmail), nil
+ }
+ return qb.Q().Space("worksheet.creator != ?", creatorEmail), nil
+ default:
+ return nil, errors.Errorf("unexpected function %v", functionName)
+ }
+ }
+
+ q, err := getFilter(ast.NativeRep().Expr())
+ if err != nil {
+ return nil, err
+ }
+ return qb.Q().Space("(?)", q), nil
+}
diff --git a/backend/tests/tests.go b/backend/tests/tests.go
index 74f719f1f9..46aef4f52b 100644
--- a/backend/tests/tests.go
+++ b/backend/tests/tests.go
@@ -112,6 +112,7 @@ type controller struct {
serviceAccountServiceClient v1connect.ServiceAccountServiceClient
workloadIdentityServiceClient v1connect.WorkloadIdentityServiceClient
accessGrantServiceClient v1connect.AccessGrantServiceClient
+ worksheetServiceClient v1connect.WorksheetServiceClient
project *v1pb.Project
@@ -303,6 +304,7 @@ func (ctl *controller) start(ctx context.Context, port int) (context.Context, er
ctl.serviceAccountServiceClient = v1connect.NewServiceAccountServiceClient(ctl.client, baseURL, interceptors)
ctl.workloadIdentityServiceClient = v1connect.NewWorkloadIdentityServiceClient(ctl.client, baseURL, interceptors)
ctl.accessGrantServiceClient = v1connect.NewAccessGrantServiceClient(ctl.client, baseURL, interceptors)
+ ctl.worksheetServiceClient = v1connect.NewWorksheetServiceClient(ctl.client, baseURL, interceptors)
if err := ctl.waitForHealthz(ctx); err != nil {
return nil, errors.Wrap(err, "failed to wait for healthz")
diff --git a/backend/tests/worksheet_test.go b/backend/tests/worksheet_test.go
new file mode 100644
index 0000000000..3c8e0f12f2
--- /dev/null
+++ b/backend/tests/worksheet_test.go
@@ -0,0 +1,150 @@
+package tests
+
+import (
+ "context"
+ "fmt"
+ "testing"
+
+ "connectrpc.com/connect"
+ "github.com/stretchr/testify/require"
+
+ v1pb "github.com/bytebase/bytebase/backend/generated-go/v1"
+)
+
+func TestListWorksheets(t *testing.T) {
+ t.Parallel()
+ a := require.New(t)
+ ctx := context.Background()
+ ctl := &controller{}
+ ctx, err := ctl.StartServerWithExternalPg(ctx)
+ a.NoError(err)
+ defer ctl.Close(ctx)
+
+ ownerToken := ctl.authInterceptor.token
+
+ otherProjectResp, err := ctl.projectServiceClient.CreateProject(ctx, connect.NewRequest(&v1pb.CreateProjectRequest{
+ Project: &v1pb.Project{
+ Title: "Worksheet Other Project",
+ AllowSelfApproval: true,
+ },
+ ProjectId: generateRandomString("worksheet-project"),
+ }))
+ a.NoError(err)
+ otherProject := otherProjectResp.Msg
+
+ otherEmail := fmt.Sprintf("worksheet-%[email protected]", generateRandomString("user"))
+ otherPassword := "1024bytebase"
+ otherUser, err := ctl.userServiceClient.CreateUser(ctx, connect.NewRequest(&v1pb.CreateUserRequest{
+ User: &v1pb.User{
+ Email: otherEmail,
+ Password: otherPassword,
+ Title: "Worksheet User",
+ },
+ }))
+ a.NoError(err)
+ _, err = ctl.addMemberToWorkspaceIAM(ctx, otherUser.Msg.Workspace, fmt.Sprintf("user:%s", otherEmail), "roles/workspaceMember")
+ a.NoError(err)
+
+ createWorksheet := func(title, parent string) *v1pb.Worksheet {
+ resp, err := ctl.worksheetServiceClient.CreateWorksheet(ctx, connect.NewRequest(&v1pb.CreateWorksheetRequest{
+ Parent: parent,
+ Worksheet: &v1pb.Worksheet{
+ Title: title,
+ Content: []byte("SELECT 1;"),
+ Visibility: v1pb.Worksheet_PROJECT_READ,
+ },
+ }))
+ a.NoError(err)
+ return resp.Msg
+ }
+
+ projectOwnerWorksheet := createWorksheet("project-owner", ctl.project.Name)
+ crossProjectOwnerWorksheet := createWorksheet("cross-project-owner", otherProject.Name)
+
+ loginResp, err := ctl.authServiceClient.Login(ctx, connect.NewRequest(&v1pb.LoginRequest{
+ Email: otherEmail,
+ Password: otherPassword,
+ }))
+ a.NoError(err)
+ ctl.authInterceptor.token = loginResp.Msg.Token
+ otherWorksheet := createWorksheet("other-creator", ctl.project.Name)
+
+ _, err = ctl.worksheetServiceClient.ListWorksheets(ctx, connect.NewRequest(&v1pb.ListWorksheetsRequest{
+ Parent: "projects/-",
+ }))
+ a.Error(err)
+ a.Equal(connect.CodePermissionDenied, connect.CodeOf(err))
+
+ ctl.authInterceptor.token = ownerToken
+ roleID := generateRandomString("worksheet-lister")
+ _, err = ctl.roleServiceClient.CreateRole(ctx, connect.NewRequest(&v1pb.CreateRoleRequest{
+ Role: &v1pb.Role{
+ Title: "Worksheet Lister",
+ Permissions: []string{"bb.worksheets.list"},
+ },
+ RoleId: roleID,
+ }))
+ a.NoError(err)
+ _, err = ctl.addMemberToWorkspaceIAM(ctx, otherUser.Msg.Workspace, fmt.Sprintf("user:%s", otherEmail), fmt.Sprintf("roles/%s", roleID))
+ a.NoError(err)
+
+ ctl.authInterceptor.token = loginResp.Msg.Token
+ listProjectResp, err := ctl.worksheetServiceClient.ListWorksheets(ctx, connect.NewRequest(&v1pb.ListWorksheetsRequest{
+ Parent: ctl.project.Name,
+ Filter: fmt.Sprintf("creator == \"users/%s\"", otherEmail),
+ }))
+ a.NoError(err)
+ a.ElementsMatch([]string{otherWorksheet.Name}, worksheetNames(listProjectResp.Msg.Worksheets))
+
+ listNotCreatorResp, err := ctl.worksheetServiceClient.ListWorksheets(ctx, connect.NewRequest(&v1pb.ListWorksheetsRequest{
+ Parent: ctl.project.Name,
+ Filter: fmt.Sprintf("creator != \"users/%s\"", otherEmail),
+ }))
+ a.NoError(err)
+ a.ElementsMatch([]string{projectOwnerWorksheet.Name}, worksheetNames(listNotCreatorResp.Msg.Worksheets))
+
+ listCrossProjectResp, err := ctl.worksheetServiceClient.ListWorksheets(ctx, connect.NewRequest(&v1pb.ListWorksheetsRequest{
+ Parent: "projects/-",
+ Filter: `creator == "users/[email protected]"`,
+ }))
+ a.NoError(err)
+ a.ElementsMatch([]string{projectOwnerWorksheet.Name, crossProjectOwnerWorksheet.Name}, worksheetNames(listCrossProjectResp.Msg.Worksheets))
+
+ firstPageResp, err := ctl.worksheetServiceClient.ListWorksheets(ctx, connect.NewRequest(&v1pb.ListWorksheetsRequest{
+ Parent: "projects/-",
+ Filter: `creator == "users/[email protected]"`,
+ PageSize: 1,
+ }))
+ a.NoError(err)
+ a.Len(firstPageResp.Msg.Worksheets, 1)
+ a.NotEmpty(firstPageResp.Msg.NextPageToken)
+
+ secondPageResp, err := ctl.worksheetServiceClient.ListWorksheets(ctx, connect.NewRequest(&v1pb.ListWorksheetsRequest{
+ Parent: "projects/-",
+ Filter: `creator == "users/[email protected]"`,
+ PageSize: 1,
+ PageToken: firstPageResp.Msg.NextPageToken,
+ }))
+ a.NoError(err)
+ a.Len(secondPageResp.Msg.Worksheets, 1)
+ a.Empty(secondPageResp.Msg.NextPageToken)
+ a.ElementsMatch(
+ []string{projectOwnerWorksheet.Name, crossProjectOwnerWorksheet.Name},
+ append(worksheetNames(firstPageResp.Msg.Worksheets), worksheetNames(secondPageResp.Msg.Worksheets)...),
+ )
+
+ _, err = ctl.worksheetServiceClient.ListWorksheets(ctx, connect.NewRequest(&v1pb.ListWorksheetsRequest{
+ Parent: "projects/-",
+ Filter: `visibility == "PROJECT_READ"`,
+ }))
+ a.Error(err)
+ a.Equal(connect.CodeInvalidArgument, connect.CodeOf(err))
+}
+
+func worksheetNames(worksheets []*v1pb.Worksheet) []string {
+ names := make([]string, 0, len(worksheets))
+ for _, worksheet := range worksheets {
+ names = append(names, worksheet.Name)
+ }
+ return names
+}
diff --git a/frontend/src/types/iam/permission-generated.ts b/frontend/src/types/iam/permission-generated.ts
index 330732c639..cb90143570 100644
--- a/frontend/src/types/iam/permission-generated.ts
+++ b/frontend/src/types/iam/permission-generated.ts
@@ -134,6 +134,7 @@ export type Permission =
| "bb.users.update"
| "bb.users.updateEmail"
| "bb.worksheets.get"
+ | "bb.worksheets.list"
| "bb.worksheets.manage"
| "bb.workloadIdentities.create"
| "bb.workloadIdentities.delete"
diff --git a/frontend/src/types/proto-es/v1/worksheet_service_pb.d.ts b/frontend/src/types/proto-es/v1/worksheet_service_pb.d.ts
index 9f6477222e..e27cfb3829 100644
--- a/frontend/src/types/proto-es/v1/worksheet_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/worksheet_service_pb.d.ts
@@ -56,6 +56,89 @@ export declare type GetWorksheetRequest = Message<"bytebase.v1.GetWorksheetReque
*/
export declare const GetWorksheetRequestSchema: GenMessage<GetWorksheetRequest>;
+/**
+ * @generated from message bytebase.v1.ListWorksheetsRequest
+ */
+export declare type ListWorksheetsRequest = Message<"bytebase.v1.ListWorksheetsRequest"> & {
+ /**
+ * The parent resource of the worksheets.
+ * Format: projects/{project}
+ * Use "projects/-" to list worksheets across all projects.
+ *
+ * @generated from field: string parent = 1;
+ */
+ parent: string;
+
+ /**
+ * To filter the list result.
+ * The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+ *
+ * Supported filter:
+ * - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.
+ *
+ * For example:
+ * creator == "users/{email}"
+ * creator != "users/{email}"
+ *
+ * @generated from field: string filter = 2;
+ */
+ filter: string;
+
+ /**
+ * The maximum number of worksheets to return. The service may return fewer than
+ * this value.
+ * If unspecified, at most 10 worksheets will be returned.
+ * The maximum value is 1000; values above 1000 will be coerced to 1000.
+ *
+ * @generated from field: int32 page_size = 3;
+ */
+ pageSize: number;
+
+ /**
+ * A page token, received from a previous `ListWorksheets` call.
+ * Provide this to retrieve the subsequent page.
+ *
+ * When paginating, all other parameters provided to `ListWorksheets` must match
+ * the call that provided the page token.
+ *
+ * @generated from field: string page_token = 4;
+ */
+ pageToken: string;
+};
+
+/**
+ * Describes the message bytebase.v1.ListWorksheetsRequest.
+ * Use `create(ListWorksheetsRequestSchema)` to create a new message.
+ */
+export declare const ListWorksheetsRequestSchema: GenMessage<ListWorksheetsRequest>;
+
+/**
+ * @generated from message bytebase.v1.ListWorksheetsResponse
+ */
+export declare type ListWorksheetsResponse = Message<"bytebase.v1.ListWorksheetsResponse"> & {
+ /**
+ * The worksheets from the specified parent.
+ *
+ * @generated from field: repeated bytebase.v1.Worksheet worksheets = 1;
+ */
+ worksheets: Worksheet[];
+
+ /**
+ * A token to retrieve next page of worksheets.
+ * Pass this value in the page_token field in the subsequent call to
+ * `ListWorksheets` method to retrieve the next page of worksheets.
+ *
+ * @generated from field: string next_page_token = 2;
+ */
+ nextPageToken: string;
+};
+
+/**
+ * Describes the message bytebase.v1.ListWorksheetsResponse.
+ * Use `create(ListWorksheetsResponseSchema)` to create a new message.
+ */
+export declare const ListWorksheetsResponseSchema: GenMessage<ListWorksheetsResponse>;
+
/**
* @generated from message bytebase.v1.UpdateWorksheetRequest
*/
@@ -437,6 +520,18 @@ export declare const WorksheetService: GenService<{
input: typeof GetWorksheetRequestSchema;
output: typeof WorksheetSchema;
},
+ /**
+ * List worksheets.
+ * This is used for listing worksheets in a project, or across all projects by using `projects/-`.
+ * Permissions required: bb.worksheets.list
+ *
+ * @generated from rpc bytebase.v1.WorksheetService.ListWorksheets
+ */
+ listWorksheets: {
+ methodKind: "unary";
+ input: typeof ListWorksheetsRequestSchema;
+ output: typeof ListWorksheetsResponseSchema;
+ },
/**
* Search for worksheets.
* This is used for finding my worksheets or worksheets shared by other people.
diff --git a/frontend/src/types/proto-es/v1/worksheet_service_pb.js b/frontend/src/types/proto-es/v1/worksheet_service_pb.js
index 5a6b41c762..4024db30fb 100644
--- a/frontend/src/types/proto-es/v1/worksheet_service_pb.js
+++ b/frontend/src/types/proto-es/v1/worksheet_service_pb.js
@@ -7,6 +7,7 @@ import { file_buf_validate_validate } from "../buf/validate/validate_pb";
import { file_google_api_annotations } from "../google/api/annotations_pb";
import { file_google_api_client } from "../google/api/client_pb";
import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";
+import { file_google_api_resource } from "../google/api/resource_pb";
import { file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
import { file_v1_annotation } from "./annotation_pb";
@@ -14,7 +15,7 @@ import { file_v1_annotation } from "./annotation_pb";
* Describes the file v1/worksheet_service.proto.
*/
export const file_v1_worksheet_service = /*@__PURE__*/
- fileDesc("Chp2MS93b3Jrc2hlZXRfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiXQoWQ3JlYXRlV29ya3NoZWV0UmVxdWVzdBITCgZwYXJlbnQYASABKAlCA+BBAhIuCgl3b3Jrc2hlZXQYAiABKAsyFi5ieXRlYmFzZS52MS5Xb3Jrc2hlZXRCA+BBAiIoChNHZXRXb3Jrc2hlZXRSZXF1ZXN0EhEKBG5hbWUYASABKAlCA+BBAiJ5ChZVcGRhdGVXb3Jrc2hlZXRSZXF1ZXN0Ei4KCXdvcmtzaGVldBgBIAEoCzIWLmJ5dGViYXNlLnYxLldvcmtzaGVldEID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzayJrCiRCYXRjaFVwZGF0ZVdvcmtzaGVldE9yZ2FuaXplclJlcXVlc3QSQwoIcmVxdWVzdHMYASADKAsyLC5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IXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_buf_validate_validate, file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_protobuf_timestamp, file_v1_annotation]);
+ fileDesc("Chp2MS93b3Jrc2hlZXRfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiXQoWQ3JlYXRlV29ya3NoZWV0UmVxdWVzdBITCgZwYXJlbnQYASABKAlCA+BBAhIuCgl3b3Jrc2hlZXQYAiABKAsyFi5ieXRlYmFzZS52MS5Xb3Jrc2hlZXRCA+BBAiIoChNHZXRXb3Jrc2hlZXRSZXF1ZXN0EhEKBG5hbWUYASABKAlCA+BBAiJ8ChVMaXN0V29ya3NoZWV0c1JlcXVlc3QSLAoGcGFyZW50GAEgASgJQhzgQQL6QRYKFGJ5dGViYXNlLmNvbS9Qcm9qZWN0Eg4KBmZpbHRlchgCIAEoCRIRCglwYWdlX3NpemUYAyABKAUSEgoKcGFnZV90b2tlbhgEIAEoCSJdChZMaXN0V29ya3NoZWV0c1Jlc3BvbnNlEioKCndvcmtzaGVldHMYASADKAsyFi5ieXRlYmFzZS52MS5Xb3Jrc2hlZXQSFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJInkKFlVwZGF0ZVdvcmtzaGVldFJlcXVlc3QSLgoJd29ya3NoZWV0GAEgASgLMhYuYnl0ZWJhc2UudjEuV29ya3NoZWV0QgPgQQISLwoLdXBkYXRlX21hc2sYAiABKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrImsKJEJhdGNoVXBkYXRlV29ya3NoZWV0T3JnYW5pemVyUmVxdWVzdBJDCghyZXF1ZXN0cxgBIAMoCzIsLmJ5dGViYXNlLnYxLlVwZGF0ZVdvcmtzaGVldE9yZ2FuaXplclJlcXVlc3RCA+BBAiJmCiVCYXRjaFVwZGF0ZVdvcmtzaGVldE9yZ2FuaXplclJlc3Bv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ZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_buf_validate_validate, 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_protobuf_timestamp, file_v1_annotation]);
/**
* Describes the message bytebase.v1.CreateWorksheetRequest.
@@ -30,74 +31,88 @@ export const CreateWorksheetRequestSchema = /*@__PURE__*/
export const GetWorksheetRequestSchema = /*@__PURE__*/
messageDesc(file_v1_worksheet_service, 1);
+/**
+ * Describes the message bytebase.v1.ListWorksheetsRequest.
+ * Use `create(ListWorksheetsRequestSchema)` to create a new message.
+ */
+export const ListWorksheetsRequestSchema = /*@__PURE__*/
+ messageDesc(file_v1_worksheet_service, 2);
+
+/**
+ * Describes the message bytebase.v1.ListWorksheetsResponse.
+ * Use `create(ListWorksheetsResponseSchema)` to create a new message.
+ */
+export const ListWorksheetsResponseSchema = /*@__PURE__*/
+ messageDesc(file_v1_worksheet_service, 3);
+
/**
* Describes the message bytebase.v1.UpdateWorksheetRequest.
* Use `create(UpdateWorksheetRequestSchema)` to create a new message.
*/
export const UpdateWorksheetRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_worksheet_service, 2);
+ messageDesc(file_v1_worksheet_service, 4);
/**
* Describes the message bytebase.v1.BatchUpdateWorksheetOrganizerRequest.
* Use `create(BatchUpdateWorksheetOrganizerRequestSchema)` to create a new message.
*/
export const BatchUpdateWorksheetOrganizerRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_worksheet_service, 3);
+ messageDesc(file_v1_worksheet_service, 5);
/**
* Describes the message bytebase.v1.BatchUpdateWorksheetOrganizerResponse.
* Use `create(BatchUpdateWorksheetOrganizerResponseSchema)` to create a new message.
*/
export const BatchUpdateWorksheetOrganizerResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_worksheet_service, 4);
+ messageDesc(file_v1_worksheet_service, 6);
/**
* Describes the message bytebase.v1.UpdateWorksheetOrganizerRequest.
* Use `create(UpdateWorksheetOrganizerRequestSchema)` to create a new message.
*/
export const UpdateWorksheetOrganizerRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_worksheet_service, 5);
+ messageDesc(file_v1_worksheet_service, 7);
/**
* Describes the message bytebase.v1.WorksheetOrganizer.
* Use `create(WorksheetOrganizerSchema)` to create a new message.
*/
export const WorksheetOrganizerSchema = /*@__PURE__*/
- messageDesc(file_v1_worksheet_service, 6);
+ messageDesc(file_v1_worksheet_service, 8);
/**
* Describes the message bytebase.v1.DeleteWorksheetRequest.
* Use `create(DeleteWorksheetRequestSchema)` to create a new message.
*/
export const DeleteWorksheetRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_worksheet_service, 7);
+ messageDesc(file_v1_worksheet_service, 9);
/**
* Describes the message bytebase.v1.SearchWorksheetsRequest.
* Use `create(SearchWorksheetsRequestSchema)` to create a new message.
*/
export const SearchWorksheetsRequestSchema = /*@__PURE__*/
- messageDesc(file_v1_worksheet_service, 8);
+ messageDesc(file_v1_worksheet_service, 10);
/**
* Describes the message bytebase.v1.SearchWorksheetsResponse.
* Use `create(SearchWorksheetsResponseSchema)` to create a new message.
*/
export const SearchWorksheetsResponseSchema = /*@__PURE__*/
- messageDesc(file_v1_worksheet_service, 9);
+ messageDesc(file_v1_worksheet_service, 11);
/**
* Describes the message bytebase.v1.Worksheet.
* Use `create(WorksheetSchema)` to create a new message.
*/
export const WorksheetSchema = /*@__PURE__*/
- messageDesc(file_v1_worksheet_service, 10);
+ messageDesc(file_v1_worksheet_service, 12);
/**
* Describes the enum bytebase.v1.Worksheet.Visibility.
*/
export const Worksheet_VisibilitySchema = /*@__PURE__*/
- enumDesc(file_v1_worksheet_service, 10, 0);
+ enumDesc(file_v1_worksheet_service, 12, 0);
/**
* @generated from enum bytebase.v1.Worksheet.Visibility
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index b7494aba73..06474fcb35 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -11303,6 +11303,66 @@ paths:
schema:
$ref: '#/components/schemas/bytebase.v1.WorkloadIdentity'
/v1/projects/{project}/worksheets:
+ get:
+ tags:
+ - WorksheetService
+ summary: ListWorksheets
+ description: |-
+ List worksheets.
+ This is used for listing worksheets in a project, or across all projects by using `projects/-`.
+ Permissions required: bb.worksheets.list
+ operationId: WorksheetService_ListWorksheets
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ - name: filter
+ in: query
+ description: |-
+ To filter the list result.
+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+ Supported filter:
+ - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.
+
+ For example:
+ creator == "users/{email}"
+ creator != "users/{email}"
+ schema:
+ type: string
+ title: filter
+ - name: pageSize
+ in: query
+ description: |-
+ The maximum number of worksheets to return. The service may return fewer than
+ this value.
+ If unspecified, at most 10 worksheets will be returned.
+ The maximum value is 1000; values above 1000 will be coerced to 1000.
+ schema:
+ type: integer
+ title: page_size
+ format: int32
+ - name: pageToken
+ in: query
+ description: |-
+ A page token, received from a previous `ListWorksheets` call.
+ Provide this to retrieve the subsequent page.
+
+ When paginating, all other parameters provided to `ListWorksheets` must match
+ the call that provided the page token.
+ schema:
+ type: string
+ title: page_token
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.ListWorksheetsResponse'
post:
tags:
- WorksheetService
@@ -22762,6 +22822,69 @@ components:
title: ListWorkloadIdentitiesResponse
additionalProperties: false
description: Response message for listing workload identities.
+ bytebase.v1.ListWorksheetsRequest:
+ type: object
+ properties:
+ parent:
+ type: string
+ title: parent
+ description: |-
+ The parent resource of the worksheets.
+ Format: projects/{project}
+ Use "projects/-" to list worksheets across all projects.
+ filter:
+ type: string
+ title: filter
+ description: |-
+ To filter the list result.
+ The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+ Supported filter:
+ - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.
+
+ For example:
+ creator == "users/{email}"
+ creator != "users/{email}"
+ pageSize:
+ type: integer
+ title: page_size
+ format: int32
+ description: |-
+ The maximum number of worksheets to return. The service may return fewer than
+ this value.
+ If unspecified, at most 10 worksheets will be returned.
+ The maximum value is 1000; values above 1000 will be coerced to 1000.
+ pageToken:
+ type: string
+ title: page_token
+ description: |-
+ A page token, received from a previous `ListWorksheets` call.
+ Provide this to retrieve the subsequent page.
+
+ When paginating, all other parameters provided to `ListWorksheets` must match
+ the call that provided the page token.
+ title: ListWorksheetsRequest
+ required:
+ - parent
+ additionalProperties: false
+ bytebase.v1.ListWorksheetsResponse:
+ type: object
+ properties:
+ worksheets:
+ type: array
+ items:
+ $ref: '#/components/schemas/bytebase.v1.Worksheet'
+ title: worksheets
+ description: The worksheets from the specified parent.
+ nextPageToken:
+ type: string
+ title: next_page_token
+ description: |-
+ A token to retrieve next page of worksheets.
+ Pass this value in the page_token field in the subsequent call to
+ `ListWorksheets` method to retrieve the next page of worksheets.
+ title: ListWorksheetsResponse
+ additionalProperties: false
bytebase.v1.ListWorkspacesRequest:
type: object
title: ListWorkspacesRequest
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 06b5ab2df6..d71c36afc0 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -744,6 +744,8 @@
- [CreateWorksheetRequest](#bytebase-v1-CreateWorksheetRequest)
- [DeleteWorksheetRequest](#bytebase-v1-DeleteWorksheetRequest)
- [GetWorksheetRequest](#bytebase-v1-GetWorksheetRequest)
+ - [ListWorksheetsRequest](#bytebase-v1-ListWorksheetsRequest)
+ - [ListWorksheetsResponse](#bytebase-v1-ListWorksheetsResponse)
- [SearchWorksheetsRequest](#bytebase-v1-SearchWorksheetsRequest)
- [SearchWorksheetsResponse](#bytebase-v1-SearchWorksheetsResponse)
- [UpdateWorksheetOrganizerRequest](#bytebase-v1-UpdateWorksheetOrganizerRequest)
@@ -12093,6 +12095,46 @@ WorkloadIdentityService manages workload identities for external CI/CD integrati
+<a name="bytebase-v1-ListWorksheetsRequest"></a>
+
+### ListWorksheetsRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| parent | [string](#string) | | The parent resource of the worksheets. Format: projects/{project} Use &#34;projects/-&#34; to list worksheets across all projects. |
+| filter | [string](#string) | | To filter the list result. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+Supported filter: - creator: the worksheet creator in &#34;users/{email}&#34; format, support &#34;==&#34; and &#34;!=&#34; operator.
+
+For example: creator == &#34;users/{email}&#34; creator != &#34;users/{email}&#34; |
+| page_size | [int32](#int32) | | The maximum number of worksheets to return. The service may return fewer than this value. If unspecified, at most 10 worksheets will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
+| page_token | [string](#string) | | A page token, received from a previous `ListWorksheets` call. Provide this to retrieve the subsequent page.
+
+When paginating, all other parameters provided to `ListWorksheets` must match the call that provided the page token. |
+
+
+
+
+
+
+<a name="bytebase-v1-ListWorksheetsResponse"></a>
+
+### ListWorksheetsResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| worksheets | [Worksheet](#bytebase-v1-Worksheet) | repeated | The worksheets from the specified parent. |
+| next_page_token | [string](#string) | | A token to retrieve next page of worksheets. Pass this value in the page_token field in the subsequent call to `ListWorksheets` method to retrieve the next page of worksheets. |
+
+
+
+
+
+
<a name="bytebase-v1-SearchWorksheetsRequest"></a>
### SearchWorksheetsRequest
@@ -12237,6 +12279,7 @@ WorksheetService manages SQL worksheets for query development.
| ----------- | ------------ | ------------- | ------------|
| CreateWorksheet | [CreateWorksheetRequest](#bytebase-v1-CreateWorksheetRequest) | [Worksheet](#bytebase-v1-Worksheet) | Creates a personal worksheet used in SQL Editor. Any authenticated user can create their own worksheets. Permissions required: None (authenticated users only) |
| GetWorksheet | [GetWorksheetRequest](#bytebase-v1-GetWorksheetRequest) | [Worksheet](#bytebase-v1-Worksheet) | Get a worksheet by name. The users can access this method if, - they are the creator of the worksheet; - they have bb.worksheets.get permission on the workspace; - the sheet is shared with them with PROJECT_READ and PROJECT_WRITE visibility, and they have bb.projects.get permission on the project. Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets) |
+| ListWorksheets | [ListWorksheetsRequest](#bytebase-v1-ListWorksheetsRequest) | [ListWorksheetsResponse](#bytebase-v1-ListWorksheetsResponse) | List worksheets. This is used for listing worksheets in a project, or across all projects by using `projects/-`. Permissions required: bb.worksheets.list |
| SearchWorksheets | [SearchWorksheetsRequest](#bytebase-v1-SearchWorksheetsRequest) | [SearchWorksheetsResponse](#bytebase-v1-SearchWorksheetsResponse) | Search for worksheets. This is used for finding my worksheets or worksheets shared by other people. The sheet accessibility is the same as GetWorksheet(). Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets) |
| UpdateWorksheet | [UpdateWorksheetRequest](#bytebase-v1-UpdateWorksheetRequest) | [Worksheet](#bytebase-v1-Worksheet) | Update a worksheet. The users can access this method if, - they are the creator of the worksheet; - they have bb.worksheets.manage permission on the workspace; - the sheet is shared with them with PROJECT_WRITE visibility, and they have bb.projects.get permission on the project. Permissions required: bb.worksheets.manage (or creator, or project member for PROJECT_WRITE worksheets) |
| UpdateWorksheetOrganizer | [UpdateWorksheetOrganizerRequest](#bytebase-v1-UpdateWorksheetOrganizerRequest) | [WorksheetOrganizer](#bytebase-v1-WorksheetOrganizer) | Update the organizer of a worksheet. The access is the same as UpdateWorksheet method. Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets) |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 669388ec2f..25660ca6ba 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -3018,6 +3018,14 @@
<a href="#bytebase.v1.GetWorksheetRequest"><span class="badge">M</span>GetWorksheetRequest</a>
</li>
+ <li>
+ <a href="#bytebase.v1.ListWorksheetsRequest"><span class="badge">M</span>ListWorksheetsRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.ListWorksheetsResponse"><span class="badge">M</span>ListWorksheetsResponse</a>
+ </li>
+
<li>
<a href="#bytebase.v1.SearchWorksheetsRequest"><span class="badge">M</span>SearchWorksheetsRequest</a>
</li>
@@ -34151,6 +34159,101 @@ Format: projects/{project}/worksheets/{worksheet} </p></td>
+ <h3 id="bytebase.v1.ListWorksheetsRequest">ListWorksheetsRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>parent</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The parent resource of the worksheets.
+Format: projects/{project}
+Use &#34;projects/-&#34; to list worksheets across all projects. </p></td>
+ </tr>
+
+ <tr>
+ <td>filter</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>To filter the list result.
+The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+
+Supported filter:
+- creator: the worksheet creator in &#34;users/{email}&#34; format, support &#34;==&#34; and &#34;!=&#34; operator.
+
+For example:
+creator == &#34;users/{email}&#34;
+creator != &#34;users/{email}&#34; </p></td>
+ </tr>
+
+ <tr>
+ <td>page_size</td>
+ <td><a href="#int32">int32</a></td>
+ <td></td>
+ <td><p>The maximum number of worksheets to return. The service may return fewer than
+this value.
+If unspecified, at most 10 worksheets will be returned.
+The maximum value is 1000; values above 1000 will be coerced to 1000. </p></td>
+ </tr>
+
+ <tr>
+ <td>page_token</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>A page token, received from a previous `ListWorksheets` call.
+Provide this to retrieve the subsequent page.
+
+When paginating, all other parameters provided to `ListWorksheets` must match
+the call that provided the page token. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.ListWorksheetsResponse">ListWorksheetsResponse</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>worksheets</td>
+ <td><a href="#bytebase.v1.Worksheet">Worksheet</a></td>
+ <td>repeated</td>
+ <td><p>The worksheets from the specified parent. </p></td>
+ </tr>
+
+ <tr>
+ <td>next_page_token</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>A token to retrieve next page of worksheets.
+Pass this value in the page_token field in the subsequent call to
+`ListWorksheets` method to retrieve the next page of worksheets. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.v1.SearchWorksheetsRequest">SearchWorksheetsRequest</h3>
<p></p>
@@ -34524,6 +34627,15 @@ The users can access this method if,
Permissions required: bb.worksheets.get (or creator, or project member for shared worksheets)</p></td>
</tr>
+ <tr>
+ <td>ListWorksheets</td>
+ <td><a href="#bytebase.v1.ListWorksheetsRequest">ListWorksheetsRequest</a></td>
+ <td><a href="#bytebase.v1.ListWorksheetsResponse">ListWorksheetsResponse</a></td>
+ <td><p>List worksheets.
+This is used for listing worksheets in a project, or across all projects by using `projects/-`.
+Permissions required: bb.worksheets.list</p></td>
+ </tr>
+
<tr>
<td>SearchWorksheets</td>
<td><a href="#bytebase.v1.SearchWorksheetsRequest">SearchWorksheetsRequest</a></td>
@@ -34613,6 +34725,16 @@ Permissions required: bb.worksheets.manage (or creator, or project member for PR
+ <tr>
+ <td>ListWorksheets</td>
+ <td>GET</td>
+ <td>/v1/{parent=projects/*}/worksheets</td>
+ <td></td>
+ </tr>
+
+
+
+
<tr>
<td>SearchWorksheets</td>
<td>POST</td>
diff --git a/proto/v1/v1/worksheet_service.proto b/proto/v1/v1/worksheet_service.proto
index 9d2b0dd486..8a768a23a8 100644
--- a/proto/v1/v1/worksheet_service.proto
+++ b/proto/v1/v1/worksheet_service.proto
@@ -6,6 +6,7 @@ import "buf/validate/validate.proto";
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
+import "google/api/resource.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
@@ -38,6 +39,16 @@ service WorksheetService {
option (bytebase.v1.auth_method) = CUSTOM;
}
+ // List worksheets.
+ // This is used for listing worksheets in a project, or across all projects by using `projects/-`.
+ // Permissions required: bb.worksheets.list
+ rpc ListWorksheets(ListWorksheetsRequest) returns (ListWorksheetsResponse) {
+ option (google.api.http) = {get: "/v1/{parent=projects/*}/worksheets"};
+ option (google.api.method_signature) = "parent";
+ option (bytebase.v1.permission) = "bb.worksheets.list";
+ option (bytebase.v1.auth_method) = IAM;
+ }
+
// Search for worksheets.
// This is used for finding my worksheets or worksheets shared by other people.
// The sheet accessibility is the same as GetWorksheet().
@@ -114,6 +125,50 @@ message GetWorksheetRequest {
string name = 1 [(google.api.field_behavior) = REQUIRED];
}
+message ListWorksheetsRequest {
+ // The parent resource of the worksheets.
+ // Format: projects/{project}
+ // Use "projects/-" to list worksheets across all projects.
+ string parent = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {type: "bytebase.com/Project"}
+ ];
+
+ // To filter the list result.
+ // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+ //
+ // Supported filter:
+ // - creator: the worksheet creator in "users/{email}" format, support "==" and "!=" operator.
+ //
+ // For example:
+ // creator == "users/{email}"
+ // creator != "users/{email}"
+ string filter = 2;
+
+ // The maximum number of worksheets to return. The service may return fewer than
+ // this value.
+ // If unspecified, at most 10 worksheets will be returned.
+ // The maximum value is 1000; values above 1000 will be coerced to 1000.
+ int32 page_size = 3;
+
+ // A page token, received from a previous `ListWorksheets` call.
+ // Provide this to retrieve the subsequent page.
+ //
+ // When paginating, all other parameters provided to `ListWorksheets` must match
+ // the call that provided the page token.
+ string page_token = 4;
+}
+
+message ListWorksheetsResponse {
+ // The worksheets from the specified parent.
+ repeated Worksheet worksheets = 1;
+
+ // A token to retrieve next page of worksheets.
+ // Pass this value in the page_token field in the subsequent call to
+ // `ListWorksheets` method to retrieve the next page of worksheets.
+ string next_page_token = 2;
+}
+
message UpdateWorksheetRequest {
// The worksheet to update.
//