feat: Added Auto Labeling to Montior Tab. When sending hosts from the scan tab, it will bring their hostnames over to the label section. When adding a one off host to the montior tab, it will auto query it's hostname. You can also edit labels by double clicking. Closes #3
This commit is contained in:
@@ -180,3 +180,19 @@ pub async fn monitor_stop() -> Result<(), String> {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
#[tauri::command]
|
||||
pub async fn monitor_update_label(ip: String, label: String) -> Result<(), String> {
|
||||
let parsed: IpAddr = ip.parse().map_err(|e| format!("Invalid IP: {}", e))?;
|
||||
let state = get_monitor();
|
||||
let mut guard = state.lock().await;
|
||||
if let Some(entry) = guard.entries.get_mut(&parsed) {
|
||||
entry.label = if label.is_empty() { None } else { Some(label) };
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn monitor_resolve_host(ip: String) -> Result<Option<String>, String> {
|
||||
let parsed: IpAddr = ip.parse().map_err(|e| format!("Invalid IP: {}", e))?;
|
||||
Ok(crate::net::dns::reverse_lookup(parsed).await)
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ pub fn run() {
|
||||
commands::updater::check_for_update,
|
||||
commands::actions::check_privileges,
|
||||
commands::changelog::get_changelog,
|
||||
commands::monitor::monitor_update_label,
|
||||
commands::monitor::monitor_resolve_host
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
Reference in New Issue
Block a user