v0.31.0
This commit is contained in:
1 parent
f213d853e2
commit
76b8bb7ee2
78 files changed
+7750
-5204
No files matched your search
@@ -1,94 +1,4 @@
|
||||
const LIVE_LOG_COLUMNS: &[&str] = &[
|
||||
"time",
|
||||
"request",
|
||||
"host",
|
||||
"source_ip",
|
||||
"vhost",
|
||||
"backend",
|
||||
"status",
|
||||
"duration",
|
||||
"cache",
|
||||
"outcome",
|
||||
"transport",
|
||||
"websocket",
|
||||
"upstream_error",
|
||||
];
|
||||
const FILE_LOG_COLUMN_MAX: usize = 64;
|
||||
const BACKEND_TABLE_COLUMNS: &[&str] = &[
|
||||
"vhost",
|
||||
"backend",
|
||||
"status",
|
||||
"active",
|
||||
"requests",
|
||||
"errors",
|
||||
"latency",
|
||||
"traffic",
|
||||
"generation",
|
||||
"generationRequests",
|
||||
"generationAge",
|
||||
"rotations",
|
||||
"lastFailure",
|
||||
"lastRecovery",
|
||||
];
|
||||
const VHOST_LIST_SORT_COLUMNS: &[&str] = &[
|
||||
"id",
|
||||
"hostname",
|
||||
"status",
|
||||
"listeners",
|
||||
"certificate",
|
||||
"backends",
|
||||
];
|
||||
const DOCKER_VHOST_SORT_COLUMNS: &[&str] = &[
|
||||
"service",
|
||||
"hostname",
|
||||
"status",
|
||||
"backend",
|
||||
"scheme",
|
||||
"published",
|
||||
];
|
||||
const REDIRECT_LIST_SORT_COLUMNS: &[&str] = &[
|
||||
"id",
|
||||
"name",
|
||||
"hostname",
|
||||
"status",
|
||||
"target",
|
||||
"rules",
|
||||
"listeners",
|
||||
"certificate",
|
||||
];
|
||||
const NOTFOUND_LIST_SORT_COLUMNS: &[&str] = &[
|
||||
"id",
|
||||
"name",
|
||||
"hostname",
|
||||
"status",
|
||||
"mode",
|
||||
"listeners",
|
||||
"certificate",
|
||||
];
|
||||
const STREAM_LIST_SORT_COLUMNS: &[&str] = &[
|
||||
"name",
|
||||
"id",
|
||||
"protocol",
|
||||
"listen",
|
||||
"upstream",
|
||||
"status",
|
||||
"maxConnections",
|
||||
"idleTimeout",
|
||||
];
|
||||
const DASHBOARD_WIDGETS: &[&str] = &[
|
||||
"requests",
|
||||
"active",
|
||||
"bandwidth",
|
||||
"errors",
|
||||
"cache",
|
||||
"memory",
|
||||
"websocket",
|
||||
"http2",
|
||||
"http3",
|
||||
"tls",
|
||||
"http_protocol",
|
||||
"websocket_protocol",
|
||||
];
|
||||
include!("preferences_columns.rs");
|
||||
|
||||
fn default_admin_theme() -> String {
|
||||
"dark".to_owned()
|
||||
@@ -159,9 +69,13 @@ fn default_stream_list_sort() -> String {
|
||||
"name".to_owned()
|
||||
}
|
||||
|
||||
include!("refresh_preferences.rs");
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct AdminPreferences {
|
||||
#[serde(default)]
|
||||
refresh: RefreshPreferences,
|
||||
#[serde(default = "default_live_log_columns")]
|
||||
live_log_columns: Vec<String>,
|
||||
#[serde(default = "default_admin_theme")]
|
||||
theme: String,
|
||||
@@ -216,6 +130,7 @@ struct AdminPreferences {
|
||||
impl Default for AdminPreferences {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
refresh: RefreshPreferences::default(),
|
||||
live_log_columns: LIVE_LOG_COLUMNS
|
||||
.iter()
|
||||
.map(|value| (*value).to_owned())
|
||||
@@ -249,6 +164,7 @@ impl Default for AdminPreferences {
|
||||
}
|
||||
|
||||
fn validate_admin_preferences(preferences: &AdminPreferences) -> Result<(), ApiError> {
|
||||
validate_refresh_preferences(&preferences.refresh)?;
|
||||
if preferences.live_log_columns.is_empty()
|
||||
|| preferences.live_log_columns.len() > LIVE_LOG_COLUMNS.len()
|
||||
{
|
||||
@@ -490,3 +406,4 @@ async fn update_preferences(
|
||||
}
|
||||
Ok(Json(preferences))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user