global table content

This commit is contained in:
Priec
2026-08-12 14:10:20 +02:00
parent 112bea6519
commit 78e3f1ae08
7 changed files with 54 additions and 17 deletions

View File

@@ -26,7 +26,7 @@ use crate::{
};
use super::state::{
DetailColumn, LoadError, PageInputs, RenameEntry, ScriptView, TableDefinitionPageState,
DetailColumn, GLOBAL_SCOPE, LoadError, PageInputs, RenameEntry, ScriptView, TableDefinitionPageState,
TableDetailView, TablePermissionAction, TableRolePermissions, TableSummary,
};
@@ -96,19 +96,24 @@ pub(crate) async fn load_page(
.collect::<Vec<_>>();
// A profile that no longer exists takes the table selection with it.
if !profiles.contains(&inputs.selection.profile) {
if inputs.selection.profile != GLOBAL_SCOPE && !profiles.contains(&inputs.selection.profile) {
inputs.selection.profile.clear();
inputs.selection.table.clear();
}
let tables = tree
.profiles
.iter()
.find(|profile| profile.name == inputs.selection.profile)
.map(|profile| {
profile
.tables
let selected_tables = if inputs.selection.is_global() {
tree.profiles.first().map(|profile| profile.tables.as_slice())
} else {
tree.profiles
.iter()
.find(|profile| profile.name == inputs.selection.profile)
.map(|profile| profile.tables.as_slice())
};
let tables = selected_tables
.map(|tables| {
tables
.iter()
.filter(|table| table.global == inputs.selection.is_global())
.map(|table| TableSummary {
name: table.name.clone(),
table_kind: table.table_kind.clone(),