global table profile name from server in web now
This commit is contained in:
@@ -70,11 +70,13 @@ pub(crate) async fn load_page(
|
||||
|
||||
// The global scope is the catalog's answer, here as everywhere else, so a
|
||||
// shared table the admin panel lists is a shared table this page can link
|
||||
// to — see `crate::pages::table_scope`.
|
||||
// to — see `crate::pages::table_scope`. Which profile holds the shared
|
||||
// tables is the server's to say, and the tree above says it.
|
||||
let shared_profile = tree.shared_profile_name.clone();
|
||||
let catalog_tables = definitions
|
||||
.get_table_catalog(
|
||||
authenticated_request(headers, GetTableCatalogRequest {
|
||||
profile_name: crate::pages::GLOBAL_SCOPE.to_string(),
|
||||
profile_name: shared_profile.clone(),
|
||||
})
|
||||
.map_err(|_| LoadError::Unauthenticated)?,
|
||||
)
|
||||
@@ -127,6 +129,7 @@ pub(crate) async fn load_page(
|
||||
|
||||
Ok(AddTablePageState {
|
||||
nav: crate::ui::Nav::from_authorization(headers, "admin", &authorization),
|
||||
shared_profile,
|
||||
profiles: tree
|
||||
.profiles
|
||||
.into_iter()
|
||||
|
||||
@@ -95,8 +95,10 @@ pub(crate) async fn create_table(
|
||||
}
|
||||
};
|
||||
|
||||
// A global table is stored in the shared profile, which the loader read
|
||||
// off the profile tree; the redirect below browses it under that name.
|
||||
let profile_name = if request.global {
|
||||
"__global".to_string()
|
||||
page.shared_profile.clone()
|
||||
} else {
|
||||
request.profile_name.clone()
|
||||
};
|
||||
@@ -245,6 +247,7 @@ mod tests {
|
||||
});
|
||||
AddTablePageState {
|
||||
nav: crate::ui::Nav::default(),
|
||||
shared_profile: "__global".to_string(),
|
||||
profiles: vec!["billing".to_string()],
|
||||
draft,
|
||||
status: None,
|
||||
|
||||
@@ -192,6 +192,9 @@ impl BuilderForm {
|
||||
pub(crate) struct AddTablePageState {
|
||||
pub nav: crate::ui::Nav,
|
||||
pub profiles: Vec<String>,
|
||||
/// The profile a global table lands in, as the profile tree reports it.
|
||||
/// The builder posts it as the created table's scope.
|
||||
pub shared_profile: String,
|
||||
pub draft: TableDraft,
|
||||
/// The outcome of the last builder action, if any.
|
||||
pub status: Option<String>,
|
||||
@@ -492,6 +495,7 @@ mod tests {
|
||||
fn the_column_list_shows_what_a_definition_row_expands_into() {
|
||||
let mut page = AddTablePageState {
|
||||
nav: crate::ui::Nav::default(),
|
||||
shared_profile: "__global".to_string(),
|
||||
profiles: Vec::new(),
|
||||
draft: posted_form().to_draft(),
|
||||
status: None,
|
||||
@@ -567,6 +571,7 @@ mod tests {
|
||||
|
||||
let page = AddTablePageState {
|
||||
nav: crate::ui::Nav::default(),
|
||||
shared_profile: "__global".to_string(),
|
||||
profiles: Vec::new(),
|
||||
draft,
|
||||
status: None,
|
||||
|
||||
@@ -109,6 +109,7 @@ mod tests {
|
||||
|
||||
AddTablePageState {
|
||||
nav: Nav::default(),
|
||||
shared_profile: "__global".to_string(),
|
||||
profiles: vec!["billing".to_string()],
|
||||
draft,
|
||||
status: None,
|
||||
|
||||
Reference in New Issue
Block a user