This commit is contained in:
Douglas Barone 2022-04-04 12:07:43 -04:00
parent c5785757ee
commit fcedb29135
2 changed files with 24 additions and 17 deletions

View File

@ -19,19 +19,19 @@ export async function userPresence(_, { search }) {
const filteredUsers = search
? usersWithWifiDevices.filter(
user =>
Object.keys(user).some(
key => typeof user[key] == 'string' && user[key].contains(search)
) ||
user.wifiDevices?.some(
device =>
device.status != 'OFFLINE' &&
(device.ip?.startsWith(search) ||
device.apName?.contains(search) ||
device.essid?.contains(search) ||
device.hostname?.contains(search))
)
)
user =>
Object.keys(user).some(
key => typeof user[key] == 'string' && user[key].contains(search)
) ||
user.wifiDevices?.some(
device =>
device.status != 'OFFLINE' &&
(device.ip?.startsWith(search) ||
device.apName?.contains(search) ||
device.essid?.contains(search) ||
device.hostname?.contains(search))
)
)
: usersWithWifiDevices
const sortedUsers = filteredUsers.sort((a, b) => {
@ -62,8 +62,8 @@ export async function userPresence(_, { search }) {
thumbnailPhoto: userPresence.thumbnailPhoto,
lastSeen: userPresence.wifiDevices[0].lastSeen,
status: userPresence.wifiDevices[0].status,
apName: userPresence.wifiDevices[0].apName,
local: userPresence.wifiDevices[0].accessPoint.local
apName: userPresence.wifiDevices[0].accessPoint?.name || userPresence.wifiDevices[0].apName || userPresence.wifiDevices[0].accessPoint?.hostname,
local: userPresence.wifiDevices[0].accessPoint?.local
}))
.slice(0, 200)
}

View File

@ -139,8 +139,15 @@
<span class="font-weight-medium">On-line</span>
</v-list-item-subtitle>
<v-list-item-subtitle>
<span class="font-weight-medium">
{{ userPresence.local || userPresence.apName }}
<span
v-if="userPresence.local"
class="font-weight-medium"
>
{{ userPresence.local }}
</span>
<span v-else>
Próximo ao AP
{{ userPresence.apName }}
</span>
</v-list-item-subtitle>
</template>