organization of incoming data
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user