IP测速:测速IP后面直接显示DNS名称;测速未通过的IP却排在前面的问题修复。

pull/336/head
王良 2024-09-01 09:51:19 +08:00
parent aef75c8c2a
commit 827feac5e4
2 changed files with 14 additions and 3 deletions

View File

@ -200,8 +200,8 @@
<a-icon v-else type="info-circle"/>
</a>
<a-tag style="margin:2px;" v-for="(element,index) of item.backupList" :title="element.dns"
:color="element.time?'green':'red'" :key='index'>{{ element.host }}
{{ element.time }}{{ element.time ? 'ms' : '' }}
:color="element.time?'green':'red'" :key='index'>
{{ element.host }} {{ element.time }}{{ element.time ? 'ms' : '' }} {{ element.dns }}
</a-tag>
</a-card>
</a-col>

View File

@ -111,7 +111,18 @@ class SpeedTester {
_.merge(item, ret)
aliveList.push({ ...ret, ...item })
aliveList.sort((a, b) => a.time - b.time)
this.backupList.sort((a, b) => a.time - b.time)
this.backupList.sort((a, b) => {
if (a.time === b.time) {
return 0
}
if (a.time == null) {
return 1
}
if (b.time == null) {
return -1
}
return a.time - b.time
})
} catch (e) {
if (e.message !== 'timeout') {
log.warn('[speed] test error: ', this.hostname, `${item.host}:${item.port} from DNS '${item.dns}'`, ', errorMsg:', e.message)