diff --git a/client-gui2 b/client-gui2 index 34dcd980..aa345299 160000 --- a/client-gui2 +++ b/client-gui2 @@ -1 +1 @@ -Subproject commit 34dcd980de5e218f718088b5997b1b6db9402d59 +Subproject commit aa345299911882a251cd5628087f1243a28ac194 diff --git a/common/proto/table_structure.proto b/common/proto/table_structure.proto index 7d66a6b1..ec9bc954 100644 --- a/common/proto/table_structure.proto +++ b/common/proto/table_structure.proto @@ -136,6 +136,7 @@ message ImportFieldDescriptor { string generated_from = 11; optional ImportLinkDescriptor link = 12; repeated ImportValueKind accepted_value_kinds = 13; + bool account_reference = 14; } message GetTableImportDescriptorResponse { diff --git a/common/proto/tables_data.proto b/common/proto/tables_data.proto index 90b48381..43a27d86 100644 --- a/common/proto/tables_data.proto +++ b/common/proto/tables_data.proto @@ -203,6 +203,11 @@ message StageTableDataImportRequest { int64 expected_table_revision = 4; } +enum ImportAccountMatch { + IMPORT_ACCOUNT_MATCH_PATH = 0; + IMPORT_ACCOUNT_MATCH_ID = 1; +} + message TableDataImportRow { // Required. Data payload for one staged row. map data = 1; @@ -210,6 +215,7 @@ message TableDataImportRow { // row display value, including text made only of digits. Unlisted columns // retain the normal table-write link semantics. repeated string link_display_columns = 2; + ImportAccountMatch account_match = 3; } message StageTableDataImportResponse { diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index bc79ce51..d9a24ec1 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_structure.rs b/common/src/proto/komp_ac.table_structure.rs index 3e567a7e..701f5a9f 100644 --- a/common/src/proto/komp_ac.table_structure.rs +++ b/common/src/proto/komp_ac.table_structure.rs @@ -131,6 +131,8 @@ pub struct ImportFieldDescriptor { pub link: ::core::option::Option, #[prost(enumeration = "ImportValueKind", repeated, tag = "13")] pub accepted_value_kinds: ::prost::alloc::vec::Vec, + #[prost(bool, tag = "14")] + pub account_reference: bool, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/common/src/proto/komp_ac.tables_data.rs b/common/src/proto/komp_ac.tables_data.rs index 58c17342..f43fad4e 100644 --- a/common/src/proto/komp_ac.tables_data.rs +++ b/common/src/proto/komp_ac.tables_data.rs @@ -113,6 +113,8 @@ pub struct TableDataImportRow { /// retain the normal table-write link semantics. #[prost(string, repeated, tag = "2")] pub link_display_columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(enumeration = "ImportAccountMatch", tag = "3")] + pub account_match: i32, } #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] pub struct StageTableDataImportResponse { @@ -494,6 +496,32 @@ pub struct GetTableDataByPositionRequest { #[prost(enumeration = "RowNavigationMode", tag = "5")] pub navigation_mode: i32, } +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ImportAccountMatch { + Path = 0, + Id = 1, +} +impl ImportAccountMatch { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Path => "IMPORT_ACCOUNT_MATCH_PATH", + Self::Id => "IMPORT_ACCOUNT_MATCH_ID", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "IMPORT_ACCOUNT_MATCH_PATH" => Some(Self::Path), + "IMPORT_ACCOUNT_MATCH_ID" => Some(Self::Id), + _ => None, + } + } +} /// A link resolved exactly as the source row stored it, together with the /// target row's current state. The physical companion version column remains /// an internal implementation detail. diff --git a/komp-app/src/import_export.rs b/komp-app/src/import_export.rs index 9c1f3abc..063c86d9 100644 --- a/komp-app/src/import_export.rs +++ b/komp-app/src/import_export.rs @@ -425,7 +425,7 @@ pub fn row_to_table_data( }; data.insert(target_column.clone(), value); } - Ok(TableDataImportRow { data, link_display_columns: Vec::new() }) + Ok(TableDataImportRow { data, account_match: common::proto::komp_ac::tables_data::ImportAccountMatch::Path as i32, link_display_columns: Vec::new() }) } pub fn exportable_columns(schema: &TableStructureResponse) -> Vec { diff --git a/web/src/pages/import_export/import/logic.rs b/web/src/pages/import_export/import/logic.rs index c122573b..c94a7f7f 100644 --- a/web/src/pages/import_export/import/logic.rs +++ b/web/src/pages/import_export/import/logic.rs @@ -707,7 +707,7 @@ fn import_row( let value = csv_value(locale, raw, data_type)?; data.insert(column.clone(), value); } - Ok(TableDataImportRow { data, link_display_columns: Vec::new() }) + Ok(TableDataImportRow { data, account_match: common::proto::komp_ac::tables_data::ImportAccountMatch::Path as i32, link_display_columns: Vec::new() }) } async fn render_step(