diff --git a/easytier-web/frontend-lib/src/modules/api.ts b/easytier-web/frontend-lib/src/modules/api.ts index f3ab554..26ff64c 100644 --- a/easytier-web/frontend-lib/src/modules/api.ts +++ b/easytier-web/frontend-lib/src/modules/api.ts @@ -1,5 +1,6 @@ import axios, { AxiosError, AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from 'axios'; import { Md5 } from 'ts-md5' +import { UUID } from './utils'; export interface ValidateConfigResponse { toml_config: string; @@ -31,6 +32,11 @@ export interface Summary { device_count: number; } +export interface ListNetworkInstanceIdResponse { + running_inst_ids: Array, + disabled_inst_ids: Array, +} + export class ApiClient { private client: AxiosInstance; private authFailedCb: Function | undefined; @@ -141,6 +147,17 @@ export class ApiClient { return response.machines; } + public async list_deivce_instance_ids(machine_id: string): Promise { + const response = await this.client.get('/machines/' + machine_id + '/networks'); + return response; + } + + public async update_device_instance_state(machine_id: string, inst_id: string, disabled: boolean): Promise { + await this.client.put('/machines/' + machine_id + '/networks/' + inst_id, { + disabled: disabled, + }); + } + public async get_network_info(machine_id: string, inst_id: string): Promise { const response = await this.client.get>('/machines/' + machine_id + '/networks/info/' + inst_id); return response.info.map; diff --git a/easytier-web/frontend/src/components/DeviceManagement.vue b/easytier-web/frontend/src/components/DeviceManagement.vue index 48e48de..d60ad36 100644 --- a/easytier-web/frontend/src/components/DeviceManagement.vue +++ b/easytier-web/frontend/src/components/DeviceManagement.vue @@ -1,7 +1,7 @@