aliasing can now move things around
This commit is contained in:
@@ -194,6 +194,7 @@ pub(crate) async fn load_page(
|
||||
.find(|table| table.name == inputs.selection.table)
|
||||
.map(|table| TableDetailView {
|
||||
id: table.id,
|
||||
row_version: table.row_version,
|
||||
columns: table
|
||||
.columns
|
||||
.iter()
|
||||
|
||||
@@ -363,6 +363,7 @@ pub(crate) async fn set_column_presentation(
|
||||
profile_name: form.profile.clone(),
|
||||
table_name: form.table.clone(),
|
||||
columns,
|
||||
expected_row_version: form.expected_row_version,
|
||||
};
|
||||
let Ok(request) = authenticated_request(&headers, request) else {
|
||||
return Redirect::to("/login").into_response();
|
||||
|
||||
@@ -80,6 +80,7 @@ impl TableSummary {
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct TableDetailView {
|
||||
pub id: i64,
|
||||
pub row_version: i64,
|
||||
pub row_display_columns: Vec<String>,
|
||||
pub columns: Vec<DetailColumn>,
|
||||
pub scripts: Vec<ScriptView>,
|
||||
@@ -181,6 +182,8 @@ pub(crate) struct PresentationForm {
|
||||
#[serde(default)]
|
||||
pub table: String,
|
||||
#[serde(default)]
|
||||
pub expected_row_version: i64,
|
||||
#[serde(default)]
|
||||
pub column_ids: Vec<i64>,
|
||||
#[serde(default)]
|
||||
pub aliases: Vec<String>,
|
||||
@@ -387,6 +390,7 @@ mod tests {
|
||||
fn provenance_and_renameability_are_independent() {
|
||||
let detail = TableDetailView {
|
||||
id: 1,
|
||||
row_version: 1,
|
||||
row_display_columns: Vec::new(),
|
||||
scripts: Vec::new(),
|
||||
columns: vec![
|
||||
|
||||
@@ -237,6 +237,7 @@ mod tests {
|
||||
link_targets: vec![table("invoice", "dynamic"), table("accounts", "system")],
|
||||
detail: Some(TableDetailView {
|
||||
id: 7,
|
||||
row_version: 1,
|
||||
row_display_columns: vec!["number".to_string()],
|
||||
scripts: Vec::new(),
|
||||
columns: vec![DetailColumn {
|
||||
@@ -377,6 +378,7 @@ mod tests {
|
||||
|
||||
assert!(html.contains(r#"hx-post="/admin/tables/presentation""#), "{html}");
|
||||
assert!(html.contains(r#"name="column_ids" value="1""#), "{html}");
|
||||
assert!(html.contains(r#"name="expected_row_version" value="1""#), "{html}");
|
||||
assert!(html.contains(r#"name="aliases" value="number""#), "{html}");
|
||||
assert!(html.contains(r#"name="action" value="save""#), "{html}");
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
hx-target="#table-panel" hx-swap="innerHTML">
|
||||
<input type="hidden" name="profile" value="{{ page.selection.profile }}">
|
||||
<input type="hidden" name="table" value="{{ page.selection.table }}">
|
||||
<input type="hidden" name="expected_row_version" value="{{ detail.row_version }}">
|
||||
<div class="form-grid">
|
||||
{% for column in detail.columns %}
|
||||
<input type="hidden" name="column_ids" value="{{ column.column_id }}">
|
||||
|
||||
Reference in New Issue
Block a user