forked from proxmox-mirrors/proxmox
notify: cleanup all the imports sections
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
985717d948
commit
7cb339dfa3
@ -1,8 +1,8 @@
|
|||||||
|
use proxmox_http_error::HttpError;
|
||||||
|
|
||||||
use super::http_err;
|
use super::http_err;
|
||||||
use crate::{Bus, Config, Notification};
|
use crate::{Bus, Config, Notification};
|
||||||
|
|
||||||
use proxmox_http_error::HttpError;
|
|
||||||
|
|
||||||
/// Send a notification to a given target.
|
/// Send a notification to a given target.
|
||||||
///
|
///
|
||||||
/// The caller is responsible for any needed permission checks.
|
/// The caller is responsible for any needed permission checks.
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
use proxmox_http_error::HttpError;
|
||||||
|
|
||||||
use crate::api::http_err;
|
use crate::api::http_err;
|
||||||
use crate::filter::{DeleteableFilterProperty, FilterConfig, FilterConfigUpdater, FILTER_TYPENAME};
|
use crate::filter::{DeleteableFilterProperty, FilterConfig, FilterConfigUpdater, FILTER_TYPENAME};
|
||||||
use crate::Config;
|
use crate::Config;
|
||||||
use proxmox_http_error::HttpError;
|
|
||||||
|
|
||||||
/// Get a list of all filters
|
/// Get a list of all filters
|
||||||
///
|
///
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use crate::Config;
|
|
||||||
use proxmox_http_error::HttpError;
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use proxmox_http_error::HttpError;
|
||||||
|
|
||||||
|
use crate::Config;
|
||||||
|
|
||||||
pub mod common;
|
pub mod common;
|
||||||
pub mod filter;
|
pub mod filter;
|
||||||
#[cfg(feature = "gotify")]
|
#[cfg(feature = "gotify")]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
|
||||||
use proxmox_schema::{ApiType, ObjectSchema};
|
use proxmox_schema::{ApiType, ObjectSchema};
|
||||||
use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
|
use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use once_cell::sync::OnceCell;
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
use once_cell::sync::OnceCell;
|
||||||
|
|
||||||
pub trait Context: Send + Sync + Debug {
|
pub trait Context: Send + Sync + Debug {
|
||||||
fn lookup_email_for_user(&self, user: &str) -> Option<String>;
|
fn lookup_email_for_user(&self, user: &str) -> Option<String>;
|
||||||
fn default_sendmail_author(&self) -> String;
|
fn default_sendmail_author(&self) -> String;
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::renderer::TemplateRenderer;
|
|
||||||
use crate::schema::ENTITY_NAME_SCHEMA;
|
|
||||||
use crate::{renderer, Endpoint, Error, Notification, Severity};
|
|
||||||
|
|
||||||
use proxmox_schema::api_types::COMMENT_SCHEMA;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
use crate::context::context;
|
|
||||||
use proxmox_http::client::sync::Client;
|
use proxmox_http::client::sync::Client;
|
||||||
use proxmox_http::{HttpClient, HttpOptions, ProxyConfig};
|
use proxmox_http::{HttpClient, HttpOptions, ProxyConfig};
|
||||||
|
use proxmox_schema::api_types::COMMENT_SCHEMA;
|
||||||
use proxmox_schema::{api, Updater};
|
use proxmox_schema::{api, Updater};
|
||||||
|
|
||||||
|
use crate::context::context;
|
||||||
|
use crate::renderer::TemplateRenderer;
|
||||||
|
use crate::schema::ENTITY_NAME_SCHEMA;
|
||||||
|
use crate::{renderer, Endpoint, Error, Notification, Severity};
|
||||||
|
|
||||||
fn severity_to_priority(level: Severity) -> u32 {
|
fn severity_to_priority(level: Severity) -> u32 {
|
||||||
match level {
|
match level {
|
||||||
Severity::Info => 1,
|
Severity::Info => 1,
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use proxmox_schema::api_types::COMMENT_SCHEMA;
|
||||||
|
use proxmox_schema::{api, Updater};
|
||||||
|
|
||||||
use crate::context::context;
|
use crate::context::context;
|
||||||
use crate::renderer::TemplateRenderer;
|
use crate::renderer::TemplateRenderer;
|
||||||
use crate::schema::{EMAIL_SCHEMA, ENTITY_NAME_SCHEMA, USER_SCHEMA};
|
use crate::schema::{EMAIL_SCHEMA, ENTITY_NAME_SCHEMA, USER_SCHEMA};
|
||||||
use crate::{renderer, Endpoint, Error, Notification};
|
use crate::{renderer, Endpoint, Error, Notification};
|
||||||
use std::collections::HashSet;
|
|
||||||
|
|
||||||
use proxmox_schema::api_types::COMMENT_SCHEMA;
|
|
||||||
use proxmox_schema::{api, Updater};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
pub(crate) const SENDMAIL_TYPENAME: &str = "sendmail";
|
pub(crate) const SENDMAIL_TYPENAME: &str = "sendmail";
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox_schema::api_types::COMMENT_SCHEMA;
|
use proxmox_schema::api_types::COMMENT_SCHEMA;
|
||||||
use proxmox_schema::{api, Updater};
|
use proxmox_schema::{api, Updater};
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use crate::schema::ENTITY_NAME_SCHEMA;
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use proxmox_schema::api_types::COMMENT_SCHEMA;
|
use proxmox_schema::api_types::COMMENT_SCHEMA;
|
||||||
use proxmox_schema::{api, Updater};
|
use proxmox_schema::{api, Updater};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
use crate::schema::ENTITY_NAME_SCHEMA;
|
||||||
|
|
||||||
pub(crate) const GROUP_TYPENAME: &str = "group";
|
pub(crate) const GROUP_TYPENAME: &str = "group";
|
||||||
|
|
||||||
|
@ -1,25 +1,28 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::error::Error as StdError;
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
|
|
||||||
use filter::{FilterConfig, FilterMatcher, FILTER_TYPENAME};
|
|
||||||
use group::{GroupConfig, GROUP_TYPENAME};
|
|
||||||
use proxmox_schema::api;
|
|
||||||
use proxmox_section_config::SectionConfigData;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use std::error::Error as StdError;
|
use proxmox_schema::api;
|
||||||
|
use proxmox_section_config::SectionConfigData;
|
||||||
|
|
||||||
|
pub mod filter;
|
||||||
|
use filter::{FilterConfig, FilterMatcher, FILTER_TYPENAME};
|
||||||
|
|
||||||
|
pub mod group;
|
||||||
|
use group::{GroupConfig, GROUP_TYPENAME};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
mod config;
|
|
||||||
pub mod context;
|
pub mod context;
|
||||||
pub mod endpoints;
|
pub mod endpoints;
|
||||||
pub mod filter;
|
|
||||||
pub mod group;
|
|
||||||
pub mod renderer;
|
pub mod renderer;
|
||||||
pub mod schema;
|
pub mod schema;
|
||||||
|
|
||||||
|
mod config;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
ConfigSerialization(Box<dyn StdError + Send + Sync>),
|
ConfigSerialization(Box<dyn StdError + Send + Sync>),
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
use crate::define_helper_with_prefix_and_postfix;
|
|
||||||
use crate::renderer::BlockRenderFunctions;
|
|
||||||
use handlebars::{
|
use handlebars::{
|
||||||
Context, Handlebars, Helper, HelperResult, Output, RenderContext,
|
Context, Handlebars, Helper, HelperResult, Output, RenderContext,
|
||||||
RenderError as HandlebarsRenderError,
|
RenderError as HandlebarsRenderError,
|
||||||
@ -7,6 +5,8 @@ use handlebars::{
|
|||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use super::{table::Table, value_to_string};
|
use super::{table::Table, value_to_string};
|
||||||
|
use crate::define_helper_with_prefix_and_postfix;
|
||||||
|
use crate::renderer::BlockRenderFunctions;
|
||||||
|
|
||||||
fn render_html_table(
|
fn render_html_table(
|
||||||
h: &Helper,
|
h: &Helper,
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
//! Module for rendering notification templates.
|
//! Module for rendering notification templates.
|
||||||
|
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use handlebars::{
|
use handlebars::{
|
||||||
Context, Handlebars, Helper, HelperDef, HelperResult, Output, RenderContext,
|
Context, Handlebars, Helper, HelperDef, HelperResult, Output, RenderContext,
|
||||||
RenderError as HandlebarsRenderError,
|
RenderError as HandlebarsRenderError,
|
||||||
};
|
};
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::Error;
|
|
||||||
use proxmox_human_byte::HumanByte;
|
use proxmox_human_byte::HumanByte;
|
||||||
use proxmox_time::TimeSpan;
|
use proxmox_time::TimeSpan;
|
||||||
|
|
||||||
|
use crate::Error;
|
||||||
|
|
||||||
mod html;
|
mod html;
|
||||||
mod plaintext;
|
mod plaintext;
|
||||||
mod table;
|
mod table;
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
use crate::define_helper_with_prefix_and_postfix;
|
use std::collections::HashMap;
|
||||||
use crate::renderer::BlockRenderFunctions;
|
|
||||||
use handlebars::{
|
use handlebars::{
|
||||||
Context, Handlebars, Helper, HelperResult, Output, RenderContext,
|
Context, Handlebars, Helper, HelperResult, Output, RenderContext,
|
||||||
RenderError as HandlebarsRenderError,
|
RenderError as HandlebarsRenderError,
|
||||||
};
|
};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
use super::{table::Table, value_to_string};
|
use super::{table::Table, value_to_string};
|
||||||
|
use crate::define_helper_with_prefix_and_postfix;
|
||||||
|
use crate::renderer::BlockRenderFunctions;
|
||||||
|
|
||||||
fn optimal_column_widths(table: &Table) -> HashMap<&str, usize> {
|
fn optimal_column_widths(table: &Table) -> HashMap<&str, usize> {
|
||||||
let mut widths = HashMap::new();
|
let mut widths = HashMap::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user