Connections view #130

Merged
jsegarra merged 5 commits from wbuezas/hedera-web-mindshore:feature/connections-view into beta 2025-03-28 13:33:10 +00:00
1 changed files with 9 additions and 12 deletions
Showing only changes of commit 365d4d31e1 - Show all commits

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, inject, onBeforeUnmount } from 'vue';
import { ref, onMounted, inject, onBeforeUnmount, h } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
@ -103,6 +103,13 @@ onMounted(async () => {
});
onBeforeUnmount(() => clearInterval(intervalId.value));
const renderAgentDetails = connection => {
const agent = connection.visitAgent;
return agent?.platform && agent?.browser && agent?.version
? h('span', `${agent.platform} - ${agent.browser} - ${agent.version}`)
: null;
};
</script>
<template>
@ -152,17 +159,7 @@ onBeforeUnmount(() => clearInterval(intervalId.value));
)
}}</span
>
<span
v-if="
connection.visitAgent?.platform &&
connection.visitAgent?.browser &&
connection.visitAgent?.version
"
>
{{ connection.visitAgent?.platform }} -
{{ connection.visitAgent?.browser }} -
{{ connection.visitAgent?.version }}
</span>
<component :is="renderAgentDetails(connection)" />
</template>
<template #actions>

Esto se podria simplificar, porque el uso x6 de connection.visitagent no mola
Seria una funcion en el v-if y otra funcion a la que le pases connection y te lo devuelva formateado
Otra opcion es
const renderAgentDetails = (connection) => { const agent = connection.visitAgent; return agent?.platform && agent?.browser && agent?.version ? h('span', ${agent.platform} - ${agent.browser} - ${agent.version}) : null; };

<component :is="renderAgentDetails(connection)" />

Esto se podria simplificar, porque el uso x6 de connection.visitagent no mola Seria una funcion en el v-if y otra funcion a la que le pases connection y te lo devuelva formateado Otra opcion es `const renderAgentDetails = (connection) => { const agent = connection.visitAgent; return agent?.platform && agent?.browser && agent?.version ? h('span', `${agent.platform} - ${agent.browser} - ${agent.version}`) : null; };` ` <component :is="renderAgentDetails(connection)" />`

Aplicado.

Commit: 365d4d31e1

Aplicado. Commit: https://gitea.verdnatura.es/verdnatura/hedera-web/commit/365d4d31e105d5ccb748c046ce01b3db53eddc45
<QBtn