organization of incoming data

This commit is contained in:
Priec
2026-08-12 17:46:58 +02:00
parent 08af99e334
commit 719bae0cd2
10 changed files with 184 additions and 24 deletions

View File

@@ -45,6 +45,7 @@ impl Selection {
pub(crate) struct TableSummary {
pub name: String,
pub table_kind: String,
pub global: bool,
pub depends_on: Vec<String>,
pub row_display_columns: Vec<String>,
}
@@ -277,10 +278,34 @@ pub(crate) struct TablePermissionAction {
}
impl TableDefinitionPageState {
pub(crate) fn link_target_tables(&self) -> Vec<&str> {
fn eligible_link_target(&self, table: &TableSummary) -> bool {
table.name != self.selection.table && table.name != "accounts"
}
pub(crate) fn global_link_target_tables(&self) -> Vec<&str> {
self.tables
.iter()
.filter(|table| table.name != self.selection.table && table.name != "accounts")
.filter(|table| self.eligible_link_target(table) && table.global)
.map(|table| table.name.as_str())
.collect()
}
pub(crate) fn user_link_target_tables(&self) -> Vec<&str> {
self.tables
.iter()
.filter(|table| {
self.eligible_link_target(table) && !table.global && !table.is_system()
})
.map(|table| table.name.as_str())
.collect()
}
pub(crate) fn system_link_target_tables(&self) -> Vec<&str> {
self.tables
.iter()
.filter(|table| {
self.eligible_link_target(table) && !table.global && table.is_system()
})
.map(|table| table.name.as_str())
.collect()
}