diff --git a/package.json b/package.json
index 8a722b4..c5d1ebb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "frontend",
- "version": "0.9.4",
+ "version": "0.9.5",
"private": true,
"type": "module",
"scripts": {
diff --git a/src/components/NodesStatus.vue b/src/components/NodesStatus.vue
index 1530628..b0d7553 100644
--- a/src/components/NodesStatus.vue
+++ b/src/components/NodesStatus.vue
@@ -34,11 +34,17 @@
class="h-5 w-auto rounded-sm"
/>
{{ host.name }}
-
- {{ host.isOnline ? 'online' : 'offline' }}
+
+
+
+
+
@@ -73,21 +79,48 @@ const error = ref(null)
const countriesList = getAllCountries()
+// Ручной маппинг для проблемных стран
+const countryOverrides = {
+ 'United States': 'us',
+ 'USA': 'us',
+ 'U.S.A.': 'us',
+ 'America': 'us',
+ 'United Arab Emirates': 'ae',
+ 'UAE': 'ae',
+}
+
const findCountryByFirstWord = (name) => {
if (!name) return null
+
+ // 1. Проверяем ручные override
+ const override = countryOverrides[name]
+ if (override) {
+ return { code: override.toUpperCase() }
+ }
+
+ // 2. Ищем по первому слову
const firstWord = name.split(' ')[0]
if (!firstWord) return null
+ // Точное совпадение
const exact = countriesList.find(c =>
c.label.toLowerCase() === firstWord.toLowerCase()
)
if (exact) return exact
+ // Частичное совпадение
const partial = countriesList.find(c =>
firstWord.toLowerCase().includes(c.label.toLowerCase()) ||
c.label.toLowerCase().includes(firstWord.toLowerCase())
)
- return partial || null
+ if (partial) return partial
+
+ // 3. Пробуем найти по полному имени
+ const fullMatch = countriesList.find(c =>
+ name.toLowerCase().includes(c.label.toLowerCase()) ||
+ c.label.toLowerCase().includes(name.toLowerCase())
+ )
+ return fullMatch || null
}
const sortedHosts = computed(() => {
@@ -157,7 +190,6 @@ const refreshData = async () => {
}
})
- // Пингуем все хосты параллельно
const pings = await Promise.all(hosts.value.map(h => pingHost(h)))
hosts.value.forEach((h, i) => {
if (h.isOnline) h.ping = pings[i]
@@ -170,7 +202,10 @@ const refreshData = async () => {
}
}
-onMounted(() => {
- fetchHosts()
+// При первом открытии — загружаем и пингуем
+onMounted(async () => {
+ await fetchHosts()
+ // Автоматический пинг только при первом открытии
+ await refreshData()
})
\ No newline at end of file