This commit is contained in:
Priec
2026-08-15 18:31:51 +02:00
parent 56baa35cf2
commit 10d9784b9b
14 changed files with 404 additions and 111 deletions

View File

@@ -173,10 +173,18 @@ pub(crate) struct GeneratedTableView {
pub parent_table_name: String,
}
/// The rename panel's inputs, kept across a failed submit so the user does not
/// retype them.
/// Renaming one column.
///
/// `SetColumnPresentation` sets names and order in one call and insists on
/// being given every column, so a browser that posts the whole table posts a
/// list it read at some earlier moment. When the ids and the aliases came from
/// two different moments, they still zipped into a valid request -- one that
/// renamed `amount` to `note` and `note` to `amount`, and took every validation
/// and type along with the names. This form carries one alias and the id of the
/// column it was typed into, so there is no list to misalign; the handler fills
/// the rest of the table in from the backend.
#[derive(Clone, Debug, Default, serde::Deserialize)]
pub(crate) struct PresentationForm {
pub(crate) struct AliasForm {
#[serde(default)]
pub profile: String,
#[serde(default)]
@@ -184,11 +192,29 @@ pub(crate) struct PresentationForm {
#[serde(default)]
pub expected_row_version: i64,
#[serde(default)]
pub column_ids: Vec<i64>,
pub column_id: i64,
#[serde(default)]
pub aliases: Vec<String>,
pub alias: String,
}
/// Moving one column past its neighbour.
///
/// It carries no alias at all -- not even the one it is moving -- so a reorder
/// cannot rename anything, whatever the browser still had on screen. See
/// [`AliasForm`] for why that separation is worth two forms.
#[derive(Clone, Debug, Default, serde::Deserialize)]
pub(crate) struct OrderForm {
#[serde(default)]
pub action: String,
pub profile: String,
#[serde(default)]
pub table: String,
#[serde(default)]
pub expected_row_version: i64,
#[serde(default)]
pub column_id: i64,
/// `up` or `down`. Anything else moves nothing.
#[serde(default)]
pub direction: String,
}
/// The copy-profile panel. An empty `table_names` copies the whole profile,
@@ -248,7 +274,6 @@ pub(crate) struct PageInputs {
pub selection: Selection,
/// The columns staged for `AddTableColumns`.
pub columns: ColumnDraft,
pub presentation: PresentationForm,
pub copy: CopyForm,
pub invoice: InvoiceTemplateForm,
pub status: Option<String>,