better charts3
This commit is contained in:
Submodule client-gui2 updated: 43a95c3533...a66fa8e746
@@ -196,15 +196,6 @@ enum ReportNullPolicy {
|
|||||||
REPORT_NULL_POLICY_ZERO = 2;
|
REPORT_NULL_POLICY_ZERO = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ReportCapability {
|
|
||||||
REPORT_CAPABILITY_UNSPECIFIED = 0;
|
|
||||||
REPORT_CAPABILITY_VIEW = 1;
|
|
||||||
REPORT_CAPABILITY_FILTER = 2;
|
|
||||||
REPORT_CAPABILITY_DRILL = 3;
|
|
||||||
REPORT_CAPABILITY_EXPORT = 4;
|
|
||||||
REPORT_CAPABILITY_CUSTOMIZE = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ReportExecutionPurpose {
|
enum ReportExecutionPurpose {
|
||||||
REPORT_EXECUTION_PURPOSE_UNSPECIFIED = 0;
|
REPORT_EXECUTION_PURPOSE_UNSPECIFIED = 0;
|
||||||
REPORT_EXECUTION_PURPOSE_VIEW = 1;
|
REPORT_EXECUTION_PURPOSE_VIEW = 1;
|
||||||
@@ -360,20 +351,11 @@ message ReportPanel {
|
|||||||
repeated ReportPanelAction actions = 23;
|
repeated ReportPanelAction actions = 23;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ReportGrant {
|
|
||||||
oneof subject {
|
|
||||||
string role = 1;
|
|
||||||
string user_id = 2;
|
|
||||||
}
|
|
||||||
repeated ReportCapability capabilities = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message ReportDashboardDefinition {
|
message ReportDashboardDefinition {
|
||||||
string title = 1;
|
string title = 1;
|
||||||
string description = 2;
|
string description = 2;
|
||||||
repeated ReportDashboardFilter filters = 3;
|
repeated ReportDashboardFilter filters = 3;
|
||||||
repeated ReportPanel panels = 4;
|
repeated ReportPanel panels = 4;
|
||||||
repeated ReportGrant grants = 5;
|
|
||||||
uint32 refresh_seconds = 6;
|
uint32 refresh_seconds = 6;
|
||||||
repeated ReportDatasetVersionRef dataset_versions = 7;
|
repeated ReportDatasetVersionRef dataset_versions = 7;
|
||||||
ReportPeriod period = 8;
|
ReportPeriod period = 8;
|
||||||
@@ -420,7 +402,6 @@ message ReportAssetSummary {
|
|||||||
uint64 published_version = 6;
|
uint64 published_version = 6;
|
||||||
bool archived = 7;
|
bool archived = 7;
|
||||||
string updated_at = 8;
|
string updated_at = 8;
|
||||||
repeated ReportCapability capabilities = 9;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ReportAsset {
|
message ReportAsset {
|
||||||
|
|||||||
Binary file not shown.
@@ -389,25 +389,6 @@ pub struct ReportPanel {
|
|||||||
pub actions: ::prost::alloc::vec::Vec<ReportPanelAction>,
|
pub actions: ::prost::alloc::vec::Vec<ReportPanelAction>,
|
||||||
}
|
}
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
|
||||||
pub struct ReportGrant {
|
|
||||||
#[prost(enumeration = "ReportCapability", repeated, tag = "3")]
|
|
||||||
pub capabilities: ::prost::alloc::vec::Vec<i32>,
|
|
||||||
#[prost(oneof = "report_grant::Subject", tags = "1, 2")]
|
|
||||||
pub subject: ::core::option::Option<report_grant::Subject>,
|
|
||||||
}
|
|
||||||
/// Nested message and enum types in `ReportGrant`.
|
|
||||||
pub mod report_grant {
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
|
|
||||||
pub enum Subject {
|
|
||||||
#[prost(string, tag = "1")]
|
|
||||||
Role(::prost::alloc::string::String),
|
|
||||||
#[prost(string, tag = "2")]
|
|
||||||
UserId(::prost::alloc::string::String),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
pub struct ReportDashboardDefinition {
|
pub struct ReportDashboardDefinition {
|
||||||
#[prost(string, tag = "1")]
|
#[prost(string, tag = "1")]
|
||||||
@@ -418,8 +399,6 @@ pub struct ReportDashboardDefinition {
|
|||||||
pub filters: ::prost::alloc::vec::Vec<ReportDashboardFilter>,
|
pub filters: ::prost::alloc::vec::Vec<ReportDashboardFilter>,
|
||||||
#[prost(message, repeated, tag = "4")]
|
#[prost(message, repeated, tag = "4")]
|
||||||
pub panels: ::prost::alloc::vec::Vec<ReportPanel>,
|
pub panels: ::prost::alloc::vec::Vec<ReportPanel>,
|
||||||
#[prost(message, repeated, tag = "5")]
|
|
||||||
pub grants: ::prost::alloc::vec::Vec<ReportGrant>,
|
|
||||||
#[prost(uint32, tag = "6")]
|
#[prost(uint32, tag = "6")]
|
||||||
pub refresh_seconds: u32,
|
pub refresh_seconds: u32,
|
||||||
#[prost(message, repeated, tag = "7")]
|
#[prost(message, repeated, tag = "7")]
|
||||||
@@ -504,8 +483,6 @@ pub struct ReportAssetSummary {
|
|||||||
pub archived: bool,
|
pub archived: bool,
|
||||||
#[prost(string, tag = "8")]
|
#[prost(string, tag = "8")]
|
||||||
pub updated_at: ::prost::alloc::string::String,
|
pub updated_at: ::prost::alloc::string::String,
|
||||||
#[prost(enumeration = "ReportCapability", repeated, tag = "9")]
|
|
||||||
pub capabilities: ::prost::alloc::vec::Vec<i32>,
|
|
||||||
}
|
}
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||||
@@ -1069,45 +1046,6 @@ impl ReportNullPolicy {
|
|||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
#[derive(serde::Serialize, serde::Deserialize)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
pub enum ReportCapability {
|
|
||||||
Unspecified = 0,
|
|
||||||
View = 1,
|
|
||||||
Filter = 2,
|
|
||||||
Drill = 3,
|
|
||||||
Export = 4,
|
|
||||||
Customize = 5,
|
|
||||||
}
|
|
||||||
impl ReportCapability {
|
|
||||||
/// String value of the enum field names used in the ProtoBuf definition.
|
|
||||||
///
|
|
||||||
/// The values are not transformed in any way and thus are considered stable
|
|
||||||
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
||||||
pub fn as_str_name(&self) -> &'static str {
|
|
||||||
match self {
|
|
||||||
Self::Unspecified => "REPORT_CAPABILITY_UNSPECIFIED",
|
|
||||||
Self::View => "REPORT_CAPABILITY_VIEW",
|
|
||||||
Self::Filter => "REPORT_CAPABILITY_FILTER",
|
|
||||||
Self::Drill => "REPORT_CAPABILITY_DRILL",
|
|
||||||
Self::Export => "REPORT_CAPABILITY_EXPORT",
|
|
||||||
Self::Customize => "REPORT_CAPABILITY_CUSTOMIZE",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
||||||
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
||||||
match value {
|
|
||||||
"REPORT_CAPABILITY_UNSPECIFIED" => Some(Self::Unspecified),
|
|
||||||
"REPORT_CAPABILITY_VIEW" => Some(Self::View),
|
|
||||||
"REPORT_CAPABILITY_FILTER" => Some(Self::Filter),
|
|
||||||
"REPORT_CAPABILITY_DRILL" => Some(Self::Drill),
|
|
||||||
"REPORT_CAPABILITY_EXPORT" => Some(Self::Export),
|
|
||||||
"REPORT_CAPABILITY_CUSTOMIZE" => Some(Self::Customize),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
||||||
#[repr(i32)]
|
|
||||||
pub enum ReportExecutionPurpose {
|
pub enum ReportExecutionPurpose {
|
||||||
Unspecified = 0,
|
Unspecified = 0,
|
||||||
View = 1,
|
View = 1,
|
||||||
|
|||||||
@@ -176,10 +176,6 @@ pub fn validate_draft(definition: &ReportDefinition) -> Result<(), String> {
|
|||||||
enum_value::<ReportNullPolicy>(p.null_policy, "null policy")?;
|
enum_value::<ReportNullPolicy>(p.null_policy, "null policy")?;
|
||||||
for action in &p.actions { action.target.as_ref().ok_or("An action target is required")?; }
|
for action in &p.actions { action.target.as_ref().ok_or("An action target is required")?; }
|
||||||
}
|
}
|
||||||
for g in &d.grants {
|
|
||||||
g.subject.as_ref().ok_or("A grant subject is required")?;
|
|
||||||
for c in &g.capabilities { enum_value::<ReportCapability>(*c, "capability")?; }
|
|
||||||
}
|
|
||||||
if let Some(period) = &d.period { period.selection.as_ref().ok_or("A period selection is required")?; }
|
if let Some(period) = &d.period { period.selection.as_ref().ok_or("A period selection is required")?; }
|
||||||
if let Some(report_period::Selection::DateRange(range)) = d.period.as_ref().and_then(|p| p.selection.as_ref()) {
|
if let Some(report_period::Selection::DateRange(range)) = d.period.as_ref().and_then(|p| p.selection.as_ref()) {
|
||||||
enum_value::<ReportPeriodBoundary>(range.end_boundary, "period end boundary")?;
|
enum_value::<ReportPeriodBoundary>(range.end_boundary, "period end boundary")?;
|
||||||
@@ -299,10 +295,9 @@ fn validate_dashboard(dashboard: &ReportDashboardDefinition) -> Result<(), Strin
|
|||||||
if dashboard.filters.len() > 32
|
if dashboard.filters.len() > 32
|
||||||
|| dashboard.panels.is_empty()
|
|| dashboard.panels.is_empty()
|
||||||
|| dashboard.panels.len() > 32
|
|| dashboard.panels.len() > 32
|
||||||
|| dashboard.grants.len() > 200
|
|
||||||
{
|
{
|
||||||
return Err(
|
return Err(
|
||||||
"Dashboards allow up to 32 filters, between 1 and 32 panels, and up to 200 grants"
|
"Dashboards allow up to 32 filters and between 1 and 32 panels"
|
||||||
.into(),
|
.into(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -421,30 +416,6 @@ fn validate_dashboard(dashboard: &ReportDashboardDefinition) -> Result<(), Strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut subjects = HashSet::new();
|
|
||||||
for grant in &dashboard.grants {
|
|
||||||
let subject = grant
|
|
||||||
.subject
|
|
||||||
.as_ref()
|
|
||||||
.ok_or("A grant subject is required")?;
|
|
||||||
let value = match subject {
|
|
||||||
report_grant::Subject::Role(role) => role,
|
|
||||||
report_grant::Subject::UserId(user) => user,
|
|
||||||
};
|
|
||||||
nonempty(value, "Grant subject", 128)?;
|
|
||||||
if !subjects.insert(subject) {
|
|
||||||
return Err("Duplicate report grant subject".into());
|
|
||||||
}
|
|
||||||
let mut capabilities = HashSet::new();
|
|
||||||
for capability in &grant.capabilities {
|
|
||||||
capabilities.insert(enum_value::<ReportCapability>(*capability, "capability")?);
|
|
||||||
}
|
|
||||||
if !capabilities.contains(&ReportCapability::View)
|
|
||||||
|| capabilities.len() != grant.capabilities.len()
|
|
||||||
{
|
|
||||||
return Err("Report grants need View and unique capabilities".into());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
server
2
server
Submodule server updated: 96339d88c4...07ee908786
Reference in New Issue
Block a user