@cryptotaxi247 / CoPilot / commits / 158b8ad3

updated agents online check

Davide Di Modica committed Oct 7, 2023 at 11:33 UTC 158b8ad3e9108aa75f9480c3dfdb23128a026b2b
3 files changed +5 -6
src/components/agents/AgentCard.vue
+3 -3
@@ -79,11 +79,11 @@ const loading = ref(false)
79 const message = useMessage()
80 const dialog = useDialog()
81 const isOnline = computed(() => {
82 - return isAgentOnline(agent.value.last_seen)
82 + return isAgentOnline(agent.value.wazuh_last_seen)
83 })
84 const formatLastSeen = computed(() => {
85 - const lastSeenDate = dayjs(agent.value.last_seen)
86 - if (!lastSeenDate.isValid()) return agent.value.last_seen
85 + const lastSeenDate = dayjs(agent.value.wazuh_last_seen)
86 + if (!lastSeenDate.isValid()) return agent.value.wazuh_last_seen
87
88 return lastSeenDate.format("DD/MM/YYYY @ HH:mm")
89 })
src/views/socfortress/AgentOverview.vue
+1 -1
@@ -80,7 +80,7 @@ const loadingAgent = ref(false)
80 const agent = ref<Agent | null>(null)
81
82 const isOnline = computed(() => {
83 - return isAgentOnline(agent.value?.last_seen ?? "")
83 + return isAgentOnline(agent.value?.wazuh_last_seen ?? "")
84 })
85
86 function getAgent(id: string) {
src/views/socfortress/Agents.vue
+1 -2
@@ -91,7 +91,7 @@ function getAgents() {
91 .then(res => {
92 if (res.data.success) {
93 agents.value = (res.data.agents || []).map(o => {
94 - o.online = isAgentOnline(o.last_seen)
94 + o.online = isAgentOnline(o.wazuh_last_seen)
95 return o
96 })
97 } else {
@@ -133,7 +133,6 @@ function syncAgents() {
133
134 onBeforeMount(() => {
135 getAgents()
136 - syncAgents()
136 })
137 </script>
138