link in table definition
This commit is contained in:
@@ -277,6 +277,14 @@ pub(crate) struct TablePermissionAction {
|
||||
}
|
||||
|
||||
impl TableDefinitionPageState {
|
||||
pub(crate) fn link_target_tables(&self) -> Vec<&str> {
|
||||
self.tables
|
||||
.iter()
|
||||
.filter(|table| table.name != self.selection.table && table.name != "accounts")
|
||||
.map(|table| table.name.as_str())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The selected table's summary, which is where its kind and dependencies
|
||||
/// come from.
|
||||
pub(crate) fn selected_table(&self) -> Option<&TableSummary> {
|
||||
|
||||
@@ -229,6 +229,20 @@ mod tests {
|
||||
assert!(!html.contains(r#"<option value="accounting""#));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_append_panel_offers_link_targets_and_an_alias() {
|
||||
let mut state = page();
|
||||
state.columns.type_input = "link".to_string();
|
||||
state.tables.push(table("customer", "dynamic"));
|
||||
|
||||
let html = render_column_panel(&state);
|
||||
|
||||
assert!(html.contains("Link alias"));
|
||||
assert!(html.contains(r#"name="link_table_input""#));
|
||||
assert!(html.contains(r#"<option value="customer""#));
|
||||
assert!(!html.contains(r#"<option value="invoice""#));
|
||||
}
|
||||
|
||||
/// A system table is the backend's own; every write below is refused for
|
||||
/// it, so the workspace shows the definition and stops there.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user