Can edit more network settings
This commit is contained in:
@ -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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user