refactor(gui): refactor gui to use RemoteClient trait and RemoteManagement component (#1489)

* refactor(gui): refactor gui to use RemoteClient trait and RemoteManagement component
* feat(gui): Add network config saving and refactor RemoteManagement
This commit is contained in:
Mg Pig
2025-10-20 22:07:01 +08:00
committed by GitHub
parent 67ac9b00ff
commit eba9504fc2
27 changed files with 1040 additions and 793 deletions
+12 -5
View File
@@ -1,5 +1,5 @@
import { UUID } from './utils';
import { NetworkConfig } from '../types/network';
import { NetworkConfig, NetworkInstanceRunningInfo } from '../types/network';
export interface ValidateConfigResponse {
toml_config: string;
@@ -20,14 +20,21 @@ export interface ParseConfigResponse {
error?: string;
}
export interface CollectNetworkInfoResponse {
info: {
map: Record<string, NetworkInstanceRunningInfo | undefined>;
}
}
export interface RemoteClient {
validate_config(config: any): Promise<ValidateConfigResponse>;
run_network(config: any): Promise<undefined>;
get_network_info(inst_id: string): Promise<any>;
validate_config(config: NetworkConfig): Promise<ValidateConfigResponse>;
run_network(config: NetworkConfig): Promise<undefined>;
get_network_info(inst_id: string): Promise<NetworkInstanceRunningInfo | undefined>;
list_network_instance_ids(): Promise<ListNetworkInstanceIdResponse>;
delete_network(inst_id: string): Promise<undefined>;
update_network_instance_state(inst_id: string, disabled: boolean): Promise<undefined>;
get_network_config(inst_id: string): Promise<any>;
save_config(config: NetworkConfig): Promise<undefined>;
get_network_config(inst_id: string): Promise<NetworkConfig>;
generate_config(config: NetworkConfig): Promise<GenerateConfigResponse>;
parse_config(toml_config: string): Promise<ParseConfigResponse>;
}