Can edit more network settings

This commit is contained in:
2023-12-06 15:30:30 +01:00
parent 7bf4e87df1
commit b7d44f3091
17 changed files with 384 additions and 77 deletions

View File

@ -19,6 +19,8 @@ export interface NetworkInfo {
ip_v6?: IpConfig;
}
export type NetworkStatus = "Started" | "Stopped";
export function NetworkURL(n: NetworkInfo, edit: boolean = false): string {
return `/net/${n.uuid}${edit ? "/edit" : ""}`;
}
@ -61,6 +63,38 @@ export class NetworkApi {
).data;
}
/**
* Get the status of network
*/
static async GetState(net: NetworkInfo): Promise<NetworkStatus> {
return (
await APIClient.exec({
method: "GET",
uri: `/network/${net.uuid}/status`,
})
).data.status;
}
/**
* Start the network
*/
static async Start(net: NetworkInfo): Promise<void> {
await APIClient.exec({
method: "GET",
uri: `/network/${net.uuid}/start`,
});
}
/**
* Stop the network
*/
static async Stop(net: NetworkInfo): Promise<void> {
await APIClient.exec({
method: "GET",
uri: `/network/${net.uuid}/stop`,
});
}
/**
* Update an existing network
*/