hidden columns from clients

This commit is contained in:
Filipriec
2026-08-30 13:00:55 +02:00
parent cdb41c365a
commit 86efa82293
15 changed files with 263 additions and 6 deletions

Binary file not shown.

View File

@@ -495,6 +495,10 @@ pub struct ColumnBehavior {
/// Stable public identity used when updating this column's presentation.
#[prost(int64, tag = "5")]
pub column_id: i64,
/// True when bundled data-entry clients should not render this column.
/// This is not an authorization boundary; data APIs still expose the column.
#[prost(bool, tag = "6")]
pub hidden_from_forms: bool,
}
/// A script that targets a specific column in a table.
#[derive(serde::Serialize, serde::Deserialize)]
@@ -549,6 +553,36 @@ pub struct SetColumnPresentationResponse {
#[prost(int64, tag = "4")]
pub row_version: i64,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetColumnFormVisibilityRequest {
#[prost(string, tag = "1")]
pub profile_name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub table_name: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub column_id: i64,
#[prost(bool, tag = "4")]
pub hidden_from_forms: bool,
/// Row version returned by GetProfileDetails when the column was read.
#[prost(int64, tag = "5")]
pub expected_row_version: i64,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SetColumnFormVisibilityResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub column_id: i64,
#[prost(bool, tag = "4")]
pub hidden_from_forms: bool,
/// New row version after the update.
#[prost(int64, tag = "5")]
pub row_version: i64,
}
/// Request to delete one table definition entirely.
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
@@ -1227,6 +1261,38 @@ pub mod table_definition_client {
);
self.inner.unary(req, path, codec).await
}
/// Shows or hides one column in bundled data-entry forms. This is presentation
/// metadata only: hidden columns remain available to data APIs, scripts and
/// backend calculations.
pub async fn set_column_form_visibility(
&mut self,
request: impl tonic::IntoRequest<super::SetColumnFormVisibilityRequest>,
) -> std::result::Result<
tonic::Response<super::SetColumnFormVisibilityResponse>,
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/SetColumnFormVisibility",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"komp_ac.table_definition.TableDefinition",
"SetColumnFormVisibility",
),
);
self.inner.unary(req, path, codec).await
}
/// Drops a table and its metadata, then deletes the profile if it becomes empty.
pub async fn delete_table(
&mut self,
@@ -1381,6 +1447,16 @@ pub mod table_definition_server {
tonic::Response<super::SetColumnPresentationResponse>,
tonic::Status,
>;
/// Shows or hides one column in bundled data-entry forms. This is presentation
/// metadata only: hidden columns remain available to data APIs, scripts and
/// backend calculations.
async fn set_column_form_visibility(
&self,
request: tonic::Request<super::SetColumnFormVisibilityRequest>,
) -> std::result::Result<
tonic::Response<super::SetColumnFormVisibilityResponse>,
tonic::Status,
>;
/// Drops a table and its metadata, then deletes the profile if it becomes empty.
async fn delete_table(
&self,
@@ -2052,6 +2128,57 @@ pub mod table_definition_server {
};
Box::pin(fut)
}
"/komp_ac.table_definition.TableDefinition/SetColumnFormVisibility" => {
#[allow(non_camel_case_types)]
struct SetColumnFormVisibilitySvc<T: TableDefinition>(pub Arc<T>);
impl<
T: TableDefinition,
> tonic::server::UnaryService<super::SetColumnFormVisibilityRequest>
for SetColumnFormVisibilitySvc<T> {
type Response = super::SetColumnFormVisibilityResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::SetColumnFormVisibilityRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as TableDefinition>::set_column_form_visibility(
&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 = SetColumnFormVisibilitySvc(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/DeleteTable" => {
#[allow(non_camel_case_types)]
struct DeleteTableSvc<T: TableDefinition>(pub Arc<T>);