mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-13 02:54:26 +08:00
fix: 删除 nmcli 命令缺失弹窗提示
This commit is contained in:
@@ -115,7 +115,7 @@ export const otgNetworkApi = {
|
|||||||
|
|
||||||
status: () => request<OtgNetworkStatus>('/otg/network/status'),
|
status: () => request<OtgNetworkStatus>('/otg/network/status'),
|
||||||
|
|
||||||
interfaces: () => request<NetworkInterfaceInfo[]>('/devices/network'),
|
interfaces: () => request<NetworkInterfaceInfo[]>('/devices/network', {}, { toastOnError: false }),
|
||||||
}
|
}
|
||||||
|
|
||||||
export const otgConfigApi = {
|
export const otgConfigApi = {
|
||||||
|
|||||||
@@ -653,6 +653,7 @@ export default {
|
|||||||
otgNetworkDriver: 'Host Driver Mode',
|
otgNetworkDriver: 'Host Driver Mode',
|
||||||
otgNetworkInterface: 'Bridge Interface',
|
otgNetworkInterface: 'Bridge Interface',
|
||||||
otgNetworkNone: 'None',
|
otgNetworkNone: 'None',
|
||||||
|
otgNetworkInterfacesLoadFailed: 'Failed to load bridge interfaces',
|
||||||
otgDescriptor: 'USB Device Descriptor',
|
otgDescriptor: 'USB Device Descriptor',
|
||||||
vendorId: 'Vendor ID (VID)',
|
vendorId: 'Vendor ID (VID)',
|
||||||
productId: 'Product ID (PID)',
|
productId: 'Product ID (PID)',
|
||||||
|
|||||||
@@ -652,6 +652,7 @@ export default {
|
|||||||
otgNetworkDriver: '目标机驱动模式',
|
otgNetworkDriver: '目标机驱动模式',
|
||||||
otgNetworkInterface: '桥接网卡',
|
otgNetworkInterface: '桥接网卡',
|
||||||
otgNetworkNone: '无',
|
otgNetworkNone: '无',
|
||||||
|
otgNetworkInterfacesLoadFailed: '无法获取桥接网卡列表',
|
||||||
otgDescriptor: 'USB 设备描述符',
|
otgDescriptor: 'USB 设备描述符',
|
||||||
vendorId: '厂商 ID (VID)',
|
vendorId: '厂商 ID (VID)',
|
||||||
productId: '产品 ID (PID)',
|
productId: '产品 ID (PID)',
|
||||||
|
|||||||
@@ -269,15 +269,12 @@ async function loadSectionData(section: SettingsSectionId) {
|
|||||||
case 'video':
|
case 'video':
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
loadConfig(),
|
loadConfig(),
|
||||||
loadDevices(),
|
loadDeviceConfig(),
|
||||||
loadBackends(),
|
loadBackends(),
|
||||||
])
|
])
|
||||||
return
|
return
|
||||||
case 'hid':
|
case 'hid':
|
||||||
await Promise.all([
|
await Promise.all([loadConfig(), loadHidDeviceOptions()])
|
||||||
loadConfig(),
|
|
||||||
loadDevices(),
|
|
||||||
])
|
|
||||||
return
|
return
|
||||||
case 'atx':
|
case 'atx':
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
@@ -689,6 +686,7 @@ const config = ref({
|
|||||||
|
|
||||||
const otgNetworkInterfaces = ref<NetworkInterfaceInfo[]>([])
|
const otgNetworkInterfaces = ref<NetworkInterfaceInfo[]>([])
|
||||||
const otgNetworkInterfacesLoaded = ref(false)
|
const otgNetworkInterfacesLoaded = ref(false)
|
||||||
|
const otgNetworkInterfacesError = ref('')
|
||||||
const otgNetworkStatus = ref<OtgNetworkStatus | null>(null)
|
const otgNetworkStatus = ref<OtgNetworkStatus | null>(null)
|
||||||
|
|
||||||
function syncOtgNetworkInterface() {
|
function syncOtgNetworkInterface() {
|
||||||
@@ -1569,20 +1567,30 @@ async function loadConfig() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadDevices() {
|
async function loadDeviceConfig() {
|
||||||
try {
|
try {
|
||||||
const [deviceConfig, networkInterfaces] = await Promise.all([
|
devices.value = await configApi.listDevices()
|
||||||
configApi.listDevices(),
|
} catch {
|
||||||
otgNetworkApi.interfaces().catch(() => []),
|
}
|
||||||
])
|
}
|
||||||
devices.value = deviceConfig
|
|
||||||
otgNetworkInterfaces.value = networkInterfaces
|
async function loadOtgNetworkInterfaces() {
|
||||||
|
otgNetworkInterfacesError.value = ''
|
||||||
|
try {
|
||||||
|
otgNetworkInterfaces.value = await otgNetworkApi.interfaces()
|
||||||
otgNetworkInterfacesLoaded.value = true
|
otgNetworkInterfacesLoaded.value = true
|
||||||
syncOtgNetworkInterface()
|
syncOtgNetworkInterface()
|
||||||
} catch {
|
} catch {
|
||||||
|
otgNetworkInterfaces.value = []
|
||||||
|
otgNetworkInterfacesLoaded.value = false
|
||||||
|
otgNetworkInterfacesError.value = t('settings.otgNetworkInterfacesLoadFailed')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadHidDeviceOptions() {
|
||||||
|
await Promise.all([loadDeviceConfig(), loadOtgNetworkInterfaces()])
|
||||||
|
}
|
||||||
|
|
||||||
async function loadBackends() {
|
async function loadBackends() {
|
||||||
try {
|
try {
|
||||||
const result = await streamApi.getCodecs()
|
const result = await streamApi.getCodecs()
|
||||||
@@ -2902,7 +2910,7 @@ watch(isWindows, () => {
|
|||||||
<CardTitle>{{ t('settings.videoSettings') }}</CardTitle>
|
<CardTitle>{{ t('settings.videoSettings') }}</CardTitle>
|
||||||
<CardDescription>{{ t('settings.videoSettingsDesc') }}</CardDescription>
|
<CardDescription>{{ t('settings.videoSettingsDesc') }}</CardDescription>
|
||||||
</div>
|
</div>
|
||||||
<Button variant="ghost" size="icon-sm" :aria-label="t('common.refresh')" @click="loadDevices">
|
<Button variant="ghost" size="icon-sm" :aria-label="t('common.refresh')" @click="loadDeviceConfig">
|
||||||
<RefreshCw class="size-4" />
|
<RefreshCw class="size-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
@@ -3041,7 +3049,7 @@ watch(isWindows, () => {
|
|||||||
<CardTitle>{{ t('settings.hidSettings') }}</CardTitle>
|
<CardTitle>{{ t('settings.hidSettings') }}</CardTitle>
|
||||||
<CardDescription>{{ t('settings.hidSettingsDesc') }}</CardDescription>
|
<CardDescription>{{ t('settings.hidSettingsDesc') }}</CardDescription>
|
||||||
</div>
|
</div>
|
||||||
<Button variant="ghost" size="icon-sm" :aria-label="t('common.refresh')" @click="loadDevices">
|
<Button variant="ghost" size="icon-sm" :aria-label="t('common.refresh')" @click="loadHidDeviceOptions">
|
||||||
<RefreshCw class="size-4" />
|
<RefreshCw class="size-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
@@ -3325,8 +3333,22 @@ watch(isWindows, () => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
<Label for="otg-network-interface">{{ t('settings.otgNetworkInterface') }}</Label>
|
<Label for="otg-network-interface">{{ t('settings.otgNetworkInterface') }}</Label>
|
||||||
<NativeSelect id="otg-network-interface" v-model="config.otg_network_interface" class="w-full" :disabled="otgNetworkInterfaces.length === 0">
|
<NativeSelect
|
||||||
<NativeSelectOption v-if="otgNetworkInterfaces.length === 0" value="">{{ t('settings.otgNetworkNone') }}</NativeSelectOption>
|
id="otg-network-interface"
|
||||||
|
v-model="config.otg_network_interface"
|
||||||
|
class="w-full"
|
||||||
|
:disabled="otgNetworkInterfaces.length === 0"
|
||||||
|
:aria-invalid="Boolean(otgNetworkInterfacesError)"
|
||||||
|
>
|
||||||
|
<NativeSelectOption
|
||||||
|
v-if="otgNetworkInterfacesError"
|
||||||
|
:value="config.otg_network_interface"
|
||||||
|
>
|
||||||
|
{{ otgNetworkInterfacesError }}
|
||||||
|
</NativeSelectOption>
|
||||||
|
<NativeSelectOption v-else-if="otgNetworkInterfaces.length === 0" value="">
|
||||||
|
{{ t('settings.otgNetworkNone') }}
|
||||||
|
</NativeSelectOption>
|
||||||
<NativeSelectOption
|
<NativeSelectOption
|
||||||
v-for="item in otgNetworkInterfaces"
|
v-for="item in otgNetworkInterfaces"
|
||||||
:key="item.name"
|
:key="item.name"
|
||||||
|
|||||||
Reference in New Issue
Block a user