mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Tauri fixes
This commit is contained in:
parent
8768bb0eb3
commit
7e4f5ab8c5
3 changed files with 47 additions and 3 deletions
|
|
@ -1440,6 +1440,22 @@ pub async fn clear_debug_data(state: State<'_, AppState>) -> Result<(), String>
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn clear_debug_logs(state: State<'_, AppState>) -> Result<(), String> {
|
||||||
|
// For now, clear all debug data - could be enhanced to clear only logs
|
||||||
|
let debug_features_manager = &state.debug_features_manager;
|
||||||
|
debug_features_manager.clear_all_data().await;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn clear_network_requests(state: State<'_, AppState>) -> Result<(), String> {
|
||||||
|
// For now, clear all debug data - could be enhanced to clear only network requests
|
||||||
|
let debug_features_manager = &state.debug_features_manager;
|
||||||
|
debug_features_manager.clear_all_data().await;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn set_debug_mode(enabled: bool, state: State<'_, AppState>) -> Result<(), String> {
|
pub async fn set_debug_mode(enabled: bool, state: State<'_, AppState>) -> Result<(), String> {
|
||||||
let debug_features_manager = &state.debug_features_manager;
|
let debug_features_manager = &state.debug_features_manager;
|
||||||
|
|
|
||||||
|
|
@ -325,6 +325,8 @@ fn main() {
|
||||||
run_benchmarks,
|
run_benchmarks,
|
||||||
generate_diagnostic_report,
|
generate_diagnostic_report,
|
||||||
clear_debug_data,
|
clear_debug_data,
|
||||||
|
clear_debug_logs,
|
||||||
|
clear_network_requests,
|
||||||
set_debug_mode,
|
set_debug_mode,
|
||||||
get_debug_stats,
|
get_debug_stats,
|
||||||
get_api_test_config,
|
get_api_test_config,
|
||||||
|
|
|
||||||
|
|
@ -1386,8 +1386,18 @@ export class SettingsApp extends TauriBase {
|
||||||
// Load debug logs
|
// Load debug logs
|
||||||
this.debugLogs = await this.safeInvoke('get_debug_logs', { limit: 100 }) || [];
|
this.debugLogs = await this.safeInvoke('get_debug_logs', { limit: 100 }) || [];
|
||||||
|
|
||||||
// Load performance metrics
|
// Load performance metrics - returns array
|
||||||
this.performanceMetrics = await this.safeInvoke('get_performance_metrics') || {};
|
const metrics = await this.safeInvoke('get_performance_metrics', { limit: 10 }) || [];
|
||||||
|
|
||||||
|
// Convert metrics array to object for display
|
||||||
|
this.performanceMetrics = {
|
||||||
|
avg_response_time_ms: this._getMetricValue(metrics, 'response_time'),
|
||||||
|
requests_per_second: this._getMetricValue(metrics, 'requests_per_second'),
|
||||||
|
cpu_usage_percent: this._getMetricValue(metrics, 'cpu_usage'),
|
||||||
|
memory_usage_mb: this._getMetricValue(metrics, 'memory_usage'),
|
||||||
|
active_sessions: this._getMetricValue(metrics, 'active_sessions'),
|
||||||
|
total_requests: this._getMetricValue(metrics, 'total_requests')
|
||||||
|
};
|
||||||
|
|
||||||
// Load network requests
|
// Load network requests
|
||||||
this.networkRequests = await this.safeInvoke('get_network_requests', { limit: 50 }) || [];
|
this.networkRequests = await this.safeInvoke('get_network_requests', { limit: 50 }) || [];
|
||||||
|
|
@ -1399,6 +1409,11 @@ export class SettingsApp extends TauriBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _getMetricValue(metrics: Array<any>, name: string): number {
|
||||||
|
const metric = metrics.find((m: any) => m.name === name);
|
||||||
|
return metric?.value || 0;
|
||||||
|
}
|
||||||
|
|
||||||
private _renderLogsTab(): TemplateResult {
|
private _renderLogsTab(): TemplateResult {
|
||||||
const filteredLogs = this._filterLogs(this.debugLogs);
|
const filteredLogs = this._filterLogs(this.debugLogs);
|
||||||
|
|
||||||
|
|
@ -1814,7 +1829,18 @@ export class SettingsApp extends TauriBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async refreshPerformance(): Promise<void> {
|
private async refreshPerformance(): Promise<void> {
|
||||||
this.performanceMetrics = await this.safeInvoke('get_performance_metrics') || {};
|
const metrics = await this.safeInvoke('get_performance_metrics', { limit: 10 }) || [];
|
||||||
|
|
||||||
|
// Convert metrics array to object for display
|
||||||
|
this.performanceMetrics = {
|
||||||
|
avg_response_time_ms: this._getMetricValue(metrics, 'response_time'),
|
||||||
|
requests_per_second: this._getMetricValue(metrics, 'requests_per_second'),
|
||||||
|
cpu_usage_percent: this._getMetricValue(metrics, 'cpu_usage'),
|
||||||
|
memory_usage_mb: this._getMetricValue(metrics, 'memory_usage'),
|
||||||
|
active_sessions: this._getMetricValue(metrics, 'active_sessions'),
|
||||||
|
total_requests: this._getMetricValue(metrics, 'total_requests')
|
||||||
|
};
|
||||||
|
|
||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue