talbe definition web
This commit is contained in:
@@ -7,12 +7,14 @@ use crate::{
|
||||
|
||||
use super::{draft::TableDraft, state::AddTablePageState};
|
||||
|
||||
/// Loads everything the builder needs around the draft: the profiles that can
|
||||
/// be picked, and — for whichever profile the table will belong to — the tables
|
||||
/// that are link targets and the names the new table may not reuse.
|
||||
/// Loads everything the builder needs around the draft: the column-type
|
||||
/// vocabulary, the profiles that can be picked, and — for whichever profile the
|
||||
/// table will belong to — the tables that are link targets and the names the
|
||||
/// new table may not reuse.
|
||||
///
|
||||
/// The link targets and reserved names always come from the live profile tree,
|
||||
/// never from the posted form, so they cannot be spoofed by a crafted request.
|
||||
/// The vocabulary, link targets and reserved names always come from the live
|
||||
/// backend, never from the posted form, so they cannot be spoofed by a crafted
|
||||
/// request.
|
||||
pub(crate) async fn load_page(
|
||||
state: AppState,
|
||||
headers: &HeaderMap,
|
||||
@@ -36,6 +38,19 @@ pub(crate) async fn load_page(
|
||||
}
|
||||
|
||||
let mut definitions = state.definitions;
|
||||
// What a column may be is the backend's to say; the picker and every rule
|
||||
// the draft applies are read from this.
|
||||
draft.columns.catalog = crate::schema::column_catalog(
|
||||
definitions
|
||||
.list_column_types(
|
||||
authenticated_request(headers, Empty {}).map_err(|_| LoadError::Unauthenticated)?,
|
||||
)
|
||||
.await
|
||||
.map_err(|error| LoadError::Backend(error.message().to_string()))?
|
||||
.into_inner()
|
||||
.column_types,
|
||||
);
|
||||
|
||||
let tree = definitions
|
||||
.get_profile_tree(
|
||||
authenticated_request(headers, Empty {}).map_err(|_| LoadError::Unauthenticated)?,
|
||||
|
||||
Reference in New Issue
Block a user