global table profile name from server in web now
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
|
||||
use crate::schema::{ColumnCatalog, ColumnDraft};
|
||||
|
||||
pub(crate) use crate::pages::GLOBAL_SCOPE;
|
||||
|
||||
/// The profile and table the workspace is pointed at. Arrives as a query
|
||||
/// string on the selector and on the column-panel endpoints, and as hidden
|
||||
/// fields on the panels that write.
|
||||
@@ -33,8 +31,10 @@ impl Selection {
|
||||
!self.table.is_empty()
|
||||
}
|
||||
|
||||
pub(crate) fn is_global(&self) -> bool {
|
||||
self.profile == GLOBAL_SCOPE
|
||||
/// Whether the selection is the shared profile, whose name the caller has
|
||||
/// from the profile tree — the page does not spell it itself.
|
||||
pub(crate) fn is_shared_profile(&self, shared_profile: &str) -> bool {
|
||||
self.profile == shared_profile
|
||||
}
|
||||
|
||||
/// The query string the column panel posts back to, so the panel's own
|
||||
@@ -48,10 +48,14 @@ impl Selection {
|
||||
format!("?profile={}", self.profile)
|
||||
}
|
||||
|
||||
/// What the heading calls the scope, so the global one is not shown by its
|
||||
/// sentinel name.
|
||||
pub(crate) fn scope_label(&self, locale: &crate::i18n::Locale) -> String {
|
||||
if self.is_global() {
|
||||
/// What the heading calls the scope, so the shared profile is not shown by
|
||||
/// its schema name.
|
||||
pub(crate) fn scope_label(
|
||||
&self,
|
||||
locale: &crate::i18n::Locale,
|
||||
shared_profile: &str,
|
||||
) -> String {
|
||||
if self.is_shared_profile(shared_profile) {
|
||||
crate::tr!(*locale, "td-global-label")
|
||||
} else {
|
||||
self.profile.clone()
|
||||
@@ -300,6 +304,10 @@ impl PageInputs {
|
||||
pub(crate) struct TableDefinitionPageState {
|
||||
pub nav: crate::ui::Nav,
|
||||
pub selection: Selection,
|
||||
/// The profile the shared tables are stored in, as the profile tree
|
||||
/// reports it. Everything that has to recognise the shared scope reads it
|
||||
/// from here rather than knowing the name.
|
||||
pub shared_profile: String,
|
||||
/// The tables of the selected scope — what the workspace browses and acts
|
||||
/// on.
|
||||
pub tables: Vec<TableSummary>,
|
||||
@@ -327,6 +335,17 @@ impl TableDefinitionPageState {
|
||||
self.active == name
|
||||
}
|
||||
|
||||
/// Whether the workspace is pointed at the shared profile rather than a
|
||||
/// profile of its own. Read by context.html.
|
||||
pub(crate) fn is_global(&self) -> bool {
|
||||
self.selection.is_shared_profile(&self.shared_profile)
|
||||
}
|
||||
|
||||
/// The heading's name for the selected scope. Read by context.html.
|
||||
pub(crate) fn scope_label(&self, locale: &crate::i18n::Locale) -> String {
|
||||
self.selection.scope_label(locale, &self.shared_profile)
|
||||
}
|
||||
|
||||
/// A table cannot link to itself, and the chart of accounts is reached
|
||||
/// through an ACCOUNTING row rather than through a link of one's own.
|
||||
fn eligible_link_target(&self, table: &TableSummary) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user