chore: return workspace setting with default value

pull/3356/head
Steven 11 months ago
parent cf423026a5
commit eda1983964

@ -691,21 +691,6 @@ paths:
$ref: '#/definitions/googlerpcStatus' $ref: '#/definitions/googlerpcStatus'
tags: tags:
- WorkspaceService - WorkspaceService
/api/v1/workspace/settings:
get:
summary: ListWorkspaceSetting returns the list of settings.
operationId: WorkspaceSettingService_ListWorkspaceSettings
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1ListWorkspaceSettingsResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
tags:
- WorkspaceSettingService
/api/v1/workspace/{name}: /api/v1/workspace/{name}:
get: get:
summary: GetWorkspaceSetting returns the setting by name. summary: GetWorkspaceSetting returns the setting by name.
@ -2137,8 +2122,7 @@ definitions:
Note: this functionality is not currently available in the official Note: this functionality is not currently available in the official
protobuf release, and it is not used for type URLs beginning with protobuf release, and it is not used for type URLs beginning with
type.googleapis.com. As of May 2023, there are no widely used type server type.googleapis.com.
implementations and no plans to implement one.
Schemes other than `http`, `https` (or the empty scheme) might be Schemes other than `http`, `https` (or the empty scheme) might be
used with implementation specific semantics. used with implementation specific semantics.
@ -2173,7 +2157,7 @@ definitions:
foo = any.unpack(Foo.getDefaultInstance()); foo = any.unpack(Foo.getDefaultInstance());
} }
Example 3: Pack and unpack a message in Python. Example 3: Pack and unpack a message in Python.
foo = Foo(...) foo = Foo(...)
any = Any() any = Any()
@ -2183,7 +2167,7 @@ definitions:
any.Unpack(foo) any.Unpack(foo)
... ...
Example 4: Pack and unpack a message in Go Example 4: Pack and unpack a message in Go
foo := &pb.Foo{...} foo := &pb.Foo{...}
any, err := anypb.New(foo) any, err := anypb.New(foo)
@ -2203,7 +2187,7 @@ definitions:
name "y.z". name "y.z".
JSON JSON
====
The JSON representation of an `Any` value uses the regular The JSON representation of an `Any` value uses the regular
representation of the deserialized, embedded message, with an representation of the deserialized, embedded message, with an
additional field `@type` which contains the type URL. Example: additional field `@type` which contains the type URL. Example:
@ -2543,14 +2527,6 @@ definitions:
items: items:
type: object type: object
$ref: '#/definitions/v1Webhook' $ref: '#/definitions/v1Webhook'
v1ListWorkspaceSettingsResponse:
type: object
properties:
settings:
type: array
items:
type: object
$ref: '#/definitions/apiv1WorkspaceSetting'
v1MathBlockNode: v1MathBlockNode:
type: object type: object
properties: properties:

@ -9,10 +9,6 @@ import "google/api/field_behavior.proto";
option go_package = "gen/api/v1"; option go_package = "gen/api/v1";
service WorkspaceSettingService { service WorkspaceSettingService {
// ListWorkspaceSetting returns the list of settings.
rpc ListWorkspaceSettings(ListWorkspaceSettingsRequest) returns (ListWorkspaceSettingsResponse) {
option (google.api.http) = {get: "/api/v1/workspace/settings"};
}
// GetWorkspaceSetting returns the setting by name. // GetWorkspaceSetting returns the setting by name.
rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) { rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
option (google.api.http) = {get: "/api/v1/workspace/{name=settings/*}"}; option (google.api.http) = {get: "/api/v1/workspace/{name=settings/*}"};
@ -100,12 +96,6 @@ message WorkspaceMemoRelatedSetting {
int32 content_length_limit = 3; int32 content_length_limit = 3;
} }
message ListWorkspaceSettingsRequest {}
message ListWorkspaceSettingsResponse {
repeated WorkspaceSetting settings = 1;
}
message GetWorkspaceSettingRequest { message GetWorkspaceSettingRequest {
// The resource name of the workspace setting. // The resource name of the workspace setting.
// Format: settings/{setting} // Format: settings/{setting}

@ -495,91 +495,6 @@ func (x *WorkspaceMemoRelatedSetting) GetContentLengthLimit() int32 {
return 0 return 0
} }
type ListWorkspaceSettingsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ListWorkspaceSettingsRequest) Reset() {
*x = ListWorkspaceSettingsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListWorkspaceSettingsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListWorkspaceSettingsRequest) ProtoMessage() {}
func (x *ListWorkspaceSettingsRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListWorkspaceSettingsRequest.ProtoReflect.Descriptor instead.
func (*ListWorkspaceSettingsRequest) Descriptor() ([]byte, []int) {
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{5}
}
type ListWorkspaceSettingsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Settings []*WorkspaceSetting `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty"`
}
func (x *ListWorkspaceSettingsResponse) Reset() {
*x = ListWorkspaceSettingsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListWorkspaceSettingsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListWorkspaceSettingsResponse) ProtoMessage() {}
func (x *ListWorkspaceSettingsResponse) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListWorkspaceSettingsResponse.ProtoReflect.Descriptor instead.
func (*ListWorkspaceSettingsResponse) Descriptor() ([]byte, []int) {
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{6}
}
func (x *ListWorkspaceSettingsResponse) GetSettings() []*WorkspaceSetting {
if x != nil {
return x.Settings
}
return nil
}
type GetWorkspaceSettingRequest struct { type GetWorkspaceSettingRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -593,7 +508,7 @@ type GetWorkspaceSettingRequest struct {
func (x *GetWorkspaceSettingRequest) Reset() { func (x *GetWorkspaceSettingRequest) Reset() {
*x = GetWorkspaceSettingRequest{} *x = GetWorkspaceSettingRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7] mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -606,7 +521,7 @@ func (x *GetWorkspaceSettingRequest) String() string {
func (*GetWorkspaceSettingRequest) ProtoMessage() {} func (*GetWorkspaceSettingRequest) ProtoMessage() {}
func (x *GetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message { func (x *GetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7] mi := &file_api_v1_workspace_setting_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -619,7 +534,7 @@ func (x *GetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetWorkspaceSettingRequest.ProtoReflect.Descriptor instead. // Deprecated: Use GetWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
func (*GetWorkspaceSettingRequest) Descriptor() ([]byte, []int) { func (*GetWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{7} return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{5}
} }
func (x *GetWorkspaceSettingRequest) GetName() string { func (x *GetWorkspaceSettingRequest) GetName() string {
@ -641,7 +556,7 @@ type SetWorkspaceSettingRequest struct {
func (x *SetWorkspaceSettingRequest) Reset() { func (x *SetWorkspaceSettingRequest) Reset() {
*x = SetWorkspaceSettingRequest{} *x = SetWorkspaceSettingRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[8] mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -654,7 +569,7 @@ func (x *SetWorkspaceSettingRequest) String() string {
func (*SetWorkspaceSettingRequest) ProtoMessage() {} func (*SetWorkspaceSettingRequest) ProtoMessage() {}
func (x *SetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message { func (x *SetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[8] mi := &file_api_v1_workspace_setting_service_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -667,7 +582,7 @@ func (x *SetWorkspaceSettingRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SetWorkspaceSettingRequest.ProtoReflect.Descriptor instead. // Deprecated: Use SetWorkspaceSettingRequest.ProtoReflect.Descriptor instead.
func (*SetWorkspaceSettingRequest) Descriptor() ([]byte, []int) { func (*SetWorkspaceSettingRequest) Descriptor() ([]byte, []int) {
return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{8} return file_api_v1_workspace_setting_service_proto_rawDescGZIP(), []int{6}
} }
func (x *SetWorkspaceSettingRequest) GetSetting() *WorkspaceSetting { func (x *SetWorkspaceSettingRequest) GetSetting() *WorkspaceSetting {
@ -693,7 +608,7 @@ type WorkspaceStorageSetting_S3Config struct {
func (x *WorkspaceStorageSetting_S3Config) Reset() { func (x *WorkspaceStorageSetting_S3Config) Reset() {
*x = WorkspaceStorageSetting_S3Config{} *x = WorkspaceStorageSetting_S3Config{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[9] mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -706,7 +621,7 @@ func (x *WorkspaceStorageSetting_S3Config) String() string {
func (*WorkspaceStorageSetting_S3Config) ProtoMessage() {} func (*WorkspaceStorageSetting_S3Config) ProtoMessage() {}
func (x *WorkspaceStorageSetting_S3Config) ProtoReflect() protoreflect.Message { func (x *WorkspaceStorageSetting_S3Config) ProtoReflect() protoreflect.Message {
mi := &file_api_v1_workspace_setting_service_proto_msgTypes[9] mi := &file_api_v1_workspace_setting_service_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -866,67 +781,50 @@ var file_api_v1_workspace_setting_service_proto_rawDesc = []byte{
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x6f,
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x6c, 0x69, 0x6d, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x5f, 0x6c, 0x69, 0x6d,
0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x1e, 0x0a, 0x1c, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x36, 0x0a, 0x1a,
0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74,
0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5b, 0x0a, 0x1d, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61,
0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04,
0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x56, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73,
0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65,
0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20,
0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e,
0x08, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x36, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74,
0x69, 0x6e, 0x67, 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xd9, 0x02, 0x0a,
0x17, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e,
0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x93, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74,
0x65, 0x22, 0x56, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d,
0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70,
0x38, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x32, 0xda, 0x41, 0x04, 0x6e,
0x32, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x7b, 0x6e, 0x61,
0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0xa7,
0x01, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53,
0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0xf0, 0x03, 0x0a, 0x17, 0x57, 0x6f, 0x22, 0x46, 0xda, 0x41, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x82, 0xd3, 0xe4, 0x93,
0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x02, 0x36, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x2b, 0x2f, 0x61, 0x70,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x94, 0x01, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x6f, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2f, 0x7b,
0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74,
0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xb4, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d,
0x69, 0x73, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x1c, 0x57,
0x69, 0x6e, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6d, 0x65, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x53,
0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67,
0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67,
0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2,
0x61, 0x63, 0x65, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x93, 0x01, 0x0a, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70,
0x13, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69,
0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c,
0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02,
0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62,
0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x32,
0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65,
0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f,
0x2a, 0x7d, 0x12, 0xa7, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70,
0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d,
0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x57, 0x6f, 0x72,
0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x76, 0x31, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74,
0x74, 0x69, 0x6e, 0x67, 0x22, 0x46, 0xda, 0x41, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x36, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32,
0x2b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61,
0x63, 0x65, 0x2f, 0x7b, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, 0x65,
0x3d, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xb4, 0x01, 0x0a,
0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
0x31, 0x42, 0x1c, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x74,
0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73,
0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70,
0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f,
0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73,
0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c,
0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -942,7 +840,7 @@ func file_api_v1_workspace_setting_service_proto_rawDescGZIP() []byte {
} }
var file_api_v1_workspace_setting_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_api_v1_workspace_setting_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_api_v1_workspace_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_api_v1_workspace_setting_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_api_v1_workspace_setting_service_proto_goTypes = []interface{}{ var file_api_v1_workspace_setting_service_proto_goTypes = []interface{}{
(WorkspaceStorageSetting_StorageType)(0), // 0: memos.api.v1.WorkspaceStorageSetting.StorageType (WorkspaceStorageSetting_StorageType)(0), // 0: memos.api.v1.WorkspaceStorageSetting.StorageType
(*WorkspaceSetting)(nil), // 1: memos.api.v1.WorkspaceSetting (*WorkspaceSetting)(nil), // 1: memos.api.v1.WorkspaceSetting
@ -950,32 +848,27 @@ var file_api_v1_workspace_setting_service_proto_goTypes = []interface{}{
(*WorkspaceCustomProfile)(nil), // 3: memos.api.v1.WorkspaceCustomProfile (*WorkspaceCustomProfile)(nil), // 3: memos.api.v1.WorkspaceCustomProfile
(*WorkspaceStorageSetting)(nil), // 4: memos.api.v1.WorkspaceStorageSetting (*WorkspaceStorageSetting)(nil), // 4: memos.api.v1.WorkspaceStorageSetting
(*WorkspaceMemoRelatedSetting)(nil), // 5: memos.api.v1.WorkspaceMemoRelatedSetting (*WorkspaceMemoRelatedSetting)(nil), // 5: memos.api.v1.WorkspaceMemoRelatedSetting
(*ListWorkspaceSettingsRequest)(nil), // 6: memos.api.v1.ListWorkspaceSettingsRequest (*GetWorkspaceSettingRequest)(nil), // 6: memos.api.v1.GetWorkspaceSettingRequest
(*ListWorkspaceSettingsResponse)(nil), // 7: memos.api.v1.ListWorkspaceSettingsResponse (*SetWorkspaceSettingRequest)(nil), // 7: memos.api.v1.SetWorkspaceSettingRequest
(*GetWorkspaceSettingRequest)(nil), // 8: memos.api.v1.GetWorkspaceSettingRequest (*WorkspaceStorageSetting_S3Config)(nil), // 8: memos.api.v1.WorkspaceStorageSetting.S3Config
(*SetWorkspaceSettingRequest)(nil), // 9: memos.api.v1.SetWorkspaceSettingRequest
(*WorkspaceStorageSetting_S3Config)(nil), // 10: memos.api.v1.WorkspaceStorageSetting.S3Config
} }
var file_api_v1_workspace_setting_service_proto_depIdxs = []int32{ var file_api_v1_workspace_setting_service_proto_depIdxs = []int32{
2, // 0: memos.api.v1.WorkspaceSetting.general_setting:type_name -> memos.api.v1.WorkspaceGeneralSetting 2, // 0: memos.api.v1.WorkspaceSetting.general_setting:type_name -> memos.api.v1.WorkspaceGeneralSetting
4, // 1: memos.api.v1.WorkspaceSetting.storage_setting:type_name -> memos.api.v1.WorkspaceStorageSetting 4, // 1: memos.api.v1.WorkspaceSetting.storage_setting:type_name -> memos.api.v1.WorkspaceStorageSetting
5, // 2: memos.api.v1.WorkspaceSetting.memo_related_setting:type_name -> memos.api.v1.WorkspaceMemoRelatedSetting 5, // 2: memos.api.v1.WorkspaceSetting.memo_related_setting:type_name -> memos.api.v1.WorkspaceMemoRelatedSetting
3, // 3: memos.api.v1.WorkspaceGeneralSetting.custom_profile:type_name -> memos.api.v1.WorkspaceCustomProfile 3, // 3: memos.api.v1.WorkspaceGeneralSetting.custom_profile:type_name -> memos.api.v1.WorkspaceCustomProfile
0, // 4: memos.api.v1.WorkspaceStorageSetting.storage_type:type_name -> memos.api.v1.WorkspaceStorageSetting.StorageType 0, // 4: memos.api.v1.WorkspaceStorageSetting.storage_type:type_name -> memos.api.v1.WorkspaceStorageSetting.StorageType
10, // 5: memos.api.v1.WorkspaceStorageSetting.s3_config:type_name -> memos.api.v1.WorkspaceStorageSetting.S3Config 8, // 5: memos.api.v1.WorkspaceStorageSetting.s3_config:type_name -> memos.api.v1.WorkspaceStorageSetting.S3Config
1, // 6: memos.api.v1.ListWorkspaceSettingsResponse.settings:type_name -> memos.api.v1.WorkspaceSetting 1, // 6: memos.api.v1.SetWorkspaceSettingRequest.setting:type_name -> memos.api.v1.WorkspaceSetting
1, // 7: memos.api.v1.SetWorkspaceSettingRequest.setting:type_name -> memos.api.v1.WorkspaceSetting 6, // 7: memos.api.v1.WorkspaceSettingService.GetWorkspaceSetting:input_type -> memos.api.v1.GetWorkspaceSettingRequest
6, // 8: memos.api.v1.WorkspaceSettingService.ListWorkspaceSettings:input_type -> memos.api.v1.ListWorkspaceSettingsRequest 7, // 8: memos.api.v1.WorkspaceSettingService.SetWorkspaceSetting:input_type -> memos.api.v1.SetWorkspaceSettingRequest
8, // 9: memos.api.v1.WorkspaceSettingService.GetWorkspaceSetting:input_type -> memos.api.v1.GetWorkspaceSettingRequest 1, // 9: memos.api.v1.WorkspaceSettingService.GetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting
9, // 10: memos.api.v1.WorkspaceSettingService.SetWorkspaceSetting:input_type -> memos.api.v1.SetWorkspaceSettingRequest 1, // 10: memos.api.v1.WorkspaceSettingService.SetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting
7, // 11: memos.api.v1.WorkspaceSettingService.ListWorkspaceSettings:output_type -> memos.api.v1.ListWorkspaceSettingsResponse 9, // [9:11] is the sub-list for method output_type
1, // 12: memos.api.v1.WorkspaceSettingService.GetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting 7, // [7:9] is the sub-list for method input_type
1, // 13: memos.api.v1.WorkspaceSettingService.SetWorkspaceSetting:output_type -> memos.api.v1.WorkspaceSetting 7, // [7:7] is the sub-list for extension type_name
11, // [11:14] is the sub-list for method output_type 7, // [7:7] is the sub-list for extension extendee
8, // [8:11] is the sub-list for method input_type 0, // [0:7] is the sub-list for field type_name
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
} }
func init() { file_api_v1_workspace_setting_service_proto_init() } func init() { file_api_v1_workspace_setting_service_proto_init() }
@ -1045,30 +938,6 @@ func file_api_v1_workspace_setting_service_proto_init() {
} }
} }
file_api_v1_workspace_setting_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_api_v1_workspace_setting_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListWorkspaceSettingsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_v1_workspace_setting_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListWorkspaceSettingsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_api_v1_workspace_setting_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetWorkspaceSettingRequest); i { switch v := v.(*GetWorkspaceSettingRequest); i {
case 0: case 0:
return &v.state return &v.state
@ -1080,7 +949,7 @@ func file_api_v1_workspace_setting_service_proto_init() {
return nil return nil
} }
} }
file_api_v1_workspace_setting_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { file_api_v1_workspace_setting_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SetWorkspaceSettingRequest); i { switch v := v.(*SetWorkspaceSettingRequest); i {
case 0: case 0:
return &v.state return &v.state
@ -1092,7 +961,7 @@ func file_api_v1_workspace_setting_service_proto_init() {
return nil return nil
} }
} }
file_api_v1_workspace_setting_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { file_api_v1_workspace_setting_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*WorkspaceStorageSetting_S3Config); i { switch v := v.(*WorkspaceStorageSetting_S3Config); i {
case 0: case 0:
return &v.state return &v.state
@ -1116,7 +985,7 @@ func file_api_v1_workspace_setting_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_v1_workspace_setting_service_proto_rawDesc, RawDescriptor: file_api_v1_workspace_setting_service_proto_rawDesc,
NumEnums: 1, NumEnums: 1,
NumMessages: 10, NumMessages: 8,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },

@ -31,24 +31,6 @@ var _ = runtime.String
var _ = utilities.NewDoubleArray var _ = utilities.NewDoubleArray
var _ = metadata.Join var _ = metadata.Join
func request_WorkspaceSettingService_ListWorkspaceSettings_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceSettingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListWorkspaceSettingsRequest
var metadata runtime.ServerMetadata
msg, err := client.ListWorkspaceSettings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_WorkspaceSettingService_ListWorkspaceSettings_0(ctx context.Context, marshaler runtime.Marshaler, server WorkspaceSettingServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListWorkspaceSettingsRequest
var metadata runtime.ServerMetadata
msg, err := server.ListWorkspaceSettings(ctx, &protoReq)
return msg, metadata, err
}
func request_WorkspaceSettingService_GetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceSettingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_WorkspaceSettingService_GetWorkspaceSetting_0(ctx context.Context, marshaler runtime.Marshaler, client WorkspaceSettingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetWorkspaceSettingRequest var protoReq GetWorkspaceSettingRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
@ -167,31 +149,6 @@ func local_request_WorkspaceSettingService_SetWorkspaceSetting_0(ctx context.Con
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWorkspaceSettingServiceHandlerFromEndpoint instead. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWorkspaceSettingServiceHandlerFromEndpoint instead.
func RegisterWorkspaceSettingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkspaceSettingServiceServer) error { func RegisterWorkspaceSettingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkspaceSettingServiceServer) error {
mux.Handle("GET", pattern_WorkspaceSettingService_ListWorkspaceSettings_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)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.WorkspaceSettingService/ListWorkspaceSettings", runtime.WithHTTPPathPattern("/api/v1/workspace/settings"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_WorkspaceSettingService_ListWorkspaceSettings_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_WorkspaceSettingService_ListWorkspaceSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
@ -283,28 +240,6 @@ func RegisterWorkspaceSettingServiceHandler(ctx context.Context, mux *runtime.Se
// "WorkspaceSettingServiceClient" to call the correct interceptors. // "WorkspaceSettingServiceClient" to call the correct interceptors.
func RegisterWorkspaceSettingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkspaceSettingServiceClient) error { func RegisterWorkspaceSettingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkspaceSettingServiceClient) error {
mux.Handle("GET", pattern_WorkspaceSettingService_ListWorkspaceSettings_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)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.WorkspaceSettingService/ListWorkspaceSettings", runtime.WithHTTPPathPattern("/api/v1/workspace/settings"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_WorkspaceSettingService_ListWorkspaceSettings_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_WorkspaceSettingService_ListWorkspaceSettings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_WorkspaceSettingService_GetWorkspaceSetting_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
@ -353,16 +288,12 @@ func RegisterWorkspaceSettingServiceHandlerClient(ctx context.Context, mux *runt
} }
var ( var (
pattern_WorkspaceSettingService_ListWorkspaceSettings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"api", "v1", "workspace", "settings"}, ""))
pattern_WorkspaceSettingService_GetWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 2, 5, 4}, []string{"api", "v1", "workspace", "settings", "name"}, "")) pattern_WorkspaceSettingService_GetWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 2, 5, 4}, []string{"api", "v1", "workspace", "settings", "name"}, ""))
pattern_WorkspaceSettingService_SetWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 2, 5, 4}, []string{"api", "v1", "workspace", "settings", "setting.name"}, "")) pattern_WorkspaceSettingService_SetWorkspaceSetting_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 2, 5, 4}, []string{"api", "v1", "workspace", "settings", "setting.name"}, ""))
) )
var ( var (
forward_WorkspaceSettingService_ListWorkspaceSettings_0 = runtime.ForwardResponseMessage
forward_WorkspaceSettingService_GetWorkspaceSetting_0 = runtime.ForwardResponseMessage forward_WorkspaceSettingService_GetWorkspaceSetting_0 = runtime.ForwardResponseMessage
forward_WorkspaceSettingService_SetWorkspaceSetting_0 = runtime.ForwardResponseMessage forward_WorkspaceSettingService_SetWorkspaceSetting_0 = runtime.ForwardResponseMessage

@ -19,17 +19,14 @@ import (
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion7
const ( const (
WorkspaceSettingService_ListWorkspaceSettings_FullMethodName = "/memos.api.v1.WorkspaceSettingService/ListWorkspaceSettings" WorkspaceSettingService_GetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting"
WorkspaceSettingService_GetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceSettingService/GetWorkspaceSetting" WorkspaceSettingService_SetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceSettingService/SetWorkspaceSetting"
WorkspaceSettingService_SetWorkspaceSetting_FullMethodName = "/memos.api.v1.WorkspaceSettingService/SetWorkspaceSetting"
) )
// WorkspaceSettingServiceClient is the client API for WorkspaceSettingService service. // WorkspaceSettingServiceClient is the client API for WorkspaceSettingService service.
// //
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type WorkspaceSettingServiceClient interface { type WorkspaceSettingServiceClient interface {
// ListWorkspaceSetting returns the list of settings.
ListWorkspaceSettings(ctx context.Context, in *ListWorkspaceSettingsRequest, opts ...grpc.CallOption) (*ListWorkspaceSettingsResponse, error)
// GetWorkspaceSetting returns the setting by name. // GetWorkspaceSetting returns the setting by name.
GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error)
// SetWorkspaceSetting updates the setting. // SetWorkspaceSetting updates the setting.
@ -44,15 +41,6 @@ func NewWorkspaceSettingServiceClient(cc grpc.ClientConnInterface) WorkspaceSett
return &workspaceSettingServiceClient{cc} return &workspaceSettingServiceClient{cc}
} }
func (c *workspaceSettingServiceClient) ListWorkspaceSettings(ctx context.Context, in *ListWorkspaceSettingsRequest, opts ...grpc.CallOption) (*ListWorkspaceSettingsResponse, error) {
out := new(ListWorkspaceSettingsResponse)
err := c.cc.Invoke(ctx, WorkspaceSettingService_ListWorkspaceSettings_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *workspaceSettingServiceClient) GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) { func (c *workspaceSettingServiceClient) GetWorkspaceSetting(ctx context.Context, in *GetWorkspaceSettingRequest, opts ...grpc.CallOption) (*WorkspaceSetting, error) {
out := new(WorkspaceSetting) out := new(WorkspaceSetting)
err := c.cc.Invoke(ctx, WorkspaceSettingService_GetWorkspaceSetting_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, WorkspaceSettingService_GetWorkspaceSetting_FullMethodName, in, out, opts...)
@ -75,8 +63,6 @@ func (c *workspaceSettingServiceClient) SetWorkspaceSetting(ctx context.Context,
// All implementations must embed UnimplementedWorkspaceSettingServiceServer // All implementations must embed UnimplementedWorkspaceSettingServiceServer
// for forward compatibility // for forward compatibility
type WorkspaceSettingServiceServer interface { type WorkspaceSettingServiceServer interface {
// ListWorkspaceSetting returns the list of settings.
ListWorkspaceSettings(context.Context, *ListWorkspaceSettingsRequest) (*ListWorkspaceSettingsResponse, error)
// GetWorkspaceSetting returns the setting by name. // GetWorkspaceSetting returns the setting by name.
GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error) GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error)
// SetWorkspaceSetting updates the setting. // SetWorkspaceSetting updates the setting.
@ -88,9 +74,6 @@ type WorkspaceSettingServiceServer interface {
type UnimplementedWorkspaceSettingServiceServer struct { type UnimplementedWorkspaceSettingServiceServer struct {
} }
func (UnimplementedWorkspaceSettingServiceServer) ListWorkspaceSettings(context.Context, *ListWorkspaceSettingsRequest) (*ListWorkspaceSettingsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListWorkspaceSettings not implemented")
}
func (UnimplementedWorkspaceSettingServiceServer) GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error) { func (UnimplementedWorkspaceSettingServiceServer) GetWorkspaceSetting(context.Context, *GetWorkspaceSettingRequest) (*WorkspaceSetting, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceSetting not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetWorkspaceSetting not implemented")
} }
@ -111,24 +94,6 @@ func RegisterWorkspaceSettingServiceServer(s grpc.ServiceRegistrar, srv Workspac
s.RegisterService(&WorkspaceSettingService_ServiceDesc, srv) s.RegisterService(&WorkspaceSettingService_ServiceDesc, srv)
} }
func _WorkspaceSettingService_ListWorkspaceSettings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListWorkspaceSettingsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WorkspaceSettingServiceServer).ListWorkspaceSettings(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: WorkspaceSettingService_ListWorkspaceSettings_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WorkspaceSettingServiceServer).ListWorkspaceSettings(ctx, req.(*ListWorkspaceSettingsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WorkspaceSettingService_GetWorkspaceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _WorkspaceSettingService_GetWorkspaceSetting_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetWorkspaceSettingRequest) in := new(GetWorkspaceSettingRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -172,10 +137,6 @@ var WorkspaceSettingService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "memos.api.v1.WorkspaceSettingService", ServiceName: "memos.api.v1.WorkspaceSettingService",
HandlerType: (*WorkspaceSettingServiceServer)(nil), HandlerType: (*WorkspaceSettingServiceServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{
MethodName: "ListWorkspaceSettings",
Handler: _WorkspaceSettingService_ListWorkspaceSettings_Handler,
},
{ {
MethodName: "GetWorkspaceSetting", MethodName: "GetWorkspaceSetting",
Handler: _WorkspaceSettingService_GetWorkspaceSetting_Handler, Handler: _WorkspaceSettingService_GetWorkspaceSetting_Handler,

@ -12,40 +12,32 @@ import (
"github.com/usememos/memos/store" "github.com/usememos/memos/store"
) )
func (s *APIV1Service) ListWorkspaceSettings(ctx context.Context, _ *v1pb.ListWorkspaceSettingsRequest) (*v1pb.ListWorkspaceSettingsResponse, error) { func (s *APIV1Service) GetWorkspaceSetting(ctx context.Context, request *v1pb.GetWorkspaceSettingRequest) (*v1pb.WorkspaceSetting, error) {
user, err := getCurrentUser(ctx, s.Store) workspaceSettingKeyString, err := ExtractWorkspaceSettingKeyFromName(request.Name)
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err) return nil, status.Errorf(codes.InvalidArgument, "invalid workspace setting name: %v", err)
} }
workspaceSettingFind := &store.FindWorkspaceSetting{} workspaceSettingKey := storepb.WorkspaceSettingKey(storepb.WorkspaceSettingKey_value[workspaceSettingKeyString])
if user == nil || user.Role == store.RoleUser { // Get workspace setting from store with default value.
workspaceSettingFind.Name = storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL.String() switch workspaceSettingKey {
case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC:
_, err = s.Store.GetWorkspaceBasicSetting(ctx)
case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL:
_, err = s.Store.GetWorkspaceGeneralSetting(ctx)
case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED:
_, err = s.Store.GetWorkspaceMemoRelatedSetting(ctx)
case storepb.WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE:
_, err = s.Store.GetWorkspaceStorageSetting(ctx)
default:
return nil, status.Errorf(codes.InvalidArgument, "unsupported workspace setting key: %v", workspaceSettingKey)
} }
workspaceSettings, err := s.Store.ListWorkspaceSettings(ctx, workspaceSettingFind)
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err) return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)
} }
response := &v1pb.ListWorkspaceSettingsResponse{
Settings: []*v1pb.WorkspaceSetting{},
}
for _, workspaceSetting := range workspaceSettings {
if workspaceSetting.Key == storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC {
continue
}
response.Settings = append(response.Settings, convertWorkspaceSettingFromStore(workspaceSetting))
}
return response, nil
}
func (s *APIV1Service) GetWorkspaceSetting(ctx context.Context, request *v1pb.GetWorkspaceSettingRequest) (*v1pb.WorkspaceSetting, error) {
settingKeyString, err := ExtractWorkspaceSettingKeyFromName(request.Name)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, "invalid workspace setting name: %v", err)
}
workspaceSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{ workspaceSetting, err := s.Store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{
Name: settingKeyString, Name: workspaceSettingKey.String(),
}) })
if err != nil { if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err) return nil, status.Errorf(codes.Internal, "failed to get workspace setting: %v", err)

@ -111,6 +111,10 @@ func (s *Store) GetWorkspaceBasicSetting(ctx context.Context) (*storepb.Workspac
if workspaceSetting != nil { if workspaceSetting != nil {
workspaceBasicSetting = workspaceSetting.GetBasicSetting() workspaceBasicSetting = workspaceSetting.GetBasicSetting()
} }
s.workspaceSettingCache.Store(storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC.String(), &storepb.WorkspaceSetting{
Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_BASIC,
Value: &storepb.WorkspaceSetting_BasicSetting{BasicSetting: workspaceBasicSetting},
})
return workspaceBasicSetting, nil return workspaceBasicSetting, nil
} }
@ -126,6 +130,10 @@ func (s *Store) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.Worksp
if workspaceSetting != nil { if workspaceSetting != nil {
workspaceGeneralSetting = workspaceSetting.GetGeneralSetting() workspaceGeneralSetting = workspaceSetting.GetGeneralSetting()
} }
s.workspaceSettingCache.Store(storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL.String(), &storepb.WorkspaceSetting{
Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_GENERAL,
Value: &storepb.WorkspaceSetting_GeneralSetting{GeneralSetting: workspaceGeneralSetting},
})
return workspaceGeneralSetting, nil return workspaceGeneralSetting, nil
} }
@ -149,6 +157,10 @@ func (s *Store) GetWorkspaceMemoRelatedSetting(ctx context.Context) (*storepb.Wo
if workspaceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit { if workspaceMemoRelatedSetting.ContentLengthLimit < DefaultContentLengthLimit {
workspaceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit workspaceMemoRelatedSetting.ContentLengthLimit = DefaultContentLengthLimit
} }
s.workspaceSettingCache.Store(storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED.String(), &storepb.WorkspaceSetting{
Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_MEMO_RELATED,
Value: &storepb.WorkspaceSetting_MemoRelatedSetting{MemoRelatedSetting: workspaceMemoRelatedSetting},
})
return workspaceMemoRelatedSetting, nil return workspaceMemoRelatedSetting, nil
} }
@ -179,6 +191,10 @@ func (s *Store) GetWorkspaceStorageSetting(ctx context.Context) (*storepb.Worksp
if workspaceStorageSetting.FilepathTemplate == "" { if workspaceStorageSetting.FilepathTemplate == "" {
workspaceStorageSetting.FilepathTemplate = defaultWorkspaceFilepathTemplate workspaceStorageSetting.FilepathTemplate = defaultWorkspaceFilepathTemplate
} }
s.workspaceSettingCache.Store(storepb.WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE.String(), &storepb.WorkspaceSetting{
Key: storepb.WorkspaceSettingKey_WORKSPACE_SETTING_STORAGE,
Value: &storepb.WorkspaceSetting_StorageSetting{StorageSetting: workspaceStorageSetting},
})
return workspaceStorageSetting, nil return workspaceStorageSetting, nil
} }

@ -36,7 +36,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => {
useEffect(() => { useEffect(() => {
const initialWorkspace = async () => { const initialWorkspace = async () => {
const workspaceProfile = await workspaceServiceClient.getWorkspaceProfile({}); const workspaceProfile = await workspaceServiceClient.getWorkspaceProfile({});
await workspaceSettingStore.listWorkspaceSettings(); await workspaceSettingStore.fetchWorkspaceSetting(WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL);
const workspaceGeneralSetting = const workspaceGeneralSetting =
workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL).generalSetting || workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL).generalSetting ||

@ -1,6 +1,6 @@
import { Option, Select } from "@mui/joy"; import { Option, Select } from "@mui/joy";
import { LucideIcon } from "lucide-react"; import { LucideIcon } from "lucide-react";
import { useCallback, useMemo, useState } from "react"; import { useCallback, useEffect, useMemo, useState } from "react";
import Icon from "@/components/Icon"; import Icon from "@/components/Icon";
import MobileHeader from "@/components/MobileHeader"; import MobileHeader from "@/components/MobileHeader";
import MemberSection from "@/components/Settings/MemberSection"; import MemberSection from "@/components/Settings/MemberSection";
@ -12,7 +12,9 @@ import StorageSection from "@/components/Settings/StorageSection";
import WorkspaceSection from "@/components/Settings/WorkspaceSection"; import WorkspaceSection from "@/components/Settings/WorkspaceSection";
import useCurrentUser from "@/hooks/useCurrentUser"; import useCurrentUser from "@/hooks/useCurrentUser";
import { useCommonContext } from "@/layouts/CommonContextProvider"; import { useCommonContext } from "@/layouts/CommonContextProvider";
import { useWorkspaceSettingStore } from "@/store/v1";
import { User_Role } from "@/types/proto/api/v1/user_service"; import { User_Role } from "@/types/proto/api/v1/user_service";
import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";
import { useTranslate } from "@/utils/i18n"; import { useTranslate } from "@/utils/i18n";
type SettingSection = "my-account" | "preference" | "member" | "system" | "storage" | "sso"; type SettingSection = "my-account" | "preference" | "member" | "system" | "storage" | "sso";
@ -36,10 +38,10 @@ const Setting = () => {
const t = useTranslate(); const t = useTranslate();
const commonContext = useCommonContext(); const commonContext = useCommonContext();
const user = useCurrentUser(); const user = useCurrentUser();
const workspaceSettingStore = useWorkspaceSettingStore();
const [state, setState] = useState<State>({ const [state, setState] = useState<State>({
selectedSection: "my-account", selectedSection: "my-account",
}); });
const isHost = user.role === User_Role.HOST; const isHost = user.role === User_Role.HOST;
const settingsSectionList = useMemo(() => { const settingsSectionList = useMemo(() => {
@ -50,6 +52,19 @@ const Setting = () => {
return settingList; return settingList;
}, [isHost]); }, [isHost]);
useEffect(() => {
if (!isHost) {
return;
}
// Initial fetch for workspace settings.
(async () => {
[WorkspaceSettingKey.WORKSPACE_SETTING_MEMO_RELATED, WorkspaceSettingKey.WORKSPACE_SETTING_STORAGE].forEach(async (key) => {
await workspaceSettingStore.fetchWorkspaceSetting(key);
});
})();
}, [isHost]);
const handleSectionSelectorItemClick = useCallback((settingSection: SettingSection) => { const handleSectionSelectorItemClick = useCallback((settingSection: SettingSection) => {
setState({ setState({
selectedSection: settingSection, selectedSection: settingSection,

@ -18,10 +18,6 @@ export const useWorkspaceSettingStore = create(
getState: () => { getState: () => {
return get(); return get();
}, },
listWorkspaceSettings: async () => {
const { settings } = await workspaceSettingServiceClient.listWorkspaceSettings({});
set({ workspaceSettingByName: settings.reduce((acc, setting) => ({ ...acc, [setting.name]: setting }), {}) });
},
fetchWorkspaceSetting: async (key: WorkspaceSettingKey) => { fetchWorkspaceSetting: async (key: WorkspaceSettingKey) => {
const setting = await workspaceSettingServiceClient.getWorkspaceSetting({ name: `${WorkspaceSettingPrefix}${key}` }); const setting = await workspaceSettingServiceClient.getWorkspaceSetting({ name: `${WorkspaceSettingPrefix}${key}` });
set({ workspaceSettingByName: { ...get().workspaceSettingByName, [setting.name]: setting } }); set({ workspaceSettingByName: { ...get().workspaceSettingByName, [setting.name]: setting } });

Loading…
Cancel
Save