diff --git a/client b/client index a2e1881..4d45b25 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit a2e1881ca644746217f5685d98a97733fe5d9efd +Subproject commit 4d45b25c757d51f9f11a6fcf55d64171442346c1 diff --git a/common/build.rs b/common/build.rs index f15ef84..1d71c08 100644 --- a/common/build.rs +++ b/common/build.rs @@ -173,6 +173,14 @@ fn main() -> Result<(), Box> { ".komp_ac.table_definition.TableDefinitionResponse", "#[derive(serde::Serialize, serde::Deserialize)]" ) + .type_attribute( + ".komp_ac.table_definition.CopyProfileRequest", + "#[derive(serde::Serialize, serde::Deserialize)]" + ) + .type_attribute( + ".komp_ac.table_definition.CopyProfileResponse", + "#[derive(serde::Serialize, serde::Deserialize)]" + ) .type_attribute( ".komp_ac.table_definition.GetColumnAliasRenameHistoryRequest", "#[derive(serde::Serialize, serde::Deserialize)]" diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index d535eca..bcf966b 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -26,6 +26,9 @@ service TableDefinition { // Pure data retrieval - no business logic. rpc GetProfileDetails(GetProfileDetailsRequest) returns (GetProfileDetailsResponse); + // Copies one complete profile into a new profile without copying table data. + rpc CopyProfile(CopyProfileRequest) returns (CopyProfileResponse); + // Returns the stored rename history for column aliases in one profile. rpc GetColumnAliasRenameHistory(GetColumnAliasRenameHistoryRequest) returns (GetColumnAliasRenameHistoryResponse); @@ -160,6 +163,21 @@ message GetProfileDetailsResponse { repeated TableDetail tables = 2; } +// Request to copy one full profile into a new profile. +message CopyProfileRequest { + string source_profile_name = 1; + string target_profile_name = 2; + repeated string table_names = 3; +} + +// Response after copying a profile. +message CopyProfileResponse { + bool success = 1; + string message = 2; + int32 tables_copied = 3; + int32 scripts_copied = 4; +} + // Request to fetch recorded column alias rename history for one profile. message GetColumnAliasRenameHistoryRequest { string profile_name = 1; diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 7815935..a930fce 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.table_definition.rs b/common/src/proto/komp_ac.table_definition.rs index addb9a4..482afe5 100644 --- a/common/src/proto/komp_ac.table_definition.rs +++ b/common/src/proto/komp_ac.table_definition.rs @@ -142,6 +142,30 @@ pub struct GetProfileDetailsResponse { #[prost(message, repeated, tag = "2")] pub tables: ::prost::alloc::vec::Vec, } +/// Request to copy one full profile into a new profile. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct CopyProfileRequest { + #[prost(string, tag = "1")] + pub source_profile_name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub target_profile_name: ::prost::alloc::string::String, + #[prost(string, repeated, tag = "3")] + pub table_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// Response after copying a profile. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct CopyProfileResponse { + #[prost(bool, tag = "1")] + pub success: bool, + #[prost(string, tag = "2")] + pub message: ::prost::alloc::string::String, + #[prost(int32, tag = "3")] + pub tables_copied: i32, + #[prost(int32, tag = "4")] + pub scripts_copied: i32, +} /// Request to fetch recorded column alias rename history for one profile. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] @@ -469,6 +493,36 @@ pub mod table_definition_client { ); self.inner.unary(req, path, codec).await } + /// Copies one complete profile into a new profile without copying table data. + pub async fn copy_profile( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/komp_ac.table_definition.TableDefinition/CopyProfile", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "komp_ac.table_definition.TableDefinition", + "CopyProfile", + ), + ); + self.inner.unary(req, path, codec).await + } /// Returns the stored rename history for column aliases in one profile. pub async fn get_column_alias_rename_history( &mut self, @@ -611,6 +665,14 @@ pub mod table_definition_server { tonic::Response, tonic::Status, >; + /// Copies one complete profile into a new profile without copying table data. + async fn copy_profile( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Returns the stored rename history for column aliases in one profile. async fn get_column_alias_rename_history( &self, @@ -903,6 +965,51 @@ pub mod table_definition_server { }; Box::pin(fut) } + "/komp_ac.table_definition.TableDefinition/CopyProfile" => { + #[allow(non_camel_case_types)] + struct CopyProfileSvc(pub Arc); + impl< + T: TableDefinition, + > tonic::server::UnaryService + for CopyProfileSvc { + type Response = super::CopyProfileResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::copy_profile(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = CopyProfileSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } "/komp_ac.table_definition.TableDefinition/GetColumnAliasRenameHistory" => { #[allow(non_camel_case_types)] struct GetColumnAliasRenameHistorySvc( diff --git a/server b/server index 5110c89..e290953 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 5110c89efce598888c87f759b4e16462ee48dba3 +Subproject commit e2909537f5693574442914a9dd95d6372b891c86 diff --git a/tui-canvas b/tui-canvas index b7aa87c..38702e4 160000 --- a/tui-canvas +++ b/tui-canvas @@ -1 +1 @@ -Subproject commit b7aa87cf6bb7cd5503288badec6e7decce605702 +Subproject commit 38702e44fa090872cf3bbc147c927081713886bb